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( |
| 248 JNIEnv* env, |
| 249 jobject obj, |
| 250 jboolean include_disk_files) { |
| 251 render_view_host_ext_->Send(new AwViewMsg_ClearCache); |
| 252 // TODO(boliu): Implement clear network disk cache. |
| 253 } |
| 254 |
246 FindHelper* AwContents::GetFindHelper() { | 255 FindHelper* AwContents::GetFindHelper() { |
247 if (!find_helper_.get()) { | 256 if (!find_helper_.get()) { |
248 WebContents* web_contents = contents_container_->GetWebContents(); | 257 WebContents* web_contents = contents_container_->GetWebContents(); |
249 find_helper_.reset(new FindHelper(web_contents)); | 258 find_helper_.reset(new FindHelper(web_contents)); |
250 find_helper_->SetListener(this); | 259 find_helper_->SetListener(this); |
251 } | 260 } |
252 return find_helper_.get(); | 261 return find_helper_.get(); |
253 } | 262 } |
254 | 263 |
255 void AwContents::OnFindResultReceived(int active_ordinal, | 264 void AwContents::OnFindResultReceived(int active_ordinal, |
256 int match_count, | 265 int match_count, |
257 bool finished) { | 266 bool finished) { |
258 JNIEnv* env = AttachCurrentThread(); | 267 JNIEnv* env = AttachCurrentThread(); |
259 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 268 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
260 if (obj.is_null()) | 269 if (obj.is_null()) |
261 return; | 270 return; |
262 | 271 |
263 Java_AwContents_onFindResultReceived( | 272 Java_AwContents_onFindResultReceived( |
264 env, obj.obj(), active_ordinal, match_count, finished); | 273 env, obj.obj(), active_ordinal, match_count, finished); |
265 } | 274 } |
266 | 275 |
267 } // namespace android_webview | 276 } // namespace android_webview |
OLD | NEW |