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" | 8 #include "android_webview/browser/find_helper.h" |
9 #include "android_webview/native/aw_contents.h" | 9 #include "android_webview/native/aw_contents.h" |
10 #include "android_webview/native/aw_javascript_dialog_creator.h" | 10 #include "android_webview/native/aw_javascript_dialog_creator.h" |
| 11 #include "content/public/browser/android/download_controller_android.h" |
11 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 13 #include "net/http/http_request_headers.h" |
12 | 14 |
13 using content::WebContents; | 15 using content::WebContents; |
14 | 16 |
15 namespace android_webview { | 17 namespace android_webview { |
16 | 18 |
17 static base::LazyInstance<AwJavaScriptDialogCreator>::Leaky | 19 static base::LazyInstance<AwJavaScriptDialogCreator>::Leaky |
18 g_javascript_dialog_creator = LAZY_INSTANCE_INITIALIZER; | 20 g_javascript_dialog_creator = LAZY_INSTANCE_INITIALIZER; |
19 | 21 |
20 AwWebContentsDelegate::AwWebContentsDelegate( | 22 AwWebContentsDelegate::AwWebContentsDelegate( |
21 JNIEnv* env, | 23 JNIEnv* env, |
(...skipping 18 matching lines...) Expand all Loading... |
40 AwContents* aw_contents = AwContents::FromWebContents(web_contents); | 42 AwContents* aw_contents = AwContents::FromWebContents(web_contents); |
41 if (!aw_contents) | 43 if (!aw_contents) |
42 return; | 44 return; |
43 | 45 |
44 aw_contents->GetFindHelper()->HandleFindReply(request_id, | 46 aw_contents->GetFindHelper()->HandleFindReply(request_id, |
45 number_of_matches, | 47 number_of_matches, |
46 active_match_ordinal, | 48 active_match_ordinal, |
47 final_update); | 49 final_update); |
48 } | 50 } |
49 | 51 |
| 52 bool AwWebContentsDelegate::CanDownload(content::RenderViewHost* source, |
| 53 int request_id, |
| 54 const std::string& request_method) { |
| 55 if (request_method == net::HttpRequestHeaders::kGetMethod) { |
| 56 content::DownloadControllerAndroid::Get()->CreateGETDownload( |
| 57 source, request_id); |
| 58 } |
| 59 return false; |
| 60 } |
| 61 |
| 62 void AwWebContentsDelegate::OnStartDownload(WebContents* source, |
| 63 content::DownloadItem* download) { |
| 64 NOTREACHED(); // We always return false in CanDownload. |
| 65 } |
| 66 |
50 } // namespace android_webview | 67 } // namespace android_webview |
OLD | NEW |