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

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

Issue 11970002: Added Client-Hints. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Made float literals explicit in tests Created 7 years, 9 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
« no previous file with comments | « chrome/browser/net/chrome_network_delegate.h ('k') | chrome/browser/net/client_hints.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « chrome/browser/net/chrome_network_delegate.h ('k') | chrome/browser/net/client_hints.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698