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

Unified Diff: chrome/browser/protector/base_setting_change.h

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 | « no previous file | chrome/browser/protector/base_setting_change.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/protector/base_setting_change.h
diff --git a/chrome/browser/protector/base_setting_change.h b/chrome/browser/protector/base_setting_change.h
index e53f7ebc0254c20031b78cef4af1792baf95d186..53f2518fab9ada6cc588bb6117555884cc96f49d 100644
--- a/chrome/browser/protector/base_setting_change.h
+++ b/chrome/browser/protector/base_setting_change.h
@@ -25,15 +25,21 @@ class BaseSettingChange {
virtual ~BaseSettingChange();
// Applies initial actions to the setting if needed. Must be called before
- // any other calls are made, including text getters. Returns true if
- // initialization was successful.
+ // any other calls are made, including text getters.
+ // Returns true if initialization was successful. Otherwise, no other
+ // calls should be made.
+ // Associates this change with |protector_| instance so overrides must
+ // call the base method.
virtual bool Init(Protector* protector);
// Persists new setting if needed.
- virtual void Apply(Protector* protector);
+ virtual void Apply();
// Restores old setting if needed.
- virtual void Discard(Protector* protector);
+ virtual void Discard();
+
+ // Called before the change is removed from the protector instance.
+ virtual void OnBeforeRemoved() = 0;
// Returns the wrench menu item and bubble title.
virtual string16 GetBubbleTitle() const = 0;
@@ -48,7 +54,12 @@ class BaseSettingChange {
// Returns text for the button to discard the change with |Discard|.
virtual string16 GetDiscardButtonText() const = 0;
+ // Protector instance we've been associated with by an |Init| call.
+ Protector* protector() { return protector_; }
+
private:
+ Protector* protector_;
+
DISALLOW_COPY_AND_ASSIGN(BaseSettingChange);
};
« no previous file with comments | « no previous file | chrome/browser/protector/base_setting_change.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698