| 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 29 matching lines...) Expand all Loading... |
| 40 // Creates field trials based on Variations Seed loaded from local prefs. If | 40 // Creates field trials based on Variations Seed loaded from local prefs. If |
| 41 // there is a problem loading the seed data, all trials specified by the seed | 41 // there is a problem loading the seed data, all trials specified by the seed |
| 42 // may not be created. | 42 // may not be created. |
| 43 bool CreateTrialsFromSeed(PrefService* local_prefs); | 43 bool CreateTrialsFromSeed(PrefService* local_prefs); |
| 44 | 44 |
| 45 // Calls FetchVariationsSeed once and repeats this periodically. See | 45 // Calls FetchVariationsSeed once and repeats this periodically. See |
| 46 // implementation for details on the period. Must be called after | 46 // implementation for details on the period. Must be called after |
| 47 // |CreateTrialsFromSeed|. | 47 // |CreateTrialsFromSeed|. |
| 48 void StartRepeatedVariationsSeedFetch(); | 48 void StartRepeatedVariationsSeedFetch(); |
| 49 | 49 |
| 50 // TODO(mad): Eventually move this to a NetworkTimeService. |
| 51 // Returns a network time based on previous url request header value and CPU |
| 52 // ticks count since then. Returns false if no network time is available yet. |
| 53 // Can also return the error range if |uncertainty| isn't NULL. |
| 54 bool GetNetworkTime(base::Time* network_time, |
| 55 base::TimeDelta* uncertainty) const; |
| 56 |
| 50 #if defined(OS_WIN) | 57 #if defined(OS_WIN) |
| 51 // Starts syncing Google Update Variation IDs with the registry. | 58 // Starts syncing Google Update Variation IDs with the registry. |
| 52 void StartGoogleUpdateRegistrySync(); | 59 void StartGoogleUpdateRegistrySync(); |
| 53 #endif | 60 #endif |
| 54 | 61 |
| 55 // Exposed for testing. | 62 // Exposed for testing. |
| 56 void SetCreateTrialsFromSeedCalledForTesting(bool called); | 63 void SetCreateTrialsFromSeedCalledForTesting(bool called); |
| 57 | 64 |
| 58 // Register Variations related prefs in Local State. | 65 // Register Variations related prefs in Local State. |
| 59 static void RegisterPrefs(PrefServiceSimple* prefs); | 66 static void RegisterPrefs(PrefServiceSimple* prefs); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 base::RepeatingTimer<VariationsService> timer_; | 183 base::RepeatingTimer<VariationsService> timer_; |
| 177 | 184 |
| 178 // Helper class used to tell this service if it's allowed to make network | 185 // Helper class used to tell this service if it's allowed to make network |
| 179 // resource requests. | 186 // resource requests. |
| 180 scoped_ptr<ResourceRequestAllowedNotifier> resource_request_allowed_notifier_; | 187 scoped_ptr<ResourceRequestAllowedNotifier> resource_request_allowed_notifier_; |
| 181 | 188 |
| 182 // The start time of the last seed request. This is used to measure the | 189 // The start time of the last seed request. This is used to measure the |
| 183 // latency of seed requests. Initially zero. | 190 // latency of seed requests. Initially zero. |
| 184 base::TimeTicks last_request_started_time_; | 191 base::TimeTicks last_request_started_time_; |
| 185 | 192 |
| 193 // TODO(mad): Eventually move this to a NetworkTimeService. In the mean time, |
| 194 // these data members are used to remember and track a network time based on |
| 195 // url request header values. |network_time_ticks_| is the ticks count when |
| 196 // |network_time_| was set. |network_time_uncertainty_| provides an error |
| 197 // range based on the added inaccuracies of the method used to get the time. |
| 198 base::Time network_time_; |
| 199 base::TimeTicks network_time_ticks_; |
| 200 base::TimeDelta network_time_uncertainty_; |
| 201 |
| 186 #if defined(OS_WIN) | 202 #if defined(OS_WIN) |
| 187 // Helper that handles synchronizing Variations with the Registry. | 203 // Helper that handles synchronizing Variations with the Registry. |
| 188 VariationsRegistrySyncer registry_syncer_; | 204 VariationsRegistrySyncer registry_syncer_; |
| 189 #endif | 205 #endif |
| 190 }; | 206 }; |
| 191 | 207 |
| 192 } // namespace chrome_variations | 208 } // namespace chrome_variations |
| 193 | 209 |
| 194 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ | 210 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ |
| OLD | NEW |