Merge "Crash recover no longer uses icicle."
diff --git a/res/values/dimensions.xml b/res/values/dimensions.xml
index 8844f6b..d6ae6ba 100644
--- a/res/values/dimensions.xml
+++ b/res/values/dimensions.xml
@@ -27,7 +27,7 @@
     <dimen name="widgetItemMinHeight">48dip</dimen>
     <dimen name="favicon_size">16dip</dimen>
     <dimen name="favicon_padded_size">20dip</dimen>
-    <dimen name="qc_radius_start">45dip</dimen>
+    <dimen name="qc_radius_start">60dip</dimen>
     <dimen name="qc_radius_increment">70dip</dimen>
     <dimen name="qc_slop">10dip</dimen>
     <dimen name="qc_touch_offset">15dip</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1daa43f..1438c1c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -408,7 +408,7 @@
     <string name="autofill_profile_editor_delete_profile">Delete</string>
 
     <!-- Text on a dialog shown to the user when they are prompted to set up the autofill feature [CHAR-LIMIT=NONE] -->
-    <string name="autofill_setup_dialog_message">The browser can automatically complete web forms like this one. Would you like to set up your auto-fill text?</string>
+    <string name="autofill_setup_dialog_message">The browser can automatically complete web forms like this one. Do you want to set up your auto-fill text?</string>
     <!-- Toast message displayed when the user decides to not set up autofill at this time. We want to remind them that they can configure
          it through the Browser Settings menu. [CHAR-LIMIT=NONE] -->
     <string name="autofill_setup_dialog_negative_toast">You can always set up your auto-fill text from the Browser &gt; Settings &gt; General screen.</string>
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index e3b620a..88829cc 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -753,7 +753,12 @@
         if (enabled) {
             winParams.flags |=  bits;
             if (mCustomView != null) {
-                mCustomView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
+                // HTML5 Video can ask for the HIDE_NAVIGATION specifically,
+                // and we want to differentiate it from the flash.
+                if ((mCustomView.getSystemUiVisibility()
+                        & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0) {
+                    mCustomView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
+                }
             } else {
                 mContentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
             }
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index e72570d..7c73411 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -207,8 +207,6 @@
      */
     private boolean mExtendedMenuOpen;
 
-    private boolean mInLoad;
-
     private boolean mActivityPaused = true;
     private boolean mLoadStopped;
 
@@ -885,17 +883,16 @@
             // when the main frame completes loading regardless of the state of
             // any sub frames so calls to onProgressChanges may continue after
             // onPageFinished has executed)
-            if (mInLoad) {
-                mInLoad = false;
-                updateInLoadMenuItems(mCachedMenu);
+            if (tab.inPageLoad()) {
+                updateInLoadMenuItems(mCachedMenu, tab);
             }
         } else {
-            if (!mInLoad) {
+            if (!tab.inPageLoad()) {
                 // onPageFinished may have already been called but a subframe is
-                // still loading and updating the progress. Reset mInLoad and
+                // still loading
+                // updating the progress and
                 // update the menu items.
-                mInLoad = true;
-                updateInLoadMenuItems(mCachedMenu);
+                updateInLoadMenuItems(mCachedMenu, tab);
             }
         }
         mUi.onProgressChanged(tab);
@@ -1434,12 +1431,12 @@
      * we must manually update the state of the stop/reload menu
      * item
      */
-    private void updateInLoadMenuItems(Menu menu) {
+    private void updateInLoadMenuItems(Menu menu, Tab tab) {
         if (menu == null) {
             return;
         }
         MenuItem dest = menu.findItem(R.id.stop_reload_menu_id);
-        MenuItem src = mInLoad ?
+        MenuItem src = tab.inPageLoad() ?
                 menu.findItem(R.id.stop_menu_id):
                 menu.findItem(R.id.reload_menu_id);
         if (src != null) {
@@ -1449,7 +1446,7 @@
     }
 
     boolean onPrepareOptionsMenu(Menu menu) {
-        updateInLoadMenuItems(menu);
+        updateInLoadMenuItems(menu, getCurrentTab());
         // hold on to the menu reference here; it is used by the page callbacks
         // to update the menu based on loading state
         mCachedMenu = menu;
@@ -1500,7 +1497,8 @@
         final MenuItem forward = menu.findItem(R.id.forward_menu_id);
         forward.setEnabled(canGoForward);
 
-        final MenuItem source = menu.findItem(mInLoad ? R.id.stop_menu_id : R.id.reload_menu_id);
+        final MenuItem source = menu.findItem(isInLoad() ? R.id.stop_menu_id
+                : R.id.reload_menu_id);
         final MenuItem dest = menu.findItem(R.id.stop_reload_menu_id);
         if (source != null && dest != null) {
             dest.setTitle(source.getTitle());
@@ -1580,7 +1578,7 @@
                 break;
 
             case R.id.stop_reload_menu_id:
-                if (mInLoad) {
+                if (isInLoad()) {
                     stopLoading();
                 } else {
                     getCurrentTopWebView().reload();
@@ -1795,7 +1793,7 @@
                     // Switching the menu back to icon view, so show the
                     // title bar once again.
                     mExtendedMenuOpen = false;
-                    mUi.onExtendedMenuClosed(mInLoad);
+                    mUi.onExtendedMenuClosed(isInLoad());
                 }
             }
         } else {
@@ -1810,11 +1808,11 @@
 
     public void onOptionsMenuClosed(Menu menu) {
         mOptionsMenuOpen = false;
-        mUi.onOptionsMenuClosed(mInLoad);
+        mUi.onOptionsMenuClosed(isInLoad());
     }
 
     public void onContextMenuClosed(Menu menu) {
-        mUi.onContextMenuClosed(menu, mInLoad);
+        mUi.onContextMenuClosed(menu, isInLoad());
     }
 
     // Helper method for getting the top window.
@@ -1877,12 +1875,12 @@
      */
     public void onActionModeFinished(ActionMode mode) {
         if (!isInCustomActionMode()) return;
-        mUi.onActionModeFinished(mInLoad);
+        mUi.onActionModeFinished(isInLoad());
         mActionMode = null;
     }
 
     boolean isInLoad() {
-        return mInLoad;
+        return getCurrentTab().inPageLoad();
     }
 
     // bookmark handling
@@ -2227,7 +2225,10 @@
         removeSubWindow(tab);
         // dismiss the subwindow. This will destroy the WebView.
         tab.dismissSubWindow();
-        getCurrentTopWebView().requestFocus();
+        WebView wv = getCurrentTopWebView();
+        if (wv != null) {
+            wv.requestFocus();
+        }
     }
 
     @Override
diff --git a/src/com/android/browser/DownloadHandler.java b/src/com/android/browser/DownloadHandler.java
index 17ad320..6e2c786 100644
--- a/src/com/android/browser/DownloadHandler.java
+++ b/src/com/android/browser/DownloadHandler.java
@@ -67,6 +67,7 @@
             //     that matches.
             Intent intent = new Intent(Intent.ACTION_VIEW);
             intent.setDataAndType(Uri.parse(url), mimetype);
+            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
             ResolveInfo info = activity.getPackageManager().resolveActivity(intent,
                     PackageManager.MATCH_DEFAULT_ONLY);
             if (info != null) {
diff --git a/src/com/android/browser/NavigationBarPhone.java b/src/com/android/browser/NavigationBarPhone.java
index 2e206fb..60b228d 100644
--- a/src/com/android/browser/NavigationBarPhone.java
+++ b/src/com/android/browser/NavigationBarPhone.java
@@ -213,6 +213,7 @@
             if (hasFocus && !mUrlInput.getText().toString().equals(mUrlInput.getTag())) {
                 // only change text if different
                 mUrlInput.setText((String) mUrlInput.getTag(), false);
+                mUrlInput.selectAll();
             } else {
                 setDisplayTitle(mUrlInput.getText().toString());
             }
diff --git a/src/com/android/browser/PieControlPhone.java b/src/com/android/browser/PieControlPhone.java
index f12c49a..2b6a3c5 100644
--- a/src/com/android/browser/PieControlPhone.java
+++ b/src/com/android/browser/PieControlPhone.java
@@ -24,6 +24,7 @@
 import android.widget.PopupMenu;
 import android.widget.PopupMenu.OnMenuItemClickListener;
 
+import com.android.browser.UI.ComboViews;
 import com.android.browser.view.PieItem;
 import com.android.browser.view.PieMenu.PieView.OnLayoutListener;
 import com.android.browser.view.PieStackView;
@@ -40,6 +41,8 @@
     private PieItem mUrl;
     private PieItem mShowTabs;
     private PieItem mOptions;
+    private PieItem mNewTab;
+    private PieItem mBookmarks;
     private TabAdapter mTabAdapter;
     private PopupMenu mPopup;
 
@@ -67,10 +70,14 @@
                 1);
 
         // level 1
+        mNewTab = makeItem(R.drawable.ic_new_window_holo_dark, 1);
+        mBookmarks = makeItem(R.drawable.ic_bookmarks_holo_dark, 1);
+        mPie.addItem(mNewTab);
         mPie.addItem(mShowTabs);
         mPie.addItem(mUrl);
+        mPie.addItem(mBookmarks);
         mPie.addItem(mOptions);
-        setClickListener(this, mUrl, mShowTabs, mOptions);
+        setClickListener(this, mUrl, mShowTabs, mOptions, mNewTab, mBookmarks);
         mPopup = new PopupMenu(mActivity, mUi.getTitleBar());
         Menu menu = mPopup.getMenu();
         mPopup.getMenuInflater().inflate(R.menu.browser, menu);
@@ -105,6 +112,11 @@
             mUi.showNavScreen();
         } else if (mOptions.getView() == v) {
             showMenu();
+        } else if (mNewTab.getView() == v) {
+            mUiController.openTabToHomePage();
+            mUi.editUrl(false);
+        } else if (mBookmarks.getView() == v) {
+            mUiController.bookmarksOrHistoryPicker(ComboViews.Bookmarks);
         }
     }
 
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index dd97960..0abc86b 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -619,7 +619,6 @@
                 LogTag.logPageFinishedLoading(
                         url, SystemClock.uptimeMillis() - mLoadStartTime);
             }
-            mInPageLoad = false;
             syncCurrentState(view, url);
             mWebViewController.onPageFinished(Tab.this);
         }
@@ -1044,6 +1043,9 @@
         @Override
         public void onProgressChanged(WebView view, int newProgress) {
             mPageLoadProgress = newProgress;
+            if (newProgress == 100) {
+                mInPageLoad = false;
+            }
             mWebViewController.onProgressChanged(Tab.this);
         }