Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4165)

Unified Diff: chrome/browser/protector/protector.cc

Issue 8586050: Revert 110684 - Protector strings and bubble/SettingsChange code refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/protector/protector.h ('k') | chrome/browser/protector/setting_change.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/protector/protector.cc
===================================================================
--- chrome/browser/protector/protector.cc (revision 110688)
+++ chrome/browser/protector/protector.cc (working copy)
@@ -4,7 +4,6 @@
#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"
@@ -42,44 +41,37 @@
void Protector::ShowChange(SettingChange* change) {
DCHECK(change);
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&Protector::InitAndShowChange,
- base::Unretained(this), change));
-}
+ SettingChangeVector changes(1, change);
-void Protector::InitAndShowChange(SettingChange* change) {
- VLOG(1) << "Init change";
- if (!change->Init(this)) {
- VLOG(1) << "Error while initializing, removing ourselves";
- delete change;
- OnRemovedFromProfile();
- return;
- }
- error_.reset(new SettingsChangeGlobalError(change, this));
+ error_.reset(new SettingsChangeGlobalError(changes, this));
error_->ShowForProfile(profile_);
}
-void Protector::OnApplyChange() {
- VLOG(1) << "Apply change";
- error_->mutable_change()->Apply(this);
+void Protector::OnApplyChanges() {
+ OnChangesAction(&SettingChange::Accept);
}
-void Protector::OnDiscardChange() {
- VLOG(1) << "Discard change";
- error_->mutable_change()->Discard(this);
+void Protector::OnDiscardChanges() {
+ OnChangesAction(&SettingChange::Revert);
}
void Protector::OnDecisionTimeout() {
- // TODO(ivankr): Add histogram.
- VLOG(1) << "Timeout";
+ OnChangesAction(&SettingChange::DoDefault);
}
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);
if (!hmac.Init(kProtectorSigningKey)) {
« no previous file with comments | « chrome/browser/protector/protector.h ('k') | chrome/browser/protector/setting_change.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698