OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_STATUS_ICONS_STATUS_ICON_MENU_MODEL_H_ | 5 #ifndef CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_MENU_MODEL_H_ |
6 #define CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_MENU_MODEL_H_ | 6 #define CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_MENU_MODEL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // shown. | 70 // shown. |
71 void ChangeLabelForCommandId(int command_id, const base::string16& label); | 71 void ChangeLabelForCommandId(int command_id, const base::string16& label); |
72 void ChangeSublabelForCommandId( | 72 void ChangeSublabelForCommandId( |
73 int command_id, const base::string16& sublabel); | 73 int command_id, const base::string16& sublabel); |
74 void ChangeIconForCommandId(int command_id, const gfx::Image& icon); | 74 void ChangeIconForCommandId(int command_id, const gfx::Image& icon); |
75 | 75 |
76 void AddObserver(Observer* observer); | 76 void AddObserver(Observer* observer); |
77 void RemoveObserver(Observer* observer); | 77 void RemoveObserver(Observer* observer); |
78 | 78 |
79 // Overridden from ui::SimpleMenuModel::Delegate: | 79 // Overridden from ui::SimpleMenuModel::Delegate: |
80 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | 80 virtual bool IsCommandIdChecked(int command_id) const override; |
81 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 81 virtual bool IsCommandIdEnabled(int command_id) const override; |
82 virtual bool IsCommandIdVisible(int command_id) const OVERRIDE; | 82 virtual bool IsCommandIdVisible(int command_id) const override; |
83 virtual bool GetAcceleratorForCommandId( | 83 virtual bool GetAcceleratorForCommandId( |
84 int command_id, ui::Accelerator* accelerator) OVERRIDE; | 84 int command_id, ui::Accelerator* accelerator) override; |
85 virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; | 85 virtual bool IsItemForCommandIdDynamic(int command_id) const override; |
86 virtual base::string16 GetLabelForCommandId(int command_id) const OVERRIDE; | 86 virtual base::string16 GetLabelForCommandId(int command_id) const override; |
87 virtual base::string16 GetSublabelForCommandId(int command_id) const OVERRIDE; | 87 virtual base::string16 GetSublabelForCommandId(int command_id) const override; |
88 virtual bool GetIconForCommandId(int command_id, gfx::Image* icon) const | 88 virtual bool GetIconForCommandId(int command_id, gfx::Image* icon) const |
89 OVERRIDE; | 89 override; |
90 | 90 |
91 protected: | 91 protected: |
92 // Overriden from ui::SimpleMenuModel: | 92 // Overriden from ui::SimpleMenuModel: |
93 virtual void MenuItemsChanged() OVERRIDE; | 93 virtual void MenuItemsChanged() override; |
94 | 94 |
95 void NotifyMenuStateChanged(); | 95 void NotifyMenuStateChanged(); |
96 | 96 |
97 void set_delegate(Delegate* delegate) { delegate_ = delegate; } | 97 void set_delegate(Delegate* delegate) { delegate_ = delegate; } |
98 Delegate* delegate() { return delegate_; } | 98 Delegate* delegate() { return delegate_; } |
99 | 99 |
100 private: | 100 private: |
101 // Overridden from ui::SimpleMenuModel::Delegate: | 101 // Overridden from ui::SimpleMenuModel::Delegate: |
102 virtual void CommandIdHighlighted(int command_id) OVERRIDE; | 102 virtual void CommandIdHighlighted(int command_id) override; |
103 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | 103 virtual void ExecuteCommand(int command_id, int event_flags) override; |
104 | 104 |
105 struct ItemState; | 105 struct ItemState; |
106 | 106 |
107 // Map the properties to the command id (used as key). | 107 // Map the properties to the command id (used as key). |
108 typedef std::map<int, ItemState> ItemStateMap; | 108 typedef std::map<int, ItemState> ItemStateMap; |
109 | 109 |
110 ItemStateMap item_states_; | 110 ItemStateMap item_states_; |
111 | 111 |
112 ObserverList<Observer> observer_list_; | 112 ObserverList<Observer> observer_list_; |
113 | 113 |
114 Delegate* delegate_; | 114 Delegate* delegate_; |
115 | 115 |
116 DISALLOW_COPY_AND_ASSIGN(StatusIconMenuModel); | 116 DISALLOW_COPY_AND_ASSIGN(StatusIconMenuModel); |
117 }; | 117 }; |
118 | 118 |
119 #endif // CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_MENU_MODEL_H_ | 119 #endif // CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_MENU_MODEL_H_ |
OLD | NEW |