Bug 877870 - Factor out code to open url and cancel editing mode (r=bnicholson)
authorLucas Rocha <lucasr@mozilla.com>
Tue, 11 Jun 2013 17:57:45 +0100
changeset 143316 7875f965bb4cee4381626de9b3d82b7768d3683d
parent 143315 dc61bbe74149dcd4d860481ac118707cd8ac7fc5
child 143317 0496e60d608c89f4fbf9b15c0814f2b8cf8cdccf
push id25130
push userlrocha@mozilla.com
push dateWed, 21 Aug 2013 09:41:27 +0000
treeherdermozilla-central@b2486721572e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson
bugs877870
milestone24.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 877870 - Factor out code to open url and cancel editing mode (r=bnicholson)
mobile/android/base/BrowserApp.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -1112,16 +1112,28 @@ abstract public class BrowserApp extends
     }
 
     @Override
     public void onSaveInstanceState(Bundle outState) {
         super.onSaveInstanceState(outState);
         outState.putBoolean(STATE_DYNAMIC_TOOLBAR_ENABLED, mDynamicToolbarEnabled);
     }
 
+    private void openUrl(String url) {
+        mBrowserToolbar.setProgressVisibility(true);
+
+        int flags = Tabs.LOADURL_NONE;
+        if (mBrowserToolbar.getEditingTarget() == EditingTarget.NEW_TAB) {
+            flags |= Tabs.LOADURL_NEW_TAB;
+        }
+
+        Tabs.getInstance().loadUrl(url, flags);
+        mBrowserToolbar.cancelEdit();
+    }
+
     /* Favicon methods */
     private void loadFavicon(final Tab tab) {
         maybeCancelFaviconLoad(tab);
 
         long id = Favicons.getInstance().loadFavicon(tab.getURL(), tab.getFaviconURL(), !tab.isPrivate(),
                         new Favicons.OnFaviconLoadedListener() {
 
             @Override
@@ -1759,25 +1771,17 @@ abstract public class BrowserApp extends
                 if (url.length() > 0)
                     GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Feedback:LastUrl", url));
             }
         }).execute();
     }
 
     @Override
     public void onAboutHomeUriLoad(String url) {
-        mBrowserToolbar.setProgressVisibility(true);
-
-        int flags = Tabs.LOADURL_NONE;
-        if (mBrowserToolbar.getEditingTarget() == EditingTarget.NEW_TAB) {
-            flags |= Tabs.LOADURL_NEW_TAB;
-        }
-
-        Tabs.getInstance().loadUrl(url, flags);
-        mBrowserToolbar.cancelEdit();
+        openUrl(url);
     }
 
     @Override
     public void onAboutHomeLoadComplete() {
         mAboutHomeStartupTimer.stop();
     }
 
     @Override