| 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 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 #endif | 792 #endif |
| 793 } | 793 } |
| 794 | 794 |
| 795 void ChromeResourceDispatcherHostDelegate::OnResponseStarted( | 795 void ChromeResourceDispatcherHostDelegate::OnResponseStarted( |
| 796 net::URLRequest* request, | 796 net::URLRequest* request, |
| 797 content::ResourceContext* resource_context, | 797 content::ResourceContext* resource_context, |
| 798 content::ResourceResponse* response) { | 798 content::ResourceResponse* response) { |
| 799 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 799 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
| 800 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); | 800 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); |
| 801 | 801 |
| 802 // See if the response contains the X-Chrome-Manage-Accounts header. If so | 802 signin::ProcessAccountConsistencyResponseHeaders( |
| 803 // show the profile avatar bubble so that user can complete signin/out action | 803 request, GURL(), io_data, info->GetChildID(), info->GetRouteID()); |
| 804 // the native UI. | |
| 805 signin::ProcessMirrorResponseHeaderIfExists(request, io_data, | |
| 806 info->GetChildID(), | |
| 807 info->GetRouteID()); | |
| 808 | 804 |
| 809 // Built-in additional protection for the chrome web store origin. | 805 // Built-in additional protection for the chrome web store origin. |
| 810 #if BUILDFLAG(ENABLE_EXTENSIONS) | 806 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 811 GURL webstore_url(extension_urls::GetWebstoreLaunchURL()); | 807 GURL webstore_url(extension_urls::GetWebstoreLaunchURL()); |
| 812 if (request->url().SchemeIsHTTPOrHTTPS() && | 808 if (request->url().SchemeIsHTTPOrHTTPS() && |
| 813 request->url().DomainIs(webstore_url.host().c_str())) { | 809 request->url().DomainIs(webstore_url.host().c_str())) { |
| 814 net::HttpResponseHeaders* response_headers = request->response_headers(); | 810 net::HttpResponseHeaders* response_headers = request->response_headers(); |
| 815 if (response_headers && | 811 if (response_headers && |
| 816 !response_headers->HasHeaderValue("x-frame-options", "deny") && | 812 !response_headers->HasHeaderValue("x-frame-options", "deny") && |
| 817 !response_headers->HasHeaderValue("x-frame-options", "sameorigin")) { | 813 !response_headers->HasHeaderValue("x-frame-options", "sameorigin")) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 842 // the content area. | 838 // the content area. |
| 843 // | 839 // |
| 844 // For example, on Android, for users that are signed in to Chrome, the | 840 // For example, on Android, for users that are signed in to Chrome, the |
| 845 // identity is mirrored into the content area. To do so, Chrome appends a | 841 // identity is mirrored into the content area. To do so, Chrome appends a |
| 846 // X-Chrome-Connected header to all Gaia requests from a connected profile so | 842 // X-Chrome-Connected header to all Gaia requests from a connected profile so |
| 847 // Gaia could return a 204 response and let Chrome handle the action with | 843 // Gaia could return a 204 response and let Chrome handle the action with |
| 848 // native UI. The only exception is requests from gaia webview, since the | 844 // native UI. The only exception is requests from gaia webview, since the |
| 849 // native profile management UI is built on top of it. | 845 // native profile management UI is built on top of it. |
| 850 signin::FixAccountConsistencyRequestHeader( | 846 signin::FixAccountConsistencyRequestHeader( |
| 851 request, redirect_url, io_data, info->GetChildID(), info->GetRouteID()); | 847 request, redirect_url, io_data, info->GetChildID(), info->GetRouteID()); |
| 848 signin::ProcessAccountConsistencyResponseHeaders( |
| 849 request, redirect_url, io_data, info->GetChildID(), info->GetRouteID()); |
| 852 | 850 |
| 853 if (io_data->loading_predictor_observer()) { | 851 if (io_data->loading_predictor_observer()) { |
| 854 io_data->loading_predictor_observer()->OnRequestRedirected( | 852 io_data->loading_predictor_observer()->OnRequestRedirected( |
| 855 request, redirect_url, info->GetWebContentsGetterForRequest()); | 853 request, redirect_url, info->GetWebContentsGetterForRequest()); |
| 856 } | 854 } |
| 857 | 855 |
| 858 if (io_data->policy_header_helper()) | 856 if (io_data->policy_header_helper()) |
| 859 io_data->policy_header_helper()->AddPolicyHeaders(redirect_url, request); | 857 io_data->policy_header_helper()->AddPolicyHeaders(redirect_url, request); |
| 860 } | 858 } |
| 861 | 859 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1001 &ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, | 999 &ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, |
| 1002 base::Unretained(this), url, request_loading_time)); | 1000 base::Unretained(this), url, request_loading_time)); |
| 1003 return; | 1001 return; |
| 1004 } | 1002 } |
| 1005 | 1003 |
| 1006 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? | 1004 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? |
| 1007 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); | 1005 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); |
| 1008 rappor::SampleDomainAndRegistryFromGURL( | 1006 rappor::SampleDomainAndRegistryFromGURL( |
| 1009 g_browser_process->rappor_service(), metric_name, url); | 1007 g_browser_process->rappor_service(), metric_name, url); |
| 1010 } | 1008 } |
| OLD | NEW |