Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1136)

Unified Diff: chrome/browser/net/chrome_network_delegate.cc

Issue 24451003: Client Hints (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed nit and use ScopedLocale with posix only Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 4de27d4fd55fa7fbde1af8979694dd0018b3389f..230b40b3fcfd613ffa05ba5603efa781be3e0df1 100644
--- a/chrome/browser/net/chrome_network_delegate.cc
+++ b/chrome/browser/net/chrome_network_delegate.cc
@@ -30,6 +30,7 @@
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/google/google_util.h"
#include "chrome/browser/net/chrome_network_data_saving_metrics.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"
@@ -334,6 +335,11 @@ void ChromeNetworkDelegate::set_predictor(
new chrome_browser_net::ConnectInterceptor(predictor));
}
+void ChromeNetworkDelegate::SetEnableClientHints() {
+ client_hints_.reset(new ClientHints());
+ client_hints_->Init();
+}
+
// static
void ChromeNetworkDelegate::NeverThrottleRequests() {
g_never_throttle_requests_ = true;
@@ -418,6 +424,12 @@ int ChromeNetworkDelegate::OnBeforeURLRequest(
if (enable_do_not_track_ && enable_do_not_track_->GetValue())
request->SetExtraRequestHeaderByName(kDNTHeader, "1", true /* override */);
+ if (client_hints_) {
+ request->SetExtraRequestHeaderByName(
+ ClientHints::kDevicePixelRatioHeader,
+ client_hints_->GetDevicePixelRatioHeader(), true);
+ }
+
bool force_safe_search = force_google_safe_search_ &&
force_google_safe_search_->GetValue();

Powered by Google App Engine
This is Rietveld 408576698