Added command line switches

- Added top control switches for browser.

Change-Id: I5d0c00292e7fd94b1733c940b30df9d902d81a2c
diff --git a/src/com/android/browser/BrowserConfigBase.java b/src/com/android/browser/BrowserConfigBase.java
index c81e593..9dd0bc0 100644
--- a/src/com/android/browser/BrowserConfigBase.java
+++ b/src/com/android/browser/BrowserConfigBase.java
@@ -50,9 +50,8 @@
     }
 
     public void overrideUserAgent() {
-        BrowserCommandLine bcl = BrowserCommandLine.getInstance();
         // Check if the UA is already present using command line file
-        if (bcl.hasSwitch(OVERRIDE_USER_AGENT)) {
+        if (BrowserCommandLine.hasSwitch(OVERRIDE_USER_AGENT)) {
             return;
         }
 
@@ -64,10 +63,21 @@
         ua = constructUserAgent(ua);
 
         if (!TextUtils.isEmpty(ua)){
-            bcl.appendSwitchWithValue(OVERRIDE_USER_AGENT, ua);
+            BrowserCommandLine.appendSwitchWithValue(OVERRIDE_USER_AGENT, ua);
         }
     }
 
+    public void initCommandLineSwitches() {
+        //SWE-hide-title-bar - enable following flags
+        BrowserCommandLine.appendSwitch("enable-top-controls-position-calculation");
+        BrowserCommandLine.appendSwitchWithValue("top-controls-height", "52");
+        BrowserCommandLine.appendSwitchWithValue("top-controls-show-threshold", "0.5");
+        BrowserCommandLine.appendSwitchWithValue("top-controls-hide-threshold", "0.5");
+
+        // Allow to override UserAgent
+        overrideUserAgent();
+    }
+
     private String constructUserAgent(String userAgent) {
         try {
             userAgent = userAgent.replaceAll("<%build_model>", Build.MODEL);
diff --git a/src/com/android/browser/CrashLogExceptionHandler.java b/src/com/android/browser/CrashLogExceptionHandler.java
index 67beaab..49b4403 100644
--- a/src/com/android/browser/CrashLogExceptionHandler.java
+++ b/src/com/android/browser/CrashLogExceptionHandler.java
@@ -82,9 +82,8 @@
 
     public CrashLogExceptionHandler(Context ctx) {
         mAppContext = ctx;
-        BrowserCommandLine cl = BrowserCommandLine.getInstance();
-        if (cl.hasSwitch(CRASH_LOG_SERVER_CMD)) {
-            mLogServer = cl.getSwitchValue(CRASH_LOG_SERVER_CMD);
+        if (BrowserCommandLine.hasSwitch(CRASH_LOG_SERVER_CMD)) {
+            mLogServer = BrowserCommandLine.getSwitchValue(CRASH_LOG_SERVER_CMD);
             if (mLogServer != null) {
                 uploadPastCrashLog();
                 mOverrideHandler = true;
@@ -92,8 +91,9 @@
         }
 
         try {
-            int size = Integer.parseInt(cl.getSwitchValue(CRASH_LOG_MAX_FILE_SIZE_CMD,
-                                                      Integer.toString(mMaxLogFileSize)));
+            int size = Integer.parseInt(
+                                BrowserCommandLine.getSwitchValue(CRASH_LOG_MAX_FILE_SIZE_CMD,
+                                Integer.toString(mMaxLogFileSize)));
             mMaxLogFileSize = size;
         } catch (NumberFormatException nfe) {
             Log.e(LOGTAG,"Max log file size is not configured properly. Using default: "
diff --git a/src/com/android/browser/EngineInitializer.java b/src/com/android/browser/EngineInitializer.java
index 7fa7b2a..3f3608c 100644
--- a/src/com/android/browser/EngineInitializer.java
+++ b/src/com/android/browser/EngineInitializer.java
@@ -202,8 +202,8 @@
         if (!mInitializationCompleted) {
             // TODO: Evaluate the benefit of async Engine.initialize()
             Engine.initialize(ctx);
-            // Add the UA override
-            BrowserConfig.getInstance(ctx).overrideUserAgent();
+            // Add the browser commandline options
+            BrowserConfig.getInstance(ctx).initCommandLineSwitches();
             //Enable remote debugging by default
             Engine.setWebContentsDebuggingEnabled(true);
             mInitializationCompleted = true;