summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjdduke@chromium.org <jdduke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-20 03:01:07 +0000
committerjdduke@chromium.org <jdduke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-20 03:01:07 +0000
commitb873bc8b51dbee1193f3e6b48db0d08a86e3badc (patch)
tree4e5ef2799807c547deb9af271b3af6b5a77fb635
parentccb962dfd9abe9fe9c990372a56e04cc9aa8ddb8 (diff)
downloadchromium_src-b873bc8b51dbee1193f3e6b48db0d08a86e3badc.zip
chromium_src-b873bc8b51dbee1193f3e6b48db0d08a86e3badc.tar.gz
chromium_src-b873bc8b51dbee1193f3e6b48db0d08a86e3badc.tar.bz2
[Android] Move CommandLine.java to base
The native CommandLine lives in base, and so too should the Java wrapper. Move CommandLine.java to base, updating all references and factoring out previously contained switches to BaseSwitches and ContentSwitches. BUG=320747 TBR=ajwong@chromium.org Review URL: https://codereview.chromium.org/62333025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236113 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java5
-rw-r--r--base/android/base_jni_registrar.cc2
-rw-r--r--base/android/command_line.cc (renamed from content/common/android/command_line.cc)16
-rw-r--r--base/android/command_line.h26
-rw-r--r--base/android/java/src/org/chromium/base/BaseSwitches.java17
-rw-r--r--base/android/java/src/org/chromium/base/CommandLine.java (renamed from content/public/android/java/src/org/chromium/content/common/CommandLine.java)74
-rw-r--r--base/android/javatests/src/org/chromium/base/CommandLineTest.java130
-rw-r--r--base/base.gyp1
-rw-r--r--base/base.gypi2
-rw-r--r--chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java5
-rw-r--r--chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellApplication.java2
-rw-r--r--chrome/android/testshell/javatests/src/org/chromium/chrome/testshell/ChromiumTestShellTestBase.java2
-rw-r--r--chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/sync/SyncTestUtil.java2
-rw-r--r--content/app/android/library_loader_hooks.cc4
-rw-r--r--content/common/android/command_line.h17
-rw-r--r--content/common/android/common_jni_registrar.cc2
-rw-r--r--content/content_common.gypi2
-rw-r--r--content/content_jni.gypi1
-rw-r--r--content/public/android/java/src/org/chromium/content/app/LibraryLoader.java2
-rw-r--r--content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java5
-rw-r--r--content/public/android/java/src/org/chromium/content/browser/DeviceUtils.java7
-rw-r--r--content/public/android/java/src/org/chromium/content/browser/HeapStatsLogger.java5
-rw-r--r--content/public/android/java/src/org/chromium/content/browser/accessibility/AccessibilityInjector.java8
-rw-r--r--content/public/android/java/src/org/chromium/content/common/ContentSwitches.java72
-rw-r--r--content/public/android/java/src/org/chromium/content/common/TraceEvent.java4
-rw-r--r--content/public/android/javatests/src/org/chromium/content/browser/ContentCommandLineTest.java (renamed from content/public/android/javatests/src/org/chromium/content/browser/CommandLineTest.java)59
-rw-r--r--content/public/android/javatests/src/org/chromium/content/browser/ImportantFileWriterAndroidTest.java2
-rw-r--r--content/public/android/javatests/src/org/chromium/content/browser/PhoneNumberDetectionTest.java5
-rw-r--r--content/shell/android/linker_test_apk/src/org/chromium/content_linker_test_apk/ContentLinkerTestActivity.java5
-rw-r--r--content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java8
30 files changed, 313 insertions, 179 deletions
diff --git a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java
index 29b0c44..2faa2e4 100644
--- a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java
+++ b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java
@@ -9,9 +9,10 @@ import android.content.Context;
import android.os.Debug;
import android.util.Log;
+import org.chromium.base.BaseSwitches;
+import org.chromium.base.CommandLine;
import org.chromium.android_webview.AwBrowserProcess;
import org.chromium.content.browser.ResourceExtractor;
-import org.chromium.content.common.CommandLine;
public class AwShellApplication extends Application {
@@ -29,7 +30,7 @@ public class AwShellApplication extends Application {
CommandLine.initFromFile("/data/local/tmp/android-webview-command-line");
- if (CommandLine.getInstance().hasSwitch(CommandLine.WAIT_FOR_JAVA_DEBUGGER)) {
+ if (CommandLine.getInstance().hasSwitch(BaseSwitches.WAIT_FOR_JAVA_DEBUGGER)) {
Log.e(TAG, "Waiting for Java debugger to connect...");
Debug.waitForDebugger();
Log.e(TAG, "Java debugger connected. Resuming execution.");
diff --git a/base/android/base_jni_registrar.cc b/base/android/base_jni_registrar.cc
index 0645c73..86275b2 100644
--- a/base/android/base_jni_registrar.cc
+++ b/base/android/base_jni_registrar.cc
@@ -6,6 +6,7 @@
#include "base/android/activity_status.h"
#include "base/android/build_info.h"
+#include "base/android/command_line.h"
#include "base/android/cpu_features.h"
#include "base/android/important_file_writer_android.h"
#include "base/android/java_handler_thread.h"
@@ -31,6 +32,7 @@ namespace android {
static RegistrationMethod kBaseRegisteredMethods[] = {
{ "ActivityStatus", base::android::ActivityStatus::RegisterBindings },
{ "BuildInfo", base::android::BuildInfo::RegisterBindings },
+ { "CommandLine", base::android::RegisterCommandLine },
#if defined(GOOGLE_TV)
{ "ContextTypes", base::android::RegisterContextTypes },
#endif
diff --git a/content/common/android/command_line.cc b/base/android/command_line.cc
index 8ac58c2..69ab921 100644
--- a/content/common/android/command_line.cc
+++ b/base/android/command_line.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/common/android/command_line.h"
+#include "base/android/command_line.h"
#include "base/android/jni_array.h"
#include "base/android/jni_string.h"
@@ -10,7 +10,7 @@
#include "base/logging.h"
#include "jni/CommandLine_jni.h"
-using base::android::AppendJavaStringArrayToStringVector;
+using base::android::ConvertUTF8ToJavaString;
using base::android::ConvertJavaStringToUTF8;
namespace {
@@ -20,7 +20,7 @@ void AppendJavaStringArrayToCommandLine(JNIEnv* env,
bool includes_program) {
std::vector<std::string> vec;
if (array)
- AppendJavaStringArrayToStringVector(env, array, &vec);
+ base::android::AppendJavaStringArrayToStringVector(env, array, &vec);
if (!includes_program)
vec.insert(vec.begin(), "");
CommandLine extra_command_line(vec);
@@ -46,7 +46,7 @@ static jstring GetSwitchValue(JNIEnv* env, jclass clazz, jstring jswitch) {
if (value.empty())
return 0;
// OK to release, JNI binding.
- return base::android::ConvertUTF8ToJavaString(env, value).Release();
+ return ConvertUTF8ToJavaString(env, value).Release();
}
static void AppendSwitch(JNIEnv* env, jclass clazz, jstring jswitch) {
@@ -67,6 +67,9 @@ static void AppendSwitchesAndArguments(JNIEnv* env, jclass clazz,
AppendJavaStringArrayToCommandLine(env, array, false);
}
+namespace base {
+namespace android {
+
void InitNativeCommandLineFromJavaArray(JNIEnv* env, jobjectArray array) {
// TODO(port): Make an overload of Init() that takes StringVector rather than
// have to round-trip via AppendArguments.
@@ -77,3 +80,6 @@ void InitNativeCommandLineFromJavaArray(JNIEnv* env, jobjectArray array) {
bool RegisterCommandLine(JNIEnv* env) {
return RegisterNativesImpl(env);
}
+
+} // namespace android
+} // namespace base
diff --git a/base/android/command_line.h b/base/android/command_line.h
new file mode 100644
index 0000000..a15966a
--- /dev/null
+++ b/base/android/command_line.h
@@ -0,0 +1,26 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_ANDROID_COMMAND_LINE_H_
+#define BASE_ANDROID_COMMAND_LINE_H_
+
+#include <jni.h>
+
+#include "base/base_export.h"
+
+namespace base {
+namespace android {
+
+// Appends all strings in the given array as flags to the Chrome command line.
+void BASE_EXPORT InitNativeCommandLineFromJavaArray(
+ JNIEnv* env,
+ jobjectArray init_command_line);
+
+// JNI registration boilerplate.
+bool RegisterCommandLine(JNIEnv* env);
+
+} // namespace android
+} // namespace base
+
+#endif // BASE_ANDROID_COMMAND_LINE_H_
diff --git a/base/android/java/src/org/chromium/base/BaseSwitches.java b/base/android/java/src/org/chromium/base/BaseSwitches.java
new file mode 100644
index 0000000..4cda1f5
--- /dev/null
+++ b/base/android/java/src/org/chromium/base/BaseSwitches.java
@@ -0,0 +1,17 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.base;
+
+/**
+ * Contains all of the command line switches that are specific to the base/
+ * portion of Chromium on Android.
+ */
+public abstract class BaseSwitches {
+ // Block onCreate() of Chrome until a Java debugger is attached.
+ public static final String WAIT_FOR_JAVA_DEBUGGER = "wait-for-java-debugger";
+
+ // Prevent instantiation.
+ private BaseSwitches() {}
+};
diff --git a/content/public/android/java/src/org/chromium/content/common/CommandLine.java b/base/android/java/src/org/chromium/base/CommandLine.java
index be33ecc..f4f0b1d 100644
--- a/content/public/android/java/src/org/chromium/content/common/CommandLine.java
+++ b/base/android/java/src/org/chromium/base/CommandLine.java
@@ -1,8 +1,8 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package org.chromium.content.common;
+package org.chromium.base;
import android.text.TextUtils;
import android.util.Log;
@@ -19,72 +19,12 @@ import java.util.HashMap;
import java.util.concurrent.atomic.AtomicReference;
/**
- * Java mirror of Chrome command-line utilities (e.g. class CommandLine from base/command_line.h).
- * Command line program adb_command_line can be used to set the Chrome command line:
- * adb shell "echo chrome --my-param > /data/local/chrome-command-line"
- */
+ * Java mirror of base/command_line.h.
+ * Android applications don't have command line arguments. Instead, they're "simulated" by reading a
+ * file at a specific location early during startup. Applications each define their own files, e.g.,
+ * ContentShellActivity.COMMAND_LINE_FILE or ChromiumTestShellApplication.COMMAND_LINE_FILE.
+**/
public abstract class CommandLine {
- // Block onCreate() of Chrome until a Java debugger is attached.
- public static final String WAIT_FOR_JAVA_DEBUGGER = "wait-for-java-debugger";
-
- // Tell Java to use the official command line, loaded from the
- // official-command-line.xml files. WARNING this is not done
- // immediately on startup, so early running Java code will not see
- // these flags.
- public static final String ADD_OFFICIAL_COMMAND_LINE = "add-official-command-line";
-
- // Enables test intent handling.
- public static final String ENABLE_TEST_INTENTS = "enable-test-intents";
-
- // Adds additional thread idle time information into the trace event output.
- public static final String ENABLE_IDLE_TRACING = "enable-idle-tracing";
-
- // Dump frames-per-second to the log
- public static final String LOG_FPS = "log-fps";
-
- // Whether Chromium should use a mobile user agent.
- public static final String USE_MOBILE_UA = "use-mobile-user-agent";
-
- // tablet specific UI components.
- // Native switch - chrome_switches::kTabletUI
- public static final String TABLET_UI = "tablet-ui";
-
- // Change the url of the JavaScript that gets injected when accessibility mode is enabled.
- public static final String ACCESSIBILITY_JAVASCRIPT_URL = "accessibility-js-url";
-
- public static final String ACCESSIBILITY_DEBUG_BRAILLE_SERVICE = "debug-braille-service";
-
- // Sets the ISO country code that will be used for phone number detection.
- public static final String NETWORK_COUNTRY_ISO = "network-country-iso";
-
- // Whether to enable the auto-hiding top controls.
- public static final String ENABLE_TOP_CONTROLS_POSITION_CALCULATION
- = "enable-top-controls-position-calculation";
-
- // The height of the movable top controls.
- public static final String TOP_CONTROLS_HEIGHT = "top-controls-height";
-
- // How much of the top controls need to be shown before they will auto show.
- public static final String TOP_CONTROLS_SHOW_THRESHOLD = "top-controls-show-threshold";
-
- // How much of the top controls need to be hidden before they will auto hide.
- public static final String TOP_CONTROLS_HIDE_THRESHOLD = "top-controls-hide-threshold";
-
- // Native switch - chrome_switches::kEnableInstantExtendedAPI
- public static final String ENABLE_INSTANT_EXTENDED_API = "enable-instant-extended-api";
-
- // Native switch - content_switches::kEnableSpeechRecognition
- public static final String ENABLE_SPEECH_RECOGNITION = "enable-speech-recognition";
-
- // Native switch - shell_switches::kDumpRenderTree
- public static final String DUMP_RENDER_TREE = "dump-render-tree";
-
- // Native switch - chrome_switches::kDisablePopupBlocking
- public static final String DISABLE_POPUP_BLOCKING = "disable-popup-blocking";
-
- // Whether to disable the click delay by sending click events during double tap
- public static final String DISABLE_CLICK_DELAY = "disable-click-delay";
-
// Public abstract interface, implemented in derived classes.
// All these methods reflect their native-side counterparts.
/**
diff --git a/base/android/javatests/src/org/chromium/base/CommandLineTest.java b/base/android/javatests/src/org/chromium/base/CommandLineTest.java
new file mode 100644
index 0000000..d3f5c00
--- /dev/null
+++ b/base/android/javatests/src/org/chromium/base/CommandLineTest.java
@@ -0,0 +1,130 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.base;
+
+import android.test.InstrumentationTestCase;
+import android.test.suitebuilder.annotation.MediumTest;
+import android.test.suitebuilder.annotation.SmallTest;
+
+import org.chromium.base.CommandLine;
+import org.chromium.base.test.util.Feature;
+
+public class CommandLineTest extends InstrumentationTestCase {
+ // A reference command line. Note that switch2 is [brea\d], switch3 is [and "butter"],
+ // and switch4 is [a "quoted" 'food'!]
+ static final String INIT_SWITCHES[] = { "init_command", "--SWITCH", "Arg",
+ "--switch2=brea\\d", "--switch3=and \"butter\"",
+ "--switch4=a \"quoted\" 'food'!",
+ "--", "--actually_an_arg" };
+
+ // The same command line, but in quoted string format.
+ static final char INIT_SWITCHES_BUFFER[] =
+ ("init_command --SWITCH Arg --switch2=brea\\d --switch3=\"and \\\"butt\"er\\\" "
+ + "--switch4='a \"quoted\" \\'food\\'!' "
+ + "-- --actually_an_arg").toCharArray();
+
+ static final String CL_ADDED_SWITCH = "zappo-dappo-doggy-trainer";
+ static final String CL_ADDED_SWITCH_2 = "username";
+ static final String CL_ADDED_VALUE_2 = "bozo";
+
+ @Override
+ public void setUp() throws Exception {
+ CommandLine.reset();
+ }
+
+ void checkInitSwitches() {
+ CommandLine cl = CommandLine.getInstance();
+ assertFalse(cl.hasSwitch("init_command"));
+ assertFalse(cl.hasSwitch("switch"));
+ assertTrue(cl.hasSwitch("SWITCH"));
+ assertFalse(cl.hasSwitch("--SWITCH"));
+ assertFalse(cl.hasSwitch("Arg"));
+ assertFalse(cl.hasSwitch("actually_an_arg"));
+ assertEquals("brea\\d", cl.getSwitchValue("switch2"));
+ assertEquals("and \"butter\"", cl.getSwitchValue("switch3"));
+ assertEquals("a \"quoted\" 'food'!", cl.getSwitchValue("switch4"));
+ assertNull(cl.getSwitchValue("SWITCH"));
+ assertNull(cl.getSwitchValue("non-existant"));
+ }
+
+ void checkSettingThenGetting() {
+ CommandLine cl = CommandLine.getInstance();
+
+ // Add a plain switch.
+ assertFalse(cl.hasSwitch(CL_ADDED_SWITCH));
+ cl.appendSwitch(CL_ADDED_SWITCH);
+ assertTrue(cl.hasSwitch(CL_ADDED_SWITCH));
+
+ // Add a switch paired with a value.
+ assertFalse(cl.hasSwitch(CL_ADDED_SWITCH_2));
+ assertNull(cl.getSwitchValue(CL_ADDED_SWITCH_2));
+ cl.appendSwitchWithValue(CL_ADDED_SWITCH_2, CL_ADDED_VALUE_2);
+ assertTrue(CL_ADDED_VALUE_2.equals(cl.getSwitchValue(CL_ADDED_SWITCH_2)));
+
+ // Append a few new things.
+ final String switchesAndArgs[] = { "dummy", "--superfast", "--speed=turbo" };
+ assertFalse(cl.hasSwitch("dummy"));
+ assertFalse(cl.hasSwitch("superfast"));
+ assertNull(cl.getSwitchValue("speed"));
+ cl.appendSwitchesAndArguments(switchesAndArgs);
+ assertFalse(cl.hasSwitch("dummy"));
+ assertFalse(cl.hasSwitch("command"));
+ assertTrue(cl.hasSwitch("superfast"));
+ assertTrue("turbo".equals(cl.getSwitchValue("speed")));
+ }
+
+ void checkTokenizer(String[] expected, String toParse) {
+ String[] actual = CommandLine.tokenizeQuotedAruments(toParse.toCharArray());
+ assertEquals(expected.length, actual.length);
+ for (int i = 0; i < expected.length; ++i) {
+ assertEquals("comparing element " + i, expected[i], actual[i]);
+ }
+ }
+
+ @SmallTest
+ @Feature({"Android-AppBase"})
+ public void testJavaInitialization() {
+ CommandLine.init(INIT_SWITCHES);
+ checkInitSwitches();
+ checkSettingThenGetting();
+ }
+
+ @SmallTest
+ @Feature({"Android-AppBase"})
+ public void testBufferInitialization() {
+ CommandLine.init(CommandLine.tokenizeQuotedAruments(INIT_SWITCHES_BUFFER));
+ checkInitSwitches();
+ checkSettingThenGetting();
+ }
+
+ @SmallTest
+ @Feature({"Android-AppBase"})
+ public void testArgumentTokenizer() {
+ String toParse = " a\"\\bc de\\\"f g\"\\h ij k\" \"lm";
+ String[] expected = { "a\\bc de\"f g\\h",
+ "ij",
+ "k lm" };
+ checkTokenizer(expected, toParse);
+
+ toParse = "";
+ expected = new String[0];
+ checkTokenizer(expected, toParse);
+
+ toParse = " \t\n";
+ checkTokenizer(expected, toParse);
+
+ toParse = " \"a'b\" 'c\"d' \"e\\\"f\" 'g\\'h' \"i\\'j\" 'k\\\"l'" +
+ " m\"n\\'o\"p q'r\\\"s't";
+ expected = new String[] { "a'b",
+ "c\"d",
+ "e\"f",
+ "g'h",
+ "i\\'j",
+ "k\\\"l",
+ "mn\\'op",
+ "qr\\\"st",};
+ checkTokenizer(expected, toParse);
+ }
+}
diff --git a/base/base.gyp b/base/base.gyp
index 02e056e..d0ca483 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -1214,6 +1214,7 @@
'sources': [
'android/java/src/org/chromium/base/ActivityStatus.java',
'android/java/src/org/chromium/base/BuildInfo.java',
+ 'android/java/src/org/chromium/base/CommandLine.java',
'android/java/src/org/chromium/base/CpuFeatures.java',
'android/java/src/org/chromium/base/ImportantFileWriterAndroid.java',
'android/java/src/org/chromium/base/MemoryPressureListener.java',
diff --git a/base/base.gypi b/base/base.gypi
index 955233c..a0dd681 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -39,6 +39,8 @@
'android/base_jni_registrar.h',
'android/build_info.cc',
'android/build_info.h',
+ 'android/command_line.cc',
+ 'android/command_line.h',
'android/cpu_features.cc',
'android/fifo_utils.cc',
'android/fifo_utils.h',
diff --git a/chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java b/chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java
index c5c65af..2b8d523 100644
--- a/chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java
+++ b/chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java
@@ -15,6 +15,8 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Toast;
+import org.chromium.base.BaseSwitches;
+import org.chromium.base.CommandLine;
import org.chromium.base.MemoryPressureListener;
import org.chromium.chrome.browser.DevToolsServer;
import org.chromium.chrome.testshell.sync.SyncController;
@@ -24,7 +26,6 @@ import org.chromium.content.browser.ContentVideoViewClient;
import org.chromium.content.browser.ContentView;
import org.chromium.content.browser.ContentViewClient;
import org.chromium.content.browser.DeviceUtils;
-import org.chromium.content.common.CommandLine;
import org.chromium.sync.signin.ChromeSigninController;
import org.chromium.ui.base.ActivityWindowAndroid;
import org.chromium.ui.base.WindowAndroid;
@@ -225,7 +226,7 @@ public class ChromiumTestShellActivity extends Activity implements MenuHandler {
}
private void waitForDebuggerIfNeeded() {
- if (CommandLine.getInstance().hasSwitch(CommandLine.WAIT_FOR_JAVA_DEBUGGER)) {
+ if (CommandLine.getInstance().hasSwitch(BaseSwitches.WAIT_FOR_JAVA_DEBUGGER)) {
Log.e(TAG, "Waiting for Java debugger to connect...");
android.os.Debug.waitForDebugger();
Log.e(TAG, "Java debugger connected. Resuming execution.");
diff --git a/chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellApplication.java b/chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellApplication.java
index 61461da..b1fa864d 100644
--- a/chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellApplication.java
+++ b/chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellApplication.java
@@ -7,11 +7,11 @@ package org.chromium.chrome.testshell;
import android.content.Intent;
import org.chromium.base.CalledByNative;
+import org.chromium.base.CommandLine;
import org.chromium.base.PathUtils;
import org.chromium.chrome.browser.ChromiumApplication;
import org.chromium.chrome.browser.UmaUtils;
import org.chromium.content.browser.ResourceExtractor;
-import org.chromium.content.common.CommandLine;
import java.util.ArrayList;
diff --git a/chrome/android/testshell/javatests/src/org/chromium/chrome/testshell/ChromiumTestShellTestBase.java b/chrome/android/testshell/javatests/src/org/chromium/chrome/testshell/ChromiumTestShellTestBase.java
index 4ad0645..d4b8c6a 100644
--- a/chrome/android/testshell/javatests/src/org/chromium/chrome/testshell/ChromiumTestShellTestBase.java
+++ b/chrome/android/testshell/javatests/src/org/chromium/chrome/testshell/ChromiumTestShellTestBase.java
@@ -11,12 +11,12 @@ import android.net.Uri;
import android.test.ActivityInstrumentationTestCase2;
import android.text.TextUtils;
+import org.chromium.base.CommandLine;
import org.chromium.base.ThreadUtils;
import org.chromium.chrome.test.util.ApplicationData;
import org.chromium.content.browser.BrowserStartupController;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
-import org.chromium.content.common.CommandLine;
import java.util.concurrent.atomic.AtomicBoolean;
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/sync/SyncTestUtil.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/sync/SyncTestUtil.java
index a97512b..98f79e3 100644
--- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/sync/SyncTestUtil.java
+++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/sync/SyncTestUtil.java
@@ -11,13 +11,13 @@ import android.util.Pair;
import junit.framework.Assert;
+import org.chromium.base.CommandLine;
import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.AdvancedMockContext;
import org.chromium.chrome.browser.sync.ProfileSyncService;
import org.chromium.chrome.test.util.TestHttpServerClient;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
-import org.chromium.content.common.CommandLine;
import org.chromium.sync.signin.AccountManagerHelper;
import org.chromium.sync.signin.ChromeSigninController;
import org.chromium.sync.test.util.AccountHolder;
diff --git a/content/app/android/library_loader_hooks.cc b/content/app/android/library_loader_hooks.cc
index 837bfaa..90a27c0 100644
--- a/content/app/android/library_loader_hooks.cc
+++ b/content/app/android/library_loader_hooks.cc
@@ -5,6 +5,7 @@
#include "content/public/app/android_library_loader_hooks.h"
#include "base/android/base_jni_registrar.h"
+#include "base/android/command_line.h"
#include "base/android/jni_android.h"
#include "base/android/jni_registrar.h"
#include "base/android/jni_string.h"
@@ -20,7 +21,6 @@
#include "content/app/android/app_jni_registrar.h"
#include "content/browser/android/browser_jni_registrar.h"
#include "content/child/android/child_jni_registrar.h"
-#include "content/common/android/command_line.h"
#include "content/common/android/common_jni_registrar.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/result_codes.h"
@@ -83,7 +83,7 @@ bool EnsureJniRegistered(JNIEnv* env) {
static jint LibraryLoaded(JNIEnv* env, jclass clazz,
jobjectArray init_command_line) {
- InitNativeCommandLineFromJavaArray(env, init_command_line);
+ base::android::InitNativeCommandLineFromJavaArray(env, init_command_line);
CommandLine* command_line = CommandLine::ForCurrentProcess();
diff --git a/content/common/android/command_line.h b/content/common/android/command_line.h
deleted file mode 100644
index 3fe5efb..0000000
--- a/content/common/android/command_line.h
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_COMMON_ANDROID_COMMAND_LINE_H_
-#define CONTENT_COMMON_ANDROID_COMMAND_LINE_H_
-
-#include <jni.h>
-
-// Appends all strings in the given array as flags to the Chrome command line.
-void InitNativeCommandLineFromJavaArray(JNIEnv* env,
- jobjectArray init_command_line);
-
-// JNI registration boilerplate.
-bool RegisterCommandLine(JNIEnv* env);
-
-#endif // CONTENT_COMMON_ANDROID_COMMAND_LINE_H_
diff --git a/content/common/android/common_jni_registrar.cc b/content/common/android/common_jni_registrar.cc
index c9d51e9..667224d 100644
--- a/content/common/android/common_jni_registrar.cc
+++ b/content/common/android/common_jni_registrar.cc
@@ -6,7 +6,6 @@
#include "base/android/jni_android.h"
#include "base/android/jni_registrar.h"
-#include "content/common/android/command_line.h"
#include "content/common/android/device_telephony_info.h"
#include "content/common/android/hash_set.h"
#include "content/common/android/trace_event_binding.h"
@@ -14,7 +13,6 @@
namespace {
base::android::RegistrationMethod kContentRegisteredMethods[] = {
- { "CommandLine", RegisterCommandLine },
{ "DeviceTelephonyInfo",
content::DeviceTelephonyInfo::RegisterDeviceTelephonyInfo },
{ "HashSet", content::RegisterHashSet },
diff --git a/content/content_common.gypi b/content/content_common.gypi
index 9d9b736..0abdbbd 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -108,8 +108,6 @@
'common/android/address_parser.h',
'common/android/address_parser_internal.cc',
'common/android/address_parser_internal.h',
- 'common/android/command_line.cc',
- 'common/android/command_line.h',
'common/android/common_jni_registrar.cc',
'common/android/common_jni_registrar.h',
'common/android/device_telephony_info.cc',
diff --git a/content/content_jni.gypi b/content/content_jni.gypi
index 889234c..92a3f5d 100644
--- a/content/content_jni.gypi
+++ b/content/content_jni.gypi
@@ -36,7 +36,6 @@
'public/android/java/src/org/chromium/content/browser/TracingControllerAndroid.java',
'public/android/java/src/org/chromium/content/browser/VibrationMessageFilter.java',
'public/android/java/src/org/chromium/content/browser/WebContentsObserverAndroid.java',
- 'public/android/java/src/org/chromium/content/common/CommandLine.java',
'public/android/java/src/org/chromium/content/common/DeviceTelephonyInfo.java',
'public/android/java/src/org/chromium/content/common/TraceEvent.java',
],
diff --git a/content/public/android/java/src/org/chromium/content/app/LibraryLoader.java b/content/public/android/java/src/org/chromium/content/app/LibraryLoader.java
index 8883255..38165bd 100644
--- a/content/public/android/java/src/org/chromium/content/app/LibraryLoader.java
+++ b/content/public/android/java/src/org/chromium/content/app/LibraryLoader.java
@@ -7,9 +7,9 @@ package org.chromium.content.app;
import android.text.TextUtils;
import android.util.Log;
+import org.chromium.base.CommandLine;
import org.chromium.base.JNINamespace;
import org.chromium.base.SysUtils;
-import org.chromium.content.common.CommandLine;
import org.chromium.content.common.ProcessInitException;
import org.chromium.content.common.ResultCodes;
import org.chromium.content.common.TraceEvent;
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java
index 5853a79..7256671 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java
@@ -13,11 +13,12 @@ import android.view.InputDevice;
import android.view.MotionEvent;
import android.view.ViewConfiguration;
+import org.chromium.base.CommandLine;
import org.chromium.content.browser.LongPressDetector.LongPressDelegate;
import org.chromium.content.browser.third_party.GestureDetector;
import org.chromium.content.browser.third_party.GestureDetector.OnDoubleTapListener;
import org.chromium.content.browser.third_party.GestureDetector.OnGestureListener;
-import org.chromium.content.common.CommandLine;
+import org.chromium.content.common.ContentSwitches;
import org.chromium.content.common.TraceEvent;
import java.util.ArrayDeque;
@@ -386,7 +387,7 @@ class ContentViewGestureHandler implements LongPressDelegate {
mPxToDp = 1.0f / context.getResources().getDisplayMetrics().density;
mDisableClickDelay = CommandLine.isInitialized() &&
- CommandLine.getInstance().hasSwitch(CommandLine.DISABLE_CLICK_DELAY);
+ CommandLine.getInstance().hasSwitch(ContentSwitches.DISABLE_CLICK_DELAY);
initGestureDetectors(context);
}
diff --git a/content/public/android/java/src/org/chromium/content/browser/DeviceUtils.java b/content/public/android/java/src/org/chromium/content/browser/DeviceUtils.java
index 523e2ec..f6478db 100644
--- a/content/public/android/java/src/org/chromium/content/browser/DeviceUtils.java
+++ b/content/public/android/java/src/org/chromium/content/browser/DeviceUtils.java
@@ -7,7 +7,8 @@ package org.chromium.content.browser;
import android.content.Context;
import android.content.pm.PackageManager;
-import org.chromium.content.common.CommandLine;
+import org.chromium.base.CommandLine;
+import org.chromium.content.common.ContentSwitches;
/**
* A utility class that has helper methods for device configuration.
@@ -65,9 +66,9 @@ public class DeviceUtils {
*/
public static void addDeviceSpecificUserAgentSwitch(Context context) {
if (isTablet(context)) {
- CommandLine.getInstance().appendSwitch(CommandLine.TABLET_UI);
+ CommandLine.getInstance().appendSwitch(ContentSwitches.TABLET_UI);
} else {
- CommandLine.getInstance().appendSwitch(CommandLine.USE_MOBILE_UA);
+ CommandLine.getInstance().appendSwitch(ContentSwitches.USE_MOBILE_UA);
}
}
}
diff --git a/content/public/android/java/src/org/chromium/content/browser/HeapStatsLogger.java b/content/public/android/java/src/org/chromium/content/browser/HeapStatsLogger.java
index 6f61d8e..d66f205 100644
--- a/content/public/android/java/src/org/chromium/content/browser/HeapStatsLogger.java
+++ b/content/public/android/java/src/org/chromium/content/browser/HeapStatsLogger.java
@@ -11,7 +11,8 @@ import android.content.IntentFilter;
import android.os.Debug;
import android.util.Log;
-import org.chromium.content.common.CommandLine;
+import org.chromium.base.CommandLine;
+import org.chromium.content.common.ContentSwitches;
/**
* Logs Heap stats, such as gc count, alloc count, etc.
@@ -29,7 +30,7 @@ public class HeapStatsLogger {
private final HeapStatsLoggerIntentFilter mIntentFilter;
public static void init(Context context) {
- if (CommandLine.getInstance().hasSwitch(CommandLine.ENABLE_TEST_INTENTS)) {
+ if (CommandLine.getInstance().hasSwitch(ContentSwitches.ENABLE_TEST_INTENTS)) {
sHeapStats = new HeapStatsLogger(context);
}
}
diff --git a/content/public/android/java/src/org/chromium/content/browser/accessibility/AccessibilityInjector.java b/content/public/android/java/src/org/chromium/content/browser/accessibility/AccessibilityInjector.java
index 4209741..b542009 100644
--- a/content/public/android/java/src/org/chromium/content/browser/accessibility/AccessibilityInjector.java
+++ b/content/public/android/java/src/org/chromium/content/browser/accessibility/AccessibilityInjector.java
@@ -22,10 +22,11 @@ import com.googlecode.eyesfree.braille.selfbraille.WriteData;
import org.apache.http.NameValuePair;
import org.apache.http.client.utils.URLEncodedUtils;
+import org.chromium.base.CommandLine;
import org.chromium.content.browser.ContentViewCore;
import org.chromium.content.browser.JavascriptInterface;
import org.chromium.content.browser.WebContentsObserverAndroid;
-import org.chromium.content.common.CommandLine;
+import org.chromium.content.common.ContentSwitches;
import org.json.JSONException;
import org.json.JSONObject;
@@ -112,7 +113,8 @@ public class AccessibilityInjector extends WebContentsObserverAndroid {
mContentViewCore = view;
mAccessibilityScreenReaderUrl = CommandLine.getInstance().getSwitchValue(
- CommandLine.ACCESSIBILITY_JAVASCRIPT_URL, DEFAULT_ACCESSIBILITY_SCREEN_READER_URL);
+ ContentSwitches.ACCESSIBILITY_JAVASCRIPT_URL,
+ DEFAULT_ACCESSIBILITY_SCREEN_READER_URL);
mHasVibratePermission = mContentViewCore.getContext().checkCallingOrSelfPermission(
android.Manifest.permission.VIBRATE) == PackageManager.PERMISSION_GRANTED;
@@ -397,7 +399,7 @@ public class AccessibilityInjector extends WebContentsObserverAndroid {
mView = view;
mTextToSpeech = new TextToSpeech(context, null, null);
mSelfBrailleClient = new SelfBrailleClient(context, CommandLine.getInstance().hasSwitch(
- CommandLine.ACCESSIBILITY_DEBUG_BRAILLE_SERVICE));
+ ContentSwitches.ACCESSIBILITY_DEBUG_BRAILLE_SERVICE));
}
@JavascriptInterface
diff --git a/content/public/android/java/src/org/chromium/content/common/ContentSwitches.java b/content/public/android/java/src/org/chromium/content/common/ContentSwitches.java
new file mode 100644
index 0000000..c517f43
--- /dev/null
+++ b/content/public/android/java/src/org/chromium/content/common/ContentSwitches.java
@@ -0,0 +1,72 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.content.common;
+
+/**
+ * Contains all of the command line switches that are specific to the content/
+ * portion of Chromium on Android.
+ */
+public abstract class ContentSwitches {
+ // Tell Java to use the official command line, loaded from the
+ // official-command-line.xml files. WARNING this is not done
+ // immediately on startup, so early running Java code will not see
+ // these flags.
+ public static final String ADD_OFFICIAL_COMMAND_LINE = "add-official-command-line";
+
+ // Enables test intent handling.
+ public static final String ENABLE_TEST_INTENTS = "enable-test-intents";
+
+ // Adds additional thread idle time information into the trace event output.
+ public static final String ENABLE_IDLE_TRACING = "enable-idle-tracing";
+
+ // Dump frames-per-second to the log
+ public static final String LOG_FPS = "log-fps";
+
+ // Whether Chromium should use a mobile user agent.
+ public static final String USE_MOBILE_UA = "use-mobile-user-agent";
+
+ // tablet specific UI components.
+ // Native switch - chrome_switches::kTabletUI
+ public static final String TABLET_UI = "tablet-ui";
+
+ // Change the url of the JavaScript that gets injected when accessibility mode is enabled.
+ public static final String ACCESSIBILITY_JAVASCRIPT_URL = "accessibility-js-url";
+
+ public static final String ACCESSIBILITY_DEBUG_BRAILLE_SERVICE = "debug-braille-service";
+
+ // Sets the ISO country code that will be used for phone number detection.
+ public static final String NETWORK_COUNTRY_ISO = "network-country-iso";
+
+ // Whether to enable the auto-hiding top controls.
+ public static final String ENABLE_TOP_CONTROLS_POSITION_CALCULATION
+ = "enable-top-controls-position-calculation";
+
+ // The height of the movable top controls.
+ public static final String TOP_CONTROLS_HEIGHT = "top-controls-height";
+
+ // How much of the top controls need to be shown before they will auto show.
+ public static final String TOP_CONTROLS_SHOW_THRESHOLD = "top-controls-show-threshold";
+
+ // How much of the top controls need to be hidden before they will auto hide.
+ public static final String TOP_CONTROLS_HIDE_THRESHOLD = "top-controls-hide-threshold";
+
+ // Native switch - chrome_switches::kEnableInstantExtendedAPI
+ public static final String ENABLE_INSTANT_EXTENDED_API = "enable-instant-extended-api";
+
+ // Native switch - content_switches::kEnableSpeechRecognition
+ public static final String ENABLE_SPEECH_RECOGNITION = "enable-speech-recognition";
+
+ // Native switch - shell_switches::kDumpRenderTree
+ public static final String DUMP_RENDER_TREE = "dump-render-tree";
+
+ // Native switch - chrome_switches::kDisablePopupBlocking
+ public static final String DISABLE_POPUP_BLOCKING = "disable-popup-blocking";
+
+ // Whether to disable the click delay by sending click events during double tap
+ public static final String DISABLE_CLICK_DELAY = "disable-click-delay";
+
+ // Prevent instantiation.
+ private ContentSwitches() {}
+};
diff --git a/content/public/android/java/src/org/chromium/content/common/TraceEvent.java b/content/public/android/java/src/org/chromium/content/common/TraceEvent.java
index a719653..5084bcf 100644
--- a/content/public/android/java/src/org/chromium/content/common/TraceEvent.java
+++ b/content/public/android/java/src/org/chromium/content/common/TraceEvent.java
@@ -11,7 +11,9 @@ import android.os.SystemClock;
import android.util.Log;
import android.util.Printer;
+import org.chromium.base.CommandLine;
import org.chromium.base.ThreadUtils;
+import org.chromium.content.common.ContentSwitches;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -167,7 +169,7 @@ public class TraceEvent {
// Holder for monitor avoids unnecessary construction on non-debug runs
private final static class LooperMonitorHolder {
private final static BasicLooperMonitor sInstance =
- CommandLine.getInstance().hasSwitch(CommandLine.ENABLE_IDLE_TRACING) ?
+ CommandLine.getInstance().hasSwitch(ContentSwitches.ENABLE_IDLE_TRACING) ?
new IdleTracingLooperMonitor() : new BasicLooperMonitor();
}
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/CommandLineTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ContentCommandLineTest.java
index 96015f9..68f1fb6 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/CommandLineTest.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/ContentCommandLineTest.java
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,14 +8,14 @@ import android.test.InstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
+import org.chromium.base.CommandLine;
import org.chromium.base.test.util.Feature;
import org.chromium.content.app.LibraryLoader;
-import org.chromium.content.common.CommandLine;
import org.chromium.content.common.ProcessInitException;
import org.chromium.content_shell_apk.ContentShellActivity;
import org.chromium.content_shell_apk.ContentShellApplication;
-public class CommandLineTest extends InstrumentationTestCase {
+public class ContentCommandLineTest extends InstrumentationTestCase {
// A reference command line. Note that switch2 is [brea\d], switch3 is [and "butter"],
// and switch4 is [a "quoted" 'food'!]
static final String INIT_SWITCHES[] = { "init_command", "--SWITCH", "Arg",
@@ -102,22 +102,6 @@ public class CommandLineTest extends InstrumentationTestCase {
assertTrue(CL_ADDED_VALUE_2.equals(cl.getSwitchValue(CL_ADDED_SWITCH_2)));
}
- void checkTokenizer(String[] expected, String toParse) {
- String[] actual = CommandLine.tokenizeQuotedAruments(toParse.toCharArray());
- assertEquals(expected.length, actual.length);
- for (int i = 0; i < expected.length; ++i) {
- assertEquals("comparing element " + i, expected[i], actual[i]);
- }
- }
-
- @SmallTest
- @Feature({"Android-AppBase"})
- public void testJavaInitialization() {
- CommandLine.init(INIT_SWITCHES);
- checkInitSwitches();
- checkSettingThenGetting();
- }
-
@MediumTest
@Feature({"Android-AppBase"})
public void testJavaNativeTransition() {
@@ -152,43 +136,6 @@ public class CommandLineTest extends InstrumentationTestCase {
checkSettingThenGetting();
}
- @SmallTest
- @Feature({"Android-AppBase"})
- public void testBufferInitialization() {
- CommandLine.init(CommandLine.tokenizeQuotedAruments(INIT_SWITCHES_BUFFER));
- checkInitSwitches();
- checkSettingThenGetting();
- }
-
- @SmallTest
- @Feature({"Android-AppBase"})
- public void testArgumentTokenizer() {
- String toParse = " a\"\\bc de\\\"f g\"\\h ij k\" \"lm";
- String[] expected = { "a\\bc de\"f g\\h",
- "ij",
- "k lm" };
- checkTokenizer(expected, toParse);
-
- toParse = "";
- expected = new String[0];
- checkTokenizer(expected, toParse);
-
- toParse = " \t\n";
- checkTokenizer(expected, toParse);
-
- toParse = " \"a'b\" 'c\"d' \"e\\\"f\" 'g\\'h' \"i\\'j\" 'k\\\"l'" +
- " m\"n\\'o\"p q'r\\\"s't";
- expected = new String[] { "a'b",
- "c\"d",
- "e\"f",
- "g'h",
- "i\\'j",
- "k\\\"l",
- "mn\\'op",
- "qr\\\"st",};
- checkTokenizer(expected, toParse);
- }
-
@MediumTest
@Feature({"Android-AppBase"})
public void testFileInitialization() {
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ImportantFileWriterAndroidTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ImportantFileWriterAndroidTest.java
index 069e522..92ba00f 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/ImportantFileWriterAndroidTest.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/ImportantFileWriterAndroidTest.java
@@ -7,10 +7,10 @@ package org.chromium.content.browser;
import android.test.InstrumentationTestCase;
import android.test.suitebuilder.annotation.SmallTest;
+import org.chromium.base.CommandLine;
import org.chromium.base.ImportantFileWriterAndroid;
import org.chromium.base.test.util.Feature;
import org.chromium.content.app.LibraryLoader;
-import org.chromium.content.common.CommandLine;
import org.chromium.content.common.ProcessInitException;
import org.chromium.content_shell_apk.ContentShellApplication;
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/PhoneNumberDetectionTest.java b/content/public/android/javatests/src/org/chromium/content/browser/PhoneNumberDetectionTest.java
index a0ad8d2..622868c 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/PhoneNumberDetectionTest.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/PhoneNumberDetectionTest.java
@@ -8,8 +8,9 @@ import android.test.FlakyTest;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
+import org.chromium.base.CommandLine;
import org.chromium.base.test.util.Feature;
-import org.chromium.content.common.CommandLine;
+import org.chromium.content.common.ContentSwitches;
/**
* Test suite for phone number detection.
@@ -34,7 +35,7 @@ public class PhoneNumberDetectionTest extends ContentDetectionTestBase {
private void startActivityWithTestUrlAndCountryIso(String testUrl, String countryIso)
throws Throwable {
final String[] cmdlineArgs = countryIso == null ? null : new String[] {
- "--" + CommandLine.NETWORK_COUNTRY_ISO + "=" + countryIso };
+ "--" + ContentSwitches.NETWORK_COUNTRY_ISO + "=" + countryIso };
startActivityWithTestUrlAndCommandLineArgs(testUrl, cmdlineArgs);
}
diff --git a/content/shell/android/linker_test_apk/src/org/chromium/content_linker_test_apk/ContentLinkerTestActivity.java b/content/shell/android/linker_test_apk/src/org/chromium/content_linker_test_apk/ContentLinkerTestActivity.java
index 3d3cb90..785ca19 100644
--- a/content/shell/android/linker_test_apk/src/org/chromium/content_linker_test_apk/ContentLinkerTestActivity.java
+++ b/content/shell/android/linker_test_apk/src/org/chromium/content_linker_test_apk/ContentLinkerTestActivity.java
@@ -12,12 +12,13 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
+import org.chromium.base.BaseSwitches;
+import org.chromium.base.CommandLine;
import org.chromium.content.app.LibraryLoader;
import org.chromium.content.app.Linker;
import org.chromium.content.browser.BrowserStartupController;
import org.chromium.content.browser.ContentView;
import org.chromium.content.browser.ContentViewClient;
-import org.chromium.content.common.CommandLine;
import org.chromium.content.common.ProcessInitException;
import org.chromium.content_shell.Shell;
import org.chromium.content_shell.ShellManager;
@@ -135,7 +136,7 @@ public class ContentLinkerTestActivity extends Activity {
}
private void waitForDebuggerIfNeeded() {
- if (CommandLine.getInstance().hasSwitch(CommandLine.WAIT_FOR_JAVA_DEBUGGER)) {
+ if (CommandLine.getInstance().hasSwitch(BaseSwitches.WAIT_FOR_JAVA_DEBUGGER)) {
Log.e(TAG, "Waiting for Java debugger to connect...");
android.os.Debug.waitForDebugger();
Log.e(TAG, "Java debugger connected. Resuming execution.");
diff --git a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java
index 14c8d1c..dc3e9b0 100644
--- a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java
+++ b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java
@@ -12,6 +12,8 @@ import android.util.Log;
import android.view.KeyEvent;
import android.widget.Toast;
+import org.chromium.base.BaseSwitches;
+import org.chromium.base.CommandLine;
import org.chromium.base.MemoryPressureListener;
import org.chromium.content.app.LibraryLoader;
import org.chromium.content.browser.ActivityContentVideoViewClient;
@@ -20,7 +22,7 @@ import org.chromium.content.browser.ContentVideoViewClient;
import org.chromium.content.browser.ContentView;
import org.chromium.content.browser.ContentViewClient;
import org.chromium.content.browser.DeviceUtils;
-import org.chromium.content.common.CommandLine;
+import org.chromium.content.common.ContentSwitches;
import org.chromium.content.common.ProcessInitException;
import org.chromium.content_shell.Shell;
import org.chromium.content_shell.ShellManager;
@@ -75,7 +77,7 @@ public class ContentShellActivity extends Activity {
mShellManager.setStartupUrl(Shell.sanitizeUrl(startupUrl));
}
- if (CommandLine.getInstance().hasSwitch(CommandLine.DUMP_RENDER_TREE)) {
+ if (CommandLine.getInstance().hasSwitch(ContentSwitches.DUMP_RENDER_TREE)) {
if(BrowserStartupController.get(this).startBrowserProcessesSync(
BrowserStartupController.MAX_RENDERERS_LIMIT)) {
finishInitialization(savedInstanceState);
@@ -133,7 +135,7 @@ public class ContentShellActivity extends Activity {
}
private void waitForDebuggerIfNeeded() {
- if (CommandLine.getInstance().hasSwitch(CommandLine.WAIT_FOR_JAVA_DEBUGGER)) {
+ if (CommandLine.getInstance().hasSwitch(BaseSwitches.WAIT_FOR_JAVA_DEBUGGER)) {
Log.e(TAG, "Waiting for Java debugger to connect...");
android.os.Debug.waitForDebugger();
Log.e(TAG, "Java debugger connected. Resuming execution.");