| 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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 } | 473 } |
| 474 #endif | 474 #endif |
| 475 | 475 |
| 476 // Don't attempt to append headers to requests that have already started. | 476 // Don't attempt to append headers to requests that have already started. |
| 477 // TODO(stevet): Remove this once the request ordering issues are resolved | 477 // TODO(stevet): Remove this once the request ordering issues are resolved |
| 478 // in crbug.com/128048. | 478 // in crbug.com/128048. |
| 479 if (!request->is_pending()) { | 479 if (!request->is_pending()) { |
| 480 net::HttpRequestHeaders headers; | 480 net::HttpRequestHeaders headers; |
| 481 headers.CopyFrom(request->extra_request_headers()); | 481 headers.CopyFrom(request->extra_request_headers()); |
| 482 bool is_off_the_record = io_data->IsOffTheRecord(); | 482 bool is_off_the_record = io_data->IsOffTheRecord(); |
| 483 bool is_signed_in = |
| 484 !is_off_the_record && |
| 485 !io_data->google_services_account_id()->GetValue().empty(); |
| 483 variations::AppendVariationHeaders( | 486 variations::AppendVariationHeaders( |
| 484 request->url(), is_off_the_record, | 487 request->url(), is_off_the_record, is_signed_in, |
| 485 !is_off_the_record && io_data->GetMetricsEnabledStateOnIOThread(), | 488 !is_off_the_record && io_data->GetMetricsEnabledStateOnIOThread(), |
| 486 &headers); | 489 &headers); |
| 487 request->SetExtraRequestHeaders(headers); | 490 request->SetExtraRequestHeaders(headers); |
| 488 } | 491 } |
| 489 | 492 |
| 490 if (io_data->policy_header_helper()) | 493 if (io_data->policy_header_helper()) |
| 491 io_data->policy_header_helper()->AddPolicyHeaders(request->url(), request); | 494 io_data->policy_header_helper()->AddPolicyHeaders(request->url(), request); |
| 492 | 495 |
| 493 signin::FixMirrorRequestHeaderHelper(request, GURL() /* redirect_url */, | 496 signin::FixMirrorRequestHeaderHelper(request, GURL() /* redirect_url */, |
| 494 io_data, info->GetChildID(), | 497 io_data, info->GetChildID(), |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, | 882 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, |
| 880 base::Unretained(this), url, request_loading_time)); | 883 base::Unretained(this), url, request_loading_time)); |
| 881 return; | 884 return; |
| 882 } | 885 } |
| 883 | 886 |
| 884 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? | 887 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? |
| 885 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); | 888 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); |
| 886 rappor::SampleDomainAndRegistryFromGURL( | 889 rappor::SampleDomainAndRegistryFromGURL( |
| 887 g_browser_process->rappor_service(), metric_name, url); | 890 g_browser_process->rappor_service(), metric_name, url); |
| 888 } | 891 } |
| OLD | NEW |