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

Side by Side Diff: content/browser/web_contents/web_contents_android.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/web_contents/web_contents_android.h" 5 #include "content/browser/web_contents/web_contents_android.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/command_line.h" 10 #include "base/command_line.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 reinterpret_cast<WebContentsAndroid*>( 149 reinterpret_cast<WebContentsAndroid*>(
150 Java_WebContentsImpl_getNativePointer(AttachCurrentThread(), 150 Java_WebContentsImpl_getNativePointer(AttachCurrentThread(),
151 jweb_contents_android)); 151 jweb_contents_android));
152 if (!web_contents_android) 152 if (!web_contents_android)
153 return NULL; 153 return NULL;
154 return web_contents_android->web_contents(); 154 return web_contents_android->web_contents();
155 } 155 }
156 156
157 // static 157 // static
158 static void DestroyWebContents(JNIEnv* env, 158 static void DestroyWebContents(JNIEnv* env,
159 jclass clazz, 159 const JavaParamRef<jclass>& clazz,
160 jlong jweb_contents_android_ptr) { 160 jlong jweb_contents_android_ptr) {
161 WebContentsAndroid* web_contents_android = 161 WebContentsAndroid* web_contents_android =
162 reinterpret_cast<WebContentsAndroid*>(jweb_contents_android_ptr); 162 reinterpret_cast<WebContentsAndroid*>(jweb_contents_android_ptr);
163 if (!web_contents_android) 163 if (!web_contents_android)
164 return; 164 return;
165 165
166 WebContents* web_contents = web_contents_android->web_contents(); 166 WebContents* web_contents = web_contents_android->web_contents();
167 if (!web_contents) 167 if (!web_contents)
168 return; 168 return;
169 169
170 delete web_contents; 170 delete web_contents;
171 } 171 }
172 172
173 // static 173 // static
174 ScopedJavaLocalRef<jobject> FromNativePtr(JNIEnv* env, 174 ScopedJavaLocalRef<jobject> FromNativePtr(JNIEnv* env,
175 jclass clazz, 175 const JavaParamRef<jclass>& clazz,
176 jlong web_contents_ptr) { 176 jlong web_contents_ptr) {
177 WebContentsAndroid* web_contents_android = 177 WebContentsAndroid* web_contents_android =
178 reinterpret_cast<WebContentsAndroid*>(web_contents_ptr); 178 reinterpret_cast<WebContentsAndroid*>(web_contents_ptr);
179 179
180 if (!web_contents_android) 180 if (!web_contents_android)
181 return ScopedJavaLocalRef<jobject>(); 181 return ScopedJavaLocalRef<jobject>();
182 182
183 // Check to make sure this object hasn't been destroyed. 183 // Check to make sure this object hasn't been destroyed.
184 if (g_allocated_web_contents_androids.Get().find(web_contents_android) == 184 if (g_allocated_web_contents_androids.Get().find(web_contents_android) ==
185 g_allocated_web_contents_androids.Get().end()) { 185 g_allocated_web_contents_androids.Get().end()) {
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 web_contents_->StopMediaSession(); 541 web_contents_->StopMediaSession();
542 } 542 }
543 543
544 ScopedJavaLocalRef<jstring> WebContentsAndroid::GetEncoding( 544 ScopedJavaLocalRef<jstring> WebContentsAndroid::GetEncoding(
545 JNIEnv* env, jobject obj) const { 545 JNIEnv* env, jobject obj) const {
546 return base::android::ConvertUTF8ToJavaString(env, 546 return base::android::ConvertUTF8ToJavaString(env,
547 web_contents_->GetEncoding()); 547 web_contents_->GetEncoding());
548 } 548 }
549 549
550 } // namespace content 550 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698