Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastWindowAndroid.java

Issue 773313002: Expose render_process_id to CastShellActivity. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit fixes. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chromecast/browser/android/cast_window_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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;
(...skipping 22 matching lines...) Expand all
33 public class CastWindowAndroid extends LinearLayout { 33 public class CastWindowAndroid extends LinearLayout {
34 public static final String TAG = "CastWindowAndroid"; 34 public static final String TAG = "CastWindowAndroid";
35 35
36 public static final String ACTION_PAGE_LOADED = "castPageLoaded"; 36 public static final String ACTION_PAGE_LOADED = "castPageLoaded";
37 public static final String ACTION_ENABLE_DEV_TOOLS = "castEnableDevTools"; 37 public static final String ACTION_ENABLE_DEV_TOOLS = "castEnableDevTools";
38 public static final String ACTION_DISABLE_DEV_TOOLS = "castDisableDevTools"; 38 public static final String ACTION_DISABLE_DEV_TOOLS = "castDisableDevTools";
39 39
40 private ContentViewCore mContentViewCore; 40 private ContentViewCore mContentViewCore;
41 private ContentViewRenderView mContentViewRenderView; 41 private ContentViewRenderView mContentViewRenderView;
42 private NavigationController mNavigationController; 42 private NavigationController mNavigationController;
43 private int mRenderProcessId;
43 private WebContents mWebContents; 44 private WebContents mWebContents;
44 private WebContentsObserver mWebContentsObserver; 45 private WebContentsObserver mWebContentsObserver;
45 private WindowAndroid mWindow; 46 private WindowAndroid mWindow;
46 47
47 /** 48 /**
48 * Constructor for inflating via XML. 49 * Constructor for inflating via XML.
49 */ 50 */
50 public CastWindowAndroid(Context context, AttributeSet attrs) { 51 public CastWindowAndroid(Context context, AttributeSet attrs) {
51 super(context, attrs); 52 super(context, attrs);
52 } 53 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } else { 91 } else {
91 mNavigationController.loadUrl(new LoadUrlParams(normalizeUrl(url))); 92 mNavigationController.loadUrl(new LoadUrlParams(normalizeUrl(url)));
92 } 93 }
93 94
94 // TODO(aurimas): Remove this when crbug.com/174541 is fixed. 95 // TODO(aurimas): Remove this when crbug.com/174541 is fixed.
95 mContentViewCore.getContainerView().clearFocus(); 96 mContentViewCore.getContainerView().clearFocus();
96 mContentViewCore.getContainerView().requestFocus(); 97 mContentViewCore.getContainerView().requestFocus();
97 } 98 }
98 99
99 /** 100 /**
101 * Returns the render_process_id for the associated web contents
102 */
103 public int getRenderProcessId() {
104 return mRenderProcessId;
105 }
106
107 /**
100 * Given a URI String, performs minimal normalization to attempt to build a usable URL from it. 108 * Given a URI String, performs minimal normalization to attempt to build a usable URL from it.
101 * @param uriString The passed-in path to be normalized. 109 * @param uriString The passed-in path to be normalized.
102 * @return The normalized URL, as a string. 110 * @return The normalized URL, as a string.
103 */ 111 */
104 private static String normalizeUrl(String uriString) { 112 private static String normalizeUrl(String uriString) {
105 if (uriString == null) return uriString; 113 if (uriString == null) return uriString;
106 Uri uri = Uri.parse(uriString); 114 Uri uri = Uri.parse(uriString);
107 if (uri.getScheme() == null) { 115 if (uri.getScheme() == null) {
108 uri = Uri.parse("http://" + uriString); 116 uri = Uri.parse("http://" + uriString);
109 } 117 }
110 return uri.toString(); 118 return uri.toString();
111 } 119 }
112 120
113 /** 121 /**
114 * Initializes the ContentView based on the native tab contents pointer pass ed in. 122 * Initializes the ContentView based on the native tab contents pointer pass ed in.
115 * @param nativeWebContents The pointer to the native tab contents object. 123 * @param nativeWebContents The pointer to the native tab contents object.
116 */ 124 */
117 @SuppressWarnings("unused") 125 @SuppressWarnings("unused")
118 @CalledByNative 126 @CalledByNative
119 private void initFromNativeWebContents(long nativeWebContents) { 127 private void initFromNativeWebContents(long nativeWebContents, int renderPro cessId) {
120 Context context = getContext(); 128 Context context = getContext();
121 mContentViewCore = new ContentViewCore(context); 129 mContentViewCore = new ContentViewCore(context);
122 ContentView view = ContentView.newInstance(context, mContentViewCore); 130 ContentView view = ContentView.newInstance(context, mContentViewCore);
123 mContentViewCore.initialize(view, view, nativeWebContents, mWindow); 131 mContentViewCore.initialize(view, view, nativeWebContents, mWindow);
124 mWebContents = mContentViewCore.getWebContents(); 132 mWebContents = mContentViewCore.getWebContents();
125 mNavigationController = mWebContents.getNavigationController(); 133 mNavigationController = mWebContents.getNavigationController();
134 mRenderProcessId = renderProcessId;
126 135
127 if (getParent() != null) mContentViewCore.onShow(); 136 if (getParent() != null) mContentViewCore.onShow();
128 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(view, 137 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(view,
129 new FrameLayout.LayoutParams( 138 new FrameLayout.LayoutParams(
130 FrameLayout.LayoutParams.MATCH_PARENT, 139 FrameLayout.LayoutParams.MATCH_PARENT,
131 FrameLayout.LayoutParams.MATCH_PARENT)); 140 FrameLayout.LayoutParams.MATCH_PARENT));
132 view.requestFocus(); 141 view.requestFocus();
133 mContentViewRenderView.setCurrentContentViewCore(mContentViewCore); 142 mContentViewRenderView.setCurrentContentViewCore(mContentViewCore);
134 143
135 mWebContentsObserver = new WebContentsObserver(mWebContents) { 144 mWebContentsObserver = new WebContentsObserver(mWebContents) {
(...skipping 16 matching lines...) Expand all
152 return mContentViewCore.getContainerView(); 161 return mContentViewCore.getContainerView();
153 } 162 }
154 163
155 /** 164 /**
156 * @return The {@link ContentViewCore} currently managing the view shown by this Shell. 165 * @return The {@link ContentViewCore} currently managing the view shown by this Shell.
157 */ 166 */
158 public ContentViewCore getContentViewCore() { 167 public ContentViewCore getContentViewCore() {
159 return mContentViewCore; 168 return mContentViewCore;
160 } 169 }
161 } 170 }
OLDNEW
« no previous file with comments | « no previous file | chromecast/browser/android/cast_window_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698