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

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 62203016: Remove a use of NOTIFICATION_RENDERER_PROCESS_CREATED. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "content/browser/android/content_view_core_impl.h" 5 #include "content/browser/android/content_view_core_impl.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 DCHECK(env->IsSameObject(java_ref_.get(env).obj(), obj)); 211 DCHECK(env->IsSameObject(java_ref_.get(env).obj(), obj));
212 java_ref_.reset(); 212 java_ref_.reset();
213 } 213 }
214 214
215 void ContentViewCoreImpl::InitWebContents() { 215 void ContentViewCoreImpl::InitWebContents() {
216 DCHECK(web_contents_); 216 DCHECK(web_contents_);
217 notification_registrar_.Add( 217 notification_registrar_.Add(
218 this, NOTIFICATION_RENDER_VIEW_HOST_CHANGED, 218 this, NOTIFICATION_RENDER_VIEW_HOST_CHANGED,
219 Source<WebContents>(web_contents_)); 219 Source<WebContents>(web_contents_));
220 notification_registrar_.Add( 220 notification_registrar_.Add(
221 this, NOTIFICATION_RENDERER_PROCESS_CREATED,
222 content::NotificationService::AllBrowserContextsAndSources());
223 notification_registrar_.Add(
224 this, NOTIFICATION_WEB_CONTENTS_CONNECTED, 221 this, NOTIFICATION_WEB_CONTENTS_CONNECTED,
225 Source<WebContents>(web_contents_)); 222 Source<WebContents>(web_contents_));
226 223
227 static_cast<WebContentsViewAndroid*>(web_contents_->GetView())-> 224 static_cast<WebContentsViewAndroid*>(web_contents_->GetView())->
228 SetContentViewCore(this); 225 SetContentViewCore(this);
229 DCHECK(!web_contents_->GetUserData(kContentViewUserDataKey)); 226 DCHECK(!web_contents_->GetUserData(kContentViewUserDataKey));
230 web_contents_->SetUserData(kContentViewUserDataKey, 227 web_contents_->SetUserData(kContentViewUserDataKey,
231 new ContentViewUserData(this)); 228 new ContentViewUserData(this));
232 } 229 }
233 230
(...skipping 16 matching lines...) Expand all
250 JNIEnv* env = AttachCurrentThread(); 247 JNIEnv* env = AttachCurrentThread();
251 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 248 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
252 if (!obj.is_null()) { 249 if (!obj.is_null()) {
253 Java_ContentViewCore_onRenderProcessSwap( 250 Java_ContentViewCore_onRenderProcessSwap(
254 env, obj.obj(), old_pid, new_pid); 251 env, obj.obj(), old_pid, new_pid);
255 } 252 }
256 } 253 }
257 SetFocusInternal(HasFocus()); 254 SetFocusInternal(HasFocus());
258 break; 255 break;
259 } 256 }
260 case NOTIFICATION_RENDERER_PROCESS_CREATED: {
261 // Notify the Java side of the current renderer process.
262 RenderProcessHost* source_process_host =
263 Source<RenderProcessHost>(source).ptr();
264 RenderProcessHost* current_process_host =
265 web_contents_->GetRenderViewHost()->GetProcess();
266
267 if (source_process_host == current_process_host) {
268 int pid = GetRenderProcessIdFromRenderViewHost(
269 web_contents_->GetRenderViewHost());
270 JNIEnv* env = AttachCurrentThread();
271 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
272 if (!obj.is_null()) {
273 Java_ContentViewCore_onRenderProcessSwap(env, obj.obj(), 0, pid);
274 }
275 }
276 break;
277 }
278 case NOTIFICATION_WEB_CONTENTS_CONNECTED: { 257 case NOTIFICATION_WEB_CONTENTS_CONNECTED: {
279 JNIEnv* env = AttachCurrentThread(); 258 JNIEnv* env = AttachCurrentThread();
280 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 259 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
281 if (!obj.is_null()) { 260 if (!obj.is_null()) {
282 Java_ContentViewCore_onWebContentsConnected(env, obj.obj()); 261 Java_ContentViewCore_onWebContentsConnected(env, obj.obj());
283 } 262 }
284 break; 263 break;
285 } 264 }
286 } 265 }
287 } 266 }
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 reinterpret_cast<ui::ViewAndroid*>(view_android), 1628 reinterpret_cast<ui::ViewAndroid*>(view_android),
1650 reinterpret_cast<ui::WindowAndroid*>(window_android)); 1629 reinterpret_cast<ui::WindowAndroid*>(window_android));
1651 return reinterpret_cast<jint>(view); 1630 return reinterpret_cast<jint>(view);
1652 } 1631 }
1653 1632
1654 bool RegisterContentViewCore(JNIEnv* env) { 1633 bool RegisterContentViewCore(JNIEnv* env) {
1655 return RegisterNativesImpl(env); 1634 return RegisterNativesImpl(env);
1656 } 1635 }
1657 1636
1658 } // namespace content 1637 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698