Chromium Code Reviews| 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/memory/weak_ptr.h" | |
| 13 #include "base/metrics/field_trial.h" | 14 #include "base/metrics/field_trial.h" |
| 14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "base/version.h" | |
|
Ilya Sherman
2014/06/17 21:24:59
nit: Can this be forward-declared?
Alexei Svitkine (slow)
2014/06/17 22:15:54
Done.
| |
| 15 #include "chrome/browser/metrics/variations/variations_request_scheduler.h" | 17 #include "chrome/browser/metrics/variations/variations_request_scheduler.h" |
| 16 #include "chrome/browser/metrics/variations/variations_seed_store.h" | 18 #include "chrome/browser/metrics/variations/variations_seed_store.h" |
| 17 #include "chrome/browser/web_resource/resource_request_allowed_notifier.h" | 19 #include "chrome/browser/web_resource/resource_request_allowed_notifier.h" |
| 18 #include "chrome/common/chrome_version_info.h" | 20 #include "chrome/common/chrome_version_info.h" |
| 19 #include "net/url_request/url_fetcher_delegate.h" | 21 #include "net/url_request/url_fetcher_delegate.h" |
| 20 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 21 | 23 |
| 22 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
| 23 #include "chrome/browser/metrics/variations/variations_registry_syncer_win.h" | 25 #include "chrome/browser/metrics/variations/variations_registry_syncer_win.h" |
| 24 #endif | 26 #endif |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 // Checks if prerequisites for fetching the Variations seed are met, and if | 140 // Checks if prerequisites for fetching the Variations seed are met, and if |
| 139 // so, performs the actual fetch using |DoActualFetch|. | 141 // so, performs the actual fetch using |DoActualFetch|. |
| 140 void FetchVariationsSeed(); | 142 void FetchVariationsSeed(); |
| 141 | 143 |
| 142 // net::URLFetcherDelegate implementation: | 144 // net::URLFetcherDelegate implementation: |
| 143 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 145 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
| 144 | 146 |
| 145 // ResourceRequestAllowedNotifier::Observer implementation: | 147 // ResourceRequestAllowedNotifier::Observer implementation: |
| 146 virtual void OnResourceRequestsAllowed() OVERRIDE; | 148 virtual void OnResourceRequestsAllowed() OVERRIDE; |
| 147 | 149 |
| 150 // Performs a variations seed simulation with the given |seed| and |version|. | |
|
Ilya Sherman
2014/06/17 21:24:59
From just reading the declaration and comment, it'
Alexei Svitkine (slow)
2014/06/17 22:15:54
Currently, it only logs histograms. In another CL
| |
| 151 void PerformSimulationWithVersion(scoped_ptr<VariationsSeed> seed, | |
| 152 const base::Version& version); | |
| 153 | |
| 148 // Record the time of the most recent successful fetch. | 154 // Record the time of the most recent successful fetch. |
| 149 void RecordLastFetchTime(); | 155 void RecordLastFetchTime(); |
| 150 | 156 |
| 151 // The pref service used to store persist the variations seed. | 157 // The pref service used to store persist the variations seed. |
| 152 PrefService* local_state_; | 158 PrefService* local_state_; |
| 153 | 159 |
| 154 // Used for instantiating entropy providers for variations seed simulation. | 160 // Used for instantiating entropy providers for variations seed simulation. |
| 155 // Weak pointer. | 161 // Weak pointer. |
| 156 metrics::MetricsStateManager* state_manager_; | 162 metrics::MetricsStateManager* state_manager_; |
| 157 | 163 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 186 | 192 |
| 187 // The start time of the last seed request. This is used to measure the | 193 // The start time of the last seed request. This is used to measure the |
| 188 // latency of seed requests. Initially zero. | 194 // latency of seed requests. Initially zero. |
| 189 base::TimeTicks last_request_started_time_; | 195 base::TimeTicks last_request_started_time_; |
| 190 | 196 |
| 191 #if defined(OS_WIN) | 197 #if defined(OS_WIN) |
| 192 // Helper that handles synchronizing Variations with the Registry. | 198 // Helper that handles synchronizing Variations with the Registry. |
| 193 VariationsRegistrySyncer registry_syncer_; | 199 VariationsRegistrySyncer registry_syncer_; |
| 194 #endif | 200 #endif |
| 195 | 201 |
| 202 base::WeakPtrFactory<VariationsService> weak_ptr_factory_; | |
| 203 | |
| 196 DISALLOW_COPY_AND_ASSIGN(VariationsService); | 204 DISALLOW_COPY_AND_ASSIGN(VariationsService); |
| 197 }; | 205 }; |
| 198 | 206 |
| 199 } // namespace chrome_variations | 207 } // namespace chrome_variations |
| 200 | 208 |
| 201 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ | 209 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ |
| OLD | NEW |