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

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

Issue 12047068: Add apk for running content_browsertests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 7 years, 11 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_apk;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.content.BroadcastReceiver; 8 import android.content.BroadcastReceiver;
9 import android.content.Context; 9 import android.content.Context;
10 import android.content.Intent; 10 import android.content.Intent;
11 import android.content.IntentFilter; 11 import android.content.IntentFilter;
12 import android.os.Bundle; 12 import android.os.Bundle;
13 import android.text.TextUtils; 13 import android.text.TextUtils;
14 import android.util.Log; 14 import android.util.Log;
15 import android.view.KeyEvent; 15 import android.view.KeyEvent;
16 16
17 import org.chromium.base.ChromiumActivity; 17 import org.chromium.base.ChromiumActivity;
18 import org.chromium.content.app.LibraryLoader; 18 import org.chromium.content.app.LibraryLoader;
19 import org.chromium.content.browser.ActivityContentVideoViewDelegate; 19 import org.chromium.content.browser.ActivityContentVideoViewDelegate;
20 import org.chromium.content.browser.ContentVideoView; 20 import org.chromium.content.browser.ContentVideoView;
21 import org.chromium.content.browser.ContentView; 21 import org.chromium.content.browser.ContentView;
22 import org.chromium.content.browser.DeviceUtils; 22 import org.chromium.content.browser.DeviceUtils;
23 import org.chromium.content.browser.TracingIntentHandler; 23 import org.chromium.content.browser.TracingIntentHandler;
24 import org.chromium.content.common.CommandLine; 24 import org.chromium.content.common.CommandLine;
25 import org.chromium.content.common.ProcessInitException; 25 import org.chromium.content.common.ProcessInitException;
26 import org.chromium.content_shell.Shell;
27 import org.chromium.content_shell.ShellManager;
26 import org.chromium.ui.gfx.ActivityNativeWindow; 28 import org.chromium.ui.gfx.ActivityNativeWindow;
27 29
28 /** 30 /**
29 * Activity for managing the Content Shell. 31 * Activity for managing the Content Shell.
30 */ 32 */
31 public class ContentShellActivity extends ChromiumActivity { 33 public class ContentShellActivity extends ChromiumActivity {
32 34
33 public static final String COMMAND_LINE_FILE = "/data/local/tmp/content-shel l-command-line"; 35 public static final String COMMAND_LINE_FILE = "/data/local/tmp/content-shel l-command-line";
34 private static final String TAG = ContentShellActivity.class.getName(); 36 private static final String TAG = ContentShellActivity.class.getName();
35 37
36 private static final String ACTIVE_SHELL_URL_KEY = "activeUrl"; 38 private static final String ACTIVE_SHELL_URL_KEY = "activeUrl";
37 private static final String ACTION_START_TRACE = 39 private static final String ACTION_START_TRACE =
38 "org.chromium.content_shell.action.PROFILE_START"; 40 "org.chromium.content_shell.action.PROFILE_START";
39 private static final String ACTION_STOP_TRACE = 41 private static final String ACTION_STOP_TRACE =
40 "org.chromium.content_shell.action.PROFILE_STOP"; 42 "org.chromium.content_shell.action.PROFILE_STOP";
41 public static final String DEFAULT_SHELL_URL = "http://www.google.com";
42 public static final String COMMAND_LINE_ARGS_KEY = "commandLineArgs"; 43 public static final String COMMAND_LINE_ARGS_KEY = "commandLineArgs";
43 44
44 private ShellManager mShellManager; 45 private ShellManager mShellManager;
45 private ActivityNativeWindow mActivityNativeWindow; 46 private ActivityNativeWindow mActivityNativeWindow;
46 private BroadcastReceiver mReceiver; 47 private BroadcastReceiver mReceiver;
47 48
48 @Override 49 @Override
49 protected void onCreate(Bundle savedInstanceState) { 50 protected void onCreate(Bundle savedInstanceState) {
50 super.onCreate(savedInstanceState); 51 super.onCreate(savedInstanceState);
51 52
(...skipping 17 matching lines...) Expand all
69 mActivityNativeWindow.restoreInstanceState(savedInstanceState); 70 mActivityNativeWindow.restoreInstanceState(savedInstanceState);
70 mShellManager.setWindow(mActivityNativeWindow); 71 mShellManager.setWindow(mActivityNativeWindow);
71 ContentVideoView.registerContentVideoViewContextDelegate( 72 ContentVideoView.registerContentVideoViewContextDelegate(
72 new ActivityContentVideoViewDelegate(this)); 73 new ActivityContentVideoViewDelegate(this));
73 74
74 String startupUrl = getUrlFromIntent(getIntent()); 75 String startupUrl = getUrlFromIntent(getIntent());
75 if (!TextUtils.isEmpty(startupUrl)) { 76 if (!TextUtils.isEmpty(startupUrl)) {
76 mShellManager.setStartupUrl(Shell.sanitizeUrl(startupUrl)); 77 mShellManager.setStartupUrl(Shell.sanitizeUrl(startupUrl));
77 } 78 }
78 if (!ContentView.enableMultiProcess(this, ContentView.MAX_RENDERERS_ AUTOMATIC)) { 79 if (!ContentView.enableMultiProcess(this, ContentView.MAX_RENDERERS_ AUTOMATIC)) {
79 String shellUrl = DEFAULT_SHELL_URL; 80 String shellUrl = ShellManager.DEFAULT_SHELL_URL;
80 if (savedInstanceState != null 81 if (savedInstanceState != null
81 && savedInstanceState.containsKey(ACTIVE_SHELL_URL_KEY)) { 82 && savedInstanceState.containsKey(ACTIVE_SHELL_URL_KEY)) {
82 shellUrl = savedInstanceState.getString(ACTIVE_SHELL_URL_KEY ); 83 shellUrl = savedInstanceState.getString(ACTIVE_SHELL_URL_KEY );
83 } 84 }
84 mShellManager.launchShell(shellUrl); 85 mShellManager.launchShell(shellUrl);
85 } 86 }
86 } catch (ProcessInitException e) { 87 } catch (ProcessInitException e) {
87 Log.e(TAG, "ContentView initialization failed.", e); 88 Log.e(TAG, "ContentView initialization failed.", e);
88 finish(); 89 finish();
89 } 90 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 206
206 /** 207 /**
207 * @return The {@link ContentView} owned by the currently visible {@link She ll} or null if one 208 * @return The {@link ContentView} owned by the currently visible {@link She ll} or null if one
208 * is not showing. 209 * is not showing.
209 */ 210 */
210 public ContentView getActiveContentView() { 211 public ContentView getActiveContentView() {
211 Shell shell = getActiveShell(); 212 Shell shell = getActiveShell();
212 return shell != null ? shell.getContentView() : null; 213 return shell != null ? shell.getContentView() : null;
213 } 214 }
214 } 215 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698