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

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

Issue 8558020: Protector strings and bubble/SettingsChange code refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: This time it really should compile. 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/app/generated_resources.grd ('k') | 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
new file mode 100644
index 0000000000000000000000000000000000000000..e53f7ebc0254c20031b78cef4af1792baf95d186
--- /dev/null
+++ b/chrome/browser/protector/base_setting_change.h
@@ -0,0 +1,67 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_PROTECTOR_BASE_SETTING_CHANGE_H_
+#define CHROME_BROWSER_PROTECTOR_BASE_SETTING_CHANGE_H_
+#pragma once
+
+#include <string>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/string16.h"
+
+class TemplateURL;
+
+namespace protector {
+
+class Protector;
+
+// Base class for setting change tracked by Protector.
+class BaseSettingChange {
+ public:
+ 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.
+ virtual bool Init(Protector* protector);
+
+ // Persists new setting if needed.
+ virtual void Apply(Protector* protector);
+
+ // Restores old setting if needed.
+ virtual void Discard(Protector* protector);
+
+ // Returns the wrench menu item and bubble title.
+ virtual string16 GetBubbleTitle() const = 0;
+
+ // Returns the bubble message text.
+ virtual string16 GetBubbleMessage() const = 0;
+
+ // Returns text for the button to apply the change with |Apply|.
+ // Returns empty string if no apply button should be shown.
+ virtual string16 GetApplyButtonText() const = 0;
+
+ // Returns text for the button to discard the change with |Discard|.
+ virtual string16 GetDiscardButtonText() const = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BaseSettingChange);
+};
+
+// TODO(ivankr): CompositeSettingChange that incapsulates multiple
+// BaseSettingChange instances.
+
+// Allocates and initializes SettingChange implementation for default search
+// provider setting. Both |actual| and |backup| may be NULL if corresponding
+// values are unknown or invalid.
+BaseSettingChange* CreateDefaultSearchProviderChange(
+ const TemplateURL* actual,
+ const TemplateURL* backup);
+
+} // namespace protector
+
+#endif // CHROME_BROWSER_PROTECTOR_BASE_SETTING_CHANGE_H_
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/protector/base_setting_change.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698