| Index: chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
|
| diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
|
| index f54de5dbcdf2d980ebc79b460e5a4cd4bf0de7dc..9e577f44d6b8c44c3c1ae81d472545fd6c71b471 100644
|
| --- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
|
| +++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
|
| @@ -12,6 +12,7 @@
|
| #include "chrome/browser/download/download_util.h"
|
| #include "chrome/browser/extensions/user_script_listener.h"
|
| #include "chrome/browser/external_protocol/external_protocol_handler.h"
|
| +#include "chrome/browser/google/google_util.h"
|
| #include "chrome/browser/instant/instant_loader.h"
|
| #include "chrome/browser/net/load_timing_observer.h"
|
| #include "chrome/browser/prerender/prerender_manager.h"
|
| @@ -163,6 +164,8 @@ void ChromeResourceDispatcherHostDelegate::RequestBeginning(
|
| #endif
|
| }
|
|
|
| + AppendChromeMetricsHeaders(request, resource_context, resource_type);
|
| +
|
| AppendStandardResourceThrottles(request,
|
| resource_context,
|
| child_id,
|
| @@ -293,6 +296,28 @@ void ChromeResourceDispatcherHostDelegate::AppendStandardResourceThrottles(
|
| throttles->push_back(throttle);
|
| }
|
|
|
| +void ChromeResourceDispatcherHostDelegate::AppendChromeMetricsHeaders(
|
| + net::URLRequest* request,
|
| + content::ResourceContext* resource_context,
|
| + ResourceType::Type resource_type) {
|
| + // Note our criteria for attaching Chrome experiment headers:
|
| + // 1. We only transmit to *.google.<TLD> domains. NOTE that this use of
|
| + // google_util helpers to check this does not guarantee that the URL is
|
| + // Google-owned, only that it is of the form *.google.<TLD>. In the future
|
| + // we may choose to reinforce this check.
|
| + // 2. We only transmit for non-Incognito profiles.
|
| + // 3. For the X-Chrome-UMA-Enabled bit, we only set it if UMA is in fact
|
| + // enabled for this install of Chrome.
|
| + ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context);
|
| + if (google_util::IsGoogleDomainUrl(request->url().spec(),
|
| + google_util::ALLOW_SUBDOMAIN) &&
|
| + !io_data->is_incognito() && io_data->enable_metrics()->GetValue()) {
|
| + request->SetExtraRequestHeaderByName("X-Chrome-UMA-Enabled",
|
| + "1",
|
| + false);
|
| + }
|
| +}
|
| +
|
| bool ChromeResourceDispatcherHostDelegate::ShouldForceDownloadResource(
|
| const GURL& url, const std::string& mime_type) {
|
| // Special-case user scripts to get downloaded instead of viewed.
|
|
|