| 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/resource_request_allowed_notifier.h" | 18 #include "chrome/browser/metrics/variations/resource_request_allowed_notifier.h" |
| 19 #include "chrome/common/chrome_version_info.h" | 19 #include "chrome/common/chrome_version_info.h" |
| 20 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
| 21 #include "net/url_request/url_fetcher_delegate.h" | 21 #include "net/url_request/url_fetcher_delegate.h" |
| 22 | 22 |
| 23 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
| 24 #include "chrome/browser/metrics/variations/variations_registry_syncer_win.h" | 24 #include "chrome/browser/metrics/variations/variations_registry_syncer_win.h" |
| 25 #endif | 25 #endif |
| 26 | 26 |
| 27 class PrefService; | 27 class PrefService; |
| 28 class PrefServiceSimple; | 28 class PrefRegistrySimple; |
| 29 | 29 |
| 30 namespace chrome_variations { | 30 namespace chrome_variations { |
| 31 | 31 |
| 32 // Used to setup field trials based on stored variations seed data, and fetch | 32 // Used to setup field trials based on stored variations seed data, and fetch |
| 33 // new seed data from the variations server. | 33 // new seed data from the variations server. |
| 34 class VariationsService | 34 class VariationsService |
| 35 : public net::URLFetcherDelegate, | 35 : public net::URLFetcherDelegate, |
| 36 public ResourceRequestAllowedNotifier::Observer { | 36 public ResourceRequestAllowedNotifier::Observer { |
| 37 public: | 37 public: |
| 38 virtual ~VariationsService(); | 38 virtual ~VariationsService(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 49 | 49 |
| 50 #if defined(OS_WIN) | 50 #if defined(OS_WIN) |
| 51 // Starts syncing Google Update Variation IDs with the registry. | 51 // Starts syncing Google Update Variation IDs with the registry. |
| 52 void StartGoogleUpdateRegistrySync(); | 52 void StartGoogleUpdateRegistrySync(); |
| 53 #endif | 53 #endif |
| 54 | 54 |
| 55 // Exposed for testing. | 55 // Exposed for testing. |
| 56 void SetCreateTrialsFromSeedCalledForTesting(bool called); | 56 void SetCreateTrialsFromSeedCalledForTesting(bool called); |
| 57 | 57 |
| 58 // Register Variations related prefs in Local State. | 58 // Register Variations related prefs in Local State. |
| 59 static void RegisterPrefs(PrefServiceSimple* prefs); | 59 static void RegisterPrefs(PrefRegistrySimple* prefs); |
| 60 | 60 |
| 61 // Factory method for creating a VariationsService. | 61 // Factory method for creating a VariationsService. |
| 62 static VariationsService* Create(); | 62 static VariationsService* Create(); |
| 63 | 63 |
| 64 protected: | 64 protected: |
| 65 // Starts the fetching process once, where |OnURLFetchComplete| is called with | 65 // Starts the fetching process once, where |OnURLFetchComplete| is called with |
| 66 // the response. | 66 // the response. |
| 67 virtual void DoActualFetch(); | 67 virtual void DoActualFetch(); |
| 68 | 68 |
| 69 // This constructor exists for injecting a mock notifier. It is meant for | 69 // This constructor exists for injecting a mock notifier. It is meant for |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 185 |
| 186 #if defined(OS_WIN) | 186 #if defined(OS_WIN) |
| 187 // Helper that handles synchronizing Variations with the Registry. | 187 // Helper that handles synchronizing Variations with the Registry. |
| 188 VariationsRegistrySyncer registry_syncer_; | 188 VariationsRegistrySyncer registry_syncer_; |
| 189 #endif | 189 #endif |
| 190 }; | 190 }; |
| 191 | 191 |
| 192 } // namespace chrome_variations | 192 } // namespace chrome_variations |
| 193 | 193 |
| 194 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ | 194 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ |
| OLD | NEW |