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 COMPONENTS_VARIATIONS_SERVICE_VARIATIONS_SERVICE_H_ | 5 #ifndef COMPONENTS_VARIATIONS_SERVICE_VARIATIONS_SERVICE_H_ |
6 #define COMPONENTS_VARIATIONS_SERVICE_VARIATIONS_SERVICE_H_ | 6 #define COMPONENTS_VARIATIONS_SERVICE_VARIATIONS_SERVICE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/metrics/field_trial.h" | 15 #include "base/metrics/field_trial.h" |
16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
17 #include "base/threading/thread_checker.h" | 17 #include "base/threading/thread_checker.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 19 #include "components/variations/client_filterable_state.h" |
19 #include "components/variations/service/ui_string_overrider.h" | 20 #include "components/variations/service/ui_string_overrider.h" |
20 #include "components/variations/service/variations_service_client.h" | 21 #include "components/variations/service/variations_service_client.h" |
21 #include "components/variations/variations_request_scheduler.h" | 22 #include "components/variations/variations_request_scheduler.h" |
22 #include "components/variations/variations_seed_simulator.h" | 23 #include "components/variations/variations_seed_simulator.h" |
23 #include "components/variations/variations_seed_store.h" | 24 #include "components/variations/variations_seed_store.h" |
24 #include "components/version_info/version_info.h" | 25 #include "components/version_info/version_info.h" |
25 #include "components/web_resource/resource_request_allowed_notifier.h" | 26 #include "components/web_resource/resource_request_allowed_notifier.h" |
26 #include "net/url_request/url_fetcher_delegate.h" | 27 #include "net/url_request/url_fetcher_delegate.h" |
27 #include "url/gurl.h" | 28 #include "url/gurl.h" |
28 | 29 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 LOAD_COUNTRY_HAS_BOTH_VERSION_NEQ_COUNTRY_EQ, | 230 LOAD_COUNTRY_HAS_BOTH_VERSION_NEQ_COUNTRY_EQ, |
230 LOAD_COUNTRY_HAS_BOTH_VERSION_NEQ_COUNTRY_NEQ, | 231 LOAD_COUNTRY_HAS_BOTH_VERSION_NEQ_COUNTRY_NEQ, |
231 LOAD_COUNTRY_MAX, | 232 LOAD_COUNTRY_MAX, |
232 }; | 233 }; |
233 | 234 |
234 // Loads the seed from the variations store into |seed|. If successfull, | 235 // Loads the seed from the variations store into |seed|. If successfull, |
235 // |seed| will contain the loaded data and true is returned. Set as virtual | 236 // |seed| will contain the loaded data and true is returned. Set as virtual |
236 // so that it can be overridden by tests. | 237 // so that it can be overridden by tests. |
237 virtual bool LoadSeed(VariationsSeed* seed); | 238 virtual bool LoadSeed(VariationsSeed* seed); |
238 | 239 |
| 240 // Returns all of the client state used for filtering studies. |
| 241 // As a side-effect, may update the stored permanent consistency country. |
| 242 std::unique_ptr<ClientFilterableState> GetClientFilterableStateForVersion( |
| 243 const base::Version& version); |
| 244 |
239 // Sets the stored permanent country pref for this client. | 245 // Sets the stored permanent country pref for this client. |
240 void StorePermanentCountry(const base::Version& version, | 246 void StorePermanentCountry(const base::Version& version, |
241 const std::string& country); | 247 const std::string& country); |
242 | 248 |
243 // Checks if prerequisites for fetching the Variations seed are met, and if | 249 // Checks if prerequisites for fetching the Variations seed are met, and if |
244 // so, performs the actual fetch using |DoActualFetch|. | 250 // so, performs the actual fetch using |DoActualFetch|. |
245 void FetchVariationsSeed(); | 251 void FetchVariationsSeed(); |
246 | 252 |
247 // Notify any observers of this service based on the simulation |result|. | 253 // Notify any observers of this service based on the simulation |result|. |
248 void NotifyObservers( | 254 void NotifyObservers( |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 base::ThreadChecker thread_checker_; | 341 base::ThreadChecker thread_checker_; |
336 | 342 |
337 base::WeakPtrFactory<VariationsService> weak_ptr_factory_; | 343 base::WeakPtrFactory<VariationsService> weak_ptr_factory_; |
338 | 344 |
339 DISALLOW_COPY_AND_ASSIGN(VariationsService); | 345 DISALLOW_COPY_AND_ASSIGN(VariationsService); |
340 }; | 346 }; |
341 | 347 |
342 } // namespace variations | 348 } // namespace variations |
343 | 349 |
344 #endif // COMPONENTS_VARIATIONS_SERVICE_VARIATIONS_SERVICE_H_ | 350 #endif // COMPONENTS_VARIATIONS_SERVICE_VARIATIONS_SERVICE_H_ |
OLD | NEW |