Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / metrics / variations / variations_service.h
index 2ad7026..bf76b04 100644 (file)
 class PrefService;
 class PrefRegistrySimple;
 
+namespace user_prefs {
+class PrefRegistrySyncable;
+}
+
 namespace chrome_variations {
 
 class VariationsSeed;
@@ -53,6 +57,13 @@ class VariationsService
   // static for test purposes.
   static GURL GetVariationsServerURL(PrefService* local_prefs);
 
+  // Called when the application enters foreground. This may trigger a
+  // FetchVariationsSeed call.
+  // TODO(rkaplow): Handle this and the similar event in metrics_service by
+  // observing an 'OnAppEnterForeground' event instead of requiring the frontend
+  // code to notify each service individually.
+  void OnAppEnterForeground();
+
 #if defined(OS_WIN)
   // Starts syncing Google Update Variation IDs with the registry.
   void StartGoogleUpdateRegistrySync();
@@ -67,9 +78,19 @@ class VariationsService
   // Register Variations related prefs in Local State.
   static void RegisterPrefs(PrefRegistrySimple* registry);
 
+  // Register Variations related prefs in the Profile prefs.
+  static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
+
   // Factory method for creating a VariationsService.
   static VariationsService* Create(PrefService* local_state);
 
+  // Set the PrefService responsible for getting policy-related preferences,
+  // such as the restrict parameter.
+  void set_policy_pref_service(PrefService* service) {
+    DCHECK(service);
+    policy_pref_service_ = service;
+  }
+
  protected:
   // Starts the fetching process once, where |OnURLFetchComplete| is called with
   // the response.
@@ -110,6 +131,10 @@ class VariationsService
   // The pref service used to store persist the variations seed.
   PrefService* local_state_;
 
+  // Used to obtain policy-related preferences. Depending on the platform, will
+  // either be Local State or Profile prefs.
+  PrefService* policy_pref_service_;
+
   VariationsSeedStore seed_store_;
 
   // Contains the scheduler instance that handles timing for requests to the