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

Side by Side Diff: android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc

Issue 11417061: [android_webview] Enable navigation interception for iframes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make findbugs happy? Created 8 years, 1 month 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/browser/renderer_host/aw_resource_dispatcher_host_dele gate.h" 5 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele gate.h"
6 6
7 #include "android_webview/browser/aw_login_delegate.h" 7 #include "android_webview/browser/aw_login_delegate.h"
8 #include "android_webview/browser/aw_contents_io_thread_client.h" 8 #include "android_webview/browser/aw_contents_io_thread_client.h"
9 #include "android_webview/common/url_constants.h" 9 #include "android_webview/common/url_constants.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 appcache::AppCacheService* appcache_service, 123 appcache::AppCacheService* appcache_service,
124 ResourceType::Type resource_type, 124 ResourceType::Type resource_type,
125 int child_id, 125 int child_id,
126 int route_id, 126 int route_id,
127 bool is_continuation_of_transferred_request, 127 bool is_continuation_of_transferred_request,
128 ScopedVector<content::ResourceThrottle>* throttles) { 128 ScopedVector<content::ResourceThrottle>* throttles) {
129 129
130 throttles->push_back(new MaybeCancelResourceThrottle( 130 throttles->push_back(new MaybeCancelResourceThrottle(
131 child_id, route_id, request)); 131 child_id, route_id, request));
132 132
133 if (resource_type == ResourceType::MAIN_FRAME) { 133 bool allow_intercepting =
134 // We ignore POST requests because of BUG=155250.
135 request->method() != "POST" &&
136 // We allow intercepting navigations within subframes, but only if the
137 // scheme other than http or https. This is because the embedder
138 // can't distinguish main frame and subframe callbacks (which could lead
139 // to broken content if the embedder decides to not ignore the main frame
140 // navigation, but ignores the subframe navigation).
141 // The reason this is supported at all is that certain JavaScript-based
142 // frameworks use iframe navigation as a form of communication with the
143 // embedder.
144 (resource_type == ResourceType::MAIN_FRAME ||
145 (resource_type == ResourceType::SUB_FRAME &&
146 !request->url().SchemeIs(chrome::kHttpScheme) &&
147 !request->url().SchemeIs(chrome::kHttpsScheme)));
148 if (allow_intercepting) {
134 throttles->push_back(InterceptNavigationDelegate::CreateThrottleFor( 149 throttles->push_back(InterceptNavigationDelegate::CreateThrottleFor(
135 request)); 150 request));
136 } 151 }
137 } 152 }
138 153
139 bool AwResourceDispatcherHostDelegate::AcceptAuthRequest( 154 bool AwResourceDispatcherHostDelegate::AcceptAuthRequest(
140 net::URLRequest* request, 155 net::URLRequest* request,
141 net::AuthChallengeInfo* auth_info) { 156 net::AuthChallengeInfo* auth_info) {
142 return true; 157 return true;
143 } 158 }
144 159
145 content::ResourceDispatcherHostLoginDelegate* 160 content::ResourceDispatcherHostLoginDelegate*
146 AwResourceDispatcherHostDelegate::CreateLoginDelegate( 161 AwResourceDispatcherHostDelegate::CreateLoginDelegate(
147 net::AuthChallengeInfo* auth_info, 162 net::AuthChallengeInfo* auth_info,
148 net::URLRequest* request) { 163 net::URLRequest* request) {
149 return new AwLoginDelegate(auth_info, request); 164 return new AwLoginDelegate(auth_info, request);
150 } 165 }
151 166
152 bool AwResourceDispatcherHostDelegate::HandleExternalProtocol(const GURL& url, 167 bool AwResourceDispatcherHostDelegate::HandleExternalProtocol(const GURL& url,
153 int child_id, 168 int child_id,
154 int route_id) { 169 int route_id) {
155 // The AwURLRequestJobFactory implementation should ensure this method never 170 // The AwURLRequestJobFactory implementation should ensure this method never
156 // gets called. 171 // gets called.
157 NOTREACHED(); 172 NOTREACHED();
158 return false; 173 return false;
159 } 174 }
160 175
161 } 176 }
OLDNEW
« no previous file with comments | « no previous file | android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldIgnoreNavigationTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698