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

Side by Side Diff: android_webview/native/aw_contents.cc

Issue 10702083: Add ContentViewDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nits Created 8 years, 3 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
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 "android_webview/native/aw_contents.h" 5 #include "android_webview/native/aw_contents.h"
6 6
7 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" 7 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h"
8 #include "android_webview/native/aw_browser_dependency_factory.h" 8 #include "android_webview/native/aw_browser_dependency_factory.h"
9 #include "android_webview/native/aw_contents_container.h" 9 #include "android_webview/native/aw_contents_container.h"
10 #include "android_webview/native/aw_web_contents_delegate.h" 10 #include "android_webview/native/aw_web_contents_delegate.h"
11 #include "android_webview/native/aw_contents_io_thread_client.h"
11 #include "base/android/jni_android.h" 12 #include "base/android/jni_android.h"
12 #include "base/android/jni_string.h" 13 #include "base/android/jni_string.h"
13 #include "base/bind.h" 14 #include "base/bind.h"
14 #include "base/callback.h" 15 #include "base/callback.h"
15 #include "base/supports_user_data.h" 16 #include "base/supports_user_data.h"
16 #include "content/public/browser/android/content_view_core.h" 17 #include "content/public/browser/android/content_view_core.h"
17 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
18 #include "jni/AwContents_jni.h" 19 #include "jni/AwContents_jni.h"
19 20
20 using base::android::AttachCurrentThread; 21 using base::android::AttachCurrentThread;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 98 }
98 } // namespace 99 } // namespace
99 100
100 void AwContents::DocumentHasImages(JNIEnv* env, jobject obj, jobject message) { 101 void AwContents::DocumentHasImages(JNIEnv* env, jobject obj, jobject message) {
101 render_view_host_ext_->DocumentHasImages( 102 render_view_host_ext_->DocumentHasImages(
102 base::Bind(&DocumentHasImagesCallback, 103 base::Bind(&DocumentHasImagesCallback,
103 base::Owned(new ScopedJavaGlobalRef<jobject>( 104 base::Owned(new ScopedJavaGlobalRef<jobject>(
104 ScopedJavaLocalRef<jobject>(env, message))))); 105 ScopedJavaLocalRef<jobject>(env, message)))));
105 } 106 }
106 107
108 void AwContents::SetIoThreadClient(JNIEnv* env, jobject obj, jobject client) {
joth 2012/09/13 20:09:12 DCHECK(CurrentlyOn(UIThread)) --seems it would be
mkosiba (inactive) 2012/09/17 17:48:22 Done.
109 content::WebContents* web_contents = contents_container_->GetWebContents();
110 AwContentsIoThreadClient::Associate(
111 web_contents, ScopedJavaLocalRef<jobject>(env, client));
112 }
113
107 static jint Init(JNIEnv* env, 114 static jint Init(JNIEnv* env,
108 jobject obj, 115 jobject obj,
109 jobject web_contents_delegate, 116 jobject web_contents_delegate,
110 jboolean private_browsing) { 117 jboolean private_browsing) {
111 AwContents* tab = new AwContents(env, obj, web_contents_delegate, 118 AwContents* tab = new AwContents(env, obj, web_contents_delegate,
112 private_browsing); 119 private_browsing);
113 return reinterpret_cast<jint>(tab); 120 return reinterpret_cast<jint>(tab);
114 } 121 }
115 122
116 bool RegisterAwContents(JNIEnv* env) { 123 bool RegisterAwContents(JNIEnv* env) {
117 return RegisterNativesImpl(env) >= 0; 124 return RegisterNativesImpl(env) >= 0;
118 } 125 }
119 126
120 127
121 } // namespace android_webview 128 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698