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

Side by Side Diff: chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc

Issue 436703002: Revert external protocol handler user gesture fix on M36 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1985/src
Patch Set: Created 6 years, 4 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
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 "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" 5 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 Profile* profile = 191 Profile* profile =
192 Profile::FromBrowserContext(web_contents->GetBrowserContext()); 192 Profile::FromBrowserContext(web_contents->GetBrowserContext());
193 193
194 StreamsPrivateAPI* streams_private = StreamsPrivateAPI::Get(profile); 194 StreamsPrivateAPI* streams_private = StreamsPrivateAPI::Get(profile);
195 if (!streams_private) 195 if (!streams_private)
196 return; 196 return;
197 streams_private->ExecuteMimeTypeHandler( 197 streams_private->ExecuteMimeTypeHandler(
198 extension_id, web_contents, stream.Pass(), expected_content_size); 198 extension_id, web_contents, stream.Pass(), expected_content_size);
199 } 199 }
200 200
201 void LaunchURL(const GURL& url, int render_process_id, int render_view_id, 201 void LaunchURL(const GURL& url, int render_process_id, int render_view_id) {
202 bool user_gesture) {
203 // If there is no longer a WebContents, the request may have raced with tab 202 // If there is no longer a WebContents, the request may have raced with tab
204 // closing. Don't fire the external request. (It may have been a prerender.) 203 // closing. Don't fire the external request. (It may have been a prerender.)
205 content::WebContents* web_contents = 204 content::WebContents* web_contents =
206 tab_util::GetWebContentsByID(render_process_id, render_view_id); 205 tab_util::GetWebContentsByID(render_process_id, render_view_id);
207 if (!web_contents) 206 if (!web_contents)
208 return; 207 return;
209 208
210 // Do not launch external requests attached to unswapped prerenders. 209 // Do not launch external requests attached to unswapped prerenders.
211 prerender::PrerenderContents* prerender_contents = 210 prerender::PrerenderContents* prerender_contents =
212 prerender::PrerenderContents::FromWebContents(web_contents); 211 prerender::PrerenderContents::FromWebContents(web_contents);
213 if (prerender_contents) { 212 if (prerender_contents) {
214 prerender_contents->Destroy(prerender::FINAL_STATUS_UNSUPPORTED_SCHEME); 213 prerender_contents->Destroy(prerender::FINAL_STATUS_UNSUPPORTED_SCHEME);
215 prerender::ReportPrerenderExternalURL(); 214 prerender::ReportPrerenderExternalURL();
216 return; 215 return;
217 } 216 }
218 217
219 ExternalProtocolHandler::LaunchUrlWithDelegate( 218 ExternalProtocolHandler::LaunchUrlWithDelegate(
220 url, render_process_id, render_view_id, 219 url,
221 g_external_protocol_handler_delegate, 220 render_process_id,
222 user_gesture); 221 render_view_id,
222 g_external_protocol_handler_delegate);
223 } 223 }
224 #endif // !defined(OS_ANDROID) 224 #endif // !defined(OS_ANDROID)
225 225
226 void AppendComponentUpdaterThrottles( 226 void AppendComponentUpdaterThrottles(
227 net::URLRequest* request, 227 net::URLRequest* request,
228 content::ResourceContext* resource_context, 228 content::ResourceContext* resource_context,
229 ResourceType::Type resource_type, 229 ResourceType::Type resource_type,
230 ScopedVector<content::ResourceThrottle>* throttles) { 230 ScopedVector<content::ResourceThrottle>* throttles) {
231 const char* crx_id = NULL; 231 const char* crx_id = NULL;
232 component_updater::ComponentUpdateService* cus = 232 component_updater::ComponentUpdateService* cus =
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 438
439 ResourceDispatcherHostLoginDelegate* 439 ResourceDispatcherHostLoginDelegate*
440 ChromeResourceDispatcherHostDelegate::CreateLoginDelegate( 440 ChromeResourceDispatcherHostDelegate::CreateLoginDelegate(
441 net::AuthChallengeInfo* auth_info, net::URLRequest* request) { 441 net::AuthChallengeInfo* auth_info, net::URLRequest* request) {
442 return CreateLoginPrompt(auth_info, request); 442 return CreateLoginPrompt(auth_info, request);
443 } 443 }
444 444
445 bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( 445 bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol(
446 const GURL& url, 446 const GURL& url,
447 int child_id, 447 int child_id,
448 int route_id, 448 int route_id) {
449 bool initiated_by_user_gesture) {
450 #if defined(OS_ANDROID) 449 #if defined(OS_ANDROID)
451 // Android use a resource throttle to handle external as well as internal 450 // Android use a resource throttle to handle external as well as internal
452 // protocols. 451 // protocols.
453 return false; 452 return false;
454 #else 453 #else
455 454
456 ExtensionRendererState::WebViewInfo info; 455 ExtensionRendererState::WebViewInfo info;
457 if (ExtensionRendererState::GetInstance()->GetWebViewInfo(child_id, 456 if (ExtensionRendererState::GetInstance()->GetWebViewInfo(child_id,
458 route_id, 457 route_id,
459 &info)) { 458 &info)) {
460 return false; 459 return false;
461 } 460 }
462 461
463 BrowserThread::PostTask( 462 BrowserThread::PostTask(BrowserThread::UI,
464 BrowserThread::UI, FROM_HERE, 463 FROM_HERE,
465 base::Bind(&LaunchURL, url, child_id, route_id, 464 base::Bind(&LaunchURL, url, child_id, route_id));
466 initiated_by_user_gesture));
467 return true; 465 return true;
468 #endif 466 #endif
469 } 467 }
470 468
471 void ChromeResourceDispatcherHostDelegate::AppendStandardResourceThrottles( 469 void ChromeResourceDispatcherHostDelegate::AppendStandardResourceThrottles(
472 net::URLRequest* request, 470 net::URLRequest* request,
473 content::ResourceContext* resource_context, 471 content::ResourceContext* resource_context,
474 ResourceType::Type resource_type, 472 ResourceType::Type resource_type,
475 ScopedVector<content::ResourceThrottle>* throttles) { 473 ScopedVector<content::ResourceThrottle>* throttles) {
476 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); 474 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 url_request->GetTotalReceivedBytes())); 694 url_request->GetTotalReceivedBytes()));
697 } 695 }
698 } 696 }
699 697
700 // static 698 // static
701 void ChromeResourceDispatcherHostDelegate:: 699 void ChromeResourceDispatcherHostDelegate::
702 SetExternalProtocolHandlerDelegateForTesting( 700 SetExternalProtocolHandlerDelegateForTesting(
703 ExternalProtocolHandler::Delegate* delegate) { 701 ExternalProtocolHandler::Delegate* delegate) {
704 g_external_protocol_handler_delegate = delegate; 702 g_external_protocol_handler_delegate = delegate;
705 } 703 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.h ('k') | chrome/browser/ui/tab_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698