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

Unified Diff: components/cronet/ios/cronet_environment.h

Issue 2568883002: [cronet] Add member for QUIC user agent ID, with getter and setter. (Closed)
Patch Set: fix tangled cl Created 4 years 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/cronet/ios/cronet_environment.h
diff --git a/components/cronet/ios/cronet_environment.h b/components/cronet/ios/cronet_environment.h
index f6446c7ae3ec965c136c5ae6f8d0e442b2e44e82..9c693d59a4cc39eb2b9ab10f3dcf1233be23760c 100644
--- a/components/cronet/ios/cronet_environment.h
+++ b/components/cronet/ios/cronet_environment.h
@@ -12,8 +12,10 @@
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
+#include "base/strings/sys_string_conversions.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
+#include "components/cronet/ios/version.h"
#include "components/cronet/url_request_context_config.h"
#include "net/cert/cert_verifier.h"
#include "net/url_request/url_request_context.h"
@@ -66,11 +68,21 @@ class CronetEnvironment {
// |forced_quic_origin_|. These only have any effect before Start() is
// called.
void set_http2_enabled(bool enabled) { http2_enabled_ = enabled; }
- void set_quic_enabled(bool enabled) { quic_enabled_ = enabled; }
+ // In addition to setting |quic_enabled_|, this sets |quic_user_agent_id_|
+ // to the default. A non-default user agent must be set _after_ this
+ // function is called, or it will be overwritten.
+ void set_quic_enabled(bool enabled) {
+ quic_enabled_ = enabled;
+ quic_user_agent_id_ = getDefaultQuicUserAgentId();
mef 2016/12/12 21:52:20 Maybe call getDefaultQuicUserAgentId() when it is
lilyhoughton 2016/12/13 15:10:22 call to getDefaultQuicUserAgentId() removed per co
+ }
bool http2_enabled() const { return http2_enabled_; }
bool quic_enabled() const { return quic_enabled_; }
+ void set_quic_user_agent_id(std::string& quic_user_agent_id) {
mef 2016/12/12 21:52:20 const std::string&
lilyhoughton 2016/12/13 15:10:22 Done.
+ quic_user_agent_id_ = quic_user_agent_id;
+ }
+
void set_accept_language(const std::string& accept_language) {
accept_language_ = accept_language;
}
@@ -118,8 +130,15 @@ class CronetEnvironment {
void SetHostResolverRulesOnNetworkThread(const std::string& rules,
base::WaitableEvent* event);
+ std::string getDefaultQuicUserAgentId() {
mef 2016/12/12 21:52:20 non-trivial set/get methods should have non-inline
lilyhoughton 2016/12/13 15:10:22 Done.
+ return base::SysNSStringToUTF8([[NSBundle mainBundle]
+ objectForInfoDictionaryKey:@"CFBundleDisplayName"]) +
+ " Cronet/" + CRONET_VERSION;
+ }
+
bool http2_enabled_;
bool quic_enabled_;
+ std::string quic_user_agent_id_;
std::string accept_language_;
std::string ssl_key_log_file_name_;
« no previous file with comments | « no previous file | components/cronet/ios/cronet_environment.mm » ('j') | components/cronet/ios/cronet_environment.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698