OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ |
6 #define CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ | 6 #define CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // disabled. | 145 // disabled. |
146 std::string GetInvalidVariationsSeedSignature() const; | 146 std::string GetInvalidVariationsSeedSignature() const; |
147 | 147 |
148 protected: | 148 protected: |
149 // Starts the fetching process once, where |OnURLFetchComplete| is called with | 149 // Starts the fetching process once, where |OnURLFetchComplete| is called with |
150 // the response. | 150 // the response. |
151 virtual void DoActualFetch(); | 151 virtual void DoActualFetch(); |
152 | 152 |
153 // Stores the seed to prefs. Set as virtual and protected so that it can be | 153 // Stores the seed to prefs. Set as virtual and protected so that it can be |
154 // overridden by tests. | 154 // overridden by tests. |
155 virtual void StoreSeed(const std::string& seed_data, | 155 virtual bool StoreSeed(const std::string& seed_data, |
156 const std::string& seed_signature, | 156 const std::string& seed_signature, |
157 const base::Time& date_fetched); | 157 const std::string& country_code, |
| 158 const base::Time& date_fetched, |
| 159 bool is_delta_compressed); |
158 | 160 |
159 // Creates the VariationsService with the given |local_state| prefs service | 161 // Creates the VariationsService with the given |local_state| prefs service |
160 // and |state_manager|. This instance will take ownership of |notifier|. | 162 // and |state_manager|. This instance will take ownership of |notifier|. |
161 // Does not take ownership of |state_manager|. Caller should ensure that | 163 // Does not take ownership of |state_manager|. Caller should ensure that |
162 // |state_manager| is valid for the lifetime of this class. Use the |Create| | 164 // |state_manager| is valid for the lifetime of this class. Use the |Create| |
163 // factory method to create a VariationsService. | 165 // factory method to create a VariationsService. |
164 VariationsService(web_resource::ResourceRequestAllowedNotifier* notifier, | 166 VariationsService(web_resource::ResourceRequestAllowedNotifier* notifier, |
165 PrefService* local_state, | 167 PrefService* local_state, |
166 metrics::MetricsStateManager* state_manager); | 168 metrics::MetricsStateManager* state_manager); |
167 | 169 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 // The URL to use for querying the variations server. | 253 // The URL to use for querying the variations server. |
252 GURL variations_server_url_; | 254 GURL variations_server_url_; |
253 | 255 |
254 // Tracks whether |CreateTrialsFromSeed| has been called, to ensure that | 256 // Tracks whether |CreateTrialsFromSeed| has been called, to ensure that |
255 // it gets called prior to |StartRepeatedVariationsSeedFetch|. | 257 // it gets called prior to |StartRepeatedVariationsSeedFetch|. |
256 bool create_trials_from_seed_called_; | 258 bool create_trials_from_seed_called_; |
257 | 259 |
258 // Tracks whether the initial request to the variations server had completed. | 260 // Tracks whether the initial request to the variations server had completed. |
259 bool initial_request_completed_; | 261 bool initial_request_completed_; |
260 | 262 |
| 263 // Indicates that the next request to the variations service shouldn't specify |
| 264 // that it supports delta compression. Set to true when a delta compressed |
| 265 // response encountered an error. |
| 266 bool disable_deltas_for_next_request_; |
| 267 |
261 // Helper class used to tell this service if it's allowed to make network | 268 // Helper class used to tell this service if it's allowed to make network |
262 // resource requests. | 269 // resource requests. |
263 scoped_ptr<web_resource::ResourceRequestAllowedNotifier> | 270 scoped_ptr<web_resource::ResourceRequestAllowedNotifier> |
264 resource_request_allowed_notifier_; | 271 resource_request_allowed_notifier_; |
265 | 272 |
266 // The start time of the last seed request. This is used to measure the | 273 // The start time of the last seed request. This is used to measure the |
267 // latency of seed requests. Initially zero. | 274 // latency of seed requests. Initially zero. |
268 base::TimeTicks last_request_started_time_; | 275 base::TimeTicks last_request_started_time_; |
269 | 276 |
270 // The number of requests to the variations server that have been performed. | 277 // The number of requests to the variations server that have been performed. |
(...skipping 10 matching lines...) Expand all Loading... |
281 base::ThreadChecker thread_checker_; | 288 base::ThreadChecker thread_checker_; |
282 | 289 |
283 base::WeakPtrFactory<VariationsService> weak_ptr_factory_; | 290 base::WeakPtrFactory<VariationsService> weak_ptr_factory_; |
284 | 291 |
285 DISALLOW_COPY_AND_ASSIGN(VariationsService); | 292 DISALLOW_COPY_AND_ASSIGN(VariationsService); |
286 }; | 293 }; |
287 | 294 |
288 } // namespace chrome_variations | 295 } // namespace chrome_variations |
289 | 296 |
290 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ | 297 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ |
OLD | NEW |