Chromium Code Reviews| Index: chrome/browser/metrics/variations_service.cc |
| diff --git a/chrome/browser/metrics/variations_service.cc b/chrome/browser/metrics/variations_service.cc |
| index 5ee2ee13fa8ec28026d9dd672fb2121520cf63ea..1361198c8c15a3fb18a303cb9a74cf0782099b58 100644 |
| --- a/chrome/browser/metrics/variations_service.cc |
| +++ b/chrome/browser/metrics/variations_service.cc |
| @@ -16,10 +16,12 @@ |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/browser/metrics/proto/trials_seed.pb.h" |
| #include "chrome/browser/prefs/pref_service.h" |
| +#include "chrome/common/chrome_notification_types.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/metrics/experiments_helper.h" |
| #include "chrome/common/pref_names.h" |
| #include "content/public/browser/browser_thread.h" |
| +#include "content/public/browser/notification_service.h" |
| #include "content/public/common/url_fetcher.h" |
| #include "googleurl/src/gurl.h" |
| #include "net/base/load_flags.h" |
| @@ -99,6 +101,8 @@ GURL GetVariationsServerURL() { |
| VariationsService::VariationsService() |
| : variations_server_url_(GetVariationsServerURL()) { |
| + registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, |
| + content::NotificationService::AllSources()); |
| } |
| VariationsService::~VariationsService() {} |
| @@ -193,6 +197,16 @@ void VariationsService::RegisterPrefs(PrefService* prefs) { |
| base::Time().ToInternalValue()); |
| } |
| +void VariationsService::Observe(int type, |
|
Alexei Svitkine (slow)
2012/07/23 14:42:43
Please define this in the same order as functions
SteveT
2012/07/23 15:24:31
Uh... this is already in the correct place?
Alexei Svitkine (slow)
2012/07/23 15:32:13
Oops, you're right - I must have misread the order
|
| + const content::NotificationSource& source, |
| + const content::NotificationDetails& details) { |
|
Alexei Svitkine (slow)
2012/07/23 14:42:43
Is this guaranteed to be called on the UI thread?
SteveT
2012/07/23 15:24:31
I believe it is, though I'll have to check to make
|
| + DCHECK(type == chrome::NOTIFICATION_UPGRADE_RECOMMENDED); |
| + // An upgrade is ready, so attempt to fetch the Variations seed in case there |
| + // were updates. |
| + FetchVariationsSeed(); |
| + timer_.Reset(); |
|
Alexei Svitkine (slow)
2012/07/23 14:42:43
Nit: Add a comment explaining timer resetting.
SteveT
2012/07/23 15:24:31
Done.
|
| +} |
| + |
| bool VariationsService::StoreSeedData(const std::string& seed_data, |
| const base::Time& seed_date, |
| PrefService* local_prefs) { |