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

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

Issue 8342049: Added Protector, hooked up DSE verification with error bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved histograms to protector folder Created 9 years, 2 months 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.cc ('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/setting_change.h
diff --git a/chrome/browser/protector/setting_change.h b/chrome/browser/protector/setting_change.h
new file mode 100644
index 0000000000000000000000000000000000000000..0a1e1d2910bebd3e7117d16202c40548da56be73
--- /dev/null
+++ b/chrome/browser/protector/setting_change.h
@@ -0,0 +1,73 @@
+// 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_SETTING_CHANGE_H_
+#define CHROME_BROWSER_PROTECTOR_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 SettingChange {
+ public:
+ // IDs of changes Protector currently tracks.
+ enum Type {
+ // Default search engine has been changed.
+ kSearchEngineChanged,
+
+ // Home page has been changed.
+ kHomePageChanged,
+ };
+
+ explicit SettingChange(Type type) : type_(type) {}
+ virtual ~SettingChange() {}
+
+ Type type() const { return type_; }
+
+ // Returns the old setting presentation to be shown to user.
+ // Returns empty string if the old setting is unavailable.
+ virtual string16 GetOldSetting() const = 0;
+
+ // Returns the new setting presentation to be shown to user.
+ virtual string16 GetNewSetting() const = 0;
+
+ // Persists new setting if needed.
+ virtual void Accept(Protector* protector) {}
+
+ // Restores old setting value if needed.
+ virtual void Revert(Protector* protector) {}
+
+ // Called when user ignored the change.
+ virtual void DoDefault(Protector* protector) {}
+
+ private:
+ // Type of the change. Used for strings lookup by UI.
+ // TODO(avayvod): Refactor string selection logic via polymorphism.
+ Type type_;
+
+ DISALLOW_COPY_AND_ASSIGN(SettingChange);
+};
+
+typedef std::vector<SettingChange*> SettingChangeVector;
+typedef void (SettingChange::*SettingChangeAction)(Protector*);
+
+// Allocates and initializes SettingChange implementation for default search
+// provider setting.
+SettingChange* CreateDefaultSearchProviderChange(
+ const TemplateURL* actual,
+ const TemplateURL* backup);
+
+} // namespace protector
+
+#endif // CHROME_BROWSER_PROTECTOR_SETTING_CHANGE_H_
« no previous file with comments | « chrome/browser/protector/protector.cc ('k') | chrome/browser/protector/settings_change_global_error.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698