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

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

Issue 8612002: Protector bubble cancels itself if user changes default search engine manually. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes. 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/settings_change_global_error.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/protector/protector.cc
diff --git a/chrome/browser/protector/protector.cc b/chrome/browser/protector/protector.cc
index 606302c69f25fa9875dd648c01cd72ea593c63db..9b2d417ddbffa73261b489496a3efad6790f30db 100644
--- a/chrome/browser/protector/protector.cc
+++ b/chrome/browser/protector/protector.cc
@@ -26,6 +26,8 @@ Protector::Protector(Profile* profile)
}
Protector::~Protector() {
+ if (change_.get())
+ change_->OnBeforeRemoved();
}
void Protector::OpenTab(const GURL& url) {
@@ -48,37 +50,44 @@ void Protector::ShowChange(BaseSettingChange* change) {
base::Unretained(this), change));
}
-void Protector::InitAndShowChange(BaseSettingChange* 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_->ShowForProfile(profile_);
+void Protector::DismissChange() {
+ DCHECK(error_.get());
+ error_->RemoveFromProfile();
}
void Protector::OnApplyChange() {
- VLOG(1) << "Apply change";
- error_->mutable_change()->Apply(this);
+ DVLOG(1) << "Apply change";
+ change_->Apply();
}
void Protector::OnDiscardChange() {
- VLOG(1) << "Discard change";
- error_->mutable_change()->Discard(this);
+ DVLOG(1) << "Discard change";
+ change_->Discard();
}
void Protector::OnDecisionTimeout() {
// TODO(ivankr): Add histogram.
- VLOG(1) << "Timeout";
+ DVLOG(1) << "Timeout";
}
void Protector::OnRemovedFromProfile() {
BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this);
}
+void Protector::InitAndShowChange(BaseSettingChange* change) {
+ DVLOG(1) << "Init change";
+ if (!change->Init(this)) {
+ LOG(WARNING) << "Error while initializing, removing ourselves";
+ delete change;
+ delete this;
+ return;
+ }
+ // |change_| should not be set until a successful |Init| call.
+ change_.reset(change);
+ error_.reset(new SettingsChangeGlobalError(change, this));
+ error_->ShowForProfile(profile_);
+}
+
std::string SignSetting(const std::string& value) {
crypto::HMAC hmac(crypto::HMAC::SHA256);
« no previous file with comments | « chrome/browser/protector/protector.h ('k') | chrome/browser/protector/settings_change_global_error.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698