| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // TODO(rkaplow): Handle this and the similar event in metrics_service by | 95 // TODO(rkaplow): Handle this and the similar event in metrics_service by |
| 96 // observing an 'OnAppEnterForeground' event instead of requiring the frontend | 96 // observing an 'OnAppEnterForeground' event instead of requiring the frontend |
| 97 // code to notify each service individually. | 97 // code to notify each service individually. |
| 98 void OnAppEnterForeground(); | 98 void OnAppEnterForeground(); |
| 99 | 99 |
| 100 #if defined(OS_WIN) | 100 #if defined(OS_WIN) |
| 101 // Starts syncing Google Update Variation IDs with the registry. | 101 // Starts syncing Google Update Variation IDs with the registry. |
| 102 void StartGoogleUpdateRegistrySync(); | 102 void StartGoogleUpdateRegistrySync(); |
| 103 #endif | 103 #endif |
| 104 | 104 |
| 105 // Sets the value of the "restrict" URL param to the variations service that |
| 106 // should be used for variation seed requests. This takes precedence over any |
| 107 // value coming from policy prefs. This should be called prior to any calls |
| 108 // to |StartRepeatedVariationsSeedFetch|. |
| 109 void SetRestrictMode(const std::string& restrict_mode); |
| 110 |
| 105 // Exposed for testing. | 111 // Exposed for testing. |
| 106 void SetCreateTrialsFromSeedCalledForTesting(bool called); | 112 void SetCreateTrialsFromSeedCalledForTesting(bool called); |
| 107 | 113 |
| 108 // Returns the variations server URL, which can vary if a command-line flag is | 114 // Returns the variations server URL, which can vary if a command-line flag is |
| 109 // set and/or the variations restrict pref is set in |local_prefs|. Declared | 115 // set and/or the variations restrict pref is set in |local_prefs|. Declared |
| 110 // static for test purposes. | 116 // static for test purposes. |
| 111 static GURL GetVariationsServerURL(PrefService* local_prefs); | 117 static GURL GetVariationsServerURL(PrefService* local_prefs, |
| 118 const std::string& restrict_mode_override); |
| 112 | 119 |
| 113 // Exposed for testing. | 120 // Exposed for testing. |
| 114 static std::string GetDefaultVariationsServerURLForTesting(); | 121 static std::string GetDefaultVariationsServerURLForTesting(); |
| 115 | 122 |
| 116 // Register Variations related prefs in Local State. | 123 // Register Variations related prefs in Local State. |
| 117 static void RegisterPrefs(PrefRegistrySimple* registry); | 124 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 118 | 125 |
| 119 // Register Variations related prefs in the Profile prefs. | 126 // Register Variations related prefs in the Profile prefs. |
| 120 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 127 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 121 | 128 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 208 |
| 202 // Contains the scheduler instance that handles timing for requests to the | 209 // Contains the scheduler instance that handles timing for requests to the |
| 203 // server. Initially NULL and instantiated when the initial fetch is | 210 // server. Initially NULL and instantiated when the initial fetch is |
| 204 // requested. | 211 // requested. |
| 205 scoped_ptr<VariationsRequestScheduler> request_scheduler_; | 212 scoped_ptr<VariationsRequestScheduler> request_scheduler_; |
| 206 | 213 |
| 207 // Contains the current seed request. Will only have a value while a request | 214 // Contains the current seed request. Will only have a value while a request |
| 208 // is pending, and will be reset by |OnURLFetchComplete|. | 215 // is pending, and will be reset by |OnURLFetchComplete|. |
| 209 scoped_ptr<net::URLFetcher> pending_seed_request_; | 216 scoped_ptr<net::URLFetcher> pending_seed_request_; |
| 210 | 217 |
| 211 // The URL to use for querying the Variations server. | 218 // The value of the "restrict" URL param to the variations server that has |
| 219 // been specified via |SetRestrictMode|. If empty, the URL param will be set |
| 220 // based on policy prefs. |
| 221 std::string restrict_mode_; |
| 222 |
| 223 // The URL to use for querying the variations server. |
| 212 GURL variations_server_url_; | 224 GURL variations_server_url_; |
| 213 | 225 |
| 214 // Tracks whether |CreateTrialsFromSeed| has been called, to ensure that | 226 // Tracks whether |CreateTrialsFromSeed| has been called, to ensure that |
| 215 // it gets called prior to |StartRepeatedVariationsSeedFetch|. | 227 // it gets called prior to |StartRepeatedVariationsSeedFetch|. |
| 216 bool create_trials_from_seed_called_; | 228 bool create_trials_from_seed_called_; |
| 217 | 229 |
| 218 // Tracks whether the initial request to the variations server had completed. | 230 // Tracks whether the initial request to the variations server had completed. |
| 219 bool initial_request_completed_; | 231 bool initial_request_completed_; |
| 220 | 232 |
| 221 // Helper class used to tell this service if it's allowed to make network | 233 // Helper class used to tell this service if it's allowed to make network |
| (...skipping 14 matching lines...) Expand all Loading... |
| 236 #endif | 248 #endif |
| 237 | 249 |
| 238 base::WeakPtrFactory<VariationsService> weak_ptr_factory_; | 250 base::WeakPtrFactory<VariationsService> weak_ptr_factory_; |
| 239 | 251 |
| 240 DISALLOW_COPY_AND_ASSIGN(VariationsService); | 252 DISALLOW_COPY_AND_ASSIGN(VariationsService); |
| 241 }; | 253 }; |
| 242 | 254 |
| 243 } // namespace chrome_variations | 255 } // namespace chrome_variations |
| 244 | 256 |
| 245 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ | 257 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ |
| OLD | NEW |