Chromium Code Reviews| Index: chrome/browser/protector/base_setting_change.h |
| diff --git a/chrome/browser/protector/base_setting_change.h b/chrome/browser/protector/base_setting_change.h |
| index 42c52ad7f3c321a0a0a4758e00ad13635b369f63..32ca46fd063c62401c0d83d5ce05788ef95924ac 100644 |
| --- a/chrome/browser/protector/base_setting_change.h |
| +++ b/chrome/browser/protector/base_setting_change.h |
| @@ -7,7 +7,7 @@ |
| #pragma once |
| #include <string> |
| -#include <vector> |
| +#include <utility> |
| #include "base/basictypes.h" |
| #include "base/string16.h" |
| @@ -20,12 +20,34 @@ struct SessionStartupPref; |
| namespace protector { |
| +class CompositeSettingsChange; |
| + |
| // Base class for setting change tracked by Protector. |
| class BaseSettingChange { |
| public: |
| + // Pair consisting of a display name representing either new or backup setting |
| + // and priority for it. Priority is used for composite changes, consisting |
| + // of multiple BaseSettingChange instances - the display name with the highest |
| + // priority is used. |
| + typedef std::pair<size_t, string16> DisplayName; |
| + |
| + // Default priority value. |
| + static const size_t kDefaultNamePriority; |
| + |
| BaseSettingChange(); |
| virtual ~BaseSettingChange(); |
| + // Merges |this| with |other| and returns a CompositeSettingsChange instance. |
| + // Returned instance takes ownership of |other|. |
| + // Init should not be called for the returned instance. |
| + // |this| may be another CompositeSettingsChange, in which case |other| is |
| + // simply added to it and |this| is returned. |other| cannot be |
| + // CompositeSettingsChange. |
| + virtual CompositeSettingsChange* MergeWith(BaseSettingChange* other); |
| + |
| + // Returns true if |this| is a result of merging some changes with |other|. |
| + virtual bool Contains(const BaseSettingChange* other) const; |
| + |
| // Applies initial actions to the setting if needed. Must be called before |
| // any other calls are made, including text getters. |
| // Returns true if initialization was successful. |
| @@ -66,6 +88,20 @@ class BaseSettingChange { |
| // Returns text for the button to discard the change with |Discard|. |
| virtual string16 GetDiscardButtonText() const = 0; |
| + // Returns the display name and priority for the new setting. If multiple |
| + // BaseSettingChange instances are collapsed into MulipleSettingChange |
| + // instance, the display name with the highest priority will be used for the |
| + // Apply button (Discard button will have a generic caption in that case). |
| + // Returns an empty string if there is no specific representaion for new |
|
whywhat
2012/04/06 16:28:32
s/representaion/representation
The function return
Ivan Korotkov
2012/04/09 14:46:47
Done.
|
| + // setting value and a generic string should be used. |
| + virtual DisplayName GetApplyDisplayName() const; |
| + |
| + // Returns a keyword uniquely identifying new (to be applied) settings. |
| + // BaseSettingChange instances with the same keyword may be collapsed into |
| + // a single MulipleSettingChange instance. Empty keywords are not considered |
|
whywhat
2012/04/06 16:28:32
When do we have an empty keyword? When we don't kn
Ivan Korotkov
2012/04/09 14:46:47
For settings which are not clear how to merge with
|
| + // to be equal. |
| + virtual std::string GetApplyKeyword() const; |
| + |
| protected: |
| // Profile instance we've been associated with by an |Init| call. |
| Profile* profile() { return profile_; } |