| Index: chrome/browser/metrics/variations_service.h
|
| diff --git a/chrome/browser/metrics/variations_service.h b/chrome/browser/metrics/variations_service.h
|
| index a431a6dd1498625bf167cd921b22b90428d064bb..6feed3a0caf91f31e187a5a9761b8c7e128d717d 100644
|
| --- a/chrome/browser/metrics/variations_service.h
|
| +++ b/chrome/browser/metrics/variations_service.h
|
| @@ -16,6 +16,8 @@
|
| #include "chrome/browser/metrics/proto/study.pb.h"
|
| #include "chrome/browser/metrics/proto/trials_seed.pb.h"
|
| #include "chrome/common/chrome_version_info.h"
|
| +#include "content/public/browser/notification_observer.h"
|
| +#include "content/public/browser/notification_registrar.h"
|
| #include "googleurl/src/gurl.h"
|
| #include "net/url_request/url_fetcher_delegate.h"
|
|
|
| @@ -29,7 +31,8 @@ namespace chrome_variations {
|
|
|
| // Used to setup field trials based on stored variations seed data, and fetch
|
| // new seed data from the variations server.
|
| -class VariationsService : public net::URLFetcherDelegate {
|
| +class VariationsService : public net::URLFetcherDelegate,
|
| + public content::NotificationObserver {
|
| public:
|
| VariationsService();
|
| virtual ~VariationsService();
|
| @@ -43,16 +46,20 @@ class VariationsService : public net::URLFetcherDelegate {
|
| // implementation for details on the period.
|
| void StartRepeatedVariationsSeedFetch();
|
|
|
| - // Starts the fetching process once, where |OnURLFetchComplete| is called with
|
| - // the response.
|
| - void FetchVariationsSeed();
|
| -
|
| - // net::URLFetcherDelegate implementation:
|
| - virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
|
| -
|
| // Register Variations related prefs in Local State.
|
| static void RegisterPrefs(PrefService* prefs);
|
|
|
| + protected:
|
| + // Starts the fetching process once, where |OnURLFetchComplete| is called with
|
| + // the response. This is protected so we can override this for testing
|
| + // purposes.
|
| + virtual void FetchVariationsSeed();
|
| +
|
| + // Overridden from content::NotificationObserver:
|
| + virtual void Observe(int type,
|
| + const content::NotificationSource& source,
|
| + const content::NotificationDetails& details) OVERRIDE;
|
| +
|
| private:
|
| FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CheckStudyChannel);
|
| FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CheckStudyLocale);
|
| @@ -65,6 +72,9 @@ class VariationsService : public net::URLFetcherDelegate {
|
| FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, StoreSeed);
|
| FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, ValidateStudy);
|
|
|
| + // Overridden from net::URLFetcherDelegate:
|
| + virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
|
| +
|
| // Store the given seed data to the given local prefs. Note that |seed_data|
|
| // is assumed to be the raw serialized protobuf data stored in a string. It
|
| // will be Base64Encoded for storage. If the string is invalid or the encoding
|
| @@ -131,6 +141,9 @@ class VariationsService : public net::URLFetcherDelegate {
|
| // member so if VariationsService goes out of scope, the timer is
|
| // automatically cancelled.
|
| base::RepeatingTimer<VariationsService> timer_;
|
| +
|
| + // The registrar used to manage our Notification registrations.
|
| + content::NotificationRegistrar registrar_;
|
| };
|
|
|
| } // namespace chrome_variations
|
|
|