Merge "add fullscreen option"
diff --git a/res/layout/title_bar.xml b/res/layout/title_bar.xml
index 4087640..35d3611 100644
--- a/res/layout/title_bar.xml
+++ b/res/layout/title_bar.xml
@@ -88,33 +88,53 @@
         android:visibility="gone"
         android:layout_below="@+id/taburlbar"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content">
-        <TextView
-            android:text="@string/autologin_bar_text"
-            android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:orientation="vertical">
+        <LinearLayout
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:textColor="@android:color/primary_text_light"
-            android:paddingLeft="15dip"
-            android:paddingRight="15dip"
-            android:textAppearance="?android:attr/textAppearanceMedium" />
-        <Spinner
-            android:id="@+id/autologin_account"
+            android:paddingLeft="8dip"
+            android:paddingRight="8dip">
+            <TextView
+                android:text="@string/autologin_bar_text"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textColor="@android:color/primary_text_light"
+                android:textAppearance="?android:attr/textAppearanceMedium" />
+            <Spinner
+                android:id="@+id/autologin_account"
+                android:layout_height="wrap_content"
+                android:layout_width="match_parent"
+                android:paddingLeft="8dp"
+                android:paddingRight="24dp"
+                style="@android:style/Widget.Holo.Light.Spinner" />
+        </LinearLayout>
+        <LinearLayout
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_width="wrap_content"
-            style="@android:style/Widget.Holo.Light.Spinner" />
-        <Button
-            android:id="@+id/autologin_login"
-            android:text="@string/autologin_bar_login_text"
-            style="@android:style/Widget.Holo.Light.Button"
-            android:layout_marginRight="15dip"
-            android:layout_height="wrap_content"
-            android:layout_width="wrap_content" />
-        <ProgressBar
-            android:id="@+id/autologin_progress"
-            android:indeterminateOnly="true"
-            android:layout_height="wrap_content"
-            android:layout_width="wrap_content"
-            android:visibility="gone" />
+            android:paddingLeft="8dip"
+            android:paddingRight="8dip">
+            <Button
+                android:id="@+id/autologin_close"
+                android:layout_width="0dip"
+                android:layout_weight="1"
+                android:layout_height="wrap_content"
+                android:text="@string/autologin_bar_hide_text"
+                style="@android:style/Widget.Holo.Light.Button" />
+            <ProgressBar
+                android:id="@+id/autologin_progress"
+                android:indeterminateOnly="true"
+                android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:visibility="invisible" />
+            <Button
+                android:id="@+id/autologin_login"
+                android:text="@string/autologin_bar_login_text"
+                style="@android:style/Widget.Holo.Light.Button"
+                android:layout_height="wrap_content"
+                android:layout_width="0dip"
+                android:layout_weight="1" />
+        </LinearLayout>
         <TextView
             android:id="@+id/autologin_error"
             android:layout_height="wrap_content"
@@ -123,17 +143,6 @@
             android:text="@string/autologin_bar_error"
             android:textAppearance="?android:attr/textAppearanceMedium"
             android:visibility="gone" />
-        <View
-            android:layout_width="2dip"
-            android:layout_height="match_parent"
-            android:layout_weight="1" />
-        <ImageButton
-            android:id="@+id/autologin_close"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:paddingRight="15dip"
-            android:background="@null"
-            android:src="@*android:drawable/btn_close" />
     </LinearLayout>
     <com.android.browser.PageProgressView
         android:id="@+id/progress"
@@ -144,4 +153,4 @@
         android:src="@drawable/progress"
         android:layout_marginTop="-8dip"
         android:visibility="gone" />
-</RelativeLayout>
\ No newline at end of file
+</RelativeLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 63f5aef..f3631d2 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -384,9 +384,11 @@
     <!-- Message shown during auto login [CHAR-LIMIT=none] -->
     <string name="pref_autologin_progress">Signing into Google sites using <xliff:g>%s</xliff:g></string>
     <!-- Auto-login bar description [CHAR-LIMIT=40] -->
-    <string name="autologin_bar_text">Automatic sign-in is available.</string>
+    <string name="autologin_bar_text">Sign in as</string>
     <!-- Login button [CHAR-LIMIT=10] -->
     <string name="autologin_bar_login_text">Login</string>
+    <!-- Hide button [CHAR-LIMIT=10] -->
+    <string name="autologin_bar_hide_text">Hide</string>
     <!-- Login failure text [CHAR-LIMIT=25] -->
     <string name="autologin_bar_error">Login failed.</string>
 
@@ -525,6 +527,10 @@
     </string-array>
     <!-- Label for minimum font size [CHAR LIMIT=30] -->
     <string name="pref_min_font_size">Minimum font size</string>
+    <!-- Label for whether or not to force-enable user scalablity (aka, zoom) [CHAR LIMIT=30] -->
+    <string name="pref_force_userscalable">Force enable zoom</string>
+    <!-- Summary for whether or not to force-enable user scalablity (aka, zoom) [CHAR LIMIT=30] -->
+    <string name="pref_force_userscalable_summary">Whether or not to override a website\'s request to control zoom behavior</string>
     <!-- Settings label -->
     <string name="pref_default_zoom">Default zoom</string>
     <!-- Settings default zoom options; appear in default zoom dialog box -->
@@ -588,6 +594,7 @@
         <item>iPhone</item>
         <item>iPad</item>
         <item>Froyo-N1</item>
+        <item>Honeycomb-Xoom</item>
     </string-array>
     <!-- Do not tranlsate.  Development option -->
     <string-array name="pref_development_ua_values" translatable="false">
@@ -596,6 +603,7 @@
         <item>2</item>
         <item>3</item>
         <item>4</item>
+        <item>5</item>
     </string-array>
     <string name="pref_development_error_console" translatable="false">Show JavaScript Console</string>
     <!-- Settings screen, setting option name -->
diff --git a/res/xml/accessibility_preferences.xml b/res/xml/accessibility_preferences.xml
index 368d909..799d0e2 100644
--- a/res/xml/accessibility_preferences.xml
+++ b/res/xml/accessibility_preferences.xml
@@ -32,4 +32,9 @@
         android:title="@string/pref_min_font_size"
         android:defaultValue="1" />
 
+    <CheckBoxPreference android:key="force_userscalable"
+        android:title="@string/pref_force_userscalable"
+        android:summary="@string/pref_force_userscalable_summary"
+        android:defaultValue="false" />
+
 </PreferenceScreen>
diff --git a/res/xml/debug_preferences.xml b/res/xml/debug_preferences.xml
index 50d4c14..5126b0d 100644
--- a/res/xml/debug_preferences.xml
+++ b/res/xml/debug_preferences.xml
@@ -29,4 +29,51 @@
         android:entryValues="@array/pref_development_ua_values"
         android:defaultValue="0"/>
 
+    <!-- The javascript console is enabled by default when the user has
+         also enabled debug mode by navigating to about:debug. -->
+    <CheckBoxPreference
+        android:key="enable_visual_indicator"
+        android:defaultValue="false"
+        android:title="@string/pref_development_visual_indicator" />
+
+    <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/res/xml/hidden_debug_preferences.xml b/res/xml/hidden_debug_preferences.xml
deleted file mode 100644
index 661d9de..0000000
--- a/res/xml/hidden_debug_preferences.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?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="enable_visual_indicator"
-        android:defaultValue="false"
-        android:title="@string/pref_development_visual_indicator" />
-
-    <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/BrowserPreferencesPage.java b/src/com/android/browser/BrowserPreferencesPage.java
index 8031005..8302011 100644
--- a/src/com/android/browser/BrowserPreferencesPage.java
+++ b/src/com/android/browser/BrowserPreferencesPage.java
@@ -21,7 +21,6 @@
 import android.app.ActionBar;
 import android.os.Bundle;
 import android.preference.PreferenceActivity;
-import android.preference.PreferenceManager;
 import android.view.MenuItem;
 
 import java.util.List;
@@ -48,8 +47,7 @@
     public void onBuildHeaders(List<Header> target) {
         loadHeadersFromResource(R.xml.preference_headers, target);
 
-        if (BrowserSettings.DEV_BUILD
-                || BrowserSettings.getInstance().isDebugEnabled()) {
+        if (BrowserSettings.getInstance().isDebugEnabled()) {
             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 eadd57e..7d64cfc 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -25,6 +25,7 @@
 import android.content.Context;
 import android.content.SharedPreferences;
 import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
+import android.os.Build;
 import android.os.Message;
 import android.preference.PreferenceManager;
 import android.provider.Browser;
@@ -52,9 +53,9 @@
         PreferenceKeys {
 
     // TODO: Do something with this UserAgent stuff
-    private static final String DESKTOP_USERAGENT = "Mozilla/5.0 (Macintosh; " +
-    "U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/533.16 (KHTML, " +
-    "like Gecko) Version/5.0 Safari/533.16";
+    private static final String DESKTOP_USERAGENT = "Mozilla/5.0 (X11; " +
+        "Linux x86_64) AppleWebKit/534.24 (KHTML, like Gecko) " +
+        "Chrome/11.0.696.34 Safari/534.24";
 
     private static final String IPHONE_USERAGENT = "Mozilla/5.0 (iPhone; U; " +
         "CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 " +
@@ -68,15 +69,18 @@
         "Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 " +
         "(KHTML, like Gecko) Version/4.0 Mobile Safari/533.1";
 
+    private static final String HONEYCOMB_USERAGENT = "Mozilla/5.0 (Linux; U; " +
+        "Android 3.1; en-us; Xoom Build/HMJ25) AppleWebKit/534.13 " +
+        "(KHTML, like Gecko) Version/4.0 Safari/534.13";
+
     private static final String USER_AGENTS[] = { null,
             DESKTOP_USERAGENT,
             IPHONE_USERAGENT,
             IPAD_USERAGENT,
-            FROYO_USERAGENT
+            FROYO_USERAGENT,
+            HONEYCOMB_USERAGENT,
     };
 
-    public static boolean DEV_BUILD = true;
-
     private static BrowserSettings sInstance;
 
     private Context mContext;
@@ -100,6 +104,10 @@
     private BrowserSettings(Context context) {
         mContext = context;
         mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
+        if (Build.VERSION.CODENAME.equals("REL")) {
+            // This is a release build, always startup with debug disabled
+            setDebugEnabled(false);
+        }
         mAutofillHandler = new AutofillHandler(mContext);
         mManagedSettings = new LinkedList<WeakReference<WebSettings>>();
         mWebStorageSizeManager = new WebStorageSizeManager(mContext,
@@ -139,6 +147,7 @@
         settings.setDefaultZoom(getDefaultZoom());
         settings.setMinimumFontSize(getMinimumFontSize());
         settings.setMinimumLogicalFontSize(getMinimumFontSize());
+        settings.setForceUserScalable(forceEnableUserScalable());
         settings.setPluginState(getPluginState());
         settings.setTextSize(getTextSize());
         settings.setUserAgentString(USER_AGENTS[getUserAgent()]);
@@ -389,6 +398,10 @@
         return mPrefs.getInt(PREF_MIN_FONT_SIZE, 1);
     }
 
+    public boolean forceEnableUserScalable() {
+        return mPrefs.getBoolean(PREF_FORCE_USERSCALABLE, false);
+    }
+
     // -----------------------------
     // getter/setters for advanced_preferences.xml
     // -----------------------------
@@ -465,14 +478,14 @@
     // -----------------------------
 
     public boolean isHardwareAccelerated() {
-        if (!isDebugEnabled() && !DEV_BUILD) {
+        if (!isDebugEnabled()) {
             return true;
         }
         return mPrefs.getBoolean(PREF_ENABLE_HARDWARE_ACCEL, true);
     }
 
     public int getUserAgent() {
-        if (!isDebugEnabled() && !DEV_BUILD) {
+        if (!isDebugEnabled()) {
             return 0;
         }
         return Integer.parseInt(mPrefs.getString(PREF_USER_AGENT, "0"));
diff --git a/src/com/android/browser/PreferenceKeys.java b/src/com/android/browser/PreferenceKeys.java
index b4c4a68..f7230df 100644
--- a/src/com/android/browser/PreferenceKeys.java
+++ b/src/com/android/browser/PreferenceKeys.java
@@ -26,6 +26,7 @@
     // ----------------------
     static final String PREF_MIN_FONT_SIZE = "min_font_size";
     static final String PREF_TEXT_SIZE = "text_size";
+    static final String PREF_FORCE_USERSCALABLE = "force_userscalable";
 
     // ----------------------
     // Keys for advanced_preferences.xml
diff --git a/src/com/android/browser/TitleBarBase.java b/src/com/android/browser/TitleBarBase.java
index d720257..284fe12 100644
--- a/src/com/android/browser/TitleBarBase.java
+++ b/src/com/android/browser/TitleBarBase.java
@@ -89,7 +89,7 @@
     protected Button mAutoLoginLogin;
     protected ProgressBar mAutoLoginProgress;
     protected TextView mAutoLoginError;
-    protected ImageButton mAutoLoginCancel;
+    protected View mAutoLoginCancel;
     protected DeviceAccountLogin mAutoLoginHandler;
     protected ArrayAdapter<String> mAccountsAdapter;
     protected boolean mUseQuickControls;
@@ -128,7 +128,7 @@
         mAutoLoginLogin.setOnClickListener(this);
         mAutoLoginProgress = (ProgressBar) findViewById(R.id.autologin_progress);
         mAutoLoginError = (TextView) findViewById(R.id.autologin_error);
-        mAutoLoginCancel = (ImageButton) mAutoLogin.findViewById(R.id.autologin_close);
+        mAutoLoginCancel = mAutoLogin.findViewById(R.id.autologin_close);
         mAutoLoginCancel.setOnClickListener(this);
     }
 
@@ -349,7 +349,7 @@
             mAutoLoginAccount.setSelection(0);
             mAutoLoginAccount.setEnabled(true);
             mAutoLoginLogin.setEnabled(true);
-            mAutoLoginProgress.setVisibility(View.GONE);
+            mAutoLoginProgress.setVisibility(View.INVISIBLE);
             mAutoLoginError.setVisibility(View.GONE);
             switch (login.getState()) {
                 case DeviceAccountLogin.PROCESSING:
@@ -358,7 +358,7 @@
                     mAutoLoginProgress.setVisibility(View.VISIBLE);
                     break;
                 case DeviceAccountLogin.FAILED:
-                    mAutoLoginProgress.setVisibility(View.GONE);
+                    mAutoLoginProgress.setVisibility(View.INVISIBLE);
                     mAutoLoginError.setVisibility(View.VISIBLE);
                     break;
                 case DeviceAccountLogin.INITIAL:
@@ -420,7 +420,7 @@
     public void loginFailed() {
         mAutoLoginAccount.setEnabled(true);
         mAutoLoginLogin.setEnabled(true);
-        mAutoLoginProgress.setVisibility(View.GONE);
+        mAutoLoginProgress.setVisibility(View.INVISIBLE);
         mAutoLoginError.setVisibility(View.VISIBLE);
     }
 
diff --git a/src/com/android/browser/preferences/DebugPreferencesFragment.java b/src/com/android/browser/preferences/DebugPreferencesFragment.java
index 42b18cc..984c12a 100644
--- a/src/com/android/browser/preferences/DebugPreferencesFragment.java
+++ b/src/com/android/browser/preferences/DebugPreferencesFragment.java
@@ -36,10 +36,6 @@
         // Load the XML preferences file
         addPreferencesFromResource(R.xml.debug_preferences);
 
-        if (BrowserSettings.getInstance().isDebugEnabled()) {
-            addPreferencesFromResource(R.xml.hidden_debug_preferences);
-        }
-
         Preference e = findPreference(PreferenceKeys.PREF_ENABLE_HARDWARE_ACCEL);
         e.setOnPreferenceChangeListener(this);
     }
diff --git a/src/com/android/browser/preferences/WebViewPreview.java b/src/com/android/browser/preferences/WebViewPreview.java
index 94598bc..a269dbd 100644
--- a/src/com/android/browser/preferences/WebViewPreview.java
+++ b/src/com/android/browser/preferences/WebViewPreview.java
@@ -79,6 +79,7 @@
             LayoutInflater inflater = LayoutInflater.from(getContext());
             mRoot = inflater.inflate(R.layout.webview_preview, parent, false);
             mWebView = (WebView) mRoot.findViewById(R.id.webview);
+            mWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
         }
         updatePreview();
         return mRoot;