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

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 changes in separate files. Simplified objects ownership. 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
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..6c42f80511ab4da2cbd00048a22868925f65a919
--- /dev/null
+++ b/chrome/browser/protector/setting_change.h
@@ -0,0 +1,68 @@
+// 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 KeywordTable;
+
+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 const string16& GetOldSetting() const = 0;
+
+ // Returns the new setting presentation to be shown to user.
+ virtual const 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) {}
+
+ 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;
+
+// Allocates and initializes SettingChange implementation for default search
+// provider setting.
+SettingChange* CreateDefaultSearchProviderChange(
+ KeywordTable* table, int64 old_id, int64 new_id);
+
+} // namespace protector
+
+#endif // CHROME_BROWSER_PROTECTOR_SETTING_CHANGE_H_

Powered by Google App Engine
This is Rietveld 408576698