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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_CRONET_IOS_CRONET_ENVIRONMENT_H_ 5 #ifndef COMPONENTS_CRONET_IOS_CRONET_ENVIRONMENT_H_
6 #define COMPONENTS_CRONET_IOS_CRONET_ENVIRONMENT_H_ 6 #define COMPONENTS_CRONET_IOS_CRONET_ENVIRONMENT_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
15 #include "base/strings/sys_string_conversions.h"
15 #include "base/synchronization/waitable_event.h" 16 #include "base/synchronization/waitable_event.h"
16 #include "base/threading/thread.h" 17 #include "base/threading/thread.h"
18 #include "components/cronet/ios/version.h"
17 #include "components/cronet/url_request_context_config.h" 19 #include "components/cronet/url_request_context_config.h"
18 #include "net/cert/cert_verifier.h" 20 #include "net/cert/cert_verifier.h"
19 #include "net/url_request/url_request_context.h" 21 #include "net/url_request/url_request_context.h"
20 #include "net/url_request/url_request_context_getter.h" 22 #include "net/url_request/url_request_context_getter.h"
21 23
22 namespace base { 24 namespace base {
23 class WaitableEvent; 25 class WaitableEvent;
24 } // namespace base 26 } // namespace base
25 27
26 namespace net { 28 namespace net {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // Stops logging and flushes file. If not currently logging this call is 61 // Stops logging and flushes file. If not currently logging this call is
60 // ignored. 62 // ignored.
61 void StopNetLog(); 63 void StopNetLog();
62 64
63 void AddQuicHint(const std::string& host, int port, int alternate_port); 65 void AddQuicHint(const std::string& host, int port, int alternate_port);
64 66
65 // Setters and getters for |http2_enabled_|, |quic_enabled_|, and 67 // Setters and getters for |http2_enabled_|, |quic_enabled_|, and
66 // |forced_quic_origin_|. These only have any effect before Start() is 68 // |forced_quic_origin_|. These only have any effect before Start() is
67 // called. 69 // called.
68 void set_http2_enabled(bool enabled) { http2_enabled_ = enabled; } 70 void set_http2_enabled(bool enabled) { http2_enabled_ = enabled; }
69 void set_quic_enabled(bool enabled) { quic_enabled_ = enabled; } 71 // In addition to setting |quic_enabled_|, this sets |quic_user_agent_id_|
72 // to the default. A non-default user agent must be set _after_ this
73 // function is called, or it will be overwritten.
74 void set_quic_enabled(bool enabled) {
75 quic_enabled_ = enabled;
76 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
77 }
70 78
71 bool http2_enabled() const { return http2_enabled_; } 79 bool http2_enabled() const { return http2_enabled_; }
72 bool quic_enabled() const { return quic_enabled_; } 80 bool quic_enabled() const { return quic_enabled_; }
73 81
82 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.
83 quic_user_agent_id_ = quic_user_agent_id;
84 }
85
74 void set_accept_language(const std::string& accept_language) { 86 void set_accept_language(const std::string& accept_language) {
75 accept_language_ = accept_language; 87 accept_language_ = accept_language;
76 } 88 }
77 89
78 void set_mock_cert_verifier( 90 void set_mock_cert_verifier(
79 std::unique_ptr<net::CertVerifier> mock_cert_verifier) { 91 std::unique_ptr<net::CertVerifier> mock_cert_verifier) {
80 mock_cert_verifier_ = std::move(mock_cert_verifier); 92 mock_cert_verifier_ = std::move(mock_cert_verifier);
81 } 93 }
82 94
83 void SetHostResolverRules(const std::string& host_resolver_rules); 95 void SetHostResolverRules(const std::string& host_resolver_rules);
(...skipping 27 matching lines...) Expand all
111 123
112 // Returns the HttpNetworkSession object from the passed in 124 // Returns the HttpNetworkSession object from the passed in
113 // URLRequestContext or NULL if none exists. 125 // URLRequestContext or NULL if none exists.
114 net::HttpNetworkSession* GetHttpNetworkSession( 126 net::HttpNetworkSession* GetHttpNetworkSession(
115 net::URLRequestContext* context); 127 net::URLRequestContext* context);
116 128
117 // Sets host resolver rules on the network_io_thread_. 129 // Sets host resolver rules on the network_io_thread_.
118 void SetHostResolverRulesOnNetworkThread(const std::string& rules, 130 void SetHostResolverRulesOnNetworkThread(const std::string& rules,
119 base::WaitableEvent* event); 131 base::WaitableEvent* event);
120 132
133 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.
134 return base::SysNSStringToUTF8([[NSBundle mainBundle]
135 objectForInfoDictionaryKey:@"CFBundleDisplayName"]) +
136 " Cronet/" + CRONET_VERSION;
137 }
138
121 bool http2_enabled_; 139 bool http2_enabled_;
122 bool quic_enabled_; 140 bool quic_enabled_;
141 std::string quic_user_agent_id_;
123 std::string accept_language_; 142 std::string accept_language_;
124 std::string ssl_key_log_file_name_; 143 std::string ssl_key_log_file_name_;
125 144
126 std::list<net::HostPortPair> quic_hints_; 145 std::list<net::HostPortPair> quic_hints_;
127 146
128 std::unique_ptr<base::Thread> network_io_thread_; 147 std::unique_ptr<base::Thread> network_io_thread_;
129 std::unique_ptr<base::Thread> network_cache_thread_; 148 std::unique_ptr<base::Thread> network_cache_thread_;
130 std::unique_ptr<base::Thread> file_thread_; 149 std::unique_ptr<base::Thread> file_thread_;
131 std::unique_ptr<base::Thread> file_user_blocking_thread_; 150 std::unique_ptr<base::Thread> file_user_blocking_thread_;
132 scoped_refptr<base::SequencedTaskRunner> pref_store_worker_pool_; 151 scoped_refptr<base::SequencedTaskRunner> pref_store_worker_pool_;
133 std::unique_ptr<net::CertVerifier> mock_cert_verifier_; 152 std::unique_ptr<net::CertVerifier> mock_cert_verifier_;
134 std::unique_ptr<net::CookieStore> cookie_store_; 153 std::unique_ptr<net::CookieStore> cookie_store_;
135 std::unique_ptr<net::URLRequestContext> main_context_; 154 std::unique_ptr<net::URLRequestContext> main_context_;
136 scoped_refptr<net::URLRequestContextGetter> main_context_getter_; 155 scoped_refptr<net::URLRequestContextGetter> main_context_getter_;
137 std::string user_agent_; 156 std::string user_agent_;
138 bool user_agent_partial_; 157 bool user_agent_partial_;
139 std::unique_ptr<net::NetLog> net_log_; 158 std::unique_ptr<net::NetLog> net_log_;
140 std::unique_ptr<net::WriteToFileNetLogObserver> net_log_observer_; 159 std::unique_ptr<net::WriteToFileNetLogObserver> net_log_observer_;
141 160
142 DISALLOW_COPY_AND_ASSIGN(CronetEnvironment); 161 DISALLOW_COPY_AND_ASSIGN(CronetEnvironment);
143 }; 162 };
144 163
145 } // namespace cronet 164 } // namespace cronet
146 165
147 #endif // COMPONENTS_CRONET_IOS_CRONET_ENVIRONMENT_H_ 166 #endif // COMPONENTS_CRONET_IOS_CRONET_ENVIRONMENT_H_
OLDNEW
« 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