| 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; | 5 package org.chromium.content_shell; |
| 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.AndroidBrowserProcess; |
| 20 import org.chromium.content.browser.ContentVideoView; | 21 import org.chromium.content.browser.ContentVideoView; |
| 21 import org.chromium.content.browser.ContentView; | 22 import org.chromium.content.browser.ContentView; |
| 22 import org.chromium.content.browser.DeviceUtils; | 23 import org.chromium.content.browser.DeviceUtils; |
| 23 import org.chromium.content.browser.TracingIntentHandler; | 24 import org.chromium.content.browser.TracingIntentHandler; |
| 24 import org.chromium.content.common.CommandLine; | 25 import org.chromium.content.common.CommandLine; |
| 25 import org.chromium.content.common.ProcessInitException; | 26 import org.chromium.content.common.ProcessInitException; |
| 26 import org.chromium.ui.gfx.ActivityNativeWindow; | 27 import org.chromium.ui.gfx.ActivityNativeWindow; |
| 27 | 28 |
| 28 /** | 29 /** |
| 29 * Activity for managing the Content Shell. | 30 * Activity for managing the Content Shell. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 mActivityNativeWindow = new ActivityNativeWindow(this); | 69 mActivityNativeWindow = new ActivityNativeWindow(this); |
| 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 (!AndroidBrowserProcess.init(this, AndroidBrowserProcess.MAX_REND
ERERS_AUTOMATIC)) { |
| 79 String shellUrl = DEFAULT_SHELL_URL; | 80 String shellUrl = 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(); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |