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_SERVIC
E_H_ | 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SERVIC
E_H_ |
6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SERVIC
E_H_ | 6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SERVIC
E_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "base/callback.h" | 12 #include "base/callback.h" |
11 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
12 #include "base/macros.h" | 14 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
16 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
17 #include "base/sequenced_task_runner.h" | 19 #include "base/sequenced_task_runner.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 78 |
77 // Constructs compression stats with a noop |DataReductionProxyStore|; load | 79 // Constructs compression stats with a noop |DataReductionProxyStore|; load |
78 // and store calls do nothing. This should not be called | 80 // and store calls do nothing. This should not be called |
79 // if a valid compression stats is passed into the constructor. | 81 // if a valid compression stats is passed into the constructor. |
80 void EnableCompressionStatisticsLogging( | 82 void EnableCompressionStatisticsLogging( |
81 PrefService* prefs, | 83 PrefService* prefs, |
82 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner, | 84 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner, |
83 const base::TimeDelta& commit_delay); | 85 const base::TimeDelta& commit_delay); |
84 | 86 |
85 // Records daily data savings statistics in |compression_stats_|. | 87 // Records daily data savings statistics in |compression_stats_|. |
86 void UpdateContentLengths(int64 data_used, | 88 void UpdateContentLengths(int64_t data_used, |
87 int64 original_size, | 89 int64_t original_size, |
88 bool data_reduction_proxy_enabled, | 90 bool data_reduction_proxy_enabled, |
89 DataReductionProxyRequestType request_type, | 91 DataReductionProxyRequestType request_type, |
90 const std::string& data_usage_host, | 92 const std::string& data_usage_host, |
91 const std::string& mime_type); | 93 const std::string& mime_type); |
92 | 94 |
93 // Overrides of DataReductionProxyEventStorageDelegate. | 95 // Overrides of DataReductionProxyEventStorageDelegate. |
94 void AddEvent(scoped_ptr<base::Value> event) override; | 96 void AddEvent(scoped_ptr<base::Value> event) override; |
95 void AddEnabledEvent(scoped_ptr<base::Value> event, bool enabled) override; | 97 void AddEnabledEvent(scoped_ptr<base::Value> event, bool enabled) override; |
96 void AddEventAndSecureProxyCheckState(scoped_ptr<base::Value> event, | 98 void AddEventAndSecureProxyCheckState(scoped_ptr<base::Value> event, |
97 SecureProxyCheckState state) override; | 99 SecureProxyCheckState state) override; |
98 void AddAndSetLastBypassEvent(scoped_ptr<base::Value> event, | 100 void AddAndSetLastBypassEvent(scoped_ptr<base::Value> event, |
99 int64 expiration_ticks) override; | 101 int64_t expiration_ticks) override; |
100 | 102 |
101 // Records whether the Data Reduction Proxy is unreachable or not. | 103 // Records whether the Data Reduction Proxy is unreachable or not. |
102 void SetUnreachable(bool unreachable); | 104 void SetUnreachable(bool unreachable); |
103 | 105 |
104 // Sets if Lo-Fi was active on the last main frame load in | 106 // Sets if Lo-Fi was active on the last main frame load in |
105 // DataReductionProxySettings. | 107 // DataReductionProxySettings. |
106 void SetLoFiModeActiveOnMainFrame(bool lo_fi_mode_active); | 108 void SetLoFiModeActiveOnMainFrame(bool lo_fi_mode_active); |
107 | 109 |
108 // Sets Lo-Fi mode off on the IO thread. | 110 // Sets Lo-Fi mode off on the IO thread. |
109 void SetLoFiModeOff(); | 111 void SetLoFiModeOff(); |
110 | 112 |
111 // Initializes the Lo-Fi implicit opt out prefs. | 113 // Initializes the Lo-Fi implicit opt out prefs. |
112 void InitializeLoFiPrefs(); | 114 void InitializeLoFiPrefs(); |
113 | 115 |
114 // Stores an int64 value in |prefs_|. | 116 // Stores an int64_t value in |prefs_|. |
115 void SetInt64Pref(const std::string& pref_path, int64 value); | 117 void SetInt64Pref(const std::string& pref_path, int64_t value); |
116 | 118 |
117 // Stores a string value in |prefs_|. | 119 // Stores a string value in |prefs_|. |
118 void SetStringPref(const std::string& pref_path, const std::string& value); | 120 void SetStringPref(const std::string& pref_path, const std::string& value); |
119 | 121 |
120 // Bridge methods to safely call to the UI thread objects. | 122 // Bridge methods to safely call to the UI thread objects. |
121 // Virtual for testing. | 123 // Virtual for testing. |
122 virtual void SetProxyPrefs(bool enabled, bool at_startup); | 124 virtual void SetProxyPrefs(bool enabled, bool at_startup); |
123 | 125 |
124 void LoadHistoricalDataUsage( | 126 void LoadHistoricalDataUsage( |
125 const HistoricalDataUsageCallback& load_data_usage_callback); | 127 const HistoricalDataUsageCallback& load_data_usage_callback); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 bool initialized_; | 197 bool initialized_; |
196 | 198 |
197 base::WeakPtrFactory<DataReductionProxyService> weak_factory_; | 199 base::WeakPtrFactory<DataReductionProxyService> weak_factory_; |
198 | 200 |
199 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyService); | 201 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyService); |
200 }; | 202 }; |
201 | 203 |
202 } // namespace data_reduction_proxy | 204 } // namespace data_reduction_proxy |
203 | 205 |
204 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SER
VICE_H_ | 206 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SER
VICE_H_ |
OLD | NEW |