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

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

Issue 10823051: ContentShell rendering support on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix intents Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.content_shell; 5 package org.chromium.content_shell;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.content.Intent; 8 import android.content.Intent;
9 import android.os.Bundle; 9 import android.os.Bundle;
10 import android.text.TextUtils; 10 import android.text.TextUtils;
11 import android.util.Log; 11 import android.util.Log;
12 import android.view.KeyEvent; 12 import android.view.KeyEvent;
13 13
14 import org.chromium.content.app.AppResource; 14 import org.chromium.content.app.AppResource;
15 import org.chromium.content.app.LibraryLoader; 15 import org.chromium.content.app.LibraryLoader;
16 import org.chromium.content.browser.ContentView; 16 import org.chromium.content.browser.ContentView;
17 import org.chromium.content.common.CommandLine; 17 import org.chromium.content.common.CommandLine;
18 18
19 /** 19 /**
20 * Activity for managing the Content Shell. 20 * Activity for managing the Content Shell.
21 */ 21 */
22 public class ContentShellActivity extends Activity { 22 public class ContentShellActivity extends Activity {
23 23
24 private static final String COMMAND_LINE_FILE = "/data/local/tmp/content-she ll-command-line"; 24 private static final String COMMAND_LINE_FILE = "/data/local/tmp/content-she ll-command-line";
25 private static final String TAG = ContentShellActivity.class.getName(); 25 private static final String TAG = ContentShellActivity.class.getName();
26 26
27 private static final String ACTIVE_SHELL_URL_KEY = "activeUrl"; 27 private static final String ACTIVE_SHELL_URL_KEY = "activeUrl";
28 private static final String DEFAULT_SHELL_URL = "http://www.google.com"; 28 private static final String DEFAULT_SHELL_URL = "http://www.google.com";
Ted C 2012/07/31 20:58:05 drop the private here and use the same constant in
no sievers 2012/07/31 21:17:17 Done.
29 29
30 private ShellManager mShellManager; 30 private ShellManager mShellManager;
31 31
32 @Override 32 @Override
33 protected void onCreate(Bundle savedInstanceState) { 33 protected void onCreate(Bundle savedInstanceState) {
34 super.onCreate(savedInstanceState); 34 super.onCreate(savedInstanceState);
35 35
36 // Initializing the command line must occur before loading the library. 36 // Initializing the command line must occur before loading the library.
37 if (!CommandLine.isInitialized()) CommandLine.initFromFile(COMMAND_LINE_ FILE); 37 if (!CommandLine.isInitialized()) CommandLine.initFromFile(COMMAND_LINE_ FILE);
38 String startupUrl = getUrlFromIntent(getIntent()); 38 String startupUrl = getUrlFromIntent(getIntent());
39 if (!TextUtils.isEmpty(startupUrl)) {
40 CommandLine.getInstance().appendSwitchesAndArguments(
41 new String[] {Shell.sanitizeUrl(startupUrl)});
42 }
43 waitForDebuggerIfNeeded(); 39 waitForDebuggerIfNeeded();
44 40
45 LibraryLoader.loadAndInitSync(); 41 LibraryLoader.loadAndInitSync();
46 initializeContentViewResources(); 42 initializeContentViewResources();
47 43
48 setContentView(R.layout.content_shell_activity); 44 setContentView(R.layout.content_shell_activity);
49 mShellManager = (ShellManager) findViewById(R.id.shell_container); 45 mShellManager = (ShellManager) findViewById(R.id.shell_container);
46
47 if (!TextUtils.isEmpty(startupUrl)) {
Ted C 2012/07/31 20:58:05 Move the declaration of startupUrl to right above
no sievers 2012/07/31 21:17:17 Done.
48 startupUrl = Shell.sanitizeUrl(startupUrl);
Ted C 2012/07/31 20:58:05 no need to further modify startupUrl. This can ju
no sievers 2012/07/31 21:17:17 Done.
49 mShellManager.setStartupUrl(startupUrl);
50 }
51
50 if (!ContentView.enableMultiProcess(this, ContentView.MAX_RENDERERS_AUTO MATIC)) { 52 if (!ContentView.enableMultiProcess(this, ContentView.MAX_RENDERERS_AUTO MATIC)) {
51 String shellUrl = DEFAULT_SHELL_URL; 53 String shellUrl = DEFAULT_SHELL_URL;
52 if (savedInstanceState != null 54 if (savedInstanceState != null
53 && savedInstanceState.containsKey(ACTIVE_SHELL_URL_KEY)) { 55 && savedInstanceState.containsKey(ACTIVE_SHELL_URL_KEY)) {
54 shellUrl = savedInstanceState.getString(ACTIVE_SHELL_URL_KEY); 56 shellUrl = savedInstanceState.getString(ACTIVE_SHELL_URL_KEY);
55 } 57 }
56 mShellManager.launchShell(shellUrl); 58 mShellManager.launchShell(shellUrl);
57 } 59 }
58 } 60 }
59 61
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 */ 117 */
116 public Shell getActiveShell() { 118 public Shell getActiveShell() {
117 return mShellManager != null ? mShellManager.getActiveShell() : null; 119 return mShellManager != null ? mShellManager.getActiveShell() : null;
118 } 120 }
119 121
120 private void initializeContentViewResources() { 122 private void initializeContentViewResources() {
121 AppResource.DIMENSION_LINK_PREVIEW_OVERLAY_RADIUS = R.dimen.link_preview _overlay_radius; 123 AppResource.DIMENSION_LINK_PREVIEW_OVERLAY_RADIUS = R.dimen.link_preview _overlay_radius;
122 AppResource.DRAWABLE_LINK_PREVIEW_POPUP_OVERLAY = R.drawable.popup_zoome r_overlay; 124 AppResource.DRAWABLE_LINK_PREVIEW_POPUP_OVERLAY = R.drawable.popup_zoome r_overlay;
123 } 125 }
124 } 126 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698