Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1353)

Unified Diff: content/shell/android/java/src/org/chromium/content_shell/ContentShellActivity.java

Issue 11085008: [Android] Upstream content detection and ChromeBrowserProvider tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clean-up for review. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/shell/android/java/src/org/chromium/content_shell/ContentShellActivity.java
diff --git a/content/shell/android/java/src/org/chromium/content_shell/ContentShellActivity.java b/content/shell/android/java/src/org/chromium/content_shell/ContentShellActivity.java
index f15f269b92ee22a53fedf5f11a48c7da1c6f5b40..44eab75bf40e75171402f61a4e8ab1efdddebcdb 100644
--- a/content/shell/android/java/src/org/chromium/content_shell/ContentShellActivity.java
+++ b/content/shell/android/java/src/org/chromium/content_shell/ContentShellActivity.java
@@ -27,6 +27,7 @@ public class ContentShellActivity extends Activity {
private static final String ACTIVE_SHELL_URL_KEY = "activeUrl";
public static final String DEFAULT_SHELL_URL = "http://www.google.com";
+ public static final String COMMAND_LINE_ARGS_KEY = "commandLineArgs";
private ShellManager mShellManager;
private ActivityNativeWindow mActivityNativeWindow;
@@ -36,7 +37,13 @@ public class ContentShellActivity extends Activity {
super.onCreate(savedInstanceState);
// Initializing the command line must occur before loading the library.
- if (!CommandLine.isInitialized()) CommandLine.initFromFile(COMMAND_LINE_FILE);
+ if (!CommandLine.isInitialized()) {
+ CommandLine.initFromFile(COMMAND_LINE_FILE);
+ String[] commandLineParams = getCommandLineParamsFromIntent(getIntent());
+ if (commandLineParams != null) {
+ CommandLine.getInstance().appendSwitchesAndArguments(commandLineParams);
+ }
+ }
waitForDebuggerIfNeeded();
LibraryLoader.loadAndInitSync();
@@ -97,6 +104,10 @@ public class ContentShellActivity extends Activity {
@Override
protected void onNewIntent(Intent intent) {
+ if (getCommandLineParamsFromIntent(intent) != null) {
+ Log.i(TAG, "Ignoring command line params: can only be set when creating the activity.");
+ }
+
String url = getUrlFromIntent(intent);
if (!TextUtils.isEmpty(url)) {
Shell activeView = getActiveShell();
@@ -132,6 +143,10 @@ public class ContentShellActivity extends Activity {
return intent != null ? intent.getDataString() : null;
}
+ private static String[] getCommandLineParamsFromIntent(Intent intent) {
+ return intent != null ? intent.getStringArrayExtra(COMMAND_LINE_ARGS_KEY) : null;
+ }
+
/**
* @return The {@link ShellManager} configured for the activity or null if it has not been
* created yet.
@@ -158,7 +173,11 @@ public class ContentShellActivity extends Activity {
private void initializeContentViewResources() {
AppResource.DIMENSION_LINK_PREVIEW_OVERLAY_RADIUS = R.dimen.link_preview_overlay_radius;
+ AppResource.DRAWABLE_ICON_ACTION_BAR_SHARE = R.drawable.ic_menu_share_holo_light;
+ AppResource.DRAWABLE_ICON_ACTION_BAR_WEB_SEARCH = R.drawable.ic_menu_search_holo_light;
AppResource.DRAWABLE_LINK_PREVIEW_POPUP_OVERLAY = R.drawable.popup_zoomer_overlay;
+ AppResource.STRING_ACTION_BAR_SHARE = R.string.action_bar_share;
+ AppResource.STRING_ACTION_BAR_WEB_SEARCH = R.string.action_bar_search;
AppResource.STRING_CONTENT_VIEW_CONTENT_DESCRIPTION = R.string.accessibility_content_view;
}
}

Powered by Google App Engine
This is Rietveld 408576698