Bug 860326 - Don't update BrowserToolbar after editing a top site on about:home. r=wesj, a=lsblakk
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Tue, 16 Apr 2013 17:39:47 -0700
changeset 133437 89963091a65085937df0c83c870c1548c298b75e
parent 133436 367677e9c32cb92934849c9e3202758572b881d8
child 133438 12e463ae355ccb77eb2b5c735cf87e8b22847adc
push id3645
push userryanvm@gmail.com
push dateWed, 17 Apr 2013 20:50:10 +0000
treeherdermozilla-aurora@12e463ae355c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj, lsblakk
bugs860326
milestone22.0a2
Bug 860326 - Don't update BrowserToolbar after editing a top site on about:home. r=wesj, a=lsblakk
mobile/android/base/BrowserApp.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -696,18 +696,28 @@ abstract public class BrowserApp extends
 
         if (mAboutHomeContent != null)
             mAboutHomeContent.refresh();
     }
 
     @Override
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
         super.onActivityResult(requestCode, resultCode, data);
-        String url = resultCode == Activity.RESULT_OK ? data.getStringExtra(AwesomeBar.URL_KEY) : null;
-        mBrowserToolbar.fromAwesomeBarSearch(url);
+
+        // Don't update the url in the toolbar if the activity was cancelled, or if it was launched to pick
+        //  a site. The order of these checks matters because data will be null if the activity was cancelled.
+        if (resultCode != Activity.RESULT_OK ||
+            data.getStringExtra(AwesomeBar.TARGET_KEY).equals(AwesomeBar.Target.PICK_SITE.toString())) {
+            // We still need to call fromAwesomeBarSearch to perform the toolbar animation.
+            mBrowserToolbar.fromAwesomeBarSearch(null);
+            return;
+        }
+
+        // Otherwise, update the toolbar with the url that was just entered.
+        mBrowserToolbar.fromAwesomeBarSearch(data.getStringExtra(AwesomeBar.URL_KEY));
     }
 
     public View getActionBarLayout() {
         int actionBarRes;
 
         if (!hasPermanentMenuKey() || isTablet())
            actionBarRes = R.layout.browser_toolbar_menu;
         else