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

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

Issue 11640007: Make the UI an observer of downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
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"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 bool AwWebContentsDelegate::CanDownload(content::RenderViewHost* source, 57 bool AwWebContentsDelegate::CanDownload(content::RenderViewHost* source,
58 int request_id, 58 int request_id,
59 const std::string& request_method) { 59 const std::string& request_method) {
60 if (request_method == net::HttpRequestHeaders::kGetMethod) { 60 if (request_method == net::HttpRequestHeaders::kGetMethod) {
61 content::DownloadControllerAndroid::Get()->CreateGETDownload( 61 content::DownloadControllerAndroid::Get()->CreateGETDownload(
62 source, request_id); 62 source, request_id);
63 } 63 }
64 return false; 64 return false;
65 } 65 }
66 66
67 void AwWebContentsDelegate::OnStartDownload(WebContents* source,
68 content::DownloadItem* download) {
69 NOTREACHED(); // We always return false in CanDownload.
70 }
71
72 void AwWebContentsDelegate::AddNewContents(content::WebContents* source, 67 void AwWebContentsDelegate::AddNewContents(content::WebContents* source,
73 content::WebContents* new_contents, 68 content::WebContents* new_contents,
74 WindowOpenDisposition disposition, 69 WindowOpenDisposition disposition,
75 const gfx::Rect& initial_pos, 70 const gfx::Rect& initial_pos,
76 bool user_gesture, 71 bool user_gesture,
77 bool* was_blocked) { 72 bool* was_blocked) {
78 JNIEnv* env = AttachCurrentThread(); 73 JNIEnv* env = AttachCurrentThread();
79 74
80 bool is_dialog = disposition == NEW_POPUP; 75 bool is_dialog = disposition == NEW_POPUP;
81 ScopedJavaLocalRef<jobject> java_delegate = GetJavaDelegate(env); 76 ScopedJavaLocalRef<jobject> java_delegate = GetJavaDelegate(env);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 if (java_delegate.obj()) { 121 if (java_delegate.obj()) {
127 Java_AwWebContentsDelegate_activateContents(env, java_delegate.obj()); 122 Java_AwWebContentsDelegate_activateContents(env, java_delegate.obj());
128 } 123 }
129 } 124 }
130 125
131 bool RegisterAwWebContentsDelegate(JNIEnv* env) { 126 bool RegisterAwWebContentsDelegate(JNIEnv* env) {
132 return RegisterNativesImpl(env); 127 return RegisterNativesImpl(env);
133 } 128 }
134 129
135 } // namespace android_webview 130 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698