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

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

Issue 312193005: Pass chrome version and channel in CHLO message to server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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/http_server_properties_manager.cc
diff --git a/chrome/browser/net/http_server_properties_manager.cc b/chrome/browser/net/http_server_properties_manager.cc
index c2e204db65df56bb58c83ee69928396be30cdc9a..35e5f1000e8376aaab9990bcabd0fd1796a92ac0 100644
--- a/chrome/browser/net/http_server_properties_manager.cc
+++ b/chrome/browser/net/http_server_properties_manager.cc
@@ -13,6 +13,7 @@
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "chrome/browser/chrome_notification_types.h"
+#include "chrome/common/chrome_version_info.h"
#include "chrome/common/pref_names.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "content/public/browser/browser_thread.h"
@@ -90,6 +91,28 @@ void HttpServerPropertiesManager::InitializeOnIOThread() {
new base::WeakPtrFactory<HttpServerPropertiesManager>(this));
http_server_properties_impl_.reset(new net::HttpServerPropertiesImpl());
+ std::string client_version;
+ chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
+ switch (channel) {
+ case chrome::VersionInfo::CHANNEL_CANARY:
+ client_version = "C ";
ramant (doing other things) 2014/06/04 21:30:36 Should we define an enum vs the first letter of ch
Ryan Hamilton 2014/06/04 22:31:15 We could. On the other hand, the CHLO packet is pa
ramant (doing other things) 2014/06/05 02:51:55 Done.
+ break;
+ case chrome::VersionInfo::CHANNEL_DEV:
+ client_version = "D ";
+ break;
+ case chrome::VersionInfo::CHANNEL_BETA:
+ client_version = "B ";
+ break;
+ case chrome::VersionInfo::CHANNEL_STABLE:
+ client_version = "S ";
+ break;
+ default:
+ client_version = "U ";
+ }
+ chrome::VersionInfo version_info;
+ client_version.append(version_info.Version());
Ryan Hamilton 2014/06/04 22:31:15 This doesn't include Chrome, right? It's just 37.0
ramant (doing other things) 2014/06/05 02:51:55 Done.
+ SetClientVersion(client_version);
+
io_prefs_update_timer_.reset(
new base::OneShotTimer<HttpServerPropertiesManager>);
@@ -269,15 +292,28 @@ HttpServerPropertiesManager::spdy_settings_map() const {
void HttpServerPropertiesManager::SetServerNetworkStats(
const net::HostPortPair& host_port_pair,
NetworkStats stats) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
http_server_properties_impl_->SetServerNetworkStats(host_port_pair, stats);
}
const HttpServerPropertiesManager::NetworkStats*
HttpServerPropertiesManager::GetServerNetworkStats(
const net::HostPortPair& host_port_pair) const {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
return http_server_properties_impl_->GetServerNetworkStats(host_port_pair);
}
+void HttpServerPropertiesManager::SetClientVersion(
+ const std::string& client_version) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ http_server_properties_impl_->SetClientVersion(client_version);
+}
+
+const std::string HttpServerPropertiesManager::GetClientVersion() const {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ return http_server_properties_impl_->GetClientVersion();
+}
+
//
// Update the HttpServerPropertiesImpl's cache with data from preferences.
//

Powered by Google App Engine
This is Rietveld 408576698