Chromium Code Reviews| Index: chrome/browser/metrics/variations/variations_service.cc |
| diff --git a/chrome/browser/metrics/variations/variations_service.cc b/chrome/browser/metrics/variations/variations_service.cc |
| index 2b95bf6e4aa1b2b0389b7f241fe50b541692edfa..b4d6a84b6f6faaf5433a6de9fcec544e8a29b292 100644 |
| --- a/chrome/browser/metrics/variations/variations_service.cc |
| +++ b/chrome/browser/metrics/variations/variations_service.cc |
| @@ -100,6 +100,9 @@ GURL GetVariationsServerURL() { |
| VariationsService::VariationsService() |
| : variations_server_url_(GetVariationsServerURL()), |
| create_trials_from_seed_called_(false), |
| +#if defined(OS_CHROMEOS) |
| + waiting_for_user_to_accept_eula_(false), |
| +#endif |
| was_offline_during_last_request_attempt_(false) { |
| net::NetworkChangeNotifier::AddConnectionTypeObserver(this); |
| } |
| @@ -163,6 +166,16 @@ void VariationsService::FetchVariationsSeed() { |
| return; |
| } |
| +#if defined(OS_CHROMEOS) |
| + if (!chromeos::WizardController::IsEulaAccepted()) { |
| + // The WizardController should notify this class when the EULA has been |
| + // accepted. |
|
Alexei Svitkine (slow)
2012/09/10 16:50:11
What about the case of a second start up when ther
SteveT
2012/09/10 17:25:28
Comment added below to explain how we NO-OP if the
|
| + VLOG(1) << "EULA was not accepted."; |
| + waiting_for_user_to_accept_eula_ = true; |
| + return; |
| + } |
| +#endif |
| + |
| pending_seed_request_.reset(net::URLFetcher::Create( |
| variations_server_url_, net::URLFetcher::GET, this)); |
| pending_seed_request_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
| @@ -182,6 +195,34 @@ void VariationsService::SetWasOfflineDuringLastRequestAttemptForTesting( |
| was_offline_during_last_request_attempt_ = offline; |
| } |
| +#if defined(OS_CHROMEOS) |
| + void VariationsService::OnScreenChanged(chromeos::WizardScreen* next_screen) { |
|
Alexei Svitkine (slow)
2012/09/10 16:50:11
Don't indent these. Please add a comment to the no
SteveT
2012/09/10 17:25:28
Done and done. Let me know if the comments are fin
|
| + } |
| + |
| + void VariationsService::OnSessionStart() { |
| + } |
| + |
| + void VariationsService::OnEulaAccepted() { |
| + // If an earlier request attempt was aborted because the EULA was not |
| + // accepted, retry the request now. |
| + if (!waiting_for_user_to_accept_eula_) |
| + return; |
| + DCHECK(chromeos::WizardController::IsEulaAccepted()); |
| + waiting_for_user_to_accept_eula_ = false; |
| + |
| + DCHECK(chromeos::WizardController::default_controller()); |
| + chromeos::WizardController::default_controller()->RemoveObserver(this); |
| + |
| + VLOG(1) << "Starting ping because the EULA was accepted."; |
| + FetchVariationsSeed(); |
| + |
| + // Since FetchVariationsSeed was explicitly called here, reset the timer to |
| + // avoid retrying for a full period. |
| + if (timer_.IsRunning()) |
| + timer_.Reset(); |
| + } |
| +#endif |
| + |
| // static |
| void VariationsService::RegisterPrefs(PrefService* prefs) { |
| prefs->RegisterStringPref(prefs::kVariationsSeed, std::string()); |