OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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.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 import android.view.View; | |
14 import android.widget.Toast; | 13 import android.widget.Toast; |
15 | 14 |
16 import org.chromium.base.BaseSwitches; | 15 import org.chromium.base.BaseSwitches; |
17 import org.chromium.base.CommandLine; | 16 import org.chromium.base.CommandLine; |
18 import org.chromium.base.MemoryPressureListener; | 17 import org.chromium.base.MemoryPressureListener; |
19 import org.chromium.base.library_loader.LibraryLoader; | 18 import org.chromium.base.library_loader.LibraryLoader; |
20 import org.chromium.base.library_loader.ProcessInitException; | 19 import org.chromium.base.library_loader.ProcessInitException; |
21 import org.chromium.content.browser.ActivityContentVideoViewClient; | |
22 import org.chromium.content.browser.BrowserStartupController; | 20 import org.chromium.content.browser.BrowserStartupController; |
23 import org.chromium.content.browser.ContentVideoViewClient; | |
24 import org.chromium.content.browser.ContentView; | 21 import org.chromium.content.browser.ContentView; |
25 import org.chromium.content.browser.ContentViewClient; | |
26 import org.chromium.content.browser.DeviceUtils; | 22 import org.chromium.content.browser.DeviceUtils; |
27 import org.chromium.content.common.ContentSwitches; | 23 import org.chromium.content.common.ContentSwitches; |
28 import org.chromium.content_shell.Shell; | 24 import org.chromium.content_shell.Shell; |
29 import org.chromium.content_shell.ShellManager; | 25 import org.chromium.content_shell.ShellManager; |
30 import org.chromium.ui.base.ActivityWindowAndroid; | 26 import org.chromium.ui.base.ActivityWindowAndroid; |
31 import org.chromium.ui.base.WindowAndroid; | 27 import org.chromium.ui.base.WindowAndroid; |
32 | 28 |
33 /** | 29 /** |
34 * Activity for managing the Content Shell. | 30 * Activity for managing the Content Shell. |
35 */ | 31 */ |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 105 } |
110 } | 106 } |
111 | 107 |
112 private void finishInitialization(Bundle savedInstanceState) { | 108 private void finishInitialization(Bundle savedInstanceState) { |
113 String shellUrl = ShellManager.DEFAULT_SHELL_URL; | 109 String shellUrl = ShellManager.DEFAULT_SHELL_URL; |
114 if (savedInstanceState != null | 110 if (savedInstanceState != null |
115 && savedInstanceState.containsKey(ACTIVE_SHELL_URL_KEY)) { | 111 && savedInstanceState.containsKey(ACTIVE_SHELL_URL_KEY)) { |
116 shellUrl = savedInstanceState.getString(ACTIVE_SHELL_URL_KEY); | 112 shellUrl = savedInstanceState.getString(ACTIVE_SHELL_URL_KEY); |
117 } | 113 } |
118 mShellManager.launchShell(shellUrl); | 114 mShellManager.launchShell(shellUrl); |
119 getActiveContentView().setContentViewClient(new ContentViewClient() { | |
120 @Override | |
121 public ContentVideoViewClient getContentVideoViewClient() { | |
122 return new ActivityContentVideoViewClient(ContentShellActivity.t
his) { | |
123 @Override | |
124 public void onShowCustomView(View view) { | |
125 super.onShowCustomView(view); | |
126 if (CommandLine.getInstance().hasSwitch( | |
127 ContentSwitches.ENABLE_OVERLAY_FULLSCREEN_VIDEO_
SUBTITLE)) { | |
128 mShellManager.setOverlayVideoMode(true); | |
129 } | |
130 } | |
131 | |
132 @Override | |
133 public void onDestroyContentVideoView() { | |
134 super.onDestroyContentVideoView(); | |
135 if (CommandLine.getInstance().hasSwitch( | |
136 ContentSwitches.ENABLE_OVERLAY_FULLSCREEN_VIDEO_
SUBTITLE)) { | |
137 mShellManager.setOverlayVideoMode(false); | |
138 } | |
139 } | |
140 }; | |
141 } | |
142 }); | |
143 } | 115 } |
144 | 116 |
145 private void initializationFailed() { | 117 private void initializationFailed() { |
146 Log.e(TAG, "ContentView initialization failed."); | 118 Log.e(TAG, "ContentView initialization failed."); |
147 Toast.makeText(ContentShellActivity.this, | 119 Toast.makeText(ContentShellActivity.this, |
148 R.string.browser_process_initialization_failed, | 120 R.string.browser_process_initialization_failed, |
149 Toast.LENGTH_SHORT).show(); | 121 Toast.LENGTH_SHORT).show(); |
150 finish(); | 122 finish(); |
151 } | 123 } |
152 | 124 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 218 |
247 /** | 219 /** |
248 * @return The {@link ContentView} owned by the currently visible {@link She
ll} or null if one | 220 * @return The {@link ContentView} owned by the currently visible {@link She
ll} or null if one |
249 * is not showing. | 221 * is not showing. |
250 */ | 222 */ |
251 public ContentView getActiveContentView() { | 223 public ContentView getActiveContentView() { |
252 Shell shell = getActiveShell(); | 224 Shell shell = getActiveShell(); |
253 return shell != null ? shell.getContentView() : null; | 225 return shell != null ? shell.getContentView() : null; |
254 } | 226 } |
255 } | 227 } |
OLD | NEW |