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 151300 7875f965bb4cee4381626de9b3d82b7768d3683d
parent 151299 dc61bbe74149dcd4d860481ac118707cd8ac7fc5
child 151301 0496e60d608c89f4fbf9b15c0814f2b8cf8cdccf
push idunknown
push userunknown
push dateunknown
reviewersbnicholson
bugs877870
milestone24.0a1
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