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

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

Issue 1312153003: jni_generator: Pass object parameters as JavaParamRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 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
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 "android_webview/native/aw_contents.h" 5 #include "android_webview/native/aw_contents.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "android_webview/browser/aw_browser_context.h" 9 #include "android_webview/browser/aw_browser_context.h"
10 #include "android_webview/browser/aw_browser_main_parts.h" 10 #include "android_webview/browser/aw_browser_main_parts.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 const content::RenderViewHost* rvh = 156 const content::RenderViewHost* rvh =
157 content::RenderViewHost::FromID(render_process_id, render_view_id); 157 content::RenderViewHost::FromID(render_process_id, render_view_id);
158 if (!rvh) return NULL; 158 if (!rvh) return NULL;
159 content::WebContents* web_contents = 159 content::WebContents* web_contents =
160 content::WebContents::FromRenderViewHost(rvh); 160 content::WebContents::FromRenderViewHost(rvh);
161 if (!web_contents) return NULL; 161 if (!web_contents) return NULL;
162 return FromWebContents(web_contents); 162 return FromWebContents(web_contents);
163 } 163 }
164 164
165 // static 165 // static
166 void SetLocale(JNIEnv* env, jclass, jstring locale) { 166 void SetLocale(JNIEnv* env,
167 const JavaParamRef<jclass>&,
168 const JavaParamRef<jstring>& locale) {
167 g_locale = ConvertJavaStringToUTF8(env, locale); 169 g_locale = ConvertJavaStringToUTF8(env, locale);
168 } 170 }
169 171
170 // static 172 // static
171 std::string AwContents::GetLocale() { 173 std::string AwContents::GetLocale() {
172 return g_locale; 174 return g_locale;
173 } 175 }
174 176
175 // static 177 // static
176 AwBrowserPermissionRequestDelegate* AwBrowserPermissionRequestDelegate::FromID( 178 AwBrowserPermissionRequestDelegate* AwBrowserPermissionRequestDelegate::FromID(
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 return base::android::ScopedJavaLocalRef<jobject>(); 325 return base::android::ScopedJavaLocalRef<jobject>();
324 326
325 return web_contents_->GetJavaWebContents(); 327 return web_contents_->GetJavaWebContents();
326 } 328 }
327 329
328 void AwContents::Destroy(JNIEnv* env, jobject obj) { 330 void AwContents::Destroy(JNIEnv* env, jobject obj) {
329 java_ref_.reset(); 331 java_ref_.reset();
330 delete this; 332 delete this;
331 } 333 }
332 334
333 static jlong Init(JNIEnv* env, jclass, jobject browser_context) { 335 static jlong Init(JNIEnv* env,
336 const JavaParamRef<jclass>&,
337 const JavaParamRef<jobject>& browser_context) {
334 // TODO(joth): Use |browser_context| to get the native BrowserContext, rather 338 // TODO(joth): Use |browser_context| to get the native BrowserContext, rather
335 // than hard-code the default instance lookup here. 339 // than hard-code the default instance lookup here.
336 scoped_ptr<WebContents> web_contents(content::WebContents::Create( 340 scoped_ptr<WebContents> web_contents(content::WebContents::Create(
337 content::WebContents::CreateParams(AwBrowserContext::GetDefault()))); 341 content::WebContents::CreateParams(AwBrowserContext::GetDefault())));
338 // Return an 'uninitialized' instance; most work is deferred until the 342 // Return an 'uninitialized' instance; most work is deferred until the
339 // subsequent SetJavaPeers() call. 343 // subsequent SetJavaPeers() call.
340 return reinterpret_cast<intptr_t>(new AwContents(web_contents.Pass())); 344 return reinterpret_cast<intptr_t>(new AwContents(web_contents.Pass()));
341 } 345 }
342 346
343 static void SetForceAuxiliaryBitmapRendering( 347 static void SetForceAuxiliaryBitmapRendering(
344 JNIEnv* env, 348 JNIEnv* env,
345 jclass, 349 const JavaParamRef<jclass>&,
346 jboolean force_auxiliary_bitmap_rendering) { 350 jboolean force_auxiliary_bitmap_rendering) {
347 g_force_auxiliary_bitmap_rendering = force_auxiliary_bitmap_rendering; 351 g_force_auxiliary_bitmap_rendering = force_auxiliary_bitmap_rendering;
348 } 352 }
349 353
350 static void SetAwDrawSWFunctionTable(JNIEnv* env, jclass, 354 static void SetAwDrawSWFunctionTable(JNIEnv* env,
355 const JavaParamRef<jclass>&,
351 jlong function_table) { 356 jlong function_table) {
352 RasterHelperSetAwDrawSWFunctionTable( 357 RasterHelperSetAwDrawSWFunctionTable(
353 reinterpret_cast<AwDrawSWFunctionTable*>(function_table)); 358 reinterpret_cast<AwDrawSWFunctionTable*>(function_table));
354 } 359 }
355 360
356 static void SetAwDrawGLFunctionTable(JNIEnv* env, jclass, 361 static void SetAwDrawGLFunctionTable(JNIEnv* env,
357 jlong function_table) { 362 const JavaParamRef<jclass>&,
358 } 363 jlong function_table) {}
359 364
360 static jlong GetAwDrawGLFunction(JNIEnv* env, jclass) { 365 static jlong GetAwDrawGLFunction(JNIEnv* env, const JavaParamRef<jclass>&) {
361 return reinterpret_cast<intptr_t>(&DrawGLFunction); 366 return reinterpret_cast<intptr_t>(&DrawGLFunction);
362 } 367 }
363 368
364 // static 369 // static
365 jint GetNativeInstanceCount(JNIEnv* env, jclass) { 370 jint GetNativeInstanceCount(JNIEnv* env, const JavaParamRef<jclass>&) {
366 return base::subtle::NoBarrier_Load(&g_instance_count); 371 return base::subtle::NoBarrier_Load(&g_instance_count);
367 } 372 }
368 373
369 jlong AwContents::GetAwDrawGLViewContext(JNIEnv* env, jobject obj) { 374 jlong AwContents::GetAwDrawGLViewContext(JNIEnv* env, jobject obj) {
370 DCHECK_CURRENTLY_ON(BrowserThread::UI); 375 DCHECK_CURRENTLY_ON(BrowserThread::UI);
371 return reinterpret_cast<intptr_t>( 376 return reinterpret_cast<intptr_t>(
372 browser_view_renderer_.GetAwDrawGLViewContext()); 377 browser_view_renderer_.GetAwDrawGLViewContext());
373 } 378 }
374 379
375 namespace { 380 namespace {
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 1213
1209 AwMessagePortServiceImpl::GetInstance()->CreateMessageChannel(env, ports, 1214 AwMessagePortServiceImpl::GetInstance()->CreateMessageChannel(env, ports,
1210 GetMessagePortMessageFilter()); 1215 GetMessagePortMessageFilter());
1211 } 1216 }
1212 1217
1213 void AwContents::GrantFileSchemeAccesstoChildProcess(JNIEnv* env, jobject obj) { 1218 void AwContents::GrantFileSchemeAccesstoChildProcess(JNIEnv* env, jobject obj) {
1214 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( 1219 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme(
1215 web_contents_->GetRenderProcessHost()->GetID(), url::kFileScheme); 1220 web_contents_->GetRenderProcessHost()->GetID(), url::kFileScheme);
1216 } 1221 }
1217 1222
1218 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { 1223 void SetShouldDownloadFavicons(JNIEnv* env,
1224 const JavaParamRef<jclass>& jclazz) {
1219 g_should_download_favicons = true; 1225 g_should_download_favicons = true;
1220 } 1226 }
1221 1227
1222 } // namespace android_webview 1228 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/native/android_protocol_handler.cc ('k') | android_webview/native/aw_contents_statics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698