OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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_COMPOSITE_SETTINGS_CHANGE_H_ | |
6 #define CHROME_BROWSER_PROTECTOR_COMPOSITE_SETTINGS_CHANGE_H_ | |
7 | |
8 #include <queue> | |
9 | |
10 #include "base/compiler_specific.h" | |
11 #include "base/memory/scoped_vector.h" | |
12 #include "chrome/browser/protector/base_setting_change.h" | |
13 | |
14 namespace protector { | |
15 | |
16 // Class for tracking multiple settings changes as a single change. | |
17 class CompositeSettingsChange : public BaseSettingChange { | |
18 public: | |
19 CompositeSettingsChange(); | |
20 virtual ~CompositeSettingsChange(); | |
21 | |
22 // BaseSettingChange overrides: | |
23 virtual CompositeSettingsChange* MergeWith(BaseSettingChange* other) OVERRIDE; | |
24 virtual bool Contains(const BaseSettingChange* other) const OVERRIDE; | |
25 virtual void Apply(Browser* browser) OVERRIDE; | |
26 virtual void Discard(Browser* browser) OVERRIDE; | |
27 virtual void Timeout() OVERRIDE; | |
28 virtual int GetBadgeIconID() const OVERRIDE; | |
29 virtual int GetMenuItemIconID() const OVERRIDE; | |
30 virtual int GetBubbleIconID() const OVERRIDE; | |
31 virtual string16 GetBubbleTitle() const OVERRIDE; | |
32 virtual string16 GetBubbleMessage() const OVERRIDE; | |
33 virtual string16 GetApplyButtonText() const OVERRIDE; | |
34 virtual string16 GetDiscardButtonText() const OVERRIDE; | |
35 virtual DisplayName GetApplyDisplayName() const OVERRIDE; | |
36 virtual GURL GetNewSettingURL() const OVERRIDE; | |
37 virtual bool CanBeMerged() const OVERRIDE; | |
38 | |
39 private: | |
40 // Vector with all merged changes. | |
41 ScopedVector<BaseSettingChange> changes_; | |
42 | |
43 // Display names of merged changes, sorted by their priority. The name with | |
44 // the highest priority is picked. | |
45 std::priority_queue<DisplayName> apply_names_; | |
46 | |
47 DISALLOW_COPY_AND_ASSIGN(CompositeSettingsChange); | |
48 }; | |
49 | |
50 } // namespace protector | |
51 | |
52 #endif // CHROME_BROWSER_PROTECTOR_COMPOSITE_SETTINGS_CHANGE_H_ | |
OLD | NEW |