OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_PROTECTOR_SETTING_CHANGE_H_ | 5 #ifndef CHROME_BROWSER_PROTECTOR_SETTING_CHANGE_H_ |
6 #define CHROME_BROWSER_PROTECTOR_SETTING_CHANGE_H_ | 6 #define CHROME_BROWSER_PROTECTOR_SETTING_CHANGE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
14 | 14 |
15 class TemplateURL; | 15 class TemplateURL; |
16 | 16 |
17 namespace protector { | 17 namespace protector { |
18 | 18 |
19 class Protector; | 19 class Protector; |
20 | 20 |
21 // Base class for setting change tracked by Protector. | 21 // Base class for setting change tracked by Protector. |
22 class SettingChange { | 22 class SettingChange { |
23 public: | 23 public: |
24 SettingChange(); | 24 SettingChange() {} |
25 virtual ~SettingChange(); | 25 virtual ~SettingChange() {} |
26 | 26 |
27 // Applies initial actions to the setting if needed. Must be called before | 27 // Applies initial actions to the setting if needed. Must be called before |
28 // any other calls are made, including text getters. Returns true if | 28 // any other calls are made, including text getters. Returns true if |
29 // initialization was successful. | 29 // initialization was successful. |
30 virtual bool Init(Protector* protector); | 30 virtual bool Init(Protector* protector) { return true; } |
31 | 31 |
32 // Persists new setting if needed. | 32 // Persists new setting if needed. |
33 virtual void Apply(Protector* protector); | 33 virtual void Apply(Protector* protector) {} |
34 | 34 |
35 // Restores old setting if needed. | 35 // Restores old setting if needed. |
36 virtual void Discard(Protector* protector); | 36 virtual void Discard(Protector* protector) {} |
37 | 37 |
38 // Returns the wrench menu item and bubble title. | 38 // Returns the wrench menu item and bubble title. |
39 virtual string16 GetTitle() const = 0; | 39 virtual string16 GetTitle() const = 0; |
40 | 40 |
41 // Returns the bubble message text. | 41 // Returns the bubble message text. |
42 virtual string16 GetMessage() const = 0; | 42 virtual string16 GetMessage() const = 0; |
43 | 43 |
44 // Returns text for the button to apply the change with |Apply|. | 44 // Returns text for the button to apply the change with |Apply|. |
45 // Returns empty string if no apply button should be shown. | 45 // Returns empty string if no apply button should be shown. |
46 virtual string16 GetApplyButtonText() const = 0; | 46 virtual string16 GetApplyButtonText() const = 0; |
(...skipping 11 matching lines...) Expand all Loading... |
58 // Allocates and initializes SettingChange implementation for default search | 58 // Allocates and initializes SettingChange implementation for default search |
59 // provider setting. Both |actual| and |backup| may be NULL if corresponding | 59 // provider setting. Both |actual| and |backup| may be NULL if corresponding |
60 // values are unknown or invalid. | 60 // values are unknown or invalid. |
61 SettingChange* CreateDefaultSearchProviderChange( | 61 SettingChange* CreateDefaultSearchProviderChange( |
62 const TemplateURL* actual, | 62 const TemplateURL* actual, |
63 const TemplateURL* backup); | 63 const TemplateURL* backup); |
64 | 64 |
65 } // namespace protector | 65 } // namespace protector |
66 | 66 |
67 #endif // CHROME_BROWSER_PROTECTOR_SETTING_CHANGE_H_ | 67 #endif // CHROME_BROWSER_PROTECTOR_SETTING_CHANGE_H_ |
OLD | NEW |