OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.chromecast.shell; | 5 package org.chromium.chromecast.shell; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.content.Intent; | 8 import android.content.Intent; |
9 import android.net.Uri; | 9 import android.net.Uri; |
10 import android.support.v4.content.LocalBroadcastManager; | 10 import android.support.v4.content.LocalBroadcastManager; |
11 import android.text.TextUtils; | 11 import android.text.TextUtils; |
12 import android.util.AttributeSet; | 12 import android.util.AttributeSet; |
13 import android.util.Log; | 13 import android.util.Log; |
14 import android.view.ViewGroup; | 14 import android.view.ViewGroup; |
15 import android.widget.FrameLayout; | 15 import android.widget.FrameLayout; |
16 import android.widget.LinearLayout; | 16 import android.widget.LinearLayout; |
17 | 17 |
18 import org.chromium.base.annotations.CalledByNative; | 18 import org.chromium.base.annotations.CalledByNative; |
19 import org.chromium.base.annotations.JNINamespace; | 19 import org.chromium.base.annotations.JNINamespace; |
20 import org.chromium.content.browser.ContentView; | 20 import org.chromium.content.browser.ContentView; |
21 import org.chromium.content.browser.ContentViewCore; | 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_public.browser.LoadUrlParams; | 23 import org.chromium.content_public.browser.LoadUrlParams; |
24 import org.chromium.content_public.browser.NavigationController; | 24 import org.chromium.content_public.browser.NavigationController; |
25 import org.chromium.content_public.browser.WebContents; | 25 import org.chromium.content_public.browser.WebContents; |
26 import org.chromium.content_public.browser.WebContentsObserver; | 26 import org.chromium.content_public.browser.WebContentsObserver; |
| 27 import org.chromium.ui.base.ViewAndroidDelegate; |
27 import org.chromium.ui.base.WindowAndroid; | 28 import org.chromium.ui.base.WindowAndroid; |
28 | 29 |
29 /** | 30 /** |
30 * Container for the various UI components that make up a shell window. | 31 * Container for the various UI components that make up a shell window. |
31 */ | 32 */ |
32 @JNINamespace("chromecast::shell") | 33 @JNINamespace("chromecast::shell") |
33 public class CastWindowAndroid extends LinearLayout { | 34 public class CastWindowAndroid extends LinearLayout { |
34 public static final String TAG = "CastWindowAndroid"; | 35 public static final String TAG = "CastWindowAndroid"; |
35 | 36 |
36 public static final String ACTION_PAGE_LOADED = "castPageLoaded"; | 37 public static final String ACTION_PAGE_LOADED = "castPageLoaded"; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 /** | 122 /** |
122 * Initializes the ContentView based on the native tab contents pointer pass
ed in. | 123 * Initializes the ContentView based on the native tab contents pointer pass
ed in. |
123 * @param nativeWebContents The pointer to the native tab contents object. | 124 * @param nativeWebContents The pointer to the native tab contents object. |
124 */ | 125 */ |
125 @SuppressWarnings("unused") | 126 @SuppressWarnings("unused") |
126 @CalledByNative | 127 @CalledByNative |
127 private void initFromNativeWebContents(WebContents webContents, int renderPr
ocessId) { | 128 private void initFromNativeWebContents(WebContents webContents, int renderPr
ocessId) { |
128 Context context = getContext(); | 129 Context context = getContext(); |
129 mContentViewCore = new ContentViewCore(context); | 130 mContentViewCore = new ContentViewCore(context); |
130 ContentView view = ContentView.createContentView(context, mContentViewCo
re); | 131 ContentView view = ContentView.createContentView(context, mContentViewCo
re); |
131 mContentViewCore.initialize(view, view, webContents, mWindow); | 132 mContentViewCore.initialize(ViewAndroidDelegate.createBasicDelegate(view
), view, |
| 133 webContents, mWindow); |
132 mWebContents = mContentViewCore.getWebContents(); | 134 mWebContents = mContentViewCore.getWebContents(); |
133 mNavigationController = mWebContents.getNavigationController(); | 135 mNavigationController = mWebContents.getNavigationController(); |
134 mRenderProcessId = renderProcessId; | 136 mRenderProcessId = renderProcessId; |
135 | 137 |
136 if (getParent() != null) mContentViewCore.onShow(); | 138 if (getParent() != null) mContentViewCore.onShow(); |
137 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(view, | 139 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(view, |
138 new FrameLayout.LayoutParams( | 140 new FrameLayout.LayoutParams( |
139 FrameLayout.LayoutParams.MATCH_PARENT, | 141 FrameLayout.LayoutParams.MATCH_PARENT, |
140 FrameLayout.LayoutParams.MATCH_PARENT)); | 142 FrameLayout.LayoutParams.MATCH_PARENT)); |
141 view.requestFocus(); | 143 view.requestFocus(); |
(...skipping 26 matching lines...) Expand all Loading... |
168 return mContentViewCore; | 170 return mContentViewCore; |
169 } | 171 } |
170 | 172 |
171 /** | 173 /** |
172 * @return The {@link WebContents} managed by this class. | 174 * @return The {@link WebContents} managed by this class. |
173 */ | 175 */ |
174 public WebContents getWebContents() { | 176 public WebContents getWebContents() { |
175 return mWebContents; | 177 return mWebContents; |
176 } | 178 } |
177 } | 179 } |
OLD | NEW |