| OLD | NEW |
| 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/synchronization/waitable_event.h" | 15 #include "base/synchronization/waitable_event.h" |
| 16 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
| 17 #include "components/cronet/url_request_context_config.h" | 17 #include "components/cronet/url_request_context_config.h" |
| 18 #include "net/cert/cert_verifier.h" | 18 #include "net/cert/cert_verifier.h" |
| 19 #include "net/url_request/url_request.h" | |
| 20 #include "net/url_request/url_request_context.h" | 19 #include "net/url_request/url_request_context.h" |
| 21 #include "net/url_request/url_request_context_getter.h" | 20 #include "net/url_request/url_request_context_getter.h" |
| 22 | 21 |
| 23 class JsonPrefStore; | |
| 24 | |
| 25 namespace base { | 22 namespace base { |
| 26 class WaitableEvent; | 23 class WaitableEvent; |
| 27 } // namespace base | 24 } // namespace base |
| 28 | 25 |
| 29 namespace net { | 26 namespace net { |
| 30 class CookieStore; | 27 class CookieStore; |
| 31 class NetLog; | 28 class NetLog; |
| 32 class ProxyConfigService; | |
| 33 class WriteToFileNetLogObserver; | 29 class WriteToFileNetLogObserver; |
| 34 } // namespace net | 30 } // namespace net |
| 35 | 31 |
| 36 namespace cronet { | 32 namespace cronet { |
| 37 // CronetEnvironment contains all the network stack configuration | 33 // CronetEnvironment contains all the network stack configuration |
| 38 // and initialization. | 34 // and initialization. |
| 39 class CronetEnvironment { | 35 class CronetEnvironment { |
| 40 public: | 36 public: |
| 41 // Initialize Cronet environment globals. Must be called only once on the | 37 // Initialize Cronet environment globals. Must be called only once on the |
| 42 // main thread. | 38 // main thread. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 72 void set_http2_enabled(bool enabled) { http2_enabled_ = enabled; } | 68 void set_http2_enabled(bool enabled) { http2_enabled_ = enabled; } |
| 73 void set_quic_enabled(bool enabled) { quic_enabled_ = enabled; } | 69 void set_quic_enabled(bool enabled) { quic_enabled_ = enabled; } |
| 74 | 70 |
| 75 bool http2_enabled() const { return http2_enabled_; } | 71 bool http2_enabled() const { return http2_enabled_; } |
| 76 bool quic_enabled() const { return quic_enabled_; } | 72 bool quic_enabled() const { return quic_enabled_; } |
| 77 | 73 |
| 78 void set_accept_language(const std::string& accept_language) { | 74 void set_accept_language(const std::string& accept_language) { |
| 79 accept_language_ = accept_language; | 75 accept_language_ = accept_language; |
| 80 } | 76 } |
| 81 | 77 |
| 82 void set_cert_verifier(std::unique_ptr<net::CertVerifier> cert_verifier) { | 78 void set_mock_cert_verifier( |
| 83 cert_verifier_ = std::move(cert_verifier); | 79 std::unique_ptr<net::CertVerifier> mock_cert_verifier) { |
| 80 mock_cert_verifier_ = std::move(mock_cert_verifier); |
| 84 } | 81 } |
| 85 | 82 |
| 86 void SetHostResolverRules(const std::string& host_resolver_rules); | 83 void SetHostResolverRules(const std::string& host_resolver_rules); |
| 87 | 84 |
| 88 void set_ssl_key_log_file_name(const std::string& ssl_key_log_file_name) { | 85 void set_ssl_key_log_file_name(const std::string& ssl_key_log_file_name) { |
| 89 ssl_key_log_file_name_ = ssl_key_log_file_name; | 86 ssl_key_log_file_name_ = ssl_key_log_file_name; |
| 90 } | 87 } |
| 91 | 88 |
| 92 // Returns the URLRequestContext associated with this object. | 89 // Returns the URLRequestContext associated with this object. |
| 93 net::URLRequestContext* GetURLRequestContext() const; | 90 net::URLRequestContext* GetURLRequestContext() const; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 std::string accept_language_; | 123 std::string accept_language_; |
| 127 std::string ssl_key_log_file_name_; | 124 std::string ssl_key_log_file_name_; |
| 128 | 125 |
| 129 std::list<net::HostPortPair> quic_hints_; | 126 std::list<net::HostPortPair> quic_hints_; |
| 130 | 127 |
| 131 std::unique_ptr<base::Thread> network_io_thread_; | 128 std::unique_ptr<base::Thread> network_io_thread_; |
| 132 std::unique_ptr<base::Thread> network_cache_thread_; | 129 std::unique_ptr<base::Thread> network_cache_thread_; |
| 133 std::unique_ptr<base::Thread> file_thread_; | 130 std::unique_ptr<base::Thread> file_thread_; |
| 134 std::unique_ptr<base::Thread> file_user_blocking_thread_; | 131 std::unique_ptr<base::Thread> file_user_blocking_thread_; |
| 135 scoped_refptr<base::SequencedTaskRunner> pref_store_worker_pool_; | 132 scoped_refptr<base::SequencedTaskRunner> pref_store_worker_pool_; |
| 136 scoped_refptr<JsonPrefStore> net_pref_store_; | 133 std::unique_ptr<net::CertVerifier> mock_cert_verifier_; |
| 137 std::unique_ptr<net::CertVerifier> cert_verifier_; | |
| 138 std::unique_ptr<net::ProxyConfigService> proxy_config_service_; | |
| 139 std::unique_ptr<net::HttpServerProperties> http_server_properties_; | |
| 140 std::unique_ptr<net::CookieStore> cookie_store_; | 134 std::unique_ptr<net::CookieStore> cookie_store_; |
| 141 std::unique_ptr<net::URLRequestContext> main_context_; | 135 std::unique_ptr<net::URLRequestContext> main_context_; |
| 142 scoped_refptr<net::URLRequestContextGetter> main_context_getter_; | 136 scoped_refptr<net::URLRequestContextGetter> main_context_getter_; |
| 143 std::string user_agent_; | 137 std::string user_agent_; |
| 144 bool user_agent_partial_; | 138 bool user_agent_partial_; |
| 145 std::unique_ptr<net::NetLog> net_log_; | 139 std::unique_ptr<net::NetLog> net_log_; |
| 146 std::unique_ptr<net::WriteToFileNetLogObserver> net_log_observer_; | 140 std::unique_ptr<net::WriteToFileNetLogObserver> net_log_observer_; |
| 147 | 141 |
| 148 DISALLOW_COPY_AND_ASSIGN(CronetEnvironment); | 142 DISALLOW_COPY_AND_ASSIGN(CronetEnvironment); |
| 149 }; | 143 }; |
| 150 | 144 |
| 151 } // namespace cronet | 145 } // namespace cronet |
| 152 | 146 |
| 153 #endif // COMPONENTS_CRONET_IOS_CRONET_ENVIRONMENT_H_ | 147 #endif // COMPONENTS_CRONET_IOS_CRONET_ENVIRONMENT_H_ |
| OLD | NEW |