Chromium Code Reviews| Index: chrome/browser/protector/protector.cc |
| diff --git a/chrome/browser/protector/protector.cc b/chrome/browser/protector/protector.cc |
| index 7fe13209fa1d6e966df7e3c334be3a267b599c7b..76a8614c8df9801e14e1ba88a863a2f5bcda3f85 100644 |
| --- a/chrome/browser/protector/protector.cc |
| +++ b/chrome/browser/protector/protector.cc |
| @@ -4,6 +4,7 @@ |
| #include "chrome/browser/protector/protector.h" |
| +#include "base/bind.h" |
| #include "base/logging.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/protector/settings_change_global_error.h" |
| @@ -41,36 +42,36 @@ TemplateURLService* Protector::GetTemplateURLService() { |
| void Protector::ShowChange(SettingChange* change) { |
| DCHECK(change); |
| - SettingChangeVector changes(1, change); |
| + error_.reset(new SettingsChangeGlobalError(change, this)); |
| + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| + base::Bind(&Protector::InitAndShowChange, |
| + base::Unretained(this))); |
| +} |
| - error_.reset(new SettingsChangeGlobalError(changes, this)); |
| +void Protector::InitAndShowChange() { |
| + VLOG(1) << "Init change"; |
| + error_->change()->Init(this); |
| error_->ShowForProfile(profile_); |
| } |
| -void Protector::OnApplyChanges() { |
| - OnChangesAction(&SettingChange::Accept); |
| +void Protector::OnApplyChange() { |
| + VLOG(1) << "Apply change"; |
| + error_->change()->Apply(this); |
| } |
| -void Protector::OnDiscardChanges() { |
| - OnChangesAction(&SettingChange::Revert); |
| +void Protector::OnDiscardChange() { |
| + VLOG(1) << "Discard change"; |
| + error_->change()->Discard(this); |
| } |
| void Protector::OnDecisionTimeout() { |
| - OnChangesAction(&SettingChange::DoDefault); |
| + VLOG(1) << "Timeout"; |
|
whywhat
2011/11/18 08:18:20
Add a todo for histogram here, please.
Ivan Korotkov
2011/11/18 10:44:25
Done.
|
| } |
| void Protector::OnRemovedFromProfile() { |
| BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); |
| } |
| -void Protector::OnChangesAction(SettingChangeAction action) { |
| - DCHECK(error_.get()); |
| - SettingChangeVector* changes = error_->mutable_changes(); |
| - for (SettingChangeVector::iterator it = changes->begin(); |
| - it != changes->end(); ++it) |
| - ((*it)->*action)(this); |
| -} |
| - |
| std::string SignSetting(const std::string& value) { |
| crypto::HMAC hmac(crypto::HMAC::SHA256); |