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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 // Called when the VariationsService detects that there will be significant | 66 // Called when the VariationsService detects that there will be significant |
67 // experiment changes on a restart. This notification can then be used to | 67 // experiment changes on a restart. This notification can then be used to |
68 // update UI (i.e. badging an icon). | 68 // update UI (i.e. badging an icon). |
69 virtual void OnExperimentChangesDetected(Severity severity) = 0; | 69 virtual void OnExperimentChangesDetected(Severity severity) = 0; |
70 | 70 |
71 protected: | 71 protected: |
72 virtual ~Observer() {} | 72 virtual ~Observer() {} |
73 }; | 73 }; |
74 | 74 |
75 virtual ~VariationsService(); | 75 ~VariationsService() override; |
76 | 76 |
77 // Creates field trials based on Variations Seed loaded from local prefs. If | 77 // Creates field trials based on Variations Seed loaded from local prefs. If |
78 // there is a problem loading the seed data, all trials specified by the seed | 78 // there is a problem loading the seed data, all trials specified by the seed |
79 // may not be created. | 79 // may not be created. |
80 bool CreateTrialsFromSeed(); | 80 bool CreateTrialsFromSeed(); |
81 | 81 |
82 // Calls FetchVariationsSeed once and repeats this periodically. See | 82 // Calls FetchVariationsSeed once and repeats this periodically. See |
83 // implementation for details on the period. Must be called after | 83 // implementation for details on the period. Must be called after |
84 // |CreateTrialsFromSeed|. | 84 // |CreateTrialsFromSeed|. |
85 void StartRepeatedVariationsSeedFetch(); | 85 void StartRepeatedVariationsSeedFetch(); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 166 |
167 // Checks if prerequisites for fetching the Variations seed are met, and if | 167 // Checks if prerequisites for fetching the Variations seed are met, and if |
168 // so, performs the actual fetch using |DoActualFetch|. | 168 // so, performs the actual fetch using |DoActualFetch|. |
169 void FetchVariationsSeed(); | 169 void FetchVariationsSeed(); |
170 | 170 |
171 // Notify any observers of this service based on the simulation |result|. | 171 // Notify any observers of this service based on the simulation |result|. |
172 void NotifyObservers( | 172 void NotifyObservers( |
173 const variations::VariationsSeedSimulator::Result& result); | 173 const variations::VariationsSeedSimulator::Result& result); |
174 | 174 |
175 // net::URLFetcherDelegate implementation: | 175 // net::URLFetcherDelegate implementation: |
176 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; | 176 void OnURLFetchComplete(const net::URLFetcher* source) override; |
177 | 177 |
178 // ResourceRequestAllowedNotifier::Observer implementation: | 178 // ResourceRequestAllowedNotifier::Observer implementation: |
179 virtual void OnResourceRequestsAllowed() override; | 179 void OnResourceRequestsAllowed() override; |
180 | 180 |
181 // Performs a variations seed simulation with the given |seed| and |version| | 181 // Performs a variations seed simulation with the given |seed| and |version| |
182 // and logs the simulation results as histograms. | 182 // and logs the simulation results as histograms. |
183 void PerformSimulationWithVersion(scoped_ptr<variations::VariationsSeed> seed, | 183 void PerformSimulationWithVersion(scoped_ptr<variations::VariationsSeed> seed, |
184 const base::Version& version); | 184 const base::Version& version); |
185 | 185 |
186 // Record the time of the most recent successful fetch. | 186 // Record the time of the most recent successful fetch. |
187 void RecordLastFetchTime(); | 187 void RecordLastFetchTime(); |
188 | 188 |
189 // The pref service used to store persist the variations seed. | 189 // The pref service used to store persist the variations seed. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 #endif | 235 #endif |
236 | 236 |
237 base::WeakPtrFactory<VariationsService> weak_ptr_factory_; | 237 base::WeakPtrFactory<VariationsService> weak_ptr_factory_; |
238 | 238 |
239 DISALLOW_COPY_AND_ASSIGN(VariationsService); | 239 DISALLOW_COPY_AND_ASSIGN(VariationsService); |
240 }; | 240 }; |
241 | 241 |
242 } // namespace chrome_variations | 242 } // namespace chrome_variations |
243 | 243 |
244 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ | 244 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ |
OLD | NEW |