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" |
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/metrics/field_trial.h" | 13 #include "base/metrics/field_trial.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "base/timer.h" | 15 #include "base/timer.h" |
16 #include "chrome/browser/metrics/proto/study.pb.h" | 16 #include "chrome/browser/metrics/proto/study.pb.h" |
17 #include "chrome/browser/metrics/proto/trials_seed.pb.h" | 17 #include "chrome/browser/metrics/proto/trials_seed.pb.h" |
| 18 #include "chrome/browser/metrics/variations/network_time_tracker.h" |
18 #include "chrome/browser/metrics/variations/resource_request_allowed_notifier.h" | 19 #include "chrome/browser/metrics/variations/resource_request_allowed_notifier.h" |
19 #include "chrome/common/chrome_version_info.h" | 20 #include "chrome/common/chrome_version_info.h" |
20 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
21 #include "net/url_request/url_fetcher_delegate.h" | 22 #include "net/url_request/url_fetcher_delegate.h" |
22 | 23 |
23 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
24 #include "chrome/browser/metrics/variations/variations_registry_syncer_win.h" | 25 #include "chrome/browser/metrics/variations/variations_registry_syncer_win.h" |
25 #endif | 26 #endif |
26 | 27 |
27 class PrefService; | 28 class PrefService; |
(...skipping 12 matching lines...) Expand all Loading... |
40 // Creates field trials based on Variations Seed loaded from local prefs. If | 41 // 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 | 42 // there is a problem loading the seed data, all trials specified by the seed |
42 // may not be created. | 43 // may not be created. |
43 bool CreateTrialsFromSeed(PrefService* local_prefs); | 44 bool CreateTrialsFromSeed(PrefService* local_prefs); |
44 | 45 |
45 // Calls FetchVariationsSeed once and repeats this periodically. See | 46 // Calls FetchVariationsSeed once and repeats this periodically. See |
46 // implementation for details on the period. Must be called after | 47 // implementation for details on the period. Must be called after |
47 // |CreateTrialsFromSeed|. | 48 // |CreateTrialsFromSeed|. |
48 void StartRepeatedVariationsSeedFetch(); | 49 void StartRepeatedVariationsSeedFetch(); |
49 | 50 |
| 51 // TODO(mad): Remove this once NetworkTimeTracker is available as a global |
| 52 // service. |
| 53 bool GetNetworkTime(base::Time* network_time, |
| 54 base::TimeDelta* uncertainty) const; |
| 55 |
50 #if defined(OS_WIN) | 56 #if defined(OS_WIN) |
51 // Starts syncing Google Update Variation IDs with the registry. | 57 // Starts syncing Google Update Variation IDs with the registry. |
52 void StartGoogleUpdateRegistrySync(); | 58 void StartGoogleUpdateRegistrySync(); |
53 #endif | 59 #endif |
54 | 60 |
55 // Exposed for testing. | 61 // Exposed for testing. |
56 void SetCreateTrialsFromSeedCalledForTesting(bool called); | 62 void SetCreateTrialsFromSeedCalledForTesting(bool called); |
57 | 63 |
58 // Register Variations related prefs in Local State. | 64 // Register Variations related prefs in Local State. |
59 static void RegisterPrefs(PrefServiceSimple* prefs); | 65 static void RegisterPrefs(PrefServiceSimple* prefs); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 base::RepeatingTimer<VariationsService> timer_; | 182 base::RepeatingTimer<VariationsService> timer_; |
177 | 183 |
178 // Helper class used to tell this service if it's allowed to make network | 184 // Helper class used to tell this service if it's allowed to make network |
179 // resource requests. | 185 // resource requests. |
180 scoped_ptr<ResourceRequestAllowedNotifier> resource_request_allowed_notifier_; | 186 scoped_ptr<ResourceRequestAllowedNotifier> resource_request_allowed_notifier_; |
181 | 187 |
182 // The start time of the last seed request. This is used to measure the | 188 // The start time of the last seed request. This is used to measure the |
183 // latency of seed requests. Initially zero. | 189 // latency of seed requests. Initially zero. |
184 base::TimeTicks last_request_started_time_; | 190 base::TimeTicks last_request_started_time_; |
185 | 191 |
| 192 // TODO(mad): Eventually remove this. |
| 193 NetworkTimeTracker network_time_tracker_; |
| 194 |
186 #if defined(OS_WIN) | 195 #if defined(OS_WIN) |
187 // Helper that handles synchronizing Variations with the Registry. | 196 // Helper that handles synchronizing Variations with the Registry. |
188 VariationsRegistrySyncer registry_syncer_; | 197 VariationsRegistrySyncer registry_syncer_; |
189 #endif | 198 #endif |
190 }; | 199 }; |
191 | 200 |
192 } // namespace chrome_variations | 201 } // namespace chrome_variations |
193 | 202 |
194 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ | 203 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ |
OLD | NEW |