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" | |
| 12 #include "content/public/browser/download_item.h" | |
|
joth
2012/10/12 20:50:03
nit: forward declare DownloadItem rather than #inc
nilesh
2012/10/12 21:07:45
Done.
| |
| 11 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 14 #include "net/http/http_request_headers.h" | |
| 12 | 15 |
| 13 using content::WebContents; | 16 using content::WebContents; |
| 14 | 17 |
| 15 namespace android_webview { | 18 namespace android_webview { |
| 16 | 19 |
| 17 static base::LazyInstance<AwJavaScriptDialogCreator>::Leaky | 20 static base::LazyInstance<AwJavaScriptDialogCreator>::Leaky |
| 18 g_javascript_dialog_creator = LAZY_INSTANCE_INITIALIZER; | 21 g_javascript_dialog_creator = LAZY_INSTANCE_INITIALIZER; |
| 19 | 22 |
| 20 AwWebContentsDelegate::AwWebContentsDelegate( | 23 AwWebContentsDelegate::AwWebContentsDelegate( |
| 21 JNIEnv* env, | 24 JNIEnv* env, |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 40 AwContents* aw_contents = AwContents::FromWebContents(web_contents); | 43 AwContents* aw_contents = AwContents::FromWebContents(web_contents); |
| 41 if (!aw_contents) | 44 if (!aw_contents) |
| 42 return; | 45 return; |
| 43 | 46 |
| 44 aw_contents->GetFindHelper()->HandleFindReply(request_id, | 47 aw_contents->GetFindHelper()->HandleFindReply(request_id, |
| 45 number_of_matches, | 48 number_of_matches, |
| 46 active_match_ordinal, | 49 active_match_ordinal, |
| 47 final_update); | 50 final_update); |
| 48 } | 51 } |
| 49 | 52 |
| 53 bool AwWebContentsDelegate::CanDownload(content::RenderViewHost* source, | |
| 54 int request_id, | |
| 55 const std::string& request_method) { | |
| 56 if (request_method == net::HttpRequestHeaders::kGetMethod) { | |
| 57 content::DownloadControllerAndroid::Get()->CreateGETDownload( | |
| 58 source, request_id); | |
| 59 return false; | |
| 60 } | |
| 61 return true; | |
|
joth
2012/10/12 20:50:03
always return false here, as we (currently) never
nilesh
2012/10/12 21:07:45
Done.
nilesh
2012/10/12 21:31:19
I think you meant return false always, but still h
| |
| 62 } | |
| 63 | |
| 64 void AwWebContentsDelegate::OnStartDownload(WebContents* source, | |
| 65 content::DownloadItem* download) { | |
| 66 content::DownloadControllerAndroid::Get()->OnPostDownloadStarted( | |
| 67 source, download); | |
|
joth
2012/10/12 20:50:03
replace this with
NOTREACHED(); // We always retu
nilesh
2012/10/12 21:07:45
Done.
| |
| 68 } | |
| 69 | |
| 50 } // namespace android_webview | 70 } // namespace android_webview |
| OLD | NEW |