Bug 1258464 - Part 2: Remove GeckoView implementation built on Fennec's Tab/Tabs. r=snorp
authorNick Alexander <nalexander@mozilla.com>
Wed, 30 Mar 2016 10:21:29 -0700
changeset 291285 4b8075ea02463c44f5d6c08584ac81c5dc0d62fd
parent 291284 d8cc2430bf0b6e6c10aa3c5e264af8ce3721ae4e
child 291286 230a0a44d0871347fb8215cd65d2d126cecfa93c
push id74545
push userkwierso@gmail.com
push dateFri, 01 Apr 2016 23:05:42 +0000
treeherdermozilla-inbound@c410d4e20586 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1258464
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1258464 - Part 2: Remove GeckoView implementation built on Fennec's Tab/Tabs. r=snorp This will be re-implemented without reference to Fennec's Tab/Tabs data structures. MozReview-Commit-ID: I12Dlb3ef58
mobile/android/base/java/org/mozilla/gecko/GeckoView.java
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoView.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoView.java
@@ -1,18 +1,15 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
 import java.util.Set;
 
 import org.json.JSONException;
 import org.json.JSONObject;
 import org.mozilla.gecko.annotation.ReflectionTarget;
 import org.mozilla.gecko.annotation.WrapForJNI;
 import org.mozilla.gecko.gfx.GLController;
 import org.mozilla.gecko.gfx.LayerView;
@@ -356,90 +353,26 @@ public class GeckoView extends LayerView
                 mInputConnectionListener.onKeyMultiple(keyCode, repeatCount, event);
     }
 
     /* package */ boolean isIMEEnabled() {
         return mInputConnectionListener != null &&
                 mInputConnectionListener.isIMEEnabled();
     }
 
-    /**
-    * Add a Browser to the GeckoView container.
-    * @param url The URL resource to load into the new Browser.
-    */
-    public Browser addBrowser(String url) {
-        Tab tab = Tabs.getInstance().loadUrl(url, Tabs.LOADURL_NEW_TAB);
-        if (tab != null) {
-            return new Browser(tab.getId());
-        }
-        return null;
-    }
-
-    /**
-    * Remove a Browser from the GeckoView container.
-    * @param browser The Browser to remove.
-    */
-    public void removeBrowser(Browser browser) {
-        Tab tab = Tabs.getInstance().getTab(browser.getId());
-        if (tab != null) {
-            Tabs.getInstance().closeTab(tab);
-        }
-    }
-
-    /**
-    * Set the active/visible Browser.
-    * @param browser The Browser to make selected.
-    */
-    public void setCurrentBrowser(Browser browser) {
-        Tab tab = Tabs.getInstance().getTab(browser.getId());
-        if (tab != null) {
-            Tabs.getInstance().selectTab(tab.getId());
-        }
-    }
-
-    /**
-    * Get the active/visible Browser.
-    * @return The current selected Browser.
-    */
-    public Browser getCurrentBrowser() {
-        Tab tab = Tabs.getInstance().getSelectedTab();
-        if (tab != null) {
-            return new Browser(tab.getId());
-        }
-        return null;
-    }
-
-    /**
-    * Get the list of current Browsers in the GeckoView container.
-    * @return An unmodifiable List of Browser objects.
-    */
-    public List<Browser> getBrowsers() {
-        ArrayList<Browser> browsers = new ArrayList<Browser>();
-        Iterable<Tab> tabs = Tabs.getInstance().getTabsInOrder();
-        for (Tab tab : tabs) {
-            browsers.add(new Browser(tab.getId()));
-        }
-        return Collections.unmodifiableList(browsers);
-    }
-
     public void importScript(final String url) {
         if (url.startsWith("resource://android/assets/")) {
             GeckoAppShell.notifyObservers("GeckoView:ImportScript", url);
             return;
         }
 
         throw new IllegalArgumentException("Must import script from 'resources://android/assets/' location.");
     }
 
     private void connectToGecko() {
-        Tab selectedTab = Tabs.getInstance().getSelectedTab();
-        if (selectedTab != null) {
-            Tabs.getInstance().notifyListeners(selectedTab, Tabs.TabEvents.SELECTED);
-        }
-
         GeckoAppShell.notifyObservers("Viewport:Flush", null);
     }
 
     private void handleReady(final JSONObject message) {
         connectToGecko();
 
         if (mChromeDelegate != null) {
             mChromeDelegate.onReady(this);
@@ -585,85 +518,16 @@ public class GeckoView extends LayerView
                 args.put("parentId", -1);
                 args.put("newTab", false);
                 args.put("tabID", mId);
             } catch (Exception e) {
                 Log.w(LOGTAG, "Error building JSON arguments for loadUrl.", e);
             }
             GeckoAppShell.notifyObservers("Tab:Load", args.toString());
         }
-
-        /**
-        * Reload the current URL resource into the Browser. The URL is force loaded from the
-        * network and is not pulled from cache.
-        */
-        public void reload() {
-            Tab tab = Tabs.getInstance().getTab(mId);
-            if (tab != null) {
-                tab.doReload(true);
-            }
-        }
-
-        /**
-        * Stop the current loading operation.
-        */
-        public void stop() {
-            Tab tab = Tabs.getInstance().getTab(mId);
-            if (tab != null) {
-                tab.doStop();
-            }
-        }
-
-        /**
-        * Check to see if the Browser has session history and can go back to a
-        * previous page.
-        * @return A boolean flag indicating if previous session exists.
-        * This method will likely be removed and replaced by a callback in GeckoViewContent
-        */
-        public boolean canGoBack() {
-            Tab tab = Tabs.getInstance().getTab(mId);
-            if (tab != null) {
-                return tab.canDoBack();
-            }
-            return false;
-        }
-
-        /**
-        * Move backward in the session history, if that's possible.
-        */
-        public void goBack() {
-            Tab tab = Tabs.getInstance().getTab(mId);
-            if (tab != null) {
-                tab.doBack();
-            }
-        }
-
-        /**
-        * Check to see if the Browser has session history and can go forward to a
-        * new page.
-        * @return A boolean flag indicating if forward session exists.
-        * This method will likely be removed and replaced by a callback in GeckoViewContent
-        */
-        public boolean canGoForward() {
-            Tab tab = Tabs.getInstance().getTab(mId);
-            if (tab != null) {
-                return tab.canDoForward();
-            }
-            return false;
-        }
-
-        /**
-        * Move forward in the session history, if that's possible.
-        */
-        public void goForward() {
-            Tab tab = Tabs.getInstance().getTab(mId);
-            if (tab != null) {
-                tab.doForward();
-            }
-        }
     }
 
     /* Provides a means for the client to indicate whether a JavaScript
      * dialog request should proceed. An instance of this class is passed to
      * various GeckoViewChrome callback actions.
      */
     public class PromptResult {
         private final int RESULT_OK = 0;