| OLD | NEW |
| 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/common/render_view_messages.h" |
| 8 #include "android_webview/native/aw_browser_dependency_factory.h" | 9 #include "android_webview/native/aw_browser_dependency_factory.h" |
| 9 #include "android_webview/native/aw_contents_container.h" | 10 #include "android_webview/native/aw_contents_container.h" |
| 10 #include "android_webview/native/aw_web_contents_delegate.h" | 11 #include "android_webview/native/aw_web_contents_delegate.h" |
| 11 #include "android_webview/native/aw_contents_io_thread_client_impl.h" | 12 #include "android_webview/native/aw_contents_io_thread_client_impl.h" |
| 12 #include "base/android/jni_android.h" | 13 #include "base/android/jni_android.h" |
| 13 #include "base/android/jni_string.h" | 14 #include "base/android/jni_string.h" |
| 14 #include "base/bind.h" | 15 #include "base/bind.h" |
| 15 #include "base/callback.h" | 16 #include "base/callback.h" |
| 16 #include "base/supports_user_data.h" | 17 #include "base/supports_user_data.h" |
| 17 #include "content/public/browser/android/content_view_core.h" | 18 #include "content/public/browser/android/content_view_core.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 } | 237 } |
| 237 | 238 |
| 238 void AwContents::FindNext(JNIEnv* env, jobject obj, jboolean forward) { | 239 void AwContents::FindNext(JNIEnv* env, jobject obj, jboolean forward) { |
| 239 GetFindHelper()->FindNext(forward); | 240 GetFindHelper()->FindNext(forward); |
| 240 } | 241 } |
| 241 | 242 |
| 242 void AwContents::ClearMatches(JNIEnv* env, jobject obj) { | 243 void AwContents::ClearMatches(JNIEnv* env, jobject obj) { |
| 243 GetFindHelper()->ClearMatches(); | 244 GetFindHelper()->ClearMatches(); |
| 244 } | 245 } |
| 245 | 246 |
| 247 void AwContents::ClearCache(JNIEnv* env, jobject obj) { |
| 248 render_view_host_ext_->Send(new AwViewMsg_ClearCache); |
| 249 } |
| 250 |
| 246 FindHelper* AwContents::GetFindHelper() { | 251 FindHelper* AwContents::GetFindHelper() { |
| 247 if (!find_helper_.get()) { | 252 if (!find_helper_.get()) { |
| 248 WebContents* web_contents = contents_container_->GetWebContents(); | 253 WebContents* web_contents = contents_container_->GetWebContents(); |
| 249 find_helper_.reset(new FindHelper(web_contents)); | 254 find_helper_.reset(new FindHelper(web_contents)); |
| 250 find_helper_->SetListener(this); | 255 find_helper_->SetListener(this); |
| 251 } | 256 } |
| 252 return find_helper_.get(); | 257 return find_helper_.get(); |
| 253 } | 258 } |
| 254 | 259 |
| 255 void AwContents::OnFindResultReceived(int active_ordinal, | 260 void AwContents::OnFindResultReceived(int active_ordinal, |
| 256 int match_count, | 261 int match_count, |
| 257 bool finished) { | 262 bool finished) { |
| 258 JNIEnv* env = AttachCurrentThread(); | 263 JNIEnv* env = AttachCurrentThread(); |
| 259 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 264 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 260 if (obj.is_null()) | 265 if (obj.is_null()) |
| 261 return; | 266 return; |
| 262 | 267 |
| 263 Java_AwContents_onFindResultReceived( | 268 Java_AwContents_onFindResultReceived( |
| 264 env, obj.obj(), active_ordinal, match_count, finished); | 269 env, obj.obj(), active_ordinal, match_count, finished); |
| 265 } | 270 } |
| 266 | 271 |
| 267 } // namespace android_webview | 272 } // namespace android_webview |
| OLD | NEW |