Merge "popular url test should load website list from external file"
diff --git a/res/drawable-hdpi/ic_home.png b/res/drawable-hdpi/ic_home.png
new file mode 100644
index 0000000..2b5fd01
--- /dev/null
+++ b/res/drawable-hdpi/ic_home.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_home.png b/res/drawable-mdpi/ic_home.png
new file mode 100644
index 0000000..df2dbc6
--- /dev/null
+++ b/res/drawable-mdpi/ic_home.png
Binary files differ
diff --git a/res/layout/bookmarks_header.xml b/res/layout/bookmarks_header.xml
index 05bfa32..5d83892 100644
--- a/res/layout/bookmarks_header.xml
+++ b/res/layout/bookmarks_header.xml
@@ -19,18 +19,6 @@
     android:layout_height="48dip"
     android:orientation="horizontal">
 
-    <TextView
-        android:id="@+id/root_folder"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:text="@string/defaultBookmarksUpButton"
-        android:textAppearance="?android:attr/textAppearanceMedium"
-        android:gravity="center_vertical"
-        android:visibility="gone"
-        android:paddingLeft="16dip"
-        android:drawableLeft="@drawable/ic_tab_bookmarks_selected"
-        android:drawablePadding="16dip" />
-
     <com.android.browser.BreadCrumbView
         android:id="@+id/crumbs"
         android:layout_width="0dip"
diff --git a/res/layout/bookmarks_history.xml b/res/layout/bookmarks_history.xml
index a3a5084..3294434 100644
--- a/res/layout/bookmarks_history.xml
+++ b/res/layout/bookmarks_history.xml
@@ -18,8 +18,6 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:paddingTop="8dip"
-    android:paddingLeft="16dip"
-    android:paddingRight="16dip"
     android:orientation="vertical"
     android:background="@color/black">
     <LinearLayout
@@ -29,22 +27,8 @@
         <LinearLayout
             android:id="@+id/tabs"
             android:layout_width="wrap_content"
-            android:layout_height="match_parent">
-            <TextView
-                android:id="@+id/historytab"
-                android:layout_width="wrap_content"
-                android:layout_height="match_parent"
-                android:paddingLeft="32dip"
-                android:paddingRight="32dip"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:gravity="center_vertical"
-                android:text="@string/tab_history"
-                android:drawableLeft="@drawable/ic_tab_history_selected"
-                android:drawablePadding="16dip" />
-            <ImageView
-                android:layout_width="wrap_content"
-                android:layout_height="match_parent"
-                android:src="@drawable/divider_vert" />
+            android:layout_height="match_parent"
+            style="@style/ActionBarStyle">
             <TextView
                 android:id="@+id/bmtab"
                 android:layout_width="wrap_content"
@@ -55,7 +39,26 @@
                 android:gravity="center_vertical"
                 android:text="@string/bookmarks"
                 android:drawableLeft="@drawable/ic_tab_bookmarks_selected"
-                android:drawablePadding="16dip" />
+                android:drawablePadding="16dip"
+                android:background="@drawable/tab_background" />
+            <ImageView
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:paddingTop="8dp"
+                android:paddingBottom="8dp"
+                android:src="@drawable/divider_vert" />
+            <TextView
+                android:id="@+id/historytab"
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:paddingLeft="32dip"
+                android:paddingRight="32dip"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:gravity="center_vertical"
+                android:text="@string/tab_history"
+                android:drawableLeft="@drawable/ic_tab_history_selected"
+                android:drawablePadding="16dip"
+                android:background="@drawable/tab_background" />
         </LinearLayout>
 
         <FrameLayout
@@ -83,6 +86,22 @@
             android:drawableLeft="@drawable/ic_favorite_off_normal"
             android:drawablePadding="16dip" />
 
+        <ImageView
+            android:id="@+id/seperate_select_add"
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:paddingLeft="16dip"
+            android:src="@drawable/divider_vert" />
+
+        <ImageView
+            android:id="@+id/home"
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:src="@drawable/ic_home"
+            android:paddingRight="16dip"
+            android:paddingLeft="16dip"
+            android:scaleType="center" />
+
     </LinearLayout>
     <FrameLayout
         android:id="@+id/fragment"
diff --git a/res/layout/pref_homepage_buttons.xml b/res/layout/pref_homepage_buttons.xml
new file mode 100644
index 0000000..fe21beb
--- /dev/null
+++ b/res/layout/pref_homepage_buttons.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+
+
+     This layout provides the structure for a browser tab. A tab contains the
+     WebView and any number of other UI elements specific to that tab.
+     Currently, the only such element is the Geolocation permissions prompt.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="horizontal"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center_horizontal">
+
+    <Button android:id="@+id/use_current"
+        android:text="@string/pref_use_current"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginRight="16dp" />
+
+    <Button android:id="@+id/use_default"
+        android:text="@string/pref_use_default"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content" />
+
+</LinearLayout>
diff --git a/res/layout/url_bar.xml b/res/layout/url_bar.xml
index ba93d1b..f695ae3 100644
--- a/res/layout/url_bar.xml
+++ b/res/layout/url_bar.xml
@@ -77,12 +77,13 @@
                 android:ellipsize="end"
                 android:lines="1"
                 android:scrollHorizontally="true" />
-            <ImageButton
+            <view class="com.android.browser.TitleBarXLarge$CustomCheck"
                 android:id="@+id/star"
-                android:src="@drawable/ic_favorite_off_normal"
                 android:layout_width="wrap_content"
                 android:layout_height="match_parent"
                 style="@style/HoloButton"
+                android:focusable="false"
+                android:button="@android:drawable/btn_star"
                 android:background="@drawable/browserbarbutton" />
         </LinearLayout>
         <LinearLayout
diff --git a/res/values/strings.xml b/res/values/strings.xml
index ece6ffa..b1c04dc 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -188,11 +188,11 @@
             showing. -->
     <string name="bookmark_page">Bookmark last-viewed page</string>
     <!-- Menu item in the page that displays all bookmarks.  Switches to
-            a grid view which shows thumbnails [CHAR LIMIT=50] -->
-    <string name="bookmark_thumbnail_view">Thumbnail view</string>
+            a grid view which shows thumbnails [CHAR LIMIT=20] -->
+    <string name="bookmark_thumbnail_view">Thumbnails</string>
     <!-- Menu item in the page that displays all bookmarks.  Switches to a
-            list view which shows titles [CHAR LIMIT=50] -->
-    <string name="bookmark_list_view">List view</string>
+            list view which shows titles [CHAR LIMIT=20] -->
+    <string name="bookmark_list_view">List</string>
     <!-- Summary text under the New Bookmark item on the Bookmarks screen.
             Tells the user that if they select this item, it will bring up a
             dialog to bookmark the page that the browser is currently viewing,
diff --git a/res/xml/debug_preferences.xml b/res/xml/debug_preferences.xml
index 8f8d296..50d4c14 100644
--- a/res/xml/debug_preferences.xml
+++ b/res/xml/debug_preferences.xml
@@ -17,53 +17,11 @@
 <PreferenceScreen 
         xmlns:android="http://schemas.android.com/apk/res/android" >
 
-    <!-- The javascript console is enabled by default when the user has
-         also enabled debug mode by navigating to about:debug. -->
-    <CheckBoxPreference
-        android:key="javascript_console"
-        android:defaultValue="true"
-        android:title="@string/pref_development_error_console" />
-                    
-    <CheckBoxPreference
-        android:key="small_screen"
-        android:defaultValue="false"
-        android:title="@string/pref_development_single_column_rendering" />   
-
-    <CheckBoxPreference
-        android:key="wide_viewport"
-        android:defaultValue="true"
-        android:title="@string/pref_development_viewport" />
-                
-    <CheckBoxPreference
-        android:key="normal_layout"
-        android:defaultValue="false"
-        android:title="@string/pref_development_normal_rendering" />       
-    
-    <CheckBoxPreference
-        android:key="enable_tracing"
-        android:defaultValue="false"
-        android:title="@string/pref_development_trace" />
-
-    <CheckBoxPreference
-        android:key="enable_light_touch"
-        android:defaultValue="false"
-        android:title="Enable light touch" />
-
-    <CheckBoxPreference
-        android:key="enable_nav_dump"
-        android:defaultValue="false"
-        android:title="@string/pref_development_nav_dump" />
-
     <CheckBoxPreference
         android:key="enable_hardware_accel"
         android:defaultValue="true"
         android:title="@string/pref_development_hardware_accel" />
 
-    <EditTextPreference
-        android:key="js_engine_flags"
-        android:title="@string/js_engine_flags"
-        android:singleLine="true" />
-
     <ListPreference
         android:key="user_agent"
         android:title="@string/pref_development_uastring"
diff --git a/res/xml/hidden_debug_preferences.xml b/res/xml/hidden_debug_preferences.xml
new file mode 100644
index 0000000..6d66eaa
--- /dev/null
+++ b/res/xml/hidden_debug_preferences.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<PreferenceScreen
+        xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <!-- The javascript console is enabled by default when the user has
+         also enabled debug mode by navigating to about:debug. -->
+    <CheckBoxPreference
+        android:key="javascript_console"
+        android:defaultValue="true"
+        android:title="@string/pref_development_error_console" />
+
+    <CheckBoxPreference
+        android:key="small_screen"
+        android:defaultValue="false"
+        android:title="@string/pref_development_single_column_rendering" />
+
+    <CheckBoxPreference
+        android:key="wide_viewport"
+        android:defaultValue="true"
+        android:title="@string/pref_development_viewport" />
+
+    <CheckBoxPreference
+        android:key="normal_layout"
+        android:defaultValue="false"
+        android:title="@string/pref_development_normal_rendering" />
+
+    <CheckBoxPreference
+        android:key="enable_tracing"
+        android:defaultValue="false"
+        android:title="@string/pref_development_trace" />
+
+    <CheckBoxPreference
+        android:key="enable_light_touch"
+        android:defaultValue="false"
+        android:title="Enable light touch" />
+
+    <CheckBoxPreference
+        android:key="enable_nav_dump"
+        android:defaultValue="false"
+        android:title="@string/pref_development_nav_dump" />
+
+    <EditTextPreference
+        android:key="js_engine_flags"
+        android:title="@string/js_engine_flags"
+        android:singleLine="true" />
+
+</PreferenceScreen>
diff --git a/src/com/android/browser/AddBookmarkPage.java b/src/com/android/browser/AddBookmarkPage.java
index de256a8..24a8cd5 100644
--- a/src/com/android/browser/AddBookmarkPage.java
+++ b/src/com/android/browser/AddBookmarkPage.java
@@ -140,44 +140,11 @@
                 LOADER_ID_FOLDER_CONTENTS));
         loader.setUri(uri);
         loader.forceLoad();
-        updateVisible();
         if (mFolderNamer.getVisibility() == View.VISIBLE) {
             completeOrCancelFolderNaming(true);
         }
     }
 
-    /**
-     * Update the views shown to only show the two deepest levels of crumbs.
-     * Note that this method depends on internal knowledge of BreadCrumbView.
-     */
-    private void updateVisible() {
-      if (MAX_CRUMBS_SHOWN > 0) {
-          int invisibleCrumbs = mCrumbs.size() - MAX_CRUMBS_SHOWN;
-          // This class always uses a back button, which is the first child.
-          int childIndex = 1;
-          if (invisibleCrumbs > 0) {
-              int crumbIndex = 0;
-              while (crumbIndex < invisibleCrumbs) {
-                  // Set the crumb to GONE.
-                  mCrumbs.getChildAt(childIndex).setVisibility(View.GONE);
-                  childIndex++;
-                  // Each crumb is followed by a separator (except the last
-                  // one).  Also make it GONE
-                  mCrumbs.getChildAt(childIndex).setVisibility(View.GONE);
-                  childIndex++;
-                  // Move to the next crumb.
-                  crumbIndex++;
-              }
-          }
-          // Make sure the last two are visible.
-          int childCount = mCrumbs.getChildCount();
-          while (childIndex < childCount) {
-              mCrumbs.getChildAt(childIndex).setVisibility(View.VISIBLE);
-              childIndex++;
-          }
-      }
-    }
-
     @Override
     public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
         if (v == mFolderNamer) {
@@ -428,7 +395,6 @@
                     mCrumbs.pushView(thisFolder.Name, thisFolder);
                 }
                 getLoaderManager().stopLoader(LOADER_ID_ALL_FOLDERS);
-                updateVisible();
                 break;
             default:
                 break;
@@ -566,6 +532,7 @@
         mCrumbs.pushView(name, false,
                 new Folder(name, BrowserProvider2.FIXED_ID_ROOT));
         mCrumbHolder = findViewById(R.id.crumb_holder);
+        mCrumbs.setMaxVisible(MAX_CRUMBS_SHOWN);
 
         mAdapter = new FolderAdapter(this);
         mListView = (ListView) findViewById(R.id.list);
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index 79c3327..c4f3bd5 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -245,15 +245,23 @@
 
     @Override
     public void onPageStarted(Tab tab, String url, Bitmap favicon) {
-        if (mXLargeScreenSize) {
-            mTabBar.onPageStarted(tab, url, favicon);
-        }
         if (tab.inForeground()) {
             resetLockIcon(tab, url);
             setUrlTitle(tab, url, null);
             setFavicon(tab, favicon);
         }
+        if (mXLargeScreenSize) {
+            mTabBar.onPageStarted(tab, url, favicon);
+        }
+    }
 
+    @Override
+    public void bookmarkedStatusHasChanged(Tab tab) {
+        if (tab.inForeground() && mXLargeScreenSize) {
+            boolean isBookmark = tab.isBookmarkedSite();
+            ((TitleBarXLarge) mTitleBar).setCurrentUrlIsBookmark(isBookmark);
+            ((TitleBarXLarge) mFakeTitleBar).setCurrentUrlIsBookmark(isBookmark);
+        }
     }
 
     @Override
@@ -337,6 +345,7 @@
             // Request focus on the top window.
             mTabBar.onSetActiveTab(tab);
         }
+        bookmarkedStatusHasChanged(tab);
         resetTitleIconAndProgress(tab);
         updateLockIconToLatest(tab);
         tab.getTopWindow().requestFocus();
@@ -706,7 +715,7 @@
             setUrlTitle(tab, item.getUrl(), item.getTitle());
             setFavicon(tab, item.getFavicon());
         } else {
-            setUrlTitle(tab, null, null);
+            setUrlTitle(tab, null, mActivity.getString(R.string.new_tab));
             setFavicon(tab, null);
         }
     }
@@ -850,12 +859,7 @@
     @Override
     public void setUrlTitle(Tab tab, String url, String title) {
         if (TextUtils.isEmpty(title)) {
-            if (TextUtils.isEmpty(url)) {
-                title = mActivity.getResources()
-                        .getString(R.string.title_bar_loading);
-            } else {
-                title = url;
-            }
+            title = url;
         }
         if (tab.isInVoiceSearchMode()) return;
         if (tab.inForeground()) {
diff --git a/src/com/android/browser/BreadCrumbView.java b/src/com/android/browser/BreadCrumbView.java
index d0ba8ad..e4940e9 100644
--- a/src/com/android/browser/BreadCrumbView.java
+++ b/src/com/android/browser/BreadCrumbView.java
@@ -47,6 +47,7 @@
     private List<Crumb> mCrumbs;
     private boolean mUseBackButton;
     private Drawable mSeparatorDrawable;
+    private int mMaxVisible = -1;
 
     /**
      * @param context
@@ -80,22 +81,31 @@
         mCrumbs = new ArrayList<Crumb>();
         mSeparatorDrawable = ctx.getResources().getDrawable(
                 R.drawable.crumb_divider);
+        addBackButton();
     }
 
     public void setUseBackButton(boolean useflag) {
         mUseBackButton = useflag;
-        if (mUseBackButton && (mBackButton == null)) {
-            addBackButton();
-        } else if (!mUseBackButton && (mBackButton != null)) {
-            removeView(mBackButton);
-            mBackButton = null;
-        }
+        updateVisible();
     }
 
     public void setController(Controller ctl) {
         mController = ctl;
     }
 
+    public int getMaxVisible() {
+        return mMaxVisible;
+    }
+
+    public void setMaxVisible(int max) {
+        mMaxVisible = max;
+        updateVisible();
+    }
+
+    public int getTopLevel() {
+        return mCrumbs.size();
+    }
+
     public Object getTopData() {
         Crumb c = getTopCrumb();
         if (c != null) {
@@ -155,14 +165,12 @@
     }
 
     private void pushCrumb(Crumb crumb) {
-        if (!mUseBackButton || (mCrumbs.size() > 0)) {
+        if (mCrumbs.size() > 0) {
             addSeparator();
         }
         mCrumbs.add(crumb);
         addView(crumb.crumbView);
-        if (mUseBackButton) {
-            mBackButton.setVisibility(crumb.canGoBack ? View.VISIBLE : View.INVISIBLE);
-        }
+        updateVisible();
         crumb.crumbView.setOnClickListener(this);
     }
 
@@ -191,12 +199,54 @@
                     mBackButton.setVisibility(View.INVISIBLE);
                 }
             }
+            updateVisible();
             if (notify) {
                 notifyController();
             }
         }
     }
 
+    private void updateVisible() {
+        // start at index 1 (0 == back button)
+        int childIndex = 1;
+        if (mMaxVisible >= 0) {
+            int invisibleCrumbs = size() - mMaxVisible;
+            if (invisibleCrumbs > 0) {
+                int crumbIndex = 0;
+                while (crumbIndex < invisibleCrumbs) {
+                    // Set the crumb to GONE.
+                    getChildAt(childIndex).setVisibility(View.GONE);
+                    childIndex++;
+                    // Each crumb is followed by a separator (except the last
+                    // one).  Also make it GONE
+                    if (getChildAt(childIndex) != null) {
+                        getChildAt(childIndex).setVisibility(View.GONE);
+                    }
+                    childIndex++;
+                    // Move to the next crumb.
+                    crumbIndex++;
+                }
+            }
+            // Make sure the last two are visible.
+            int childCount = getChildCount();
+            while (childIndex < childCount) {
+                getChildAt(childIndex).setVisibility(View.VISIBLE);
+                childIndex++;
+            }
+        } else {
+            int count = getChildCount();
+            for (int i = childIndex; i < count ; i++) {
+                getChildAt(i).setVisibility(View.VISIBLE);
+            }
+        }
+        if (mUseBackButton) {
+            boolean canGoBack = getTopCrumb() != null ? getTopCrumb().canGoBack : false;
+            mBackButton.setVisibility(canGoBack ? View.VISIBLE : View.INVISIBLE);
+        } else {
+            mBackButton.setVisibility(View.GONE);
+        }
+    }
+
     private void removeLastView() {
         int ix = getChildCount();
         if (ix > 0) {
diff --git a/src/com/android/browser/Browser.java b/src/com/android/browser/Browser.java
index 97b9967..12c0c41 100644
--- a/src/com/android/browser/Browser.java
+++ b/src/com/android/browser/Browser.java
@@ -16,6 +16,7 @@
 
 package com.android.browser;
 
+import android.os.FileUtils;
 import android.util.Log;
 
 import android.app.Application;
@@ -47,7 +48,11 @@
     public Browser() {
     }
 
+    @Override
     public void onCreate() {
+        // Set the umask so that native code creates files with the correct
+        // permissions (0660)
+        FileUtils.setUMask(FileUtils.S_IRWXO);
         if (LOGV_ENABLED)
             Log.v(LOGTAG, "Browser.onCreate: this=" + this);
         // Fix heap utilization for better heap size characteristics.
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index a8c393a..1c15153 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -39,6 +39,9 @@
 
 public class BrowserActivity extends Activity {
 
+    public static final String ACTION_RESTART = "--restart--";
+    private static final String EXTRA_STATE = "state";
+
     private final static String LOGTAG = "browser";
 
     private final static boolean LOGV_ENABLED =
@@ -94,6 +97,10 @@
         mController.setUi(mUi);
         mController.setWebViewFactory((BaseUi) mUi);
 
+        Bundle state = getIntent().getBundleExtra(EXTRA_STATE);
+        if (state != null && icicle == null) {
+            icicle = state;
+        }
         mController.start(icicle, getIntent());
     }
 
@@ -104,6 +111,16 @@
 
     @Override
     protected void onNewIntent(Intent intent) {
+        if (ACTION_RESTART.equals(intent.getAction())) {
+            Bundle outState = new Bundle();
+            mController.onSaveInstanceState(outState);
+            finish();
+            getApplicationContext().startActivity(
+                    new Intent(getApplicationContext(), BrowserActivity.class)
+                    .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+                    .putExtra(EXTRA_STATE, outState));
+            return;
+        }
         mController.handleNewIntent(intent);
     }
 
diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java
index 74385f9..1410ce8 100644
--- a/src/com/android/browser/BrowserBookmarksPage.java
+++ b/src/com/android/browser/BrowserBookmarksPage.java
@@ -56,7 +56,6 @@
 import android.widget.AdapterView.OnItemSelectedListener;
 import android.widget.GridView;
 import android.widget.ListView;
-import android.widget.PopupMenu;
 import android.widget.PopupMenu.OnMenuItemClickListener;
 import android.widget.TextView;
 import android.widget.Toast;
@@ -66,6 +65,7 @@
     boolean onBookmarkSelected(Cursor c, boolean isFolder);
     // Return true if handled
     boolean onOpenInNewWindow(Cursor c);
+    void onFolderChanged(int level, Uri uri);
 }
 
 /**
@@ -103,10 +103,12 @@
     View mEmptyView;
     int mCurrentView;
     View mHeader;
-    View mRootFolderView;
     ViewGroup mHeaderContainer;
     BreadCrumbView mCrumbs;
     TextView mSelectBookmarkView;
+    int mCrumbVisibility = View.VISIBLE;
+    int mCrumbMaxVisible = -1;
+    boolean mCrumbBackButton = false;
 
     static BrowserBookmarksPage newInstance(BookmarksPageCallbacks cb,
             Bundle args, ViewGroup headerContainer) {
@@ -242,20 +244,6 @@
         return -1;
     }
 
-    public void onFolderChange(int level, Object data) {
-        Uri uri = (Uri) data;
-        if (uri == null) {
-            // top level
-            uri = BrowserContract.Bookmarks.CONTENT_URI_DEFAULT_FOLDER;
-        }
-        LoaderManager manager = getLoaderManager();
-        BookmarksLoader loader =
-                (BookmarksLoader) ((Loader<?>) manager.getLoader(LOADER_BOOKMARKS));
-        loader.setUri(uri);
-        loader.forceLoad();
-
-    }
-
     @Override
     public boolean onContextItemSelected(MenuItem item) {
         final Activity activity = getActivity();
@@ -417,14 +405,20 @@
             hc = (ViewGroup) root.findViewById(R.id.header_container);
             hc.setVisibility(View.VISIBLE);
         }
-        mHeader = inflater.inflate(R.layout.bookmarks_header, hc, true);
+        mHeader = inflater.inflate(R.layout.bookmarks_header, hc, false);
+        hc.addView(mHeader);
         mCrumbs = (BreadCrumbView) mHeader.findViewById(R.id.crumbs);
         mCrumbs.setController(this);
+        mCrumbs.setUseBackButton(mCrumbBackButton);
+        mCrumbs.setMaxVisible(mCrumbMaxVisible);
+        mCrumbs.setVisibility(mCrumbVisibility);
+        String name = getString(R.string.bookmarks);
+        mCrumbs.pushView(name, false, BrowserContract.Bookmarks.CONTENT_URI_DEFAULT_FOLDER);
+        if (mCallbacks != null) {
+            mCallbacks.onFolderChanged(1, BrowserContract.Bookmarks.CONTENT_URI_DEFAULT_FOLDER);
+        }
         mSelectBookmarkView = (TextView) mHeader.findViewById(R.id.select_bookmark_view);
         mSelectBookmarkView.setOnClickListener(this);
-        mRootFolderView = mHeader.findViewById(R.id.root_folder);
-        mRootFolderView.setOnClickListener(this);
-        setShowRootFolder(mShowRootFolder);
 
         // Start the loaders
         LoaderManager lm = getLoaderManager();
@@ -432,9 +426,9 @@
         mCurrentView =
             prefs.getInt(PREF_SELECTED_VIEW, BrowserBookmarksPage.VIEW_THUMBNAILS);
         if (mCurrentView == BrowserBookmarksPage.VIEW_THUMBNAILS) {
-            mSelectBookmarkView.setText(R.string.bookmark_thumbnail_view);
-        } else {
             mSelectBookmarkView.setText(R.string.bookmark_list_view);
+        } else {
+            mSelectBookmarkView.setText(R.string.bookmark_thumbnail_view);
         }
         mAdapter = new BrowserBookmarksAdapter(getActivity(), mCurrentView);
         String accountType = prefs.getString(PREF_ACCOUNT_TYPE, DEFAULT_ACCOUNT);
@@ -459,17 +453,6 @@
         return root;
     }
 
-    public void setShowRootFolder(boolean show) {
-        mShowRootFolder = show;
-        if (mRootFolderView != null) {
-            if (mShowRootFolder) {
-                mRootFolderView.setVisibility(View.VISIBLE);
-            } else {
-                mRootFolderView.setVisibility(View.GONE);
-            }
-        }
-    }
-
     @Override
     public void onDestroyView() {
         super.onDestroyView();
@@ -505,17 +488,13 @@
 
         if (isFolder) {
             String title = cursor.getString(BookmarksLoader.COLUMN_INDEX_TITLE);
-            LoaderManager manager = getLoaderManager();
-            BookmarksLoader loader =
-                    (BookmarksLoader) ((Loader<?>) manager.getLoader(LOADER_BOOKMARKS));
             Uri uri = ContentUris.withAppendedId(
                     BrowserContract.Bookmarks.CONTENT_URI_DEFAULT_FOLDER, id);
             if (mCrumbs != null) {
                 // update crumbs
                 mCrumbs.pushView(title, uri);
             }
-            loader.setUri(uri);
-            loader.forceLoad();
+            loadFolder(uri);
         }
     }
 
@@ -636,6 +615,11 @@
             return;
         }
         mCurrentView = view;
+        if (mCurrentView == BrowserBookmarksPage.VIEW_THUMBNAILS) {
+            mSelectBookmarkView.setText(R.string.bookmark_list_view);
+        } else {
+            mSelectBookmarkView.setText(R.string.bookmark_thumbnail_view);
+        }
         SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
         Editor edit = prefs.edit();
         edit.putInt(PREF_SELECTED_VIEW, mCurrentView);
@@ -664,28 +648,39 @@
         }
     }
 
-    public BreadCrumbView getBreadCrumb() {
-        return mCrumbs;
-    }
-
     /**
      * BreadCrumb controller callback
      */
     @Override
     public void onTop(int level, Object data) {
-        onFolderChange(level, data);
+        Uri uri = (Uri) data;
+        if (uri == null) {
+            // top level
+            uri = BrowserContract.Bookmarks.CONTENT_URI_DEFAULT_FOLDER;
+        }
+        loadFolder(uri);
+    }
+
+    /**
+     * @param uri
+     */
+    private void loadFolder(Uri uri) {
+        LoaderManager manager = getLoaderManager();
+        BookmarksLoader loader =
+                (BookmarksLoader) ((Loader<?>) manager.getLoader(LOADER_BOOKMARKS));
+        loader.setUri(uri);
+        loader.forceLoad();
+        if (mCallbacks != null) {
+            mCallbacks.onFolderChanged(mCrumbs.getTopLevel(), uri);
+        }
     }
 
     @Override
     public void onClick(View view) {
         if (mSelectBookmarkView == view) {
-            PopupMenu popup = new PopupMenu(getActivity(), mSelectBookmarkView);
-            popup.getMenuInflater().inflate(R.menu.bookmark_view,
-                    popup.getMenu());
-            popup.setOnMenuItemClickListener(this);
-            popup.show();
-        } else if (mRootFolderView == view) {
-            mCrumbs.clear();
+            selectView(mCurrentView == BrowserBookmarksPage.VIEW_LIST
+                    ? BrowserBookmarksPage.VIEW_THUMBNAILS
+                    : BrowserBookmarksPage.VIEW_LIST);
         }
     }
 
@@ -693,11 +688,9 @@
     public boolean onMenuItemClick(MenuItem item) {
         switch (item.getItemId()) {
         case R.id.list_view:
-            mSelectBookmarkView.setText(R.string.bookmark_list_view);
             selectView(BrowserBookmarksPage.VIEW_LIST);
             return true;
         case R.id.thumbnail_view:
-            mSelectBookmarkView.setText(R.string.bookmark_thumbnail_view);
             selectView(BrowserBookmarksPage.VIEW_THUMBNAILS);
             return true;
         }
@@ -768,4 +761,25 @@
             }
         }
     }
+
+    public void setBreadCrumbVisibility(int visibility) {
+        mCrumbVisibility = visibility;
+        if (mCrumbs != null) {
+            mCrumbs.setVisibility(mCrumbVisibility);
+        }
+    }
+
+    public void setBreadCrumbUseBackButton(boolean use) {
+        mCrumbBackButton = use;
+        if (mCrumbs != null) {
+            mCrumbs.setUseBackButton(mCrumbBackButton);
+        }
+    }
+
+    public void setBreadCrumbMaxVisible(int max) {
+        mCrumbMaxVisible = max;
+        if (mCrumbs != null) {
+            mCrumbs.setMaxVisible(mCrumbMaxVisible);
+        }
+    }
 }
diff --git a/src/com/android/browser/BrowserHomepagePreference.java b/src/com/android/browser/BrowserHomepagePreference.java
index 9886053..80f7ec2 100644
--- a/src/com/android/browser/BrowserHomepagePreference.java
+++ b/src/com/android/browser/BrowserHomepagePreference.java
@@ -22,34 +22,28 @@
 import android.os.Bundle;
 import android.preference.EditTextPreference;
 import android.util.AttributeSet;
-import android.view.Gravity;
+import android.view.LayoutInflater;
 import android.view.View;
+import android.view.View.OnClickListener;
 import android.view.ViewGroup;
 import android.view.Window;
 import android.view.WindowManager;
-import android.widget.Button;
 import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.Toast;
 
 public class BrowserHomepagePreference extends EditTextPreference {
     private String mCurrentPage;
-    private AlertDialog mSetHomepageTo;
 
     public BrowserHomepagePreference(Context context, AttributeSet attrs,
             int defStyle) {
         super(context, attrs, defStyle);
-        createSetHomepageToDialog();
     }
 
     public BrowserHomepagePreference(Context context, AttributeSet attrs) {
         super(context, attrs);
-        createSetHomepageToDialog();
     }
 
     public BrowserHomepagePreference(Context context) {
         super(context);
-        createSetHomepageToDialog();
     }
 
     @Override
@@ -58,66 +52,40 @@
         super.onAddEditTextToDialogView(dialogView, editText);
         // Now the EditText has a parent.  Add a button to set to the current
         // page.
-        ViewGroup parent = (ViewGroup) editText.getParent();
-        Button button = new Button(getContext());
-        button.setText(R.string.pref_set_homepage_to);
-        button.setOnClickListener(new View.OnClickListener() {
-            public void onClick(View v) {
-                mSetHomepageTo.show();
-            }
-        });
-        if (parent instanceof LinearLayout) {
-            ((LinearLayout) parent).setGravity(Gravity.CENTER_HORIZONTAL);
-        }
-        parent.addView(button, ViewGroup.LayoutParams.WRAP_CONTENT,
-                ViewGroup.LayoutParams.WRAP_CONTENT);
+        createButtons((ViewGroup) editText.getParent());
     }
 
-    private void createSetHomepageToDialog() {
-        Context context = getContext();
-        CharSequence[] setToChoices = new CharSequence[] {
-                context.getText(R.string.pref_use_current),
-                context.getText(R.string.pref_use_blank),
-                context.getText(R.string.pref_use_default),
-        };
-        AlertDialog.Builder builder = new AlertDialog.Builder(context);
-        builder.setTitle(R.string.pref_set_homepage_to);
-        builder.setItems(setToChoices, new DialogInterface.OnClickListener() {
-            @Override
-            public void onClick(DialogInterface dialog, int which) {
-                if (which == 0) {
-                    getEditText().setText(mCurrentPage);
-                } else if (which == 1) {
-                    getEditText().setText("about:blank");
-                } else if (which == 2) {
-                    getEditText().setText(BrowserSettings
-                            .getFactoryResetHomeUrl(getContext()));
-                }
-            }
-        });
-        mSetHomepageTo = builder.create();
+    void createButtons(ViewGroup parent) {
+        LayoutInflater inflater = (LayoutInflater) getContext()
+                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+        View v = inflater.inflate(R.layout.pref_homepage_buttons, parent);
+        v.findViewById(R.id.use_current).setOnClickListener(mOnClick);
+        v.findViewById(R.id.use_default).setOnClickListener(mOnClick);
     }
 
+    OnClickListener mOnClick = new OnClickListener() {
+        @Override
+        public void onClick(View v) {
+            switch (v.getId()) {
+            case R.id.use_current:
+                getEditText().setText(mCurrentPage);
+                break;
+            case R.id.use_default:
+                getEditText().setText(
+                        BrowserSettings.getFactoryResetHomeUrl(getContext()));
+                break;
+            }
+        }
+    };
+
     @Override
     protected void onDialogClosed(boolean positiveResult) {
         if (positiveResult) {
-            String url = getEditText().getText().toString();
-            if (url.length() > 0
-                    && !UrlUtils.ACCEPTED_URI_SCHEMA.matcher(url)
-                            .matches()) {
-                int colon = url.indexOf(':');
-                int space = url.indexOf(' ');
-                if (colon == -1 && space == -1 && url.length() > 0) {
-                    // if no colon, no space, add "http://" to make it a url
-                    getEditText().setText("http://" + url);
-                } else {
-                    // show an error toast and change the positiveResult to
-                    // false so that the bad url will not override the old url
-                    Toast.makeText(getContext(), R.string.bookmark_url_not_valid,
-                            Toast.LENGTH_SHORT).show();
-                    positiveResult = false;
-                }
+            String url = getEditText().getText().toString().trim();
+            if (url.length() > 0) {
+                url = UrlUtils.smartUrlFilter(url);
             }
+            getEditText().setText(url);
         }
         super.onDialogClosed(positiveResult);
     }
diff --git a/src/com/android/browser/BrowserPreferencesPage.java b/src/com/android/browser/BrowserPreferencesPage.java
index d93e70f..c47675d 100644
--- a/src/com/android/browser/BrowserPreferencesPage.java
+++ b/src/com/android/browser/BrowserPreferencesPage.java
@@ -34,7 +34,7 @@
     public void onBuildHeaders(List<Header> target) {
         loadHeadersFromResource(R.xml.preference_headers, target);
 
-        if (BrowserSettings.getInstance().showDebugSettings()) {
+        if (BrowserSettings.DEV_BUILD || BrowserSettings.getInstance().showDebugSettings()) {
             Header debug = new Header();
             debug.title = getText(R.string.pref_development_title);
             debug.fragment = DebugPreferencesFragment.class.getName();
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index ba2f3fe..1f091e2 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -24,6 +24,7 @@
 import android.content.ComponentName;
 import android.content.ContentResolver;
 import android.content.Context;
+import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
 import android.content.pm.ActivityInfo;
 import android.content.SharedPreferences;
 import android.content.SharedPreferences.Editor;
@@ -68,8 +69,7 @@
  * To remove an observer:
  * s.deleteObserver(webView.getSettings());
  */
-public class BrowserSettings extends Observable {
-
+public class BrowserSettings extends Observable implements OnSharedPreferenceChangeListener {
     // Private variables for settings
     // NOTE: these defaults need to be kept in sync with the XML
     // until the performance of PreferenceManager.setDefaultValues()
@@ -164,6 +164,8 @@
     public final static String PREF_AUTOFILL_ENABLED = "autofill_enabled";
     public final static String PREF_AUTOFILL_PROFILE = "autofill_profile";
     public final static String PREF_AUTOFILL_ACTIVE_PROFILE_ID = "autofill_active_profile_id";
+    public final static String PREF_HARDWARE_ACCEL = "enable_hardware_accel";
+    public final static String PREF_USER_AGENT = "user_agent";
 
     private static final String DESKTOP_USERAGENT = "Mozilla/5.0 (Macintosh; " +
             "U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/533.16 (KHTML, " +
@@ -189,6 +191,9 @@
 
     public static final Uri RLZ_PROVIDER_URI = Uri.parse("content://" + RLZ_PROVIDER + "/");
 
+    // Set to true to enable some of the about:debug options
+    public static final boolean DEV_BUILD = true;
+
     private Controller mController;
 
     // Single instance of the BrowserSettings for use in the Browser app.
@@ -332,7 +337,7 @@
             // Set the default value for the Geolocation database path.
             geolocationDatabasePath = mContext.getDir("geolocation", 0).getPath();
 
-            if (p.getString(PREF_HOMEPAGE, "") == "") {
+            if (p.getString(PREF_HOMEPAGE, null) == null) {
                 // No home page preferences is set, set it to default.
                 setHomePage(mContext, getFactoryResetHomeUrl(mContext));
             }
@@ -390,6 +395,7 @@
 
             // PreferenceManager.setDefaultValues is TOO SLOW, need to manually keep
             // the defaults in sync
+            p.registerOnSharedPreferenceChangeListener(BrowserSettings.this);
             syncSharedPreferences(mContext, p);
 
             synchronized (sSingleton) {
@@ -482,13 +488,13 @@
             tracing = p.getBoolean("enable_tracing", tracing);
             lightTouch = p.getBoolean("enable_light_touch", lightTouch);
             navDump = p.getBoolean("enable_nav_dump", navDump);
-            userAgent = Integer.parseInt(p.getString("user_agent", "0"));
         }
 
-        // This setting can only be modified when the debug settings have been
-        // enabled but it is read and used by the browser at startup so we must
-        // initialize it regardless of the status of the debug settings.
-        hardwareAccelerated = p.getBoolean("enable_hardware_accel", hardwareAccelerated);
+        // Only set these on startup if it is a dev build
+        if (DEV_BUILD) {
+            userAgent = Integer.parseInt(p.getString(PREF_USER_AGENT, "0"));
+            hardwareAccelerated = p.getBoolean(PREF_HARDWARE_ACCEL, hardwareAccelerated);
+        }
 
         // JS flags is loaded from DB even if showDebugSettings is false,
         // so that it can be set once and be effective all the time.
@@ -642,10 +648,10 @@
     }
 
     /*
-     * Package level method for obtaining a single app instance of the
+     * Application level method for obtaining a single app instance of the
      * BrowserSettings.
      */
-    /*package*/ static BrowserSettings getInstance() {
+    public static BrowserSettings getInstance() {
         if (sSingleton == null ) {
             sSingleton = new BrowserSettings();
         }
@@ -821,4 +827,15 @@
             return null;
         }
     }
+
+    @Override
+    public void onSharedPreferenceChanged(
+            SharedPreferences p, String key) {
+        if (PREF_HARDWARE_ACCEL.equals(key)) {
+            hardwareAccelerated = p.getBoolean(PREF_HARDWARE_ACCEL, hardwareAccelerated);
+        } else if (PREF_USER_AGENT.equals(key)) {
+            userAgent = Integer.parseInt(p.getString(PREF_USER_AGENT, "0"));
+            update();
+        }
+    }
 }
diff --git a/src/com/android/browser/CombinedBookmarkHistoryView.java b/src/com/android/browser/CombinedBookmarkHistoryView.java
index 15f31f6..e63d126 100644
--- a/src/com/android/browser/CombinedBookmarkHistoryView.java
+++ b/src/com/android/browser/CombinedBookmarkHistoryView.java
@@ -24,6 +24,7 @@
 import android.content.res.Resources;
 import android.database.Cursor;
 import android.graphics.Bitmap;
+import android.net.Uri;
 import android.os.AsyncTask;
 import android.os.Bundle;
 import android.provider.Browser;
@@ -66,6 +67,7 @@
     TextView mAddBookmark;
     View mSeperateSelectAdd;
     ViewGroup mBookmarksHeader;
+    View mHome;
 
     BrowserBookmarksPage mBookmarks;
     BrowserHistoryPage mHistory;
@@ -125,9 +127,11 @@
         mTabHistory = (TextView) findViewById(R.id.historytab);
         mAddBookmark = (TextView) findViewById(R.id.addbm);
         mSeperateSelectAdd = findViewById(R.id.seperate_select_add);
+        mHome = findViewById(R.id.home);
         mAddBookmark.setOnClickListener(this);
         mTabHistory.setOnClickListener(this);
         mTabBookmarks.setOnClickListener(this);
+        mHome.setOnClickListener(this);
         // Start up the default fragment
         initFragments(mExtras);
         loadFragment(startingFragment, mExtras, false);
@@ -164,11 +168,25 @@
             mUiController.onUrlSelected(BrowserBookmarksPage.getUrl(c), false);
             return true;
         }
+
+        @Override
+        public void onFolderChanged(int level, Uri uri) {
+            // 1 is "bookmarks" root folder
+            if (level <= 1) {
+                mTabs.setVisibility(View.VISIBLE);
+                mBookmarks.setBreadCrumbVisibility(View.INVISIBLE);
+            } else {
+                mTabs.setVisibility(View.GONE);
+                mBookmarks.setBreadCrumbVisibility(View.VISIBLE);
+            }
+        }
     };
 
     private void initFragments(Bundle extras) {
         mBookmarks = BrowserBookmarksPage.newInstance(mBookmarkCallbackWrapper,
                 extras, mBookmarksHeader);
+        mBookmarks.setBreadCrumbMaxVisible(2);
+        mBookmarks.setBreadCrumbUseBackButton(true);
         mHistory = BrowserHistoryPage.newInstance(mUiController, extras);
     }
 
@@ -180,11 +198,15 @@
                 fragment = mBookmarks;
                 mSeperateSelectAdd.setVisibility(View.VISIBLE);
                 mBookmarksHeader.setVisibility(View.VISIBLE);
+                mTabBookmarks.setActivated(true);
+                mTabHistory.setActivated(false);
                 break;
             case FRAGMENT_ID_HISTORY:
                 fragment = mHistory;
                 mBookmarksHeader.setVisibility(View.INVISIBLE);
                 mSeperateSelectAdd.setVisibility(View.INVISIBLE);
+                mTabBookmarks.setActivated(false);
+                mTabHistory.setActivated(true);
                 break;
             default:
                 throw new IllegalArgumentException();
@@ -217,14 +239,12 @@
         } else if (mTabBookmarks == view) {
             if (mCurrentFragment != FRAGMENT_ID_BOOKMARKS) {
                 loadFragment(FRAGMENT_ID_BOOKMARKS, mExtras, true);
-            } else {
-                BreadCrumbView crumbs = mBookmarks.getBreadCrumb();
-                if (crumbs != null) {
-                    crumbs.clear();
-                }
             }
         } else if (mAddBookmark == view) {
             mUiController.bookmarkCurrentPage(mBookmarks.getFolderId());
+        } else if (mHome == view) {
+            BrowserSettings settings = BrowserSettings.getInstance();
+            mUiController.onUrlSelected(settings.getHomePage(), false);
         }
     }
 
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 75dd913..7acdfe5 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -108,10 +108,6 @@
 
     private static final int EMPTY_MENU = -1;
 
-    // Keep this initial progress in sync with initialProgressValue (* 100)
-    // in ProgressTracker.cpp
-    private final static int INITIAL_PROGRESS = 10;
-
     // activity requestCode
     final static int PREFERENCES_PAGE = 3;
     final static int FILE_SELECTED = 4;
@@ -564,7 +560,6 @@
             Log.e(LOGTAG, "BrowserActivity is already paused.");
             return;
         }
-        CookieManager.getInstance().flushCookieStore();
         mActivityPaused = true;
         Tab tab = mTabControl.getCurrentTab();
         if (tab != null) {
@@ -750,10 +745,6 @@
 
         mUi.onPageStarted(tab, url, favicon);
 
-        // Show some progress so that the user knows the page is beginning to
-        // load
-        onProgressChanged(tab, INITIAL_PROGRESS);
-
         // update the bookmark database for favicon
         maybeUpdateFavicon(tab, null, url, favicon);
 
@@ -1035,6 +1026,11 @@
         }
     }
 
+    @Override
+    public void bookmarkedStatusHasChanged(Tab tab) {
+        mUi.bookmarkedStatusHasChanged(tab);
+    }
+
     // end WebViewController
 
     protected void pageUp() {
@@ -2247,7 +2243,6 @@
      * @param url The URL to load.
      */
     protected void loadUrl(WebView view, String url) {
-        updateTitleBarForNewLoad(view, url);
         view.loadUrl(url);
     }
 
@@ -2258,7 +2253,6 @@
      * @param data The UrlData being loaded.
      */
     protected void loadUrlDataIn(Tab t, UrlData data) {
-        updateTitleBarForNewLoad(t.getWebView(), data.mUrl);
         data.loadIn(t);
     }
 
@@ -2279,25 +2273,6 @@
     }
 
     /**
-     * If the WebView is the top window, update the title bar to reflect
-     * loading the new URL.  i.e. set its text, clear the favicon (which
-     * will be set once the page begins loading), and set the progress to
-     * INITIAL_PROGRESS to show that the page has begun to load. Called
-     * by loadUrl and loadUrlDataIn.
-     * @param view The WebView that is starting a load.
-     * @param url The URL that is being loaded.
-     */
-    private void updateTitleBarForNewLoad(WebView view, String url) {
-        if (view == getCurrentTopWebView()) {
-            // TODO we should come with a tab and not with a view
-            Tab tab = mTabControl.getTabFromView(view);
-            setUrlTitle(tab, url, null);
-            mUi.setFavicon(tab, null);
-            onProgressChanged(tab, INITIAL_PROGRESS);
-        }
-    }
-
-    /**
      * Sets a title composed of the URL and the title string.
      * @param url The URL of the site being loaded.
      * @param title The title of the site being loaded.
diff --git a/src/com/android/browser/ShortcutActivity.java b/src/com/android/browser/ShortcutActivity.java
index 57cb4a7..786c6e1 100644
--- a/src/com/android/browser/ShortcutActivity.java
+++ b/src/com/android/browser/ShortcutActivity.java
@@ -19,6 +19,7 @@
 import android.app.Activity;
 import android.content.Intent;
 import android.database.Cursor;
+import android.net.Uri;
 import android.os.Bundle;
 
 public class ShortcutActivity extends Activity
@@ -33,7 +34,8 @@
         setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
         mBookmarks = BrowserBookmarksPage.newInstance(this, null, null);
         mBookmarks.setEnableContextMenu(false);
-        mBookmarks.setShowRootFolder(true);
+        mBookmarks.setBreadCrumbMaxVisible(2);
+        mBookmarks.setBreadCrumbUseBackButton(true);
         getFragmentManager()
                 .openTransaction()
                 .add(android.R.id.content, mBookmarks)
@@ -64,4 +66,8 @@
             super.onBackPressed();
         }
     }
+
+    @Override
+    public void onFolderChanged(int level, Uri uri) {
+    }
 }
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index 8a3bc27..3e79edb 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -25,12 +25,16 @@
 import android.content.DialogInterface;
 import android.content.DialogInterface.OnCancelListener;
 import android.content.Intent;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteException;
 import android.graphics.Bitmap;
 import android.net.Uri;
 import android.net.http.SslError;
+import android.os.AsyncTask;
 import android.os.Bundle;
 import android.os.Message;
 import android.os.SystemClock;
+import android.provider.BrowserContract;
 import android.speech.RecognizerResultsIntent;
 import android.util.Log;
 import android.view.KeyEvent;
@@ -144,6 +148,14 @@
         Bitmap  mFavicon;
     }
 
+    // Whether or not the currently shown page is a bookmarked site.  Will be
+    // out of date when loading a new page until the mBookmarkAsyncTask returns.
+    private boolean mIsBookmarkedSite;
+    // Used to determine whether the current site is bookmarked.
+    private AsyncTask<Void, Void, Boolean> mBookmarkAsyncTask;
+
+    public boolean isBookmarkedSite() { return mIsBookmarkedSite; }
+
     // Used for saving and restoring each Tab
     static final String WEBVIEW = "webview";
     static final String NUMTABS = "numTabs";
@@ -488,9 +500,42 @@
                 }
             }
 
-
             // finally update the UI in the activity if it is in the foreground
             mWebViewController.onPageStarted(Tab.this, view, url, favicon);
+
+            final String urlInQuestion = url;
+            if (mBookmarkAsyncTask != null) {
+                mBookmarkAsyncTask.cancel(true);
+            }
+            mBookmarkAsyncTask = new AsyncTask<Void, Void, Boolean>() {
+                @Override
+                protected Boolean doInBackground(Void... unused) {
+                    // Check to see if the site is bookmarked
+                    Cursor cursor = null;
+                    try {
+                        cursor = mActivity.getContentResolver().query(
+                                BrowserContract.Bookmarks.CONTENT_URI,
+                                new String[] { BrowserContract.Bookmarks.URL },
+                                BrowserContract.Bookmarks.URL + " == ?",
+                                new String[] { urlInQuestion },
+                                null);
+                        return cursor.moveToFirst();
+                    } catch (SQLiteException e) {
+                        Log.e(LOGTAG, "Error checking for bookmark: " + e);
+                        return false;
+                    } finally {
+                        if (cursor != null) cursor.close();
+                    }
+                }
+                @Override
+                protected void onPostExecute(Boolean isBookmarked) {
+                    if (this == mBookmarkAsyncTask) {
+                        mIsBookmarkedSite = isBookmarked;
+                        mWebViewController.bookmarkedStatusHasChanged(Tab.this);
+                    }
+                }
+            };
+            mBookmarkAsyncTask.execute();
         }
 
         @Override
diff --git a/src/com/android/browser/TabBar.java b/src/com/android/browser/TabBar.java
index 69e0bd2..14b1845 100644
--- a/src/com/android/browser/TabBar.java
+++ b/src/com/android/browser/TabBar.java
@@ -454,7 +454,6 @@
         mHasReceivedTitle = false;
         TabViewData tvd = mTabMap.get(tab);
         if (tvd != null) {
-            tvd.setUrlAndTitle(url, null);
             tvd.setFavicon(favicon);
             tvd.setUrlAndTitle(url, mLoadingText);
         }
diff --git a/src/com/android/browser/TitleBar.java b/src/com/android/browser/TitleBar.java
index 6dabd76..bdef82e 100644
--- a/src/com/android/browser/TitleBar.java
+++ b/src/com/android/browser/TitleBar.java
@@ -320,13 +320,13 @@
 
     /**
      * Update the text displayed in the title bar.
-     * @param title String to display.  If null, the loading string will be
+     * @param title String to display.  If null, the new tab string will be
      *      shown.
      */
     @Override
     void setDisplayTitle(String title) {
         if (title == null) {
-            mTitle.setText(R.string.title_bar_loading);
+            mTitle.setText(R.string.new_tab);
         } else {
             if (mInVoiceMode) {
                 // Add two spaces.  The second one will be replaced with an
diff --git a/src/com/android/browser/TitleBarXLarge.java b/src/com/android/browser/TitleBarXLarge.java
index 0aa09db..cd3b230 100644
--- a/src/com/android/browser/TitleBarXLarge.java
+++ b/src/com/android/browser/TitleBarXLarge.java
@@ -26,9 +26,11 @@
 import android.graphics.Bitmap;
 import android.graphics.drawable.Drawable;
 import android.text.TextUtils;
+import android.util.AttributeSet;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.View.OnClickListener;
+import android.widget.CheckBox;
 import android.widget.ImageView;
 import android.widget.TextView;
 
@@ -48,7 +50,7 @@
     private View mContainer;
     private View mBackButton;
     private View mForwardButton;
-    private View mStar;
+    private CheckBox mStar;
     private View mSearchButton;
     private View mFocusContainer;
     private View mUnfocusContainer;
@@ -82,7 +84,7 @@
         // back/forward.  Probably should be done inside onPageStarted.
         mBackButton = findViewById(R.id.back);
         mForwardButton = findViewById(R.id.forward);
-        mStar = findViewById(R.id.star);
+        mStar = (CheckBox) findViewById(R.id.star);
         mStopButton = (ImageView) findViewById(R.id.stop);
         mSearchButton = findViewById(R.id.search);
         mLockIcon = (ImageView) findViewById(R.id.lock);
@@ -106,6 +108,10 @@
         mUnfocusContainer.setOnClickListener(this);
     }
 
+    public void setCurrentUrlIsBookmark(boolean isBookmark) {
+        mStar.setChecked(isBookmark);
+    }
+
     @Override
     public void onClick(View v) {
         if (mUnfocusContainer == v) {
@@ -237,4 +243,25 @@
         mUrlUnfocused.setText(title);
     }
 
+    /**
+     * Custom CheckBox which does not toggle when pressed.  Used by mStar.
+     */
+    public static class CustomCheck extends CheckBox {
+        public CustomCheck(Context context) {
+            super(context);
+        }
+
+        public CustomCheck(Context context, AttributeSet attrs) {
+            super(context, attrs);
+        }
+
+        public CustomCheck(Context context, AttributeSet attrs, int defStyle) {
+            super(context, attrs, defStyle);
+        }
+
+        @Override
+        public void toggle() {
+            // Do nothing
+        }
+    }
 }
diff --git a/src/com/android/browser/UI.java b/src/com/android/browser/UI.java
index e7f67f2..2bfec44 100644
--- a/src/com/android/browser/UI.java
+++ b/src/com/android/browser/UI.java
@@ -130,4 +130,5 @@
 
     View getVideoLoadingProgressView();
 
+    void bookmarkedStatusHasChanged(Tab tab);
 }
diff --git a/src/com/android/browser/WebViewController.java b/src/com/android/browser/WebViewController.java
index 11a6959..894bbec 100644
--- a/src/com/android/browser/WebViewController.java
+++ b/src/com/android/browser/WebViewController.java
@@ -107,4 +107,6 @@
 
     void setupAutoFill(Message message);
 
+    void bookmarkedStatusHasChanged(Tab tab);
+
 }
diff --git a/src/com/android/browser/preferences/DebugPreferencesFragment.java b/src/com/android/browser/preferences/DebugPreferencesFragment.java
index d643a97..0a82371 100644
--- a/src/com/android/browser/preferences/DebugPreferencesFragment.java
+++ b/src/com/android/browser/preferences/DebugPreferencesFragment.java
@@ -16,17 +16,46 @@
 
 package com.android.browser.preferences;
 
+import com.android.browser.BrowserActivity;
+import com.android.browser.BrowserSettings;
+import com.android.browser.Controller;
 import com.android.browser.R;
 
+import android.content.Context;
+import android.content.Intent;
+import android.os.AsyncTask;
 import android.os.Bundle;
+import android.preference.Preference;
+import android.preference.Preference.OnPreferenceChangeListener;
+import android.preference.PreferenceActivity.Header;
 import android.preference.PreferenceFragment;
+import android.preference.PreferenceManager.OnActivityResultListener;
 
-public class DebugPreferencesFragment extends PreferenceFragment {
+import java.io.IOException;
+import java.io.Serializable;
+
+public class DebugPreferencesFragment extends PreferenceFragment
+        implements OnPreferenceChangeListener {
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
         // Load the XML preferences file
         addPreferencesFromResource(R.xml.debug_preferences);
+
+        if (BrowserSettings.getInstance().showDebugSettings()) {
+            addPreferencesFromResource(R.xml.hidden_debug_preferences);
+        }
+
+        Preference e = findPreference(BrowserSettings.PREF_HARDWARE_ACCEL);
+        e.setOnPreferenceChangeListener(this);
+    }
+
+    @Override
+    public boolean onPreferenceChange(Preference preference, Object newValue) {
+        // Attempt to restart
+        startActivity(new Intent(BrowserActivity.ACTION_RESTART, null,
+                getActivity(), BrowserActivity.class));
+        return true;
     }
 }
diff --git a/src/com/android/browser/preferences/PageContentPreferencesFragment.java b/src/com/android/browser/preferences/PageContentPreferencesFragment.java
index 1b5d0fe..4be14a6 100644
--- a/src/com/android/browser/preferences/PageContentPreferencesFragment.java
+++ b/src/com/android/browser/preferences/PageContentPreferencesFragment.java
@@ -72,29 +72,8 @@
         }
 
         if (pref.getKey().equals(BrowserSettings.PREF_HOMEPAGE)) {
-            String value = (String) objValue;
-            boolean needUpdate = value.indexOf(' ') != -1;
-            if (needUpdate) {
-                value = value.trim().replace(" ", "%20");
-            }
-            if (value.length() != 0 && Uri.parse(value).getScheme() == null) {
-                value = "http://" + value;
-                needUpdate = true;
-            }
-            // Set the summary value.
-            pref.setSummary(value);
-            if (needUpdate) {
-                // Update through the EditText control as it has a cached copy
-                // of the string and it will handle persisting the value
-                ((EditTextPreference) pref).setText(value);
-
-                // as we update the value above, we need to return false
-                // here so that setText() is not called by EditTextPref
-                // with the old value.
-                return false;
-            } else {
-                return true;
-            }
+            pref.setSummary((String) objValue);
+            return true;
         } else if (pref.getKey().equals(BrowserSettings.PREF_TEXT_SIZE)) {
             pref.setSummary(getVisualTextSizeName((String) objValue));
             return true;