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/renderer_host/chrome_resource_dispatcher_host_delegate.
h" | 5 #include "chrome/browser/renderer_host/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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 variations::AppendVariationHeaders( | 465 variations::AppendVariationHeaders( |
466 request->url(), is_off_the_record, | 466 request->url(), is_off_the_record, |
467 !is_off_the_record && io_data->GetMetricsEnabledStateOnIOThread(), | 467 !is_off_the_record && io_data->GetMetricsEnabledStateOnIOThread(), |
468 &headers); | 468 &headers); |
469 request->SetExtraRequestHeaders(headers); | 469 request->SetExtraRequestHeaders(headers); |
470 } | 470 } |
471 | 471 |
472 if (io_data->policy_header_helper()) | 472 if (io_data->policy_header_helper()) |
473 io_data->policy_header_helper()->AddPolicyHeaders(request->url(), request); | 473 io_data->policy_header_helper()->AddPolicyHeaders(request->url(), request); |
474 | 474 |
475 signin::AppendMirrorRequestHeaderHelper(request, GURL() /* redirect_url */, | 475 signin::FixMirrorRequestHeaderHelper(request, GURL() /* redirect_url */, |
476 io_data, info->GetChildID(), | 476 io_data, info->GetChildID(), |
477 info->GetRouteID()); | 477 info->GetRouteID()); |
478 | 478 |
479 AppendStandardResourceThrottles(request, | 479 AppendStandardResourceThrottles(request, |
480 resource_context, | 480 resource_context, |
481 resource_type, | 481 resource_type, |
482 throttles); | 482 throttles); |
483 #if !defined(DISABLE_NACL) | 483 #if !defined(DISABLE_NACL) |
484 if (!is_prerendering) { | 484 if (!is_prerendering) { |
485 AppendComponentUpdaterThrottles(request, | 485 AppendComponentUpdaterThrottles(request, |
486 resource_context, | 486 resource_context, |
487 resource_type, | 487 resource_type, |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 | 781 |
782 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected( | 782 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected( |
783 const GURL& redirect_url, | 783 const GURL& redirect_url, |
784 net::URLRequest* request, | 784 net::URLRequest* request, |
785 content::ResourceContext* resource_context, | 785 content::ResourceContext* resource_context, |
786 content::ResourceResponse* response) { | 786 content::ResourceResponse* response) { |
787 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); | 787 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); |
788 | 788 |
789 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 789 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
790 | 790 |
791 // In the Mirror world, Chrome should append a X-Chrome-Connected header to | 791 // In the Mirror world (for users that are signed in to the browser on |
792 // all Gaia requests from a connected profile so Gaia could return a 204 | 792 // Android, the identity is mirrored into the content area), Chrome should |
793 // response and let Chrome handle the action with native UI. The only | 793 // append a X-Chrome-Connected header to all Gaia requests from a connected |
794 // exception is requests from gaia webview, since the native profile | 794 // profile so Gaia could return a 204 response and let Chrome handle the |
795 // management UI is built on top of it. | 795 // action with native UI. The only exception is requests from gaia webview, |
796 signin::AppendMirrorRequestHeaderHelper( | 796 // since the native profile management UI is built on top of it. |
797 request, redirect_url, io_data, info->GetChildID(), info->GetRouteID()); | 797 signin::FixMirrorRequestHeaderHelper(request, redirect_url, io_data, |
| 798 info->GetChildID(), info->GetRouteID()); |
798 | 799 |
799 if (io_data->resource_prefetch_predictor_observer()) { | 800 if (io_data->resource_prefetch_predictor_observer()) { |
800 io_data->resource_prefetch_predictor_observer()->OnRequestRedirected( | 801 io_data->resource_prefetch_predictor_observer()->OnRequestRedirected( |
801 redirect_url, request); | 802 redirect_url, request); |
802 } | 803 } |
803 | 804 |
804 if (io_data->policy_header_helper()) | 805 if (io_data->policy_header_helper()) |
805 io_data->policy_header_helper()->AddPolicyHeaders(redirect_url, request); | 806 io_data->policy_header_helper()->AddPolicyHeaders(redirect_url, request); |
806 } | 807 } |
807 | 808 |
(...skipping 70 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 |