OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 IOS_CRNET_CRNET_ENVIRONMENT_H_ | 5 #ifndef IOS_CRNET_CRNET_ENVIRONMENT_H_ |
6 #define IOS_CRNET_CRNET_ENVIRONMENT_H_ | 6 #define IOS_CRNET_CRNET_ENVIRONMENT_H_ |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 // Setters and getters for |spdy_enabled_|, |quic_enabled_|, and | 87 // Setters and getters for |spdy_enabled_|, |quic_enabled_|, and |
88 // |forced_quic_origin_|. These only have any effect before Install() is | 88 // |forced_quic_origin_|. These only have any effect before Install() is |
89 // called. | 89 // called. |
90 void set_spdy_enabled(bool enabled) { spdy_enabled_ = enabled; } | 90 void set_spdy_enabled(bool enabled) { spdy_enabled_ = enabled; } |
91 void set_quic_enabled(bool enabled) { quic_enabled_ = enabled; } | 91 void set_quic_enabled(bool enabled) { quic_enabled_ = enabled; } |
92 void set_sdch_enabled(bool enabled) { sdch_enabled_ = enabled; } | 92 void set_sdch_enabled(bool enabled) { sdch_enabled_ = enabled; } |
93 void set_sdch_pref_store_filename(const std::string& pref_store) { | 93 void set_sdch_pref_store_filename(const std::string& pref_store) { |
94 sdch_pref_store_filename_ = pref_store; | 94 sdch_pref_store_filename_ = pref_store; |
95 } | 95 } |
96 void set_alternate_protocol_threshold(double threshold) { | |
97 alternate_protocol_threshold_ = threshold; | |
98 } | |
99 | 96 |
100 bool spdy_enabled() const { return spdy_enabled_; } | 97 bool spdy_enabled() const { return spdy_enabled_; } |
101 bool quic_enabled() const { return quic_enabled_; } | 98 bool quic_enabled() const { return quic_enabled_; } |
102 bool sdch_enabled() const { return sdch_enabled_; } | 99 bool sdch_enabled() const { return sdch_enabled_; } |
103 double alternate_protocol_threshold() const { | |
104 return alternate_protocol_threshold_; | |
105 } | |
106 | 100 |
107 // Clears the network stack's disk cache. | 101 // Clears the network stack's disk cache. |
108 void ClearCache(ClearCacheCallback callback); | 102 void ClearCache(ClearCacheCallback callback); |
109 | 103 |
110 private: | 104 private: |
111 // Runs a closure on the network thread. | 105 // Runs a closure on the network thread. |
112 void PostToNetworkThread(const tracked_objects::Location& from_here, | 106 void PostToNetworkThread(const tracked_objects::Location& from_here, |
113 const base::Closure& task); | 107 const base::Closure& task); |
114 | 108 |
115 // Configures SDCH on the network thread. If SDCH is enabled, sets up | 109 // Configures SDCH on the network thread. If SDCH is enabled, sets up |
(...skipping 19 matching lines...) Expand all Loading... |
135 net::URLRequestContext* context); | 129 net::URLRequestContext* context); |
136 | 130 |
137 // Helper method that closes all current SPDY sessions on the network IO | 131 // Helper method that closes all current SPDY sessions on the network IO |
138 // thread. | 132 // thread. |
139 void CloseAllSpdySessionsInternal(); | 133 void CloseAllSpdySessionsInternal(); |
140 | 134 |
141 bool spdy_enabled_; | 135 bool spdy_enabled_; |
142 bool quic_enabled_; | 136 bool quic_enabled_; |
143 bool sdch_enabled_; | 137 bool sdch_enabled_; |
144 std::string sdch_pref_store_filename_; | 138 std::string sdch_pref_store_filename_; |
145 double alternate_protocol_threshold_; | |
146 | 139 |
147 static CrNetEnvironment* chrome_net_; | 140 static CrNetEnvironment* chrome_net_; |
148 scoped_ptr<base::Thread> network_io_thread_; | 141 scoped_ptr<base::Thread> network_io_thread_; |
149 scoped_ptr<base::Thread> network_cache_thread_; | 142 scoped_ptr<base::Thread> network_cache_thread_; |
150 scoped_ptr<base::Thread> file_thread_; | 143 scoped_ptr<base::Thread> file_thread_; |
151 scoped_ptr<base::Thread> file_user_blocking_thread_; | 144 scoped_ptr<base::Thread> file_user_blocking_thread_; |
152 scoped_ptr<net::SdchManager> sdch_manager_; | 145 scoped_ptr<net::SdchManager> sdch_manager_; |
153 scoped_ptr<net::SdchOwner> sdch_owner_; | 146 scoped_ptr<net::SdchOwner> sdch_owner_; |
154 scoped_refptr<base::SequencedTaskRunner> pref_store_worker_pool_; | 147 scoped_refptr<base::SequencedTaskRunner> pref_store_worker_pool_; |
155 scoped_refptr<JsonPrefStore> net_pref_store_; | 148 scoped_refptr<JsonPrefStore> net_pref_store_; |
156 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; | 149 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; |
157 scoped_ptr<net::ProxyConfigService> proxy_config_service_; | 150 scoped_ptr<net::ProxyConfigService> proxy_config_service_; |
158 scoped_ptr<net::HttpServerProperties> http_server_properties_; | 151 scoped_ptr<net::HttpServerProperties> http_server_properties_; |
159 scoped_ptr<net::CookieStore> cookie_store_; | 152 scoped_ptr<net::CookieStore> cookie_store_; |
160 scoped_refptr<net::URLRequestContextGetter> main_context_getter_; | 153 scoped_refptr<net::URLRequestContextGetter> main_context_getter_; |
161 scoped_ptr<net::URLRequestContext> main_context_; | 154 scoped_ptr<net::URLRequestContext> main_context_; |
162 scoped_ptr<CrNetHttpProtocolHandlerDelegate> http_protocol_handler_delegate_; | 155 scoped_ptr<CrNetHttpProtocolHandlerDelegate> http_protocol_handler_delegate_; |
163 std::string user_agent_product_name_; | 156 std::string user_agent_product_name_; |
164 scoped_ptr<net::NetLog> net_log_; | 157 scoped_ptr<net::NetLog> net_log_; |
165 scoped_ptr<net::WriteToFileNetLogObserver> net_log_observer_; | 158 scoped_ptr<net::WriteToFileNetLogObserver> net_log_observer_; |
166 | 159 |
167 DISALLOW_COPY_AND_ASSIGN(CrNetEnvironment); | 160 DISALLOW_COPY_AND_ASSIGN(CrNetEnvironment); |
168 }; | 161 }; |
169 | 162 |
170 #endif // IOS_CRNET_CRNET_ENVIRONMENT_H_ | 163 #endif // IOS_CRNET_CRNET_ENVIRONMENT_H_ |
OLD | NEW |