OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/android/find_in_page/find_in_page_bridge.h" | 5 #include "chrome/browser/android/find_in_page/find_in_page_bridge.h" |
6 | 6 |
7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
8 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 8 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
10 #include "jni/FindInPageBridge_jni.h" | 10 #include "jni/FindInPageBridge_jni.h" |
11 | 11 |
12 using base::android::ConvertUTF16ToJavaString; | 12 using base::android::ConvertUTF16ToJavaString; |
| 13 using base::android::JavaParamRef; |
| 14 using base::android::ScopedJavaLocalRef; |
13 | 15 |
14 FindInPageBridge::FindInPageBridge(JNIEnv* env, | 16 FindInPageBridge::FindInPageBridge(JNIEnv* env, |
15 jobject obj, | 17 jobject obj, |
16 jobject j_web_contents) | 18 jobject j_web_contents) |
17 : weak_java_ref_(env, obj) { | 19 : weak_java_ref_(env, obj) { |
18 web_contents_ = content::WebContents::FromJavaWebContents(j_web_contents); | 20 web_contents_ = content::WebContents::FromJavaWebContents(j_web_contents); |
19 } | 21 } |
20 | 22 |
21 void FindInPageBridge::Destroy(JNIEnv*, const JavaParamRef<jobject>&) { | 23 void FindInPageBridge::Destroy(JNIEnv*, const JavaParamRef<jobject>&) { |
22 delete this; | 24 delete this; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 static jlong Init(JNIEnv* env, | 78 static jlong Init(JNIEnv* env, |
77 const JavaParamRef<jobject>& obj, | 79 const JavaParamRef<jobject>& obj, |
78 const JavaParamRef<jobject>& j_web_contents) { | 80 const JavaParamRef<jobject>& j_web_contents) { |
79 FindInPageBridge* bridge = new FindInPageBridge(env, obj, j_web_contents); | 81 FindInPageBridge* bridge = new FindInPageBridge(env, obj, j_web_contents); |
80 return reinterpret_cast<intptr_t>(bridge); | 82 return reinterpret_cast<intptr_t>(bridge); |
81 } | 83 } |
82 | 84 |
83 bool FindInPageBridge::RegisterFindInPageBridge(JNIEnv* env) { | 85 bool FindInPageBridge::RegisterFindInPageBridge(JNIEnv* env) { |
84 return RegisterNativesImpl(env); | 86 return RegisterNativesImpl(env); |
85 } | 87 } |
OLD | NEW |