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

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

Issue 124393002: Remove calls of PrerenderTracker::TryCancel in ChromeResourceDispatcherHostDelegate::HandleExternal… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 6 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
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 30 matching lines...) Expand all
41 #include "chrome/common/extensions/mime_types_handler.h" 41 #include "chrome/common/extensions/mime_types_handler.h"
42 #include "chrome/common/render_messages.h" 42 #include "chrome/common/render_messages.h"
43 #include "content/public/browser/browser_thread.h" 43 #include "content/public/browser/browser_thread.h"
44 #include "content/public/browser/notification_service.h" 44 #include "content/public/browser/notification_service.h"
45 #include "content/public/browser/render_process_host.h" 45 #include "content/public/browser/render_process_host.h"
46 #include "content/public/browser/render_view_host.h" 46 #include "content/public/browser/render_view_host.h"
47 #include "content/public/browser/resource_context.h" 47 #include "content/public/browser/resource_context.h"
48 #include "content/public/browser/resource_dispatcher_host.h" 48 #include "content/public/browser/resource_dispatcher_host.h"
49 #include "content/public/browser/resource_request_info.h" 49 #include "content/public/browser/resource_request_info.h"
50 #include "content/public/browser/stream_handle.h" 50 #include "content/public/browser/stream_handle.h"
51 #include "content/public/browser/web_contents.h"
51 #include "content/public/common/resource_response.h" 52 #include "content/public/common/resource_response.h"
52 #include "extensions/browser/info_map.h" 53 #include "extensions/browser/info_map.h"
53 #include "extensions/common/constants.h" 54 #include "extensions/common/constants.h"
54 #include "extensions/common/user_script.h" 55 #include "extensions/common/user_script.h"
55 #include "net/base/load_flags.h" 56 #include "net/base/load_flags.h"
56 #include "net/base/load_timing_info.h" 57 #include "net/base/load_timing_info.h"
57 #include "net/base/request_priority.h" 58 #include "net/base/request_priority.h"
58 #include "net/http/http_response_headers.h" 59 #include "net/http/http_response_headers.h"
59 #include "net/url_request/url_request.h" 60 #include "net/url_request/url_request.h"
60 61
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 Profile* profile = Profile::FromBrowserContext(browser_context); 149 Profile* profile = Profile::FromBrowserContext(browser_context);
149 if (!profile) 150 if (!profile)
150 return; 151 return;
151 152
152 StreamsPrivateAPI* streams_private = StreamsPrivateAPI::Get(profile); 153 StreamsPrivateAPI* streams_private = StreamsPrivateAPI::Get(profile);
153 if (!streams_private) 154 if (!streams_private)
154 return; 155 return;
155 streams_private->ExecuteMimeTypeHandler( 156 streams_private->ExecuteMimeTypeHandler(
156 extension_id, web_contents, stream.Pass(), expected_content_size); 157 extension_id, web_contents, stream.Pass(), expected_content_size);
157 } 158 }
159
160 void LaunchURL(const GURL& url, int render_process_id, int render_view_id) {
161 content::RenderViewHost* rvh = content::RenderViewHost::FromID(
162 render_process_id, render_view_id);
163 if (rvh) {
164 content::WebContents* web_contents =
165 content::WebContents::FromRenderViewHost(rvh);
166 prerender::PrerenderContents* prerender_contents =
167 prerender::PrerenderContents::FromWebContents(web_contents);
168 if (prerender_contents) {
169 prerender_contents->Destroy(prerender::FINAL_STATUS_UNSUPPORTED_SCHEME);
170 prerender::ReportPrerenderExternalURL();
171 return;
172 }
173 }
174
175 ExternalProtocolHandler::LaunchUrl(url, render_process_id, render_view_id);
176 }
158 #endif // !defined(OS_ANDROID) 177 #endif // !defined(OS_ANDROID)
159 178
160 void AppendComponentUpdaterThrottles( 179 void AppendComponentUpdaterThrottles(
161 net::URLRequest* request, 180 net::URLRequest* request,
162 content::ResourceContext* resource_context, 181 content::ResourceContext* resource_context,
163 ResourceType::Type resource_type, 182 ResourceType::Type resource_type,
164 ScopedVector<content::ResourceThrottle>* throttles) { 183 ScopedVector<content::ResourceThrottle>* throttles) {
165 const char* crx_id = NULL; 184 const char* crx_id = NULL;
166 ComponentUpdateService* cus = g_browser_process->component_updater(); 185 ComponentUpdateService* cus = g_browser_process->component_updater();
167 if (!cus) 186 if (!cus)
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 } 451 }
433 452
434 bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( 453 bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol(
435 const GURL& url, int child_id, int route_id) { 454 const GURL& url, int child_id, int route_id) {
436 #if defined(OS_ANDROID) 455 #if defined(OS_ANDROID)
437 // Android use a resource throttle to handle external as well as internal 456 // Android use a resource throttle to handle external as well as internal
438 // protocols. 457 // protocols.
439 return false; 458 return false;
440 #else 459 #else
441 460
442 if (prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id) &&
443 prerender_tracker_->TryCancel(
444 child_id, route_id, prerender::FINAL_STATUS_UNSUPPORTED_SCHEME)) {
445 prerender::ReportPrerenderExternalURL();
446 return false;
447 }
448
449 ExtensionRendererState::WebViewInfo info; 461 ExtensionRendererState::WebViewInfo info;
450 if (ExtensionRendererState::GetInstance()->GetWebViewInfo(child_id, 462 if (ExtensionRendererState::GetInstance()->GetWebViewInfo(child_id,
451 route_id, 463 route_id,
452 &info)) { 464 &info)) {
453 return false; 465 return false;
454 } 466 }
455 467
456 BrowserThread::PostTask( 468 BrowserThread::PostTask(
457 BrowserThread::UI, FROM_HERE, 469 BrowserThread::UI, FROM_HERE,
458 base::Bind(&ExternalProtocolHandler::LaunchUrl, url, child_id, route_id)); 470 base::Bind(&LaunchURL, url, child_id, route_id));
459 return true; 471 return true;
460 #endif 472 #endif
461 } 473 }
462 474
463 void ChromeResourceDispatcherHostDelegate::AppendStandardResourceThrottles( 475 void ChromeResourceDispatcherHostDelegate::AppendStandardResourceThrottles(
464 net::URLRequest* request, 476 net::URLRequest* request,
465 content::ResourceContext* resource_context, 477 content::ResourceContext* resource_context,
466 ResourceType::Type resource_type, 478 ResourceType::Type resource_type,
467 ScopedVector<content::ResourceThrottle>* throttles) { 479 ScopedVector<content::ResourceThrottle>* throttles) {
468 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); 480 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 // exception is requests from gaia webview, since the native profile 671 // exception is requests from gaia webview, since the native profile
660 // management UI is built on top of it. 672 // management UI is built on top of it.
661 signin::AppendMirrorRequestHeaderIfPossible(request, redirect_url, io_data, 673 signin::AppendMirrorRequestHeaderIfPossible(request, redirect_url, io_data,
662 info->GetChildID(), info->GetRouteID()); 674 info->GetChildID(), info->GetRouteID());
663 675
664 if (io_data->resource_prefetch_predictor_observer()) { 676 if (io_data->resource_prefetch_predictor_observer()) {
665 io_data->resource_prefetch_predictor_observer()->OnRequestRedirected( 677 io_data->resource_prefetch_predictor_observer()->OnRequestRedirected(
666 redirect_url, request); 678 redirect_url, request);
667 } 679 }
668 } 680 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698