Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: chrome/browser/status_icons/status_icon_menu_model.h

Issue 648653003: Standardize usage of virtual/override/final in chrome/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 public: 46 public:
47 // Invoked when the menu model has changed. 47 // Invoked when the menu model has changed.
48 virtual void OnMenuStateChanged() {} 48 virtual void OnMenuStateChanged() {}
49 49
50 protected: 50 protected:
51 virtual ~Observer() {} 51 virtual ~Observer() {}
52 }; 52 };
53 53
54 // The Delegate can be NULL. 54 // The Delegate can be NULL.
55 explicit StatusIconMenuModel(Delegate* delegate); 55 explicit StatusIconMenuModel(Delegate* delegate);
56 virtual ~StatusIconMenuModel(); 56 ~StatusIconMenuModel() override;
57 57
58 // Methods for seting the state of specific command ids. 58 // Methods for seting the state of specific command ids.
59 void SetCommandIdChecked(int command_id, bool checked); 59 void SetCommandIdChecked(int command_id, bool checked);
60 void SetCommandIdEnabled(int command_id, bool enabled); 60 void SetCommandIdEnabled(int command_id, bool enabled);
61 void SetCommandIdVisible(int command_id, bool visible); 61 void SetCommandIdVisible(int command_id, bool visible);
62 62
63 // Sets the accelerator for the specified command id. 63 // Sets the accelerator for the specified command id.
64 void SetAcceleratorForCommandId( 64 void SetAcceleratorForCommandId(
65 int command_id, const ui::Accelerator* accelerator); 65 int command_id, const ui::Accelerator* accelerator);
66 66
67 // Calling any of these "change" methods will mark the menu item as "dynamic" 67 // Calling any of these "change" methods will mark the menu item as "dynamic"
68 // (see menu_model.h:IsItemDynamicAt) which many platforms take as a cue to 68 // (see menu_model.h:IsItemDynamicAt) which many platforms take as a cue to
69 // refresh the label, sublabel and icon of the menu item each time the menu is 69 // refresh the label, sublabel and icon of the menu item each time the menu is
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 bool IsCommandIdChecked(int command_id) const override;
81 virtual bool IsCommandIdEnabled(int command_id) const override; 81 bool IsCommandIdEnabled(int command_id) const override;
82 virtual bool IsCommandIdVisible(int command_id) const override; 82 bool IsCommandIdVisible(int command_id) const override;
83 virtual bool GetAcceleratorForCommandId( 83 bool GetAcceleratorForCommandId(int command_id,
84 int command_id, ui::Accelerator* accelerator) override; 84 ui::Accelerator* accelerator) override;
85 virtual bool IsItemForCommandIdDynamic(int command_id) const override; 85 bool IsItemForCommandIdDynamic(int command_id) const override;
86 virtual base::string16 GetLabelForCommandId(int command_id) const override; 86 base::string16 GetLabelForCommandId(int command_id) const override;
87 virtual base::string16 GetSublabelForCommandId(int command_id) const override; 87 base::string16 GetSublabelForCommandId(int command_id) const override;
88 virtual bool GetIconForCommandId(int command_id, gfx::Image* icon) const 88 bool GetIconForCommandId(int command_id, gfx::Image* icon) const override;
89 override;
90 89
91 protected: 90 protected:
92 // Overriden from ui::SimpleMenuModel: 91 // Overriden from ui::SimpleMenuModel:
93 virtual void MenuItemsChanged() override; 92 void MenuItemsChanged() override;
94 93
95 void NotifyMenuStateChanged(); 94 void NotifyMenuStateChanged();
96 95
97 void set_delegate(Delegate* delegate) { delegate_ = delegate; } 96 void set_delegate(Delegate* delegate) { delegate_ = delegate; }
98 Delegate* delegate() { return delegate_; } 97 Delegate* delegate() { return delegate_; }
99 98
100 private: 99 private:
101 // Overridden from ui::SimpleMenuModel::Delegate: 100 // Overridden from ui::SimpleMenuModel::Delegate:
102 virtual void CommandIdHighlighted(int command_id) override; 101 void CommandIdHighlighted(int command_id) override;
103 virtual void ExecuteCommand(int command_id, int event_flags) override; 102 void ExecuteCommand(int command_id, int event_flags) override;
104 103
105 struct ItemState; 104 struct ItemState;
106 105
107 // Map the properties to the command id (used as key). 106 // Map the properties to the command id (used as key).
108 typedef std::map<int, ItemState> ItemStateMap; 107 typedef std::map<int, ItemState> ItemStateMap;
109 108
110 ItemStateMap item_states_; 109 ItemStateMap item_states_;
111 110
112 ObserverList<Observer> observer_list_; 111 ObserverList<Observer> observer_list_;
113 112
114 Delegate* delegate_; 113 Delegate* delegate_;
115 114
116 DISALLOW_COPY_AND_ASSIGN(StatusIconMenuModel); 115 DISALLOW_COPY_AND_ASSIGN(StatusIconMenuModel);
117 }; 116 };
118 117
119 #endif // CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_MENU_MODEL_H_ 118 #endif // CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_MENU_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698