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

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

Issue 12218029: Attach ImeAdapter as soon as native side is ready (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months 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 | content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } 223 }
224 224
225 void ContentViewCoreImpl::InitWebContents() { 225 void ContentViewCoreImpl::InitWebContents() {
226 DCHECK(web_contents_); 226 DCHECK(web_contents_);
227 notification_registrar_.Add( 227 notification_registrar_.Add(
228 this, NOTIFICATION_RENDER_VIEW_HOST_CHANGED, 228 this, NOTIFICATION_RENDER_VIEW_HOST_CHANGED,
229 Source<NavigationController>(&web_contents_->GetController())); 229 Source<NavigationController>(&web_contents_->GetController()));
230 notification_registrar_.Add( 230 notification_registrar_.Add(
231 this, NOTIFICATION_RENDERER_PROCESS_CREATED, 231 this, NOTIFICATION_RENDERER_PROCESS_CREATED,
232 content::NotificationService::AllBrowserContextsAndSources()); 232 content::NotificationService::AllBrowserContextsAndSources());
233 notification_registrar_.Add(
234 this, NOTIFICATION_WEB_CONTENTS_CONNECTED,
235 Source<WebContents>(web_contents_));
233 236
234 static_cast<WebContentsViewAndroid*>(web_contents_->GetView())-> 237 static_cast<WebContentsViewAndroid*>(web_contents_->GetView())->
235 SetContentViewCore(this); 238 SetContentViewCore(this);
236 DCHECK(!web_contents_->GetUserData(kContentViewUserDataKey)); 239 DCHECK(!web_contents_->GetUserData(kContentViewUserDataKey));
237 web_contents_->SetUserData(kContentViewUserDataKey, 240 web_contents_->SetUserData(kContentViewUserDataKey,
238 new ContentViewUserData(this)); 241 new ContentViewUserData(this));
239 } 242 }
240 243
241 void ContentViewCoreImpl::Observe(int type, 244 void ContentViewCoreImpl::Observe(int type,
242 const NotificationSource& source, 245 const NotificationSource& source,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 int pid = GetRenderProcessIdFromRenderViewHost( 277 int pid = GetRenderProcessIdFromRenderViewHost(
275 web_contents_->GetRenderViewHost()); 278 web_contents_->GetRenderViewHost());
276 JNIEnv* env = AttachCurrentThread(); 279 JNIEnv* env = AttachCurrentThread();
277 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 280 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
278 if (!obj.is_null()) { 281 if (!obj.is_null()) {
279 Java_ContentViewCore_onRenderProcessSwap(env, obj.obj(), 0, pid); 282 Java_ContentViewCore_onRenderProcessSwap(env, obj.obj(), 0, pid);
280 } 283 }
281 } 284 }
282 break; 285 break;
283 } 286 }
287 case NOTIFICATION_WEB_CONTENTS_CONNECTED: {
288 JNIEnv* env = AttachCurrentThread();
289 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
290 if (!obj.is_null()) {
291 Java_ContentViewCore_onWebContentsConnected(env, obj.obj());
292 }
293 break;
294 }
284 } 295 }
285 } 296 }
286 297
287 void ContentViewCoreImpl::InitJNI(JNIEnv* env, jobject obj) { 298 void ContentViewCoreImpl::InitJNI(JNIEnv* env, jobject obj) {
288 java_object_ = new JavaObject; 299 java_object_ = new JavaObject;
289 java_object_->rect_clazz.Reset(GetClass(env, "android/graphics/Rect")); 300 java_object_->rect_clazz.Reset(GetClass(env, "android/graphics/Rect"));
290 java_object_->rect_constructor = MethodID::Get<MethodID::TYPE_INSTANCE>( 301 java_object_->rect_constructor = MethodID::Get<MethodID::TYPE_INSTANCE>(
291 env, java_object_->rect_clazz.obj(), "<init>", "(IIII)V"); 302 env, java_object_->rect_clazz.obj(), "<init>", "(IIII)V");
292 } 303 }
293 304
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { 1397 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) {
1387 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; 1398 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!";
1388 return false; 1399 return false;
1389 } 1400 }
1390 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); 1401 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I");
1391 1402
1392 return RegisterNativesImpl(env) >= 0; 1403 return RegisterNativesImpl(env) >= 0;
1393 } 1404 }
1394 1405
1395 } // namespace content 1406 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698