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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_PROTECTOR_SETTING_CHANGE_H_
6 #define CHROME_BROWSER_PROTECTOR_SETTING_CHANGE_H_
7 #pragma once
8
9 #include <string>
10 #include <vector>
11
12 #include "base/basictypes.h"
13 #include "base/string16.h"
14
15 class KeywordTable;
16
17 namespace protector {
18
19 class Protector;
20
21 // Base class for setting change tracked by Protector.
22 class SettingChange {
23 public:
24 // IDs of changes Protector currently tracks.
25 enum Type {
26 // Default search engine has been changed.
27 kSearchEngineChanged,
28
29 // Home page has been changed.
30 kHomePageChanged,
31 };
32
33 explicit SettingChange(Type type) : type_(type) {}
34 virtual ~SettingChange() {}
35
36 Type type() const { return type_; }
37
38 // Returns the old setting presentation to be shown to user.
39 // Returns empty string if the old setting is unavailable.
40 virtual const string16& GetOldSetting() const = 0;
41
42 // Returns the new setting presentation to be shown to user.
43 virtual const string16& GetNewSetting() const = 0;
44
45 // Persists new setting if needed.
46 virtual void Accept(Protector* protector) {}
47
48 // Restores old setting value if needed.
49 virtual void Revert(Protector* protector) {}
50
51 private:
52 // Type of the change. Used for strings lookup by UI.
53 // TODO(avayvod): Refactor string selection logic via polymorphism.
54 Type type_;
55
56 DISALLOW_COPY_AND_ASSIGN(SettingChange);
57 };
58
59 typedef std::vector<SettingChange*> SettingChangeVector;
60
61 // Allocates and initializes SettingChange implementation for default search
62 // provider setting.
63 SettingChange* CreateDefaultSearchProviderChange(
64 KeywordTable* table, int64 old_id, int64 new_id);
65
66 } // namespace protector
67
68 #endif // CHROME_BROWSER_PROTECTOR_SETTING_CHANGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698