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; | 15 import org.chromium.base.CommandLine; |
16 import org.chromium.base.JNINamespace; | 16 import org.chromium.base.JNINamespace; |
17 import org.chromium.base.ThreadUtils; | 17 import org.chromium.base.ThreadUtils; |
18 import org.chromium.content.browser.ActivityContentVideoViewClient; | 18 import org.chromium.content.browser.ActivityContentVideoViewClient; |
19 import org.chromium.content.browser.ContentVideoViewClient; | 19 import org.chromium.content.browser.ContentVideoViewClient; |
20 import org.chromium.content.browser.ContentView; | |
21 import org.chromium.content.browser.ContentViewClient; | 20 import org.chromium.content.browser.ContentViewClient; |
| 21 import org.chromium.content.browser.ContentViewCore; |
22 import org.chromium.content.browser.ContentViewRenderView; | 22 import org.chromium.content.browser.ContentViewRenderView; |
23 import org.chromium.content.common.ContentSwitches; | 23 import org.chromium.content.common.ContentSwitches; |
24 import org.chromium.ui.base.WindowAndroid; | 24 import org.chromium.ui.base.WindowAndroid; |
25 | 25 |
26 /** | 26 /** |
27 * Container and generator of ShellViews. | 27 * Container and generator of ShellViews. |
28 */ | 28 */ |
29 @JNINamespace("content") | 29 @JNINamespace("content") |
30 public class ShellManager extends FrameLayout { | 30 public class ShellManager extends FrameLayout { |
31 | 31 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 144 |
145 showShell(shellView); | 145 showShell(shellView); |
146 return shellView; | 146 return shellView; |
147 } | 147 } |
148 | 148 |
149 private void showShell(Shell shellView) { | 149 private void showShell(Shell shellView) { |
150 shellView.setContentViewRenderView(mContentViewRenderView); | 150 shellView.setContentViewRenderView(mContentViewRenderView); |
151 addView(shellView, new FrameLayout.LayoutParams( | 151 addView(shellView, new FrameLayout.LayoutParams( |
152 FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.
MATCH_PARENT)); | 152 FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.
MATCH_PARENT)); |
153 mActiveShell = shellView; | 153 mActiveShell = shellView; |
154 ContentView contentView = mActiveShell.getContentView(); | 154 ContentViewCore contentViewCore = mActiveShell.getContentViewCore(); |
155 if (contentView != null) { | 155 if (contentViewCore != null) { |
156 mContentViewRenderView.setCurrentContentViewCore(contentView.getCont
entViewCore()); | 156 mContentViewRenderView.setCurrentContentViewCore(contentViewCore); |
157 contentView.getContentViewCore().onShow(); | 157 contentViewCore.onShow(); |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
161 @CalledByNative | 161 @CalledByNative |
162 private void removeShell(Shell shellView) { | 162 private void removeShell(Shell shellView) { |
163 if (shellView == mActiveShell) mActiveShell = null; | 163 if (shellView == mActiveShell) mActiveShell = null; |
164 if (shellView.getParent() == null) return; | 164 if (shellView.getParent() == null) return; |
165 ContentView contentView = shellView.getContentView(); | 165 ContentViewCore contentViewCore = shellView.getContentViewCore(); |
166 if (contentView != null) contentView.onHide(); | 166 if (contentViewCore != null) contentViewCore.onHide(); |
167 shellView.setContentViewRenderView(null); | 167 shellView.setContentViewRenderView(null); |
168 removeView(shellView); | 168 removeView(shellView); |
169 } | 169 } |
170 | 170 |
171 private static native void nativeInit(Object shellManagerInstance); | 171 private static native void nativeInit(Object shellManagerInstance); |
172 private static native void nativeLaunchShell(String url); | 172 private static native void nativeLaunchShell(String url); |
173 } | 173 } |
OLD | NEW |