Index: chrome/browser/net/chrome_network_delegate.cc |
diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc |
index 93ff16ac99b600b476b5a47f4f65466e55e8f030..7ef0a2f900febbc530fc2acd1288f05e9b0e21dd 100644 |
--- a/chrome/browser/net/chrome_network_delegate.cc |
+++ b/chrome/browser/net/chrome_network_delegate.cc |
@@ -25,6 +25,7 @@ |
#include "chrome/browser/extensions/extension_process_manager.h" |
#include "chrome/browser/extensions/extension_system.h" |
#include "chrome/browser/google/google_util.h" |
+#include "chrome/browser/net/client_hints.h" |
#include "chrome/browser/net/connect_interceptor.h" |
#include "chrome/browser/net/load_time_stats.h" |
#include "chrome/browser/performance_monitor/performance_monitor.h" |
@@ -75,6 +76,7 @@ bool ChromeNetworkDelegate::g_never_throttle_requests_ = false; |
namespace { |
const char kDNTHeader[] = "DNT"; |
+const char kClientHintsHeader[] = "CH"; |
// If the |request| failed due to problems with a proxy, forward the error to |
// the proxy extension API. |
@@ -299,6 +301,11 @@ void ChromeNetworkDelegate::set_predictor( |
new chrome_browser_net::ConnectInterceptor(predictor)); |
} |
+void ChromeNetworkDelegate::set_enable_client_hints() { |
+ client_hints_.reset(new ClientHints()); |
+ client_hints_->Init(); |
+} |
+ |
// static |
void ChromeNetworkDelegate::NeverThrottleRequests() { |
g_never_throttle_requests_ = true; |
@@ -383,6 +390,12 @@ int ChromeNetworkDelegate::OnBeforeURLRequest( |
if (enable_do_not_track_ && enable_do_not_track_->GetValue()) |
request->SetExtraRequestHeaderByName(kDNTHeader, "1", true /* override */); |
+ if (client_hints_ != NULL) { |
+ std::string client_hints_value = client_hints_->GetScreenInfoHints(); |
+ request->SetExtraRequestHeaderByName(kClientHintsHeader, |
+ client_hints_value, true); |
+ } |
+ |
bool force_safe_search = force_google_safe_search_ && |
force_google_safe_search_->GetValue(); |