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

Unified Diff: components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.cc

Issue 530153002: Add build and patch to Chrome-Proxy header (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Full version to auth request handler Created 6 years, 3 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: components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.cc
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.cc
index 3f1565684a729c2da104c692fa1197b957c28f9f..000295785bb435ba6764fe3daa72505106b022d3 100644
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.cc
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/single_thread_task_runner.h"
+#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
@@ -25,7 +26,7 @@ namespace data_reduction_proxy {
// The empty version for the authentication protocol. Currently used by
// Android webview.
#if defined(OS_ANDROID)
-const char kAndroidWebViewProtocolVersion[] = "0";
+const char kAndroidWebViewProtocolVersion[] = "";
bengr 2014/09/04 19:22:52 Add: // TODO(bengr): Remove when this class determ
#endif
// The clients supported by the data reduction proxy.
@@ -48,10 +49,20 @@ DataReductionProxyAuthRequestHandler::DataReductionProxyAuthRequestHandler(
: data_reduction_proxy_params_(params),
network_task_runner_(network_task_runner) {
client_ = client;
- version_ = version;
+ build_number_ = GetChromiumVersionComponent(version, 2);
+ patch_number_ = GetChromiumVersionComponent(version, 3);
bengr 2014/09/04 19:22:52 Since you are doing the same work twice, why not h
megjablon 2014/09/04 20:30:35 Done.
Init();
}
+std::string DataReductionProxyAuthRequestHandler::GetChromiumVersionComponent(
+ std::string version, int index) {
bengr 2014/09/04 19:22:52 use const std::string version&
megjablon 2014/09/04 20:30:35 Done.
+ std::vector<std::string> version_parts;
+ base::SplitString(version, '.', &version_parts);
+ if (version_parts.size() != 4)
+ return std::string();
+ return version_parts[index];
+}
+
void DataReductionProxyAuthRequestHandler::Init() {
InitAuthenticationOnUI(GetDefaultKey());
}
@@ -112,7 +123,9 @@ void DataReductionProxyAuthRequestHandler::AddAuthorizationHeader(
header_value += ", ";
}
header_value +=
- "ps=" + session_ + ", sid=" + credentials_ + ", v=" + version_;
+ "ps=" + session_ + ", sid=" + credentials_;
+ if (!build_number_.empty() && !patch_number_.empty())
+ header_value += ", b=" + build_number_ + ", p=" + patch_number_;
bengr 2014/09/04 19:22:52 indent only 2 from the 'if'
if (!client_.empty())
header_value += ", c=" + client_;
headers->SetHeader(kChromeProxyHeader, header_value);

Powered by Google App Engine
This is Rietveld 408576698