Bug 1258464 - Part 2: Remove GeckoView implementation built on Fennec's Tab/Tabs. r=snorp
☠☠ backed out by 791698f3f8cf ☠ ☠
authorNick Alexander <nalexander@mozilla.com>
Tue, 22 Mar 2016 16:40:34 -0700
changeset 290848 ab088eb19b46d9e8dc5551e39aa4a871a4c9ee23
parent 290847 dcffecae84b741d837295ad77d0dd9e7ece391eb
child 290849 5c5e48022d8330131f67902bccc3c39737d2a93d
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1258464
milestone48.0a1
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;