OLD | NEW |
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/loader/chrome_resource_dispatcher_host_delegate.h" | 5 #include "chrome/browser/loader/chrome_resource_dispatcher_host_delegate.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 #include "content/public/browser/render_frame_host.h" | 59 #include "content/public/browser/render_frame_host.h" |
60 #include "content/public/browser/render_process_host.h" | 60 #include "content/public/browser/render_process_host.h" |
61 #include "content/public/browser/render_view_host.h" | 61 #include "content/public/browser/render_view_host.h" |
62 #include "content/public/browser/resource_context.h" | 62 #include "content/public/browser/resource_context.h" |
63 #include "content/public/browser/resource_dispatcher_host.h" | 63 #include "content/public/browser/resource_dispatcher_host.h" |
64 #include "content/public/browser/resource_request_info.h" | 64 #include "content/public/browser/resource_request_info.h" |
65 #include "content/public/browser/service_worker_context.h" | 65 #include "content/public/browser/service_worker_context.h" |
66 #include "content/public/browser/stream_info.h" | 66 #include "content/public/browser/stream_info.h" |
67 #include "content/public/browser/web_contents.h" | 67 #include "content/public/browser/web_contents.h" |
68 #include "content/public/common/resource_response.h" | 68 #include "content/public/common/resource_response.h" |
| 69 #include "extensions/features/features.h" |
69 #include "net/base/load_flags.h" | 70 #include "net/base/load_flags.h" |
70 #include "net/base/load_timing_info.h" | 71 #include "net/base/load_timing_info.h" |
71 #include "net/base/request_priority.h" | 72 #include "net/base/request_priority.h" |
72 #include "net/http/http_response_headers.h" | 73 #include "net/http/http_response_headers.h" |
73 #include "net/ssl/client_cert_store.h" | 74 #include "net/ssl/client_cert_store.h" |
74 #include "net/url_request/url_request.h" | 75 #include "net/url_request/url_request.h" |
75 | 76 |
76 #if !defined(DISABLE_NACL) | 77 #if !defined(DISABLE_NACL) |
77 #include "chrome/browser/component_updater/pnacl_component_installer.h" | 78 #include "chrome/browser/component_updater/pnacl_component_installer.h" |
78 #endif | 79 #endif |
79 | 80 |
80 #if defined(ENABLE_EXTENSIONS) | 81 #if BUILDFLAG(ENABLE_EXTENSIONS) |
81 #include "chrome/browser/apps/app_url_redirector.h" | 82 #include "chrome/browser/apps/app_url_redirector.h" |
82 #include "chrome/browser/extensions/api/streams_private/streams_private_api.h" | 83 #include "chrome/browser/extensions/api/streams_private/streams_private_api.h" |
83 #include "chrome/browser/extensions/user_script_listener.h" | 84 #include "chrome/browser/extensions/user_script_listener.h" |
84 #include "chrome/browser/renderer_host/chrome_navigation_ui_data.h" | 85 #include "chrome/browser/renderer_host/chrome_navigation_ui_data.h" |
85 #include "extensions/browser/extension_throttle_manager.h" | 86 #include "extensions/browser/extension_throttle_manager.h" |
86 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" | 87 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" |
87 #include "extensions/browser/info_map.h" | 88 #include "extensions/browser/info_map.h" |
88 #include "extensions/common/constants.h" | 89 #include "extensions/common/constants.h" |
89 #include "extensions/common/extension_urls.h" | 90 #include "extensions/common/extension_urls.h" |
90 #include "extensions/common/manifest_handlers/mime_types_handler.h" | 91 #include "extensions/common/manifest_handlers/mime_types_handler.h" |
(...skipping 19 matching lines...) Expand all Loading... |
110 #include "chrome/browser/chromeos/login/signin/merge_session_resource_throttle.h
" | 111 #include "chrome/browser/chromeos/login/signin/merge_session_resource_throttle.h
" |
111 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h" | 112 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h" |
112 #endif | 113 #endif |
113 | 114 |
114 using content::BrowserThread; | 115 using content::BrowserThread; |
115 using content::RenderViewHost; | 116 using content::RenderViewHost; |
116 using content::ResourceDispatcherHostLoginDelegate; | 117 using content::ResourceDispatcherHostLoginDelegate; |
117 using content::ResourceRequestInfo; | 118 using content::ResourceRequestInfo; |
118 using content::ResourceType; | 119 using content::ResourceType; |
119 | 120 |
120 #if defined(ENABLE_EXTENSIONS) | 121 #if BUILDFLAG(ENABLE_EXTENSIONS) |
121 using extensions::Extension; | 122 using extensions::Extension; |
122 using extensions::StreamsPrivateAPI; | 123 using extensions::StreamsPrivateAPI; |
123 #endif | 124 #endif |
124 | 125 |
125 #if defined(OS_ANDROID) | 126 #if defined(OS_ANDROID) |
126 using navigation_interception::InterceptNavigationDelegate; | 127 using navigation_interception::InterceptNavigationDelegate; |
127 #endif | 128 #endif |
128 | 129 |
129 namespace { | 130 namespace { |
130 | 131 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 166 |
166 if (prerender_contents) | 167 if (prerender_contents) |
167 prerender_contents->AddNetworkBytes(bytes); | 168 prerender_contents->AddNetworkBytes(bytes); |
168 | 169 |
169 prerender::PrerenderManager* prerender_manager = | 170 prerender::PrerenderManager* prerender_manager = |
170 GetPrerenderManager(web_contents); | 171 GetPrerenderManager(web_contents); |
171 if (prerender_manager) | 172 if (prerender_manager) |
172 prerender_manager->AddProfileNetworkBytesIfEnabled(bytes); | 173 prerender_manager->AddProfileNetworkBytesIfEnabled(bytes); |
173 } | 174 } |
174 | 175 |
175 #if defined(ENABLE_EXTENSIONS) | 176 #if BUILDFLAG(ENABLE_EXTENSIONS) |
176 void SendExecuteMimeTypeHandlerEvent( | 177 void SendExecuteMimeTypeHandlerEvent( |
177 std::unique_ptr<content::StreamInfo> stream, | 178 std::unique_ptr<content::StreamInfo> stream, |
178 int64_t expected_content_size, | 179 int64_t expected_content_size, |
179 const std::string& extension_id, | 180 const std::string& extension_id, |
180 const std::string& view_id, | 181 const std::string& view_id, |
181 bool embedded, | 182 bool embedded, |
182 int frame_tree_node_id, | 183 int frame_tree_node_id, |
183 int render_process_id, | 184 int render_process_id, |
184 int render_frame_id) { | 185 int render_frame_id) { |
185 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 186 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
(...skipping 21 matching lines...) Expand all Loading... |
207 Profile* profile = | 208 Profile* profile = |
208 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 209 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
209 | 210 |
210 StreamsPrivateAPI* streams_private = StreamsPrivateAPI::Get(profile); | 211 StreamsPrivateAPI* streams_private = StreamsPrivateAPI::Get(profile); |
211 if (!streams_private) | 212 if (!streams_private) |
212 return; | 213 return; |
213 streams_private->ExecuteMimeTypeHandler( | 214 streams_private->ExecuteMimeTypeHandler( |
214 extension_id, std::move(stream), view_id, expected_content_size, embedded, | 215 extension_id, std::move(stream), view_id, expected_content_size, embedded, |
215 frame_tree_node_id, render_process_id, render_frame_id); | 216 frame_tree_node_id, render_process_id, render_frame_id); |
216 } | 217 } |
217 #endif // !defined(ENABLE_EXTENSIONS) | 218 #endif // !BUILDFLAG(ENABLE_EXTENSIONS) |
218 | 219 |
219 void LaunchURL( | 220 void LaunchURL( |
220 const GURL& url, | 221 const GURL& url, |
221 int render_process_id, | 222 int render_process_id, |
222 const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter, | 223 const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter, |
223 ui::PageTransition page_transition, | 224 ui::PageTransition page_transition, |
224 bool has_user_gesture, | 225 bool has_user_gesture, |
225 bool is_whitelisted) { | 226 bool is_whitelisted) { |
226 // If there is no longer a WebContents, the request may have raced with tab | 227 // If there is no longer a WebContents, the request may have raced with tab |
227 // closing. Don't fire the external request. (It may have been a prerender.) | 228 // closing. Don't fire the external request. (It may have been a prerender.) |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 if (metrics_observer) { | 371 if (metrics_observer) { |
371 metrics_observer->OnRequestComplete(resource_type, was_cached, net_error); | 372 metrics_observer->OnRequestComplete(resource_type, was_cached, net_error); |
372 } | 373 } |
373 } | 374 } |
374 | 375 |
375 } // namespace | 376 } // namespace |
376 | 377 |
377 ChromeResourceDispatcherHostDelegate::ChromeResourceDispatcherHostDelegate() | 378 ChromeResourceDispatcherHostDelegate::ChromeResourceDispatcherHostDelegate() |
378 : download_request_limiter_(g_browser_process->download_request_limiter()), | 379 : download_request_limiter_(g_browser_process->download_request_limiter()), |
379 safe_browsing_(g_browser_process->safe_browsing_service()) | 380 safe_browsing_(g_browser_process->safe_browsing_service()) |
380 #if defined(ENABLE_EXTENSIONS) | 381 #if BUILDFLAG(ENABLE_EXTENSIONS) |
381 , user_script_listener_(new extensions::UserScriptListener()) | 382 , user_script_listener_(new extensions::UserScriptListener()) |
382 #endif | 383 #endif |
383 { | 384 { |
384 BrowserThread::PostTask( | 385 BrowserThread::PostTask( |
385 BrowserThread::IO, FROM_HERE, | 386 BrowserThread::IO, FROM_HERE, |
386 base::Bind(content::ServiceWorkerContext::AddExcludedHeadersForFetchEvent, | 387 base::Bind(content::ServiceWorkerContext::AddExcludedHeadersForFetchEvent, |
387 variations::GetVariationHeaderNames())); | 388 variations::GetVariationHeaderNames())); |
388 } | 389 } |
389 | 390 |
390 ChromeResourceDispatcherHostDelegate::~ChromeResourceDispatcherHostDelegate() { | 391 ChromeResourceDispatcherHostDelegate::~ChromeResourceDispatcherHostDelegate() { |
391 #if defined(ENABLE_EXTENSIONS) | 392 #if BUILDFLAG(ENABLE_EXTENSIONS) |
392 CHECK(stream_target_info_.empty()); | 393 CHECK(stream_target_info_.empty()); |
393 #endif | 394 #endif |
394 } | 395 } |
395 | 396 |
396 bool ChromeResourceDispatcherHostDelegate::ShouldBeginRequest( | 397 bool ChromeResourceDispatcherHostDelegate::ShouldBeginRequest( |
397 const std::string& method, | 398 const std::string& method, |
398 const GURL& url, | 399 const GURL& url, |
399 ResourceType resource_type, | 400 ResourceType resource_type, |
400 content::ResourceContext* resource_context) { | 401 content::ResourceContext* resource_context) { |
401 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 402 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 const policy::URLBlacklist::URLBlacklistState url_state = | 555 const policy::URLBlacklist::URLBlacklistState url_state = |
555 io_data->GetURLBlacklistState(url); | 556 io_data->GetURLBlacklistState(url); |
556 if (url_state == policy::URLBlacklist::URLBlacklistState::URL_IN_BLACKLIST) { | 557 if (url_state == policy::URLBlacklist::URLBlacklistState::URL_IN_BLACKLIST) { |
557 // It's a link with custom scheme and it's blacklisted. We return false here | 558 // It's a link with custom scheme and it's blacklisted. We return false here |
558 // and let it process as a normal URL. Eventually chrome_network_delegate | 559 // and let it process as a normal URL. Eventually chrome_network_delegate |
559 // will see it's in the blacklist and the user will be shown the blocked | 560 // will see it's in the blacklist and the user will be shown the blocked |
560 // content page. | 561 // content page. |
561 return false; | 562 return false; |
562 } | 563 } |
563 int child_id = info->GetChildID(); | 564 int child_id = info->GetChildID(); |
564 #if defined(ENABLE_EXTENSIONS) | 565 #if BUILDFLAG(ENABLE_EXTENSIONS) |
565 // External protocols are disabled for guests. An exception is made for the | 566 // External protocols are disabled for guests. An exception is made for the |
566 // "mailto" protocol, so that pages that utilize it work properly in a | 567 // "mailto" protocol, so that pages that utilize it work properly in a |
567 // WebView. | 568 // WebView. |
568 ChromeNavigationUIData* navigation_data = | 569 ChromeNavigationUIData* navigation_data = |
569 static_cast<ChromeNavigationUIData*>(info->GetNavigationUIData()); | 570 static_cast<ChromeNavigationUIData*>(info->GetNavigationUIData()); |
570 if ((extensions::WebViewRendererState::GetInstance()->IsGuest(child_id) || | 571 if ((extensions::WebViewRendererState::GetInstance()->IsGuest(child_id) || |
571 (navigation_data && | 572 (navigation_data && |
572 navigation_data->GetExtensionNavigationUIData()->is_web_view())) && | 573 navigation_data->GetExtensionNavigationUIData()->is_web_view())) && |
573 !url.SchemeIs(url::kMailToScheme)) { | 574 !url.SchemeIs(url::kMailToScheme)) { |
574 return false; | 575 return false; |
575 } | 576 } |
576 #endif // defined(ENABLE_EXTENSIONS) | 577 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
577 | 578 |
578 #if defined(OS_ANDROID) | 579 #if defined(OS_ANDROID) |
579 // Main frame external protocols are handled by | 580 // Main frame external protocols are handled by |
580 // InterceptNavigationResourceThrottle. | 581 // InterceptNavigationResourceThrottle. |
581 if (info->IsMainFrame()) | 582 if (info->IsMainFrame()) |
582 return false; | 583 return false; |
583 #endif // defined(ANDROID) | 584 #endif // defined(ANDROID) |
584 | 585 |
585 const bool is_whitelisted = | 586 const bool is_whitelisted = |
586 url_state == policy::URLBlacklist::URLBlacklistState::URL_IN_WHITELIST; | 587 url_state == policy::URLBlacklist::URLBlacklistState::URL_IN_WHITELIST; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 throttles->push_back(first_throttle); | 620 throttles->push_back(first_throttle); |
620 | 621 |
621 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | 622 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
622 bool is_subresource_request = | 623 bool is_subresource_request = |
623 resource_type != content::RESOURCE_TYPE_MAIN_FRAME; | 624 resource_type != content::RESOURCE_TYPE_MAIN_FRAME; |
624 throttles->push_back(new SupervisedUserResourceThrottle( | 625 throttles->push_back(new SupervisedUserResourceThrottle( |
625 request, !is_subresource_request, | 626 request, !is_subresource_request, |
626 io_data->supervised_user_url_filter())); | 627 io_data->supervised_user_url_filter())); |
627 #endif | 628 #endif |
628 | 629 |
629 #if defined(ENABLE_EXTENSIONS) | 630 #if BUILDFLAG(ENABLE_EXTENSIONS) |
630 content::ResourceThrottle* wait_for_extensions_init_throttle = | 631 content::ResourceThrottle* wait_for_extensions_init_throttle = |
631 user_script_listener_->CreateResourceThrottle(request->url(), | 632 user_script_listener_->CreateResourceThrottle(request->url(), |
632 resource_type); | 633 resource_type); |
633 if (wait_for_extensions_init_throttle) | 634 if (wait_for_extensions_init_throttle) |
634 throttles->push_back(wait_for_extensions_init_throttle); | 635 throttles->push_back(wait_for_extensions_init_throttle); |
635 | 636 |
636 extensions::ExtensionThrottleManager* extension_throttle_manager = | 637 extensions::ExtensionThrottleManager* extension_throttle_manager = |
637 io_data->GetExtensionThrottleManager(); | 638 io_data->GetExtensionThrottleManager(); |
638 if (extension_throttle_manager) { | 639 if (extension_throttle_manager) { |
639 std::unique_ptr<content::ResourceThrottle> extension_throttle = | 640 std::unique_ptr<content::ResourceThrottle> extension_throttle = |
640 extension_throttle_manager->MaybeCreateThrottle(request); | 641 extension_throttle_manager->MaybeCreateThrottle(request); |
641 if (extension_throttle) | 642 if (extension_throttle) |
642 throttles->push_back(extension_throttle.release()); | 643 throttles->push_back(extension_throttle.release()); |
643 } | 644 } |
644 #endif | 645 #endif |
645 | 646 |
646 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 647 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
647 if (info->GetVisibilityState() == blink::WebPageVisibilityStatePrerender) { | 648 if (info->GetVisibilityState() == blink::WebPageVisibilityStatePrerender) { |
648 throttles->push_back(new prerender::PrerenderResourceThrottle(request)); | 649 throttles->push_back(new prerender::PrerenderResourceThrottle(request)); |
649 } | 650 } |
650 | 651 |
651 std::unique_ptr<PredictorResourceThrottle> predictor_throttle = | 652 std::unique_ptr<PredictorResourceThrottle> predictor_throttle = |
652 PredictorResourceThrottle::MaybeCreate(request, io_data); | 653 PredictorResourceThrottle::MaybeCreate(request, io_data); |
653 if (predictor_throttle) | 654 if (predictor_throttle) |
654 throttles->push_back(predictor_throttle.release()); | 655 throttles->push_back(predictor_throttle.release()); |
655 } | 656 } |
656 | 657 |
657 bool ChromeResourceDispatcherHostDelegate::ShouldForceDownloadResource( | 658 bool ChromeResourceDispatcherHostDelegate::ShouldForceDownloadResource( |
658 const GURL& url, const std::string& mime_type) { | 659 const GURL& url, const std::string& mime_type) { |
659 #if defined(ENABLE_EXTENSIONS) | 660 #if BUILDFLAG(ENABLE_EXTENSIONS) |
660 // Special-case user scripts to get downloaded instead of viewed. | 661 // Special-case user scripts to get downloaded instead of viewed. |
661 return extensions::UserScript::IsURLUserScript(url, mime_type); | 662 return extensions::UserScript::IsURLUserScript(url, mime_type); |
662 #else | 663 #else |
663 return false; | 664 return false; |
664 #endif | 665 #endif |
665 } | 666 } |
666 | 667 |
667 bool ChromeResourceDispatcherHostDelegate::ShouldInterceptResourceAsStream( | 668 bool ChromeResourceDispatcherHostDelegate::ShouldInterceptResourceAsStream( |
668 net::URLRequest* request, | 669 net::URLRequest* request, |
669 const base::FilePath& plugin_path, | 670 const base::FilePath& plugin_path, |
670 const std::string& mime_type, | 671 const std::string& mime_type, |
671 GURL* origin, | 672 GURL* origin, |
672 std::string* payload) { | 673 std::string* payload) { |
673 #if defined(ENABLE_EXTENSIONS) | 674 #if BUILDFLAG(ENABLE_EXTENSIONS) |
674 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 675 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
675 ProfileIOData* io_data = | 676 ProfileIOData* io_data = |
676 ProfileIOData::FromResourceContext(info->GetContext()); | 677 ProfileIOData::FromResourceContext(info->GetContext()); |
677 bool profile_is_off_the_record = io_data->IsOffTheRecord(); | 678 bool profile_is_off_the_record = io_data->IsOffTheRecord(); |
678 const scoped_refptr<const extensions::InfoMap> extension_info_map( | 679 const scoped_refptr<const extensions::InfoMap> extension_info_map( |
679 io_data->GetExtensionInfoMap()); | 680 io_data->GetExtensionInfoMap()); |
680 std::vector<std::string> whitelist = MimeTypesHandler::GetMIMETypeWhitelist(); | 681 std::vector<std::string> whitelist = MimeTypesHandler::GetMIMETypeWhitelist(); |
681 // Go through the white-listed extensions and try to use them to intercept | 682 // Go through the white-listed extensions and try to use them to intercept |
682 // the URL request. | 683 // the URL request. |
683 for (const std::string& extension_id : whitelist) { | 684 for (const std::string& extension_id : whitelist) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 } | 718 } |
718 } | 719 } |
719 } | 720 } |
720 #endif | 721 #endif |
721 return false; | 722 return false; |
722 } | 723 } |
723 | 724 |
724 void ChromeResourceDispatcherHostDelegate::OnStreamCreated( | 725 void ChromeResourceDispatcherHostDelegate::OnStreamCreated( |
725 net::URLRequest* request, | 726 net::URLRequest* request, |
726 std::unique_ptr<content::StreamInfo> stream) { | 727 std::unique_ptr<content::StreamInfo> stream) { |
727 #if defined(ENABLE_EXTENSIONS) | 728 #if BUILDFLAG(ENABLE_EXTENSIONS) |
728 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 729 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
729 std::map<net::URLRequest*, StreamTargetInfo>::iterator ix = | 730 std::map<net::URLRequest*, StreamTargetInfo>::iterator ix = |
730 stream_target_info_.find(request); | 731 stream_target_info_.find(request); |
731 CHECK(ix != stream_target_info_.end()); | 732 CHECK(ix != stream_target_info_.end()); |
732 bool embedded = info->GetResourceType() != content::RESOURCE_TYPE_MAIN_FRAME; | 733 bool embedded = info->GetResourceType() != content::RESOURCE_TYPE_MAIN_FRAME; |
733 content::BrowserThread::PostTask( | 734 content::BrowserThread::PostTask( |
734 content::BrowserThread::UI, FROM_HERE, | 735 content::BrowserThread::UI, FROM_HERE, |
735 base::Bind(&SendExecuteMimeTypeHandlerEvent, base::Passed(&stream), | 736 base::Bind(&SendExecuteMimeTypeHandlerEvent, base::Passed(&stream), |
736 request->GetExpectedContentSize(), ix->second.extension_id, | 737 request->GetExpectedContentSize(), ix->second.extension_id, |
737 ix->second.view_id, embedded, info->GetFrameTreeNodeId(), | 738 ix->second.view_id, embedded, info->GetFrameTreeNodeId(), |
(...skipping 10 matching lines...) Expand all Loading... |
748 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); | 749 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); |
749 | 750 |
750 // See if the response contains the X-Chrome-Manage-Accounts header. If so | 751 // See if the response contains the X-Chrome-Manage-Accounts header. If so |
751 // show the profile avatar bubble so that user can complete signin/out action | 752 // show the profile avatar bubble so that user can complete signin/out action |
752 // the native UI. | 753 // the native UI. |
753 signin::ProcessMirrorResponseHeaderIfExists(request, io_data, | 754 signin::ProcessMirrorResponseHeaderIfExists(request, io_data, |
754 info->GetChildID(), | 755 info->GetChildID(), |
755 info->GetRouteID()); | 756 info->GetRouteID()); |
756 | 757 |
757 // Built-in additional protection for the chrome web store origin. | 758 // Built-in additional protection for the chrome web store origin. |
758 #if defined(ENABLE_EXTENSIONS) | 759 #if BUILDFLAG(ENABLE_EXTENSIONS) |
759 GURL webstore_url(extension_urls::GetWebstoreLaunchURL()); | 760 GURL webstore_url(extension_urls::GetWebstoreLaunchURL()); |
760 if (request->url().SchemeIsHTTPOrHTTPS() && | 761 if (request->url().SchemeIsHTTPOrHTTPS() && |
761 request->url().DomainIs(webstore_url.host().c_str())) { | 762 request->url().DomainIs(webstore_url.host().c_str())) { |
762 net::HttpResponseHeaders* response_headers = request->response_headers(); | 763 net::HttpResponseHeaders* response_headers = request->response_headers(); |
763 if (response_headers && | 764 if (response_headers && |
764 !response_headers->HasHeaderValue("x-frame-options", "deny") && | 765 !response_headers->HasHeaderValue("x-frame-options", "deny") && |
765 !response_headers->HasHeaderValue("x-frame-options", "sameorigin")) { | 766 !response_headers->HasHeaderValue("x-frame-options", "sameorigin")) { |
766 response_headers->RemoveHeader("x-frame-options"); | 767 response_headers->RemoveHeader("x-frame-options"); |
767 response_headers->AddHeader("x-frame-options: sameorigin"); | 768 response_headers->AddHeader("x-frame-options: sameorigin"); |
768 } | 769 } |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, | 879 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, |
879 base::Unretained(this), url, request_loading_time)); | 880 base::Unretained(this), url, request_loading_time)); |
880 return; | 881 return; |
881 } | 882 } |
882 | 883 |
883 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? | 884 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? |
884 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); | 885 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); |
885 rappor::SampleDomainAndRegistryFromGURL( | 886 rappor::SampleDomainAndRegistryFromGURL( |
886 g_browser_process->rappor_service(), metric_name, url); | 887 g_browser_process->rappor_service(), metric_name, url); |
887 } | 888 } |
OLD | NEW |