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; | 5 package org.chromium.content_shell; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.util.AttributeSet; | 9 import android.util.AttributeSet; |
10 import android.view.LayoutInflater; | 10 import android.view.LayoutInflater; |
11 import android.view.View; | 11 import android.view.View; |
12 import android.widget.FrameLayout; | 12 import android.widget.FrameLayout; |
13 | 13 |
14 import org.chromium.base.CalledByNative; | 14 import org.chromium.base.CalledByNative; |
15 import org.chromium.base.CommandLine; | |
16 import org.chromium.base.JNINamespace; | 15 import org.chromium.base.JNINamespace; |
17 import org.chromium.base.ThreadUtils; | 16 import org.chromium.base.ThreadUtils; |
18 import org.chromium.content.browser.ActivityContentVideoViewClient; | 17 import org.chromium.content.browser.ActivityContentVideoViewClient; |
19 import org.chromium.content.browser.ContentVideoViewClient; | 18 import org.chromium.content.browser.ContentVideoViewClient; |
20 import org.chromium.content.browser.ContentViewClient; | 19 import org.chromium.content.browser.ContentViewClient; |
21 import org.chromium.content.browser.ContentViewCore; | 20 import org.chromium.content.browser.ContentViewCore; |
22 import org.chromium.content.browser.ContentViewRenderView; | 21 import org.chromium.content.browser.ContentViewRenderView; |
23 import org.chromium.content.common.ContentSwitches; | |
24 import org.chromium.ui.base.WindowAndroid; | 22 import org.chromium.ui.base.WindowAndroid; |
25 | 23 |
26 /** | 24 /** |
27 * Container and generator of ShellViews. | 25 * Container and generator of ShellViews. |
28 */ | 26 */ |
29 @JNINamespace("content") | 27 @JNINamespace("content") |
30 public class ShellManager extends FrameLayout { | 28 public class ShellManager extends FrameLayout { |
31 | 29 |
32 public static final String DEFAULT_SHELL_URL = "http://www.google.com"; | 30 public static final String DEFAULT_SHELL_URL = "http://www.google.com"; |
33 private static boolean sStartup = true; | 31 private static boolean sStartup = true; |
(...skipping 12 matching lines...) Expand all Loading... |
46 public ShellManager(final Context context, AttributeSet attrs) { | 44 public ShellManager(final Context context, AttributeSet attrs) { |
47 super(context, attrs); | 45 super(context, attrs); |
48 nativeInit(this); | 46 nativeInit(this); |
49 mContentViewClient = new ContentViewClient() { | 47 mContentViewClient = new ContentViewClient() { |
50 @Override | 48 @Override |
51 public ContentVideoViewClient getContentVideoViewClient() { | 49 public ContentVideoViewClient getContentVideoViewClient() { |
52 return new ActivityContentVideoViewClient((Activity) context) { | 50 return new ActivityContentVideoViewClient((Activity) context) { |
53 @Override | 51 @Override |
54 public boolean onShowCustomView(View view) { | 52 public boolean onShowCustomView(View view) { |
55 boolean success = super.onShowCustomView(view); | 53 boolean success = super.onShowCustomView(view); |
56 if (!CommandLine.getInstance().hasSwitch( | 54 setOverlayVideoMode(true); |
57 ContentSwitches.DISABLE_OVERLAY_FULLSCREEN_VIDEO
_SUBTITLE)) { | |
58 setOverlayVideoMode(true); | |
59 } | |
60 return success; | 55 return success; |
61 } | 56 } |
62 | 57 |
63 @Override | 58 @Override |
64 public void onDestroyContentVideoView() { | 59 public void onDestroyContentVideoView() { |
65 super.onDestroyContentVideoView(); | 60 super.onDestroyContentVideoView(); |
66 if (!CommandLine.getInstance().hasSwitch( | 61 setOverlayVideoMode(false); |
67 ContentSwitches.DISABLE_OVERLAY_FULLSCREEN_VIDEO
_SUBTITLE)) { | |
68 setOverlayVideoMode(false); | |
69 } | |
70 } | 62 } |
71 }; | 63 }; |
72 } | 64 } |
73 }; | 65 }; |
74 } | 66 } |
75 | 67 |
76 /** | 68 /** |
77 * @param window The window used to generate all shells. | 69 * @param window The window used to generate all shells. |
78 */ | 70 */ |
79 public void setWindow(WindowAndroid window) { | 71 public void setWindow(WindowAndroid window) { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 if (shellView.getParent() == null) return; | 158 if (shellView.getParent() == null) return; |
167 ContentViewCore contentViewCore = shellView.getContentViewCore(); | 159 ContentViewCore contentViewCore = shellView.getContentViewCore(); |
168 if (contentViewCore != null) contentViewCore.onHide(); | 160 if (contentViewCore != null) contentViewCore.onHide(); |
169 shellView.setContentViewRenderView(null); | 161 shellView.setContentViewRenderView(null); |
170 removeView(shellView); | 162 removeView(shellView); |
171 } | 163 } |
172 | 164 |
173 private static native void nativeInit(Object shellManagerInstance); | 165 private static native void nativeInit(Object shellManagerInstance); |
174 private static native void nativeLaunchShell(String url); | 166 private static native void nativeLaunchShell(String url); |
175 } | 167 } |
OLD | NEW |