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

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

Issue 1489453003: jni: Pass method parameters as JavaParamRef in content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/web_contents_observer_proxy.h" 5 #include "content/browser/android/web_contents_observer_proxy.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_string.h" 10 #include "base/android/jni_string.h"
(...skipping 30 matching lines...) Expand all
41 const JavaParamRef<jobject>& java_web_contents) { 41 const JavaParamRef<jobject>& java_web_contents) {
42 WebContents* web_contents = 42 WebContents* web_contents =
43 WebContents::FromJavaWebContents(java_web_contents); 43 WebContents::FromJavaWebContents(java_web_contents);
44 CHECK(web_contents); 44 CHECK(web_contents);
45 45
46 WebContentsObserverProxy* native_observer = 46 WebContentsObserverProxy* native_observer =
47 new WebContentsObserverProxy(env, obj, web_contents); 47 new WebContentsObserverProxy(env, obj, web_contents);
48 return reinterpret_cast<intptr_t>(native_observer); 48 return reinterpret_cast<intptr_t>(native_observer);
49 } 49 }
50 50
51 void WebContentsObserverProxy::Destroy(JNIEnv* env, jobject obj) { 51 void WebContentsObserverProxy::Destroy(JNIEnv* env,
52 const JavaParamRef<jobject>& obj) {
52 delete this; 53 delete this;
53 } 54 }
54 55
55 void WebContentsObserverProxy::WebContentsDestroyed() { 56 void WebContentsObserverProxy::WebContentsDestroyed() {
56 JNIEnv* env = AttachCurrentThread(); 57 JNIEnv* env = AttachCurrentThread();
57 ScopedJavaLocalRef<jobject> obj(java_observer_); 58 ScopedJavaLocalRef<jobject> obj(java_observer_);
58 // The java side will destroy |this| 59 // The java side will destroy |this|
59 Java_WebContentsObserverProxy_destroy(env, obj.obj()); 60 Java_WebContentsObserverProxy_destroy(env, obj.obj());
60 } 61 }
61 62
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 web_contents()->GetController().GetLastCommittedEntry(); 305 web_contents()->GetController().GetLastCommittedEntry();
305 // Note that GetBaseURLForDataURL is only used by the Android WebView. 306 // Note that GetBaseURLForDataURL is only used by the Android WebView.
306 if (entry && !entry->GetBaseURLForDataURL().is_empty()) 307 if (entry && !entry->GetBaseURLForDataURL().is_empty())
307 *url = entry->GetBaseURLForDataURL().possibly_invalid_spec(); 308 *url = entry->GetBaseURLForDataURL().possibly_invalid_spec();
308 } 309 }
309 310
310 bool RegisterWebContentsObserverProxy(JNIEnv* env) { 311 bool RegisterWebContentsObserverProxy(JNIEnv* env) {
311 return RegisterNativesImpl(env); 312 return RegisterNativesImpl(env);
312 } 313 }
313 } // namespace content 314 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698