OLD | NEW |
(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_BASE_SETTING_CHANGE_H_ |
| 6 #define CHROME_BROWSER_PROTECTOR_BASE_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 TemplateURL; |
| 16 |
| 17 namespace protector { |
| 18 |
| 19 class Protector; |
| 20 |
| 21 // Base class for setting change tracked by Protector. |
| 22 class BaseSettingChange { |
| 23 public: |
| 24 BaseSettingChange(); |
| 25 virtual ~BaseSettingChange(); |
| 26 |
| 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 |
| 29 // initialization was successful. |
| 30 virtual bool Init(Protector* protector); |
| 31 |
| 32 // Persists new setting if needed. |
| 33 virtual void Apply(Protector* protector); |
| 34 |
| 35 // Restores old setting if needed. |
| 36 virtual void Discard(Protector* protector); |
| 37 |
| 38 // Returns the wrench menu item and bubble title. |
| 39 virtual string16 GetBubbleTitle() const = 0; |
| 40 |
| 41 // Returns the bubble message text. |
| 42 virtual string16 GetBubbleMessage() const = 0; |
| 43 |
| 44 // Returns text for the button to apply the change with |Apply|. |
| 45 // Returns empty string if no apply button should be shown. |
| 46 virtual string16 GetApplyButtonText() const = 0; |
| 47 |
| 48 // Returns text for the button to discard the change with |Discard|. |
| 49 virtual string16 GetDiscardButtonText() const = 0; |
| 50 |
| 51 private: |
| 52 DISALLOW_COPY_AND_ASSIGN(BaseSettingChange); |
| 53 }; |
| 54 |
| 55 // TODO(ivankr): CompositeSettingChange that incapsulates multiple |
| 56 // BaseSettingChange instances. |
| 57 |
| 58 // Allocates and initializes SettingChange implementation for default search |
| 59 // provider setting. Both |actual| and |backup| may be NULL if corresponding |
| 60 // values are unknown or invalid. |
| 61 BaseSettingChange* CreateDefaultSearchProviderChange( |
| 62 const TemplateURL* actual, |
| 63 const TemplateURL* backup); |
| 64 |
| 65 } // namespace protector |
| 66 |
| 67 #endif // CHROME_BROWSER_PROTECTOR_BASE_SETTING_CHANGE_H_ |
OLD | NEW |