| 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_web_contents_delegate.h" | 5 #include "android_webview/native/aw_web_contents_delegate.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "android_webview/browser/find_helper.h" |
| 9 #include "android_webview/native/aw_contents.h" |
| 8 #include "android_webview/native/aw_javascript_dialog_creator.h" | 10 #include "android_webview/native/aw_javascript_dialog_creator.h" |
| 11 #include "content/public/browser/web_contents.h" |
| 12 |
| 13 using content::WebContents; |
| 9 | 14 |
| 10 namespace android_webview { | 15 namespace android_webview { |
| 11 | 16 |
| 12 static base::LazyInstance<AwJavaScriptDialogCreator>::Leaky | 17 static base::LazyInstance<AwJavaScriptDialogCreator>::Leaky |
| 13 g_javascript_dialog_creator = LAZY_INSTANCE_INITIALIZER; | 18 g_javascript_dialog_creator = LAZY_INSTANCE_INITIALIZER; |
| 14 | 19 |
| 15 AwWebContentsDelegate::AwWebContentsDelegate( | 20 AwWebContentsDelegate::AwWebContentsDelegate( |
| 16 JNIEnv* env, | 21 JNIEnv* env, |
| 17 jobject obj) | 22 jobject obj) |
| 18 : WebContentsDelegateAndroid(env, obj) { | 23 : WebContentsDelegateAndroid(env, obj) { |
| 19 } | 24 } |
| 20 | 25 |
| 21 AwWebContentsDelegate::~AwWebContentsDelegate() { | 26 AwWebContentsDelegate::~AwWebContentsDelegate() { |
| 22 } | 27 } |
| 23 | 28 |
| 24 content::JavaScriptDialogCreator* | 29 content::JavaScriptDialogCreator* |
| 25 AwWebContentsDelegate::GetJavaScriptDialogCreator() { | 30 AwWebContentsDelegate::GetJavaScriptDialogCreator() { |
| 26 return g_javascript_dialog_creator.Pointer(); | 31 return g_javascript_dialog_creator.Pointer(); |
| 27 } | 32 } |
| 28 | 33 |
| 34 void AwWebContentsDelegate::FindReply(WebContents* web_contents, |
| 35 int request_id, |
| 36 int number_of_matches, |
| 37 const gfx::Rect& selection_rect, |
| 38 int active_match_ordinal, |
| 39 bool final_update) { |
| 40 AwContents* aw_contents = AwContents::FromWebContents(web_contents); |
| 41 if (!aw_contents) |
| 42 return; |
| 43 |
| 44 aw_contents->GetFindHelper()->HandleFindReply(request_id, |
| 45 number_of_matches, |
| 46 active_match_ordinal, |
| 47 final_update); |
| 48 } |
| 49 |
| 29 } // namespace android_webview | 50 } // namespace android_webview |
| OLD | NEW |