Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(807)

Side by Side Diff: android_webview/native/aw_web_contents_delegate.cc

Issue 11821011: Return false in AwWebContentsDelegate::CanDownload (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « android_webview/browser/aw_download_manager_delegate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "android_webview/browser/find_helper.h" 7 #include "android_webview/browser/find_helper.h"
8 #include "android_webview/native/aw_contents.h" 8 #include "android_webview/native/aw_contents.h"
9 #include "android_webview/native/aw_javascript_dialog_creator.h" 9 #include "android_webview/native/aw_javascript_dialog_creator.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "content/public/browser/android/download_controller_android.h"
14 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
15 #include "jni/AwWebContentsDelegate_jni.h" 14 #include "jni/AwWebContentsDelegate_jni.h"
16 #include "net/http/http_request_headers.h"
17 15
18 using base::android::AttachCurrentThread; 16 using base::android::AttachCurrentThread;
19 using base::android::ScopedJavaLocalRef; 17 using base::android::ScopedJavaLocalRef;
20 using content::WebContents; 18 using content::WebContents;
21 19
22 namespace android_webview { 20 namespace android_webview {
23 21
24 static base::LazyInstance<AwJavaScriptDialogCreator>::Leaky 22 static base::LazyInstance<AwJavaScriptDialogCreator>::Leaky
25 g_javascript_dialog_creator = LAZY_INSTANCE_INITIALIZER; 23 g_javascript_dialog_creator = LAZY_INSTANCE_INITIALIZER;
26 24
(...skipping 23 matching lines...) Expand all
50 48
51 aw_contents->GetFindHelper()->HandleFindReply(request_id, 49 aw_contents->GetFindHelper()->HandleFindReply(request_id,
52 number_of_matches, 50 number_of_matches,
53 active_match_ordinal, 51 active_match_ordinal,
54 final_update); 52 final_update);
55 } 53 }
56 54
57 bool AwWebContentsDelegate::CanDownload(content::RenderViewHost* source, 55 bool AwWebContentsDelegate::CanDownload(content::RenderViewHost* source,
58 int request_id, 56 int request_id,
59 const std::string& request_method) { 57 const std::string& request_method) {
60 if (request_method == net::HttpRequestHeaders::kGetMethod) {
61 content::DownloadControllerAndroid::Get()->CreateGETDownload(
62 source, request_id);
63 }
64 return false; 58 return false;
boliu 2013/01/09 00:47:46 could you put a NOTREACHED here?
joth 2013/01/09 00:53:18 +1 also lets add a comment to explain why: // And
nilesh 2013/01/09 01:01:39 Added NOTREACHED and explanation. I have skipped t
65 } 59 }
66 60
67 void AwWebContentsDelegate::OnStartDownload(WebContents* source, 61 void AwWebContentsDelegate::OnStartDownload(WebContents* source,
68 content::DownloadItem* download) { 62 content::DownloadItem* download) {
69 NOTREACHED(); // We always return false in CanDownload. 63 NOTREACHED(); // We always return false in CanDownload.
70 } 64 }
71 65
72 void AwWebContentsDelegate::AddNewContents(content::WebContents* source, 66 void AwWebContentsDelegate::AddNewContents(content::WebContents* source,
73 content::WebContents* new_contents, 67 content::WebContents* new_contents,
74 WindowOpenDisposition disposition, 68 WindowOpenDisposition disposition,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 if (java_delegate.obj()) { 120 if (java_delegate.obj()) {
127 Java_AwWebContentsDelegate_activateContents(env, java_delegate.obj()); 121 Java_AwWebContentsDelegate_activateContents(env, java_delegate.obj());
128 } 122 }
129 } 123 }
130 124
131 bool RegisterAwWebContentsDelegate(JNIEnv* env) { 125 bool RegisterAwWebContentsDelegate(JNIEnv* env) {
132 return RegisterNativesImpl(env); 126 return RegisterNativesImpl(env);
133 } 127 }
134 128
135 } // namespace android_webview 129 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/aw_download_manager_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698