OLD | NEW |
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_apk; | 5 package org.chromium.content_shell_apk; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Context; | |
9 import android.content.Intent; | 8 import android.content.Intent; |
10 import android.os.Bundle; | 9 import android.os.Bundle; |
11 import android.text.TextUtils; | 10 import android.text.TextUtils; |
12 import android.util.Log; | 11 import android.util.Log; |
13 import android.view.KeyEvent; | 12 import android.view.KeyEvent; |
14 import android.widget.Toast; | 13 import android.widget.Toast; |
15 | 14 |
16 import org.chromium.base.MemoryPressureListener; | 15 import org.chromium.base.MemoryPressureListener; |
17 import org.chromium.content.app.LibraryLoader; | 16 import org.chromium.content.app.LibraryLoader; |
18 import org.chromium.content.browser.ActivityContentVideoViewClient; | 17 import org.chromium.content.browser.ActivityContentVideoViewClient; |
19 import org.chromium.content.browser.BrowserStartupController; | 18 import org.chromium.content.browser.BrowserStartupController; |
20 import org.chromium.content.browser.ContentVideoViewClient; | 19 import org.chromium.content.browser.ContentVideoViewClient; |
21 import org.chromium.content.browser.ContentView; | 20 import org.chromium.content.browser.ContentView; |
22 import org.chromium.content.browser.ContentViewClient; | 21 import org.chromium.content.browser.ContentViewClient; |
23 import org.chromium.content.browser.DeviceUtils; | 22 import org.chromium.content.browser.DeviceUtils; |
24 import org.chromium.content.common.CommandLine; | 23 import org.chromium.content.common.CommandLine; |
25 import org.chromium.content.common.ProcessInitException; | 24 import org.chromium.content.common.ProcessInitException; |
26 import org.chromium.content_shell.Shell; | 25 import org.chromium.content_shell.Shell; |
27 import org.chromium.content_shell.ShellManager; | 26 import org.chromium.content_shell.ShellManager; |
| 27 import org.chromium.ui.ActivityWindowAndroid; |
28 import org.chromium.ui.WindowAndroid; | 28 import org.chromium.ui.WindowAndroid; |
29 | 29 |
30 /** | 30 /** |
31 * Activity for managing the Content Shell. | 31 * Activity for managing the Content Shell. |
32 */ | 32 */ |
33 public class ContentShellActivity extends Activity { | 33 public class ContentShellActivity extends Activity { |
34 | 34 |
35 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"; |
36 private static final String TAG = "ContentShellActivity"; | 36 private static final String TAG = "ContentShellActivity"; |
37 | 37 |
(...skipping 21 matching lines...) Expand all Loading... |
59 try { | 59 try { |
60 LibraryLoader.ensureInitialized(); | 60 LibraryLoader.ensureInitialized(); |
61 } catch (ProcessInitException e) { | 61 } catch (ProcessInitException e) { |
62 Log.e(TAG, "ContentView initialization failed.", e); | 62 Log.e(TAG, "ContentView initialization failed.", e); |
63 finish(); | 63 finish(); |
64 return; | 64 return; |
65 } | 65 } |
66 | 66 |
67 setContentView(R.layout.content_shell_activity); | 67 setContentView(R.layout.content_shell_activity); |
68 mShellManager = (ShellManager) findViewById(R.id.shell_container); | 68 mShellManager = (ShellManager) findViewById(R.id.shell_container); |
69 mWindowAndroid = new WindowAndroid(this); | 69 mWindowAndroid = new ActivityWindowAndroid(this); |
70 mWindowAndroid.restoreInstanceState(savedInstanceState); | 70 mWindowAndroid.restoreInstanceState(savedInstanceState); |
71 mShellManager.setWindow(mWindowAndroid); | 71 mShellManager.setWindow(mWindowAndroid); |
72 | 72 |
73 String startupUrl = getUrlFromIntent(getIntent()); | 73 String startupUrl = getUrlFromIntent(getIntent()); |
74 if (!TextUtils.isEmpty(startupUrl)) { | 74 if (!TextUtils.isEmpty(startupUrl)) { |
75 mShellManager.setStartupUrl(Shell.sanitizeUrl(startupUrl)); | 75 mShellManager.setStartupUrl(Shell.sanitizeUrl(startupUrl)); |
76 } | 76 } |
77 | 77 |
78 if (CommandLine.getInstance().hasSwitch(CommandLine.DUMP_RENDER_TREE)) { | 78 if (CommandLine.getInstance().hasSwitch(CommandLine.DUMP_RENDER_TREE)) { |
79 if(BrowserStartupController.get(this).startBrowserProcessesSync( | 79 if(BrowserStartupController.get(this).startBrowserProcessesSync( |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 217 |
218 /** | 218 /** |
219 * @return The {@link ContentView} owned by the currently visible {@link She
ll} or null if one | 219 * @return The {@link ContentView} owned by the currently visible {@link She
ll} or null if one |
220 * is not showing. | 220 * is not showing. |
221 */ | 221 */ |
222 public ContentView getActiveContentView() { | 222 public ContentView getActiveContentView() { |
223 Shell shell = getActiveShell(); | 223 Shell shell = getActiveShell(); |
224 return shell != null ? shell.getContentView() : null; | 224 return shell != null ? shell.getContentView() : null; |
225 } | 225 } |
226 } | 226 } |
OLD | NEW |