OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_IO_DAT
A_H_ | 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_IO_DAT
A_H_ |
6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_IO_DAT
A_H_ | 6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_IO_DAT
A_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
11 #include "base/macros.h" | 13 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
14 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
15 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_debu
g_ui_service.h" | 17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_debu
g_ui_service.h" |
16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_dele
gate.h" | 18 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_dele
gate.h" |
17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_metr
ics.h" | 19 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_metr
ics.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 92 |
91 // Returns true when Lo-Fi mode should be activated. When Lo-Fi mode is | 93 // Returns true when Lo-Fi mode should be activated. When Lo-Fi mode is |
92 // active, URL requests are modified to request low fidelity versions of the | 94 // active, URL requests are modified to request low fidelity versions of the |
93 // resources, except when the user is in the Lo-Fi control group. | 95 // resources, except when the user is in the Lo-Fi control group. |
94 bool ShouldEnableLoFiMode(const net::URLRequest& request); | 96 bool ShouldEnableLoFiMode(const net::URLRequest& request); |
95 | 97 |
96 // Sets Lo-Fi mode off in |config_|. | 98 // Sets Lo-Fi mode off in |config_|. |
97 void SetLoFiModeOff(); | 99 void SetLoFiModeOff(); |
98 | 100 |
99 // Bridge methods to safely call to the UI thread objects. | 101 // Bridge methods to safely call to the UI thread objects. |
100 void UpdateContentLengths(int64 data_used, | 102 void UpdateContentLengths(int64_t data_used, |
101 int64 original_size, | 103 int64_t original_size, |
102 bool data_reduction_proxy_enabled, | 104 bool data_reduction_proxy_enabled, |
103 DataReductionProxyRequestType request_type, | 105 DataReductionProxyRequestType request_type, |
104 const std::string& data_usage_host, | 106 const std::string& data_usage_host, |
105 const std::string& mime_type); | 107 const std::string& mime_type); |
106 void SetLoFiModeActiveOnMainFrame(bool lo_fi_mode_active); | 108 void SetLoFiModeActiveOnMainFrame(bool lo_fi_mode_active); |
107 | 109 |
108 // Overrides of DataReductionProxyEventStorageDelegate. Bridges to the UI | 110 // Overrides of DataReductionProxyEventStorageDelegate. Bridges to the UI |
109 // thread objects. | 111 // thread objects. |
110 void AddEvent(scoped_ptr<base::Value> event) override; | 112 void AddEvent(scoped_ptr<base::Value> event) override; |
111 void AddEnabledEvent(scoped_ptr<base::Value> event, bool enabled) override; | 113 void AddEnabledEvent(scoped_ptr<base::Value> event, bool enabled) override; |
112 void AddEventAndSecureProxyCheckState(scoped_ptr<base::Value> event, | 114 void AddEventAndSecureProxyCheckState(scoped_ptr<base::Value> event, |
113 SecureProxyCheckState state) override; | 115 SecureProxyCheckState state) override; |
114 void AddAndSetLastBypassEvent(scoped_ptr<base::Value> event, | 116 void AddAndSetLastBypassEvent(scoped_ptr<base::Value> event, |
115 int64 expiration_ticks) override; | 117 int64_t expiration_ticks) override; |
116 | 118 |
117 // Returns true if the Data Reduction Proxy is enabled and false otherwise. | 119 // Returns true if the Data Reduction Proxy is enabled and false otherwise. |
118 bool IsEnabled() const; | 120 bool IsEnabled() const; |
119 | 121 |
120 // Various accessor methods. | 122 // Various accessor methods. |
121 DataReductionProxyConfigurator* configurator() const { | 123 DataReductionProxyConfigurator* configurator() const { |
122 return configurator_.get(); | 124 return configurator_.get(); |
123 } | 125 } |
124 | 126 |
125 DataReductionProxyConfig* config() const { | 127 DataReductionProxyConfig* config() const { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 DataReductionProxyIOData(); | 186 DataReductionProxyIOData(); |
185 | 187 |
186 // Initializes the weak pointer to |this| on the IO thread. It must be done | 188 // Initializes the weak pointer to |this| on the IO thread. It must be done |
187 // on the IO thread, since it is used for posting tasks from the UI thread | 189 // on the IO thread, since it is used for posting tasks from the UI thread |
188 // to IO thread objects in a thread safe manner. | 190 // to IO thread objects in a thread safe manner. |
189 void InitializeOnIOThread(); | 191 void InitializeOnIOThread(); |
190 | 192 |
191 // Records that the data reduction proxy is unreachable or not. | 193 // Records that the data reduction proxy is unreachable or not. |
192 void SetUnreachable(bool unreachable); | 194 void SetUnreachable(bool unreachable); |
193 | 195 |
194 // Stores an int64 value in preferences storage. | 196 // Stores an int64_t value in preferences storage. |
195 void SetInt64Pref(const std::string& pref_path, int64 value); | 197 void SetInt64Pref(const std::string& pref_path, int64_t value); |
196 | 198 |
197 // Stores a string value in preferences storage. | 199 // Stores a string value in preferences storage. |
198 void SetStringPref(const std::string& pref_path, const std::string& value); | 200 void SetStringPref(const std::string& pref_path, const std::string& value); |
199 | 201 |
200 // Stores a serialized Data Reduction Proxy configuration in preferences | 202 // Stores a serialized Data Reduction Proxy configuration in preferences |
201 // storage. | 203 // storage. |
202 void StoreSerializedConfig(const std::string& serialized_config); | 204 void StoreSerializedConfig(const std::string& serialized_config); |
203 | 205 |
204 // The type of Data Reduction Proxy client. | 206 // The type of Data Reduction Proxy client. |
205 Client client_; | 207 Client client_; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 // does not use alternate protocols. | 259 // does not use alternate protocols. |
258 scoped_refptr<net::URLRequestContextGetter> basic_url_request_context_getter_; | 260 scoped_refptr<net::URLRequestContextGetter> basic_url_request_context_getter_; |
259 | 261 |
260 base::WeakPtrFactory<DataReductionProxyIOData> weak_factory_; | 262 base::WeakPtrFactory<DataReductionProxyIOData> weak_factory_; |
261 | 263 |
262 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyIOData); | 264 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyIOData); |
263 }; | 265 }; |
264 | 266 |
265 } // namespace data_reduction_proxy | 267 } // namespace data_reduction_proxy |
266 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_IO_
DATA_H_ | 268 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_IO_
DATA_H_ |
OLD | NEW |