Bug 803293 - Remove some old code from BrowserApp. r=mfinkle
authorBrian Nicholson <bnicholson@mozilla.com>
Mon, 22 Oct 2012 12:37:50 -0700
changeset 111204 8cab337969f3451932c39db6e9b932903b05637e
parent 111203 1621bf085a370af500c855f5feed3437d1c0372e
child 111205 3d3039772d4aa1377407afcbc91da1c0e87421aa
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersmfinkle
bugs803293
milestone19.0a1
Bug 803293 - Remove some old code from BrowserApp. r=mfinkle
mobile/android/base/BrowserApp.java
mobile/android/base/GeckoApp.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -88,38 +88,35 @@ abstract public class BrowserApp extends
     // We'll ask for feedback after the user launches the app this many times.
     private static final int FEEDBACK_LAUNCH_COUNT = 15;
 
     @Override
     public void onTabChanged(Tab tab, Tabs.TabEvents msg, Object data) {
         switch(msg) {
             case LOCATION_CHANGE:
                 if (Tabs.getInstance().isSelectedTab(tab)) {
-                    String url = tab.getURL();
-                    if (url.equals("about:home"))
+                    maybeCancelFaviconLoad(tab);
+                }
+                // fall through
+            case SELECTED:
+                if (Tabs.getInstance().isSelectedTab(tab)) {
+                    if ("about:home".equals(tab.getURL()))
                         showAboutHome();
-                    else 
+                    else
                         hideAboutHome();
-                    maybeCancelFaviconLoad(tab);
                 }
                 break;
             case LOAD_ERROR:
             case START:
             case STOP:
             case MENU_UPDATED:
                 if (Tabs.getInstance().isSelectedTab(tab)) {
                     invalidateOptionsMenu();
                 }
                 break;
-            case SELECTED:
-                if ("about:home".equals(tab.getURL()))
-                    showAboutHome();
-                else
-                    hideAboutHome();
-                break;
         }
         super.onTabChanged(tab, msg, data);
     }
 
     @Override
     void handlePageShow(final int tabId) {
         super.handlePageShow(tabId);
         final Tab tab = Tabs.getInstance().getTab(tabId);
@@ -265,36 +262,22 @@ abstract public class BrowserApp extends
     protected void initializeChrome(String uri, Boolean isExternalURL) {
         super.initializeChrome(uri, isExternalURL);
 
         mBrowserToolbar.updateBackButton(false);
         mBrowserToolbar.updateForwardButton(false);
 
         mDoorHangerPopup.setAnchor(mBrowserToolbar.mFavicon);
 
-        Intent intent = getIntent();
-        String action = intent.getAction();
-        String args = intent.getStringExtra("args");
-        if (args != null && args.contains("-profile")) {
-            Pattern p = Pattern.compile("(?:-profile\\s*)(\\w*)(\\s*)");
-            Matcher m = p.matcher(args);
-            if (m.find()) {
-                mBrowserToolbar.setTitle(null);
-            }
-        }
-
         if (!isExternalURL) {
             // show about:home if we aren't restoring previous session
             if (mRestoreMode == GeckoAppShell.RESTORE_NONE) {
                 Tab tab = Tabs.getInstance().loadUrl("about:home", Tabs.LOADURL_NEW_TAB);
-                tab.updateTitle(null);
-                showAboutHome();
             }
         } else {
-            hideAboutHome();
             Tabs.getInstance().loadUrl(uri, Tabs.LOADURL_NEW_TAB | Tabs.LOADURL_USER_ENTERED);
         }
     }
 
     void toggleChrome(final boolean aShow) {
         mMainHandler.post(new Runnable() {
             public void run() {
                 if (aShow) {
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -1637,16 +1637,18 @@ abstract public class GeckoApp
                 intent.setData(null);
                 passedUri = null;
             } else {
                 startupAction = StartupAction.PREFETCH;
                 GeckoAppShell.getHandler().post(new PrefetchRunnable(copy));
             }
         }
 
+        Tabs.registerOnTabsChangedListener(this);
+
         initializeChrome(passedUri, isExternalURL);
 
         if (mRestoreMode == GeckoAppShell.RESTORE_NONE) {
             // show telemetry door hanger if we aren't restoring a session
             GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Telemetry:Prompt", null));
         }
 
         Telemetry.HistogramAdd("FENNEC_STARTUP_GECKOAPP_ACTION", startupAction.ordinal());
@@ -1664,18 +1666,16 @@ abstract public class GeckoApp
                     Log.i(LOGTAG, "Launching from debug intent after 5s wait");
                     setLaunchState(LaunchState.Launching);
                     sGeckoThread.start();
                 }
             }, 1000 * 5 /* 5 seconds */);
             Log.i(LOGTAG, "Intent : ACTION_DEBUG - waiting 5s before launching");
         }
 
-        Tabs.registerOnTabsChangedListener(this);
-
         if (cameraView == null) {
             cameraView = new SurfaceView(this);
             cameraView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
         }
 
         if (mLayerView == null) {
             LayerView layerView = (LayerView) findViewById(R.id.layer_view);
             layerView.initializeView(GeckoAppShell.getEventDispatcher());