Merge "Import revised translations."
diff --git a/res/drawable-hdpi/ic_querybuilder_normal.png b/res/drawable-hdpi/ic_querybuilder_normal.png
index de63799..195329d 100644
--- a/res/drawable-hdpi/ic_querybuilder_normal.png
+++ b/res/drawable-hdpi/ic_querybuilder_normal.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_querybuilder_pressed.png b/res/drawable-hdpi/ic_querybuilder_pressed.png
index fdfebd1..1ad9e05 100644
--- a/res/drawable-hdpi/ic_querybuilder_pressed.png
+++ b/res/drawable-hdpi/ic_querybuilder_pressed.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_search_category_history.png b/res/drawable-hdpi/ic_search_category_history.png
index 91fe1f3..94c89ae 100644
--- a/res/drawable-hdpi/ic_search_category_history.png
+++ b/res/drawable-hdpi/ic_search_category_history.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_search_category_suggest.png b/res/drawable-hdpi/ic_search_category_suggest.png
index 9a17a9d..9ee751c 100644
--- a/res/drawable-hdpi/ic_search_category_suggest.png
+++ b/res/drawable-hdpi/ic_search_category_suggest.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_querybuilder_normal.png b/res/drawable-mdpi/ic_querybuilder_normal.png
index 66b538f..0d2858b 100644
--- a/res/drawable-mdpi/ic_querybuilder_normal.png
+++ b/res/drawable-mdpi/ic_querybuilder_normal.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_querybuilder_pressed.png b/res/drawable-mdpi/ic_querybuilder_pressed.png
index 0366d1e..0d2858b 100644
--- a/res/drawable-mdpi/ic_querybuilder_pressed.png
+++ b/res/drawable-mdpi/ic_querybuilder_pressed.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_search_category_history.png b/res/drawable-mdpi/ic_search_category_history.png
index 633e9c0..0f63144 100644
--- a/res/drawable-mdpi/ic_search_category_history.png
+++ b/res/drawable-mdpi/ic_search_category_history.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_search_category_suggest.png b/res/drawable-mdpi/ic_search_category_suggest.png
index 1001573..b9c374b 100644
--- a/res/drawable-mdpi/ic_search_category_suggest.png
+++ b/res/drawable-mdpi/ic_search_category_suggest.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_querybuilder_normal.png b/res/drawable-xhdpi/ic_querybuilder_normal.png
index cc3ce59..1a4680c 100644
--- a/res/drawable-xhdpi/ic_querybuilder_normal.png
+++ b/res/drawable-xhdpi/ic_querybuilder_normal.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_querybuilder_pressed.png b/res/drawable-xhdpi/ic_querybuilder_pressed.png
index 0693fa3..af9e7a1 100644
--- a/res/drawable-xhdpi/ic_querybuilder_pressed.png
+++ b/res/drawable-xhdpi/ic_querybuilder_pressed.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_search_category_bookmark.png b/res/drawable-xhdpi/ic_search_category_bookmark.png
index 8b5ffa1..6046a95 100644
--- a/res/drawable-xhdpi/ic_search_category_bookmark.png
+++ b/res/drawable-xhdpi/ic_search_category_bookmark.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_search_category_browser.png b/res/drawable-xhdpi/ic_search_category_browser.png
index 8b195c1..bb767b4 100644
--- a/res/drawable-xhdpi/ic_search_category_browser.png
+++ b/res/drawable-xhdpi/ic_search_category_browser.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_search_category_history.png b/res/drawable-xhdpi/ic_search_category_history.png
index 8a0e828..681e4b4 100644
--- a/res/drawable-xhdpi/ic_search_category_history.png
+++ b/res/drawable-xhdpi/ic_search_category_history.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_search_category_suggest.png b/res/drawable-xhdpi/ic_search_category_suggest.png
index 985a201..d663b1b 100644
--- a/res/drawable-xhdpi/ic_search_category_suggest.png
+++ b/res/drawable-xhdpi/ic_search_category_suggest.png
Binary files differ
diff --git a/res/layout/title_bar_nav.xml b/res/layout/title_bar_nav.xml
index eeba9d7..8ed6331 100644
--- a/res/layout/title_bar_nav.xml
+++ b/res/layout/title_bar_nav.xml
@@ -26,6 +26,14 @@
         android:gravity="center_vertical"
         android:orientation="horizontal">
         <ImageView
+            android:id="@+id/magnify"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:paddingLeft="8dip"
+            android:paddingRight="8dip"
+            android:visibility="gone"
+            android:src="@drawable/ic_search_category_suggest" />
+        <ImageView
             android:id="@+id/incognito_icon"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
@@ -83,6 +91,14 @@
             android:src="@drawable/ic_voice_search_holo_dark"
             style="@style/HoloButton"
             android:visibility="gone" />
+        <ImageView
+            android:id="@+id/clear"
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:contentDescription="@string/accessibility_button_clear"
+            android:src="@drawable/ic_close_window_holo_dark"
+            style="@style/HoloButton"
+            android:visibility="gone" />
     </LinearLayout>
     <ImageButton
         android:id="@+id/tab_switcher"
diff --git a/res/values-sw600dp/styles.xml b/res/values-sw600dp/styles.xml
index 41e09ae..699f10a 100644
--- a/res/values-sw600dp/styles.xml
+++ b/res/values-sw600dp/styles.xml
@@ -24,4 +24,8 @@
     </style>
     <style name="Suggestions" parent="@android:style/Widget.Holo.AutoCompleteTextView">
     </style>
+    <style name="ActionBarStyle" parent="@android:style/Widget.Holo.ActionBar">
+        <item name="android:background">@drawable/bg_browsertabs</item>
+        <item name="android:displayOptions"></item>
+    </style>
 </resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 20e7297..c9cb170 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -40,7 +40,7 @@
         <item name="android:windowIsTranslucent">true</item>
     </style>
     <style name="ActionBarStyle" parent="@android:style/Widget.Holo.ActionBar">
-        <item name="android:background">@drawable/bg_browsertabs</item>
+        <item name="android:background">@drawable/bg_urlbar</item>
         <item name="android:displayOptions"></item>
     </style>
     <style name="Suggestions" parent="@android:style/Widget.Holo.AutoCompleteTextView">
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index 17ba4d7..bce3257 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -247,8 +247,7 @@
         setShouldShowErrorConsole(tab, mUiController.shouldShowErrorConsole());
         onTabDataChanged(tab);
         onProgressChanged(tab);
-        boolean incognito = mActiveTab.getWebView().isPrivateBrowsingEnabled();
-        mNavigationBar.setIncognitoMode(incognito);
+        mNavigationBar.setIncognitoMode(tab.isPrivateBrowsingEnabled());
         updateAutoLogin(tab, false);
         if (web != null && web.getVisibleTitleHeight()
                 != mTitleBar.getEmbeddedHeight()
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index b86759a..23aeed5 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -62,7 +62,6 @@
             finish();
             return;
         }
-
         mController = new Controller(this, icicle == null);
         boolean xlarge = isTablet(this);
         if (xlarge) {
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index 09c7200..11316ff 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -128,7 +128,6 @@
         mAutofillHandler = new AutofillHandler(mContext);
         mManagedSettings = new LinkedList<WeakReference<WebSettings>>();
         mCustomUserAgents = new WeakHashMap<WebSettings, String>();
-        mPrefs.registerOnSharedPreferenceChangeListener(this);
         mAutofillHandler.asyncLoadFromDb();
         BackgroundHandler.execute(mSetup);
     }
@@ -168,6 +167,10 @@
             mWebStorageSizeManager = new WebStorageSizeManager(mContext,
                     new WebStorageSizeManager.StatFsDiskInfo(getAppCachePath()),
                     new WebStorageSizeManager.WebKitAppCacheInfo(getAppCachePath()));
+            // Workaround b/5253777
+            CookieManager.getInstance().acceptCookie();
+            // Workaround b/5254577
+            mPrefs.registerOnSharedPreferenceChangeListener(BrowserSettings.this);
             if (Build.VERSION.CODENAME.equals("REL")) {
                 // This is a release build, always startup with debug disabled
                 setDebugEnabled(false);
diff --git a/src/com/android/browser/NavigationBarPhone.java b/src/com/android/browser/NavigationBarPhone.java
index fee9604..7e8695b 100644
--- a/src/com/android/browser/NavigationBarPhone.java
+++ b/src/com/android/browser/NavigationBarPhone.java
@@ -36,6 +36,8 @@
 
     private ImageView mStopButton;
     private ImageView mVoiceButton;
+    private ImageView mMagnify;
+    private ImageView mClearButton;
     private Drawable mStopDrawable;
     private Drawable mRefreshDrawable;
     private String mStopDescription;
@@ -69,6 +71,9 @@
         mStopButton.setOnClickListener(this);
         mVoiceButton = (ImageView) findViewById(R.id.voice);
         mVoiceButton.setOnClickListener(this);
+        mClearButton = (ImageView) findViewById(R.id.clear);
+        mClearButton.setOnClickListener(this);
+        mMagnify = (ImageView) findViewById(R.id.magnify);
         mTabSwitcher = findViewById(R.id.tab_switcher);
         mTabSwitcher.setOnClickListener(this);
         mMore = findViewById(R.id.more);
@@ -156,6 +161,8 @@
             ((PhoneUi) mBaseUi).toggleNavScreen();
         } else if (mMore == v) {
             showMenu(mMore);
+        } else if (mClearButton == v) {
+            mUrlInput.setText("");
         } else {
             super.onClick(v);
         }
@@ -209,6 +216,8 @@
         case StateListener.STATE_NORMAL:
             mComboIcon.setVisibility(View.VISIBLE);
             mStopButton.setVisibility(View.GONE);
+            mClearButton.setVisibility(View.GONE);
+            mMagnify.setVisibility(View.GONE);
             setSearchMode(mInVoiceMode);
             mTabSwitcher.setVisibility(View.VISIBLE);
             mTitleContainer.setBackgroundDrawable(null);
@@ -217,6 +226,8 @@
         case StateListener.STATE_HIGHLIGHTED:
             mComboIcon.setVisibility(View.GONE);
             mStopButton.setVisibility(View.VISIBLE);
+            mClearButton.setVisibility(View.GONE);
+            mMagnify.setVisibility(View.GONE);
             setSearchMode(true);
             mTabSwitcher.setVisibility(View.GONE);
             mMore.setVisibility(View.GONE);
@@ -225,6 +236,8 @@
         case StateListener.STATE_EDITED:
             mComboIcon.setVisibility(View.GONE);
             mStopButton.setVisibility(View.GONE);
+            mClearButton.setVisibility(View.VISIBLE);
+            mMagnify.setVisibility(View.VISIBLE);
             setSearchMode(false);
             mTabSwitcher.setVisibility(View.GONE);
             mMore.setVisibility(View.GONE);
diff --git a/src/com/android/browser/UrlInputView.java b/src/com/android/browser/UrlInputView.java
index 2acc69b..fbdf400 100644
--- a/src/com/android/browser/UrlInputView.java
+++ b/src/com/android/browser/UrlInputView.java
@@ -56,6 +56,8 @@
     static final String SUGGESTED = "browser-suggest";
     static final String VOICE = "voice-search";
 
+    static final int POST_DELAY = 100;
+
     static interface StateListener {
         static final int STATE_NORMAL = 0;
         static final int STATE_HIGHLIGHTED = 1;
@@ -123,16 +125,23 @@
 
     protected void onFocusChanged(boolean focused, int direction, Rect prevRect) {
         super.onFocusChanged(focused, direction, prevRect);
+        int state = -1;
         if (focused) {
             if (hasSelection()) {
-                changeState(StateListener.STATE_HIGHLIGHTED);
+                state = StateListener.STATE_HIGHLIGHTED;
             } else {
-                changeState(StateListener.STATE_EDITED);
+                state = StateListener.STATE_EDITED;
             }
         } else {
             // reset the selection state
-            changeState(StateListener.STATE_NORMAL);
+            state = StateListener.STATE_NORMAL;
         }
+        final int s = state;
+        post(new Runnable() {
+            public void run() {
+                changeState(s);
+            }
+        });
     }
 
     @Override
@@ -141,7 +150,10 @@
         boolean res = super.onTouchEvent(evt);
         if ((MotionEvent.ACTION_DOWN == evt.getActionMasked())
               && hasSelection) {
-            changeState(StateListener.STATE_EDITED);
+            postDelayed(new Runnable() {
+                public void run() {
+                    changeState(StateListener.STATE_EDITED);
+                }}, POST_DELAY);
         }
         return res;
     }
diff --git a/src/com/android/browser/UrlUtils.java b/src/com/android/browser/UrlUtils.java
index 681b242..e24000c 100644
--- a/src/com/android/browser/UrlUtils.java
+++ b/src/com/android/browser/UrlUtils.java
@@ -40,22 +40,22 @@
     private final static String QUICKSEARCH_G = "http://www.google.com/m?q=%s";
     private final static String QUERY_PLACE_HOLDER = "%s";
 
-    // Regular expression to strip http://, optionally www., and optionally
+    // Regular expression to strip http:// and optionally
     // the trailing slash
     private static final Pattern STRIP_URL_PATTERN =
-            Pattern.compile("^http://(?:www\\.)?(.*?)/?$");
+            Pattern.compile("^http://(.*?)/?$");
 
     private UrlUtils() { /* cannot be instantiated */ }
 
     /**
-     * Strips the provided url of preceding "http://", "www.", and any trailing "/". Does not
+     * Strips the provided url of preceding "http://" and any trailing "/". Does not
      * strip "https://". If the provided string cannot be stripped, the original string
      * is returned.
      *
      * TODO: Put this in TextUtils to be used by other packages doing something similar.
      *
      * @param url a url to strip, like "http://www.google.com/"
-     * @return a stripped url like "google.com", or the original string if it could
+     * @return a stripped url like "www.google.com", or the original string if it could
      *         not be stripped
      */
     public static String stripUrl(String url) {
diff --git a/tests/assets/bindings_test.html b/tests/assets/bindings_test.html
index 2d20ada..7218f58 100755
--- a/tests/assets/bindings_test.html
+++ b/tests/assets/bindings_test.html
@@ -114,16 +114,12 @@
   if (returned == null) {
     appendLog("returnObject() failed: expected non-null, got " + returned);
     return false;
-  } else if (returned.x != 0) {
-    // EMULATE_JSC_BINDINGS
-    // Note: the Java sets the x property to 123. JSC and V8 do not support object
-    // members in the bindings though.
-    appendLog("returnObject() failed: expected 'x' property 0, got " + returned.x)
+  } else if (returned.x != undefined) {
+    // We do not support getting object properties.
+    appendLog("returnObject() failed: expected 'x' property undefined, got " + returned.x)
     return false;
   } else if (returned.s != undefined) {
-    // EMULATE_JSC_BINDINGS
-    // Note that the java class returned has s set to Hello World. JSC and V8 do not support
-    // getting properties.
+    // We do not support getting object properties.
     appendLog("returnObject() failed: expected 's' property undefined, got " + returned.s);
     return false;
   } else if (!returned.aMethod()) {
@@ -150,19 +146,15 @@
 }
 
 function getIfaceProperties() {
-  if (JNIBindingsTest.mInt != 0) {
-    // EMULATE_JSC_BINDINGS
-    // Note: the Java sets the mInt property to 123. JSC and V8 do not support object
-    // members in the bindings though.
-    appendLog("getIfaceProperties() failed: expected mInt = 0, got " + JNIBindingsTest.mInt);
+  if (JNIBindingsTest.mInt != undefined) {
+    // We do not support getting object properties.
+    appendLog("getIfaceProperties() failed: expected mInt = undefined, got " + JNIBindingsTest.mInt);
     return false;
   }
 
   if (JNIBindingsTest.mString != undefined) {
-    // EMULATE_JSC_BINDINGS
-    // Note that the java class returned has s set to Hello World. JSC and V8 do not support
-    // getting properties.
-    appendLog("getIfaceProperties() failed: expected mString = 'Hello World', got " + JNIBindingsTest.mString);
+    // We do not support getting object properties.
+    appendLog("getIfaceProperties() failed: expected mString = undefined, got " + JNIBindingsTest.mString);
     return false;
   }