| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/metrics/field_trial.h" | 14 #include "base/metrics/field_trial.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
| 17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "components/variations/service/variations_service_client.h" | 18 #include "components/variations/service/variations_service_client.h" |
| 19 #include "components/variations/variations_request_scheduler.h" | 19 #include "components/variations/variations_request_scheduler.h" |
| 20 #include "components/variations/variations_seed_simulator.h" | 20 #include "components/variations/variations_seed_simulator.h" |
| 21 #include "components/variations/variations_seed_store.h" | 21 #include "components/variations/variations_seed_store.h" |
| 22 #include "components/web_resource/resource_request_allowed_notifier.h" | 22 #include "components/web_resource/resource_request_allowed_notifier.h" |
| 23 #include "net/url_request/url_fetcher_delegate.h" | 23 #include "net/url_request/url_fetcher_delegate.h" |
| 24 #include "url/gurl.h" | 24 #include "url/gurl.h" |
| 25 | 25 |
| 26 class PrefService; | 26 class PrefService; |
| 27 class PrefRegistrySimple; | 27 class PrefRegistrySimple; |
| 28 | 28 |
| 29 namespace base { | 29 namespace base { |
| 30 class FeatureList; |
| 30 class Version; | 31 class Version; |
| 31 } | 32 } |
| 32 | 33 |
| 33 namespace metrics { | 34 namespace metrics { |
| 34 class MetricsStateManager; | 35 class MetricsStateManager; |
| 35 } | 36 } |
| 36 | 37 |
| 37 namespace user_prefs { | 38 namespace user_prefs { |
| 38 class PrefRegistrySyncable; | 39 class PrefRegistrySyncable; |
| 39 } | 40 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 64 // experiment changes on a restart. This notification can then be used to | 65 // experiment changes on a restart. This notification can then be used to |
| 65 // update UI (i.e. badging an icon). | 66 // update UI (i.e. badging an icon). |
| 66 virtual void OnExperimentChangesDetected(Severity severity) = 0; | 67 virtual void OnExperimentChangesDetected(Severity severity) = 0; |
| 67 | 68 |
| 68 protected: | 69 protected: |
| 69 virtual ~Observer() {} | 70 virtual ~Observer() {} |
| 70 }; | 71 }; |
| 71 | 72 |
| 72 ~VariationsService() override; | 73 ~VariationsService() override; |
| 73 | 74 |
| 74 // Creates field trials based on Variations Seed loaded from local prefs. If | 75 // Creates field trials based on the variations seed loaded from local state. |
| 75 // there is a problem loading the seed data, all trials specified by the seed | 76 // If there is a problem loading the seed data, all trials specified by the |
| 76 // may not be created. | 77 // seed may not be created. Some field trials are configured to override or |
| 77 bool CreateTrialsFromSeed(); | 78 // associate with (for reporting) specific features. These associations are |
| 79 // registered with |feature_list|. |
| 80 bool CreateTrialsFromSeed(base::FeatureList* feature_list); |
| 78 | 81 |
| 79 // Should be called before startup of the main message loop. | 82 // Should be called before startup of the main message loop. |
| 80 void PerformPreMainMessageLoopStartup(); | 83 void PerformPreMainMessageLoopStartup(); |
| 81 | 84 |
| 82 // Calls FetchVariationsSeed once and repeats this periodically. See | 85 // Calls FetchVariationsSeed once and repeats this periodically. See |
| 83 // implementation for details on the period. Must be called after | 86 // implementation for details on the period. Must be called after |
| 84 // |CreateTrialsFromSeed|. | 87 // |CreateTrialsFromSeed|. |
| 85 void StartRepeatedVariationsSeedFetch(); | 88 void StartRepeatedVariationsSeedFetch(); |
| 86 | 89 |
| 87 // Adds an observer to listen for detected experiment changes. | 90 // Adds an observer to listen for detected experiment changes. |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 base::ThreadChecker thread_checker_; | 293 base::ThreadChecker thread_checker_; |
| 291 | 294 |
| 292 base::WeakPtrFactory<VariationsService> weak_ptr_factory_; | 295 base::WeakPtrFactory<VariationsService> weak_ptr_factory_; |
| 293 | 296 |
| 294 DISALLOW_COPY_AND_ASSIGN(VariationsService); | 297 DISALLOW_COPY_AND_ASSIGN(VariationsService); |
| 295 }; | 298 }; |
| 296 | 299 |
| 297 } // namespace variations | 300 } // namespace variations |
| 298 | 301 |
| 299 #endif // COMPONENTS_VARIATIONS_SERVICE_VARIATIONS_SERVICE_H_ | 302 #endif // COMPONENTS_VARIATIONS_SERVICE_VARIATIONS_SERVICE_H_ |
| OLD | NEW |