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

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

Issue 426713002: Revert of Fix the handling of user gestures for external protocol handler dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 StreamsPrivateAPI* streams_private = StreamsPrivateAPI::Get(profile); 191 StreamsPrivateAPI* streams_private = StreamsPrivateAPI::Get(profile);
192 if (!streams_private) 192 if (!streams_private)
193 return; 193 return;
194 streams_private->ExecuteMimeTypeHandler( 194 streams_private->ExecuteMimeTypeHandler(
195 extension_id, web_contents, stream.Pass(), view_id, 195 extension_id, web_contents, stream.Pass(), view_id,
196 expected_content_size); 196 expected_content_size);
197 } 197 }
198 #endif // !defined(ENABLE_EXTENSIONS) 198 #endif // !defined(ENABLE_EXTENSIONS)
199 199
200 #if !defined(OS_ANDROID) 200 #if !defined(OS_ANDROID)
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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 450
451 ResourceDispatcherHostLoginDelegate* 451 ResourceDispatcherHostLoginDelegate*
452 ChromeResourceDispatcherHostDelegate::CreateLoginDelegate( 452 ChromeResourceDispatcherHostDelegate::CreateLoginDelegate(
453 net::AuthChallengeInfo* auth_info, net::URLRequest* request) { 453 net::AuthChallengeInfo* auth_info, net::URLRequest* request) {
454 return CreateLoginPrompt(auth_info, request); 454 return CreateLoginPrompt(auth_info, request);
455 } 455 }
456 456
457 bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( 457 bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol(
458 const GURL& url, 458 const GURL& url,
459 int child_id, 459 int child_id,
460 int route_id, 460 int route_id) {
461 bool initiated_by_user_gesture) {
462 #if defined(OS_ANDROID) 461 #if defined(OS_ANDROID)
463 // Android use a resource throttle to handle external as well as internal 462 // Android use a resource throttle to handle external as well as internal
464 // protocols. 463 // protocols.
465 return false; 464 return false;
466 #else 465 #else
467 466
468 #if defined(ENABLE_EXTENSIONS) 467 #if defined(ENABLE_EXTENSIONS)
469 if (WebViewRendererState::GetInstance()->IsGuest(child_id)) 468 if (WebViewRendererState::GetInstance()->IsGuest(child_id))
470 return false; 469 return false;
471 470
472 #endif // defined(ENABLE_EXTENSIONS) 471 #endif // defined(ENABLE_EXTENSIONS)
473 472
474 BrowserThread::PostTask( 473 BrowserThread::PostTask(BrowserThread::UI,
475 BrowserThread::UI, FROM_HERE, 474 FROM_HERE,
476 base::Bind(&LaunchURL, url, child_id, route_id, 475 base::Bind(&LaunchURL, url, child_id, route_id));
477 initiated_by_user_gesture));
478 return true; 476 return true;
479 #endif 477 #endif
480 } 478 }
481 479
482 void ChromeResourceDispatcherHostDelegate::AppendStandardResourceThrottles( 480 void ChromeResourceDispatcherHostDelegate::AppendStandardResourceThrottles(
483 net::URLRequest* request, 481 net::URLRequest* request,
484 content::ResourceContext* resource_context, 482 content::ResourceContext* resource_context,
485 ResourceType::Type resource_type, 483 ResourceType::Type resource_type,
486 ScopedVector<content::ResourceThrottle>* throttles) { 484 ScopedVector<content::ResourceThrottle>* throttles) {
487 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); 485 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context);
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 url_request->GetTotalReceivedBytes())); 731 url_request->GetTotalReceivedBytes()));
734 } 732 }
735 } 733 }
736 734
737 // static 735 // static
738 void ChromeResourceDispatcherHostDelegate:: 736 void ChromeResourceDispatcherHostDelegate::
739 SetExternalProtocolHandlerDelegateForTesting( 737 SetExternalProtocolHandlerDelegateForTesting(
740 ExternalProtocolHandler::Delegate* delegate) { 738 ExternalProtocolHandler::Delegate* delegate) {
741 g_external_protocol_handler_delegate = delegate; 739 g_external_protocol_handler_delegate = delegate;
742 } 740 }
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