Chromium Code Reviews| 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 |
| 17 namespace content{ | |
| 18 class DownloadItem; | |
|
jam
2012/10/15 06:45:04
nit: unnecessary
nilesh
2012/10/15 17:13:51
Removed
| |
| 19 } | |
| 20 | |
| 15 namespace android_webview { | 21 namespace android_webview { |
| 16 | 22 |
| 17 static base::LazyInstance<AwJavaScriptDialogCreator>::Leaky | 23 static base::LazyInstance<AwJavaScriptDialogCreator>::Leaky |
| 18 g_javascript_dialog_creator = LAZY_INSTANCE_INITIALIZER; | 24 g_javascript_dialog_creator = LAZY_INSTANCE_INITIALIZER; |
| 19 | 25 |
| 20 AwWebContentsDelegate::AwWebContentsDelegate( | 26 AwWebContentsDelegate::AwWebContentsDelegate( |
| 21 JNIEnv* env, | 27 JNIEnv* env, |
| 22 jobject obj) | 28 jobject obj) |
| 23 : WebContentsDelegateAndroid(env, obj) { | 29 : WebContentsDelegateAndroid(env, obj) { |
| 24 } | 30 } |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 40 AwContents* aw_contents = AwContents::FromWebContents(web_contents); | 46 AwContents* aw_contents = AwContents::FromWebContents(web_contents); |
| 41 if (!aw_contents) | 47 if (!aw_contents) |
| 42 return; | 48 return; |
| 43 | 49 |
| 44 aw_contents->GetFindHelper()->HandleFindReply(request_id, | 50 aw_contents->GetFindHelper()->HandleFindReply(request_id, |
| 45 number_of_matches, | 51 number_of_matches, |
| 46 active_match_ordinal, | 52 active_match_ordinal, |
| 47 final_update); | 53 final_update); |
| 48 } | 54 } |
| 49 | 55 |
| 56 bool AwWebContentsDelegate::CanDownload(content::RenderViewHost* source, | |
|
joth
2012/10/12 23:03:48
as per my comment over in https://codereview.chrom
nilesh
2012/10/12 23:10:16
This will only be called if you use the Chrome Imp
| |
| 57 int request_id, | |
| 58 const std::string& request_method) { | |
| 59 if (request_method == net::HttpRequestHeaders::kGetMethod) { | |
| 60 content::DownloadControllerAndroid::Get()->CreateGETDownload( | |
| 61 source, request_id); | |
| 62 } | |
| 63 return false; | |
| 64 } | |
| 65 | |
| 66 void AwWebContentsDelegate::OnStartDownload(WebContents* source, | |
| 67 content::DownloadItem* download) { | |
| 68 NOTREACHED(); // We always return false in CanDownload. | |
| 69 } | |
| 70 | |
| 50 } // namespace android_webview | 71 } // namespace android_webview |
| OLD | NEW |