OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ |
6 #define CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ | 6 #define CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 } // namespace | 25 } // namespace |
26 | 26 |
27 // A menu model that builds the contents of an encoding menu. | 27 // A menu model that builds the contents of an encoding menu. |
28 class EncodingMenuModel : public ui::SimpleMenuModel, | 28 class EncodingMenuModel : public ui::SimpleMenuModel, |
29 public ui::SimpleMenuModel::Delegate { | 29 public ui::SimpleMenuModel::Delegate { |
30 public: | 30 public: |
31 explicit EncodingMenuModel(Browser* browser); | 31 explicit EncodingMenuModel(Browser* browser); |
32 virtual ~EncodingMenuModel(); | 32 virtual ~EncodingMenuModel(); |
33 | 33 |
34 // Overridden from ui::SimpleMenuModel::Delegate: | 34 // Overridden from ui::SimpleMenuModel::Delegate: |
35 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | 35 virtual bool IsCommandIdChecked(int command_id) const override; |
36 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 36 virtual bool IsCommandIdEnabled(int command_id) const override; |
37 virtual bool GetAcceleratorForCommandId( | 37 virtual bool GetAcceleratorForCommandId( |
38 int command_id, | 38 int command_id, |
39 ui::Accelerator* accelerator) OVERRIDE; | 39 ui::Accelerator* accelerator) override; |
40 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | 40 virtual void ExecuteCommand(int command_id, int event_flags) override; |
41 | 41 |
42 private: | 42 private: |
43 void Build(); | 43 void Build(); |
44 | 44 |
45 Browser* browser_; // weak | 45 Browser* browser_; // weak |
46 | 46 |
47 DISALLOW_COPY_AND_ASSIGN(EncodingMenuModel); | 47 DISALLOW_COPY_AND_ASSIGN(EncodingMenuModel); |
48 }; | 48 }; |
49 | 49 |
50 // A menu model that builds the contents of the zoom menu. | 50 // A menu model that builds the contents of the zoom menu. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 // Range of command ID's to use for the items in the recent tabs submenu, must | 87 // Range of command ID's to use for the items in the recent tabs submenu, must |
88 // not overlap with that for bookmarks. | 88 // not overlap with that for bookmarks. |
89 static const int kMinRecentTabsCommandId = 1001; | 89 static const int kMinRecentTabsCommandId = 1001; |
90 static const int kMaxRecentTabsCommandId = 1200; | 90 static const int kMaxRecentTabsCommandId = 1200; |
91 | 91 |
92 WrenchMenuModel(ui::AcceleratorProvider* provider, Browser* browser); | 92 WrenchMenuModel(ui::AcceleratorProvider* provider, Browser* browser); |
93 virtual ~WrenchMenuModel(); | 93 virtual ~WrenchMenuModel(); |
94 | 94 |
95 // Overridden for ButtonMenuItemModel::Delegate: | 95 // Overridden for ButtonMenuItemModel::Delegate: |
96 virtual bool DoesCommandIdDismissMenu(int command_id) const OVERRIDE; | 96 virtual bool DoesCommandIdDismissMenu(int command_id) const override; |
97 | 97 |
98 // Overridden for both ButtonMenuItemModel::Delegate and SimpleMenuModel: | 98 // Overridden for both ButtonMenuItemModel::Delegate and SimpleMenuModel: |
99 virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; | 99 virtual bool IsItemForCommandIdDynamic(int command_id) const override; |
100 virtual base::string16 GetLabelForCommandId(int command_id) const OVERRIDE; | 100 virtual base::string16 GetLabelForCommandId(int command_id) const override; |
101 virtual bool GetIconForCommandId(int command_id, | 101 virtual bool GetIconForCommandId(int command_id, |
102 gfx::Image* icon) const OVERRIDE; | 102 gfx::Image* icon) const override; |
103 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | 103 virtual void ExecuteCommand(int command_id, int event_flags) override; |
104 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | 104 virtual bool IsCommandIdChecked(int command_id) const override; |
105 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 105 virtual bool IsCommandIdEnabled(int command_id) const override; |
106 virtual bool IsCommandIdVisible(int command_id) const OVERRIDE; | 106 virtual bool IsCommandIdVisible(int command_id) const override; |
107 virtual bool GetAcceleratorForCommandId( | 107 virtual bool GetAcceleratorForCommandId( |
108 int command_id, | 108 int command_id, |
109 ui::Accelerator* accelerator) OVERRIDE; | 109 ui::Accelerator* accelerator) override; |
110 | 110 |
111 // Overridden from TabStripModelObserver: | 111 // Overridden from TabStripModelObserver: |
112 virtual void ActiveTabChanged(content::WebContents* old_contents, | 112 virtual void ActiveTabChanged(content::WebContents* old_contents, |
113 content::WebContents* new_contents, | 113 content::WebContents* new_contents, |
114 int index, | 114 int index, |
115 int reason) OVERRIDE; | 115 int reason) override; |
116 virtual void TabReplacedAt(TabStripModel* tab_strip_model, | 116 virtual void TabReplacedAt(TabStripModel* tab_strip_model, |
117 content::WebContents* old_contents, | 117 content::WebContents* old_contents, |
118 content::WebContents* new_contents, | 118 content::WebContents* new_contents, |
119 int index) OVERRIDE; | 119 int index) override; |
120 virtual void TabStripModelDeleted() OVERRIDE; | 120 virtual void TabStripModelDeleted() override; |
121 | 121 |
122 // Overridden from content::NotificationObserver: | 122 // Overridden from content::NotificationObserver: |
123 virtual void Observe(int type, | 123 virtual void Observe(int type, |
124 const content::NotificationSource& source, | 124 const content::NotificationSource& source, |
125 const content::NotificationDetails& details) OVERRIDE; | 125 const content::NotificationDetails& details) override; |
126 | 126 |
127 // Getters. | 127 // Getters. |
128 Browser* browser() const { return browser_; } | 128 Browser* browser() const { return browser_; } |
129 | 129 |
130 BookmarkSubMenuModel* bookmark_sub_menu_model() const { | 130 BookmarkSubMenuModel* bookmark_sub_menu_model() const { |
131 return bookmark_sub_menu_model_.get(); | 131 return bookmark_sub_menu_model_.get(); |
132 } | 132 } |
133 | 133 |
134 // Calculates |zoom_label_| in response to a zoom change. | 134 // Calculates |zoom_label_| in response to a zoom change. |
135 void UpdateZoomControls(); | 135 void UpdateZoomControls(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 TabStripModel* tab_strip_model_; // weak | 187 TabStripModel* tab_strip_model_; // weak |
188 | 188 |
189 scoped_ptr<content::HostZoomMap::Subscription> content_zoom_subscription_; | 189 scoped_ptr<content::HostZoomMap::Subscription> content_zoom_subscription_; |
190 scoped_ptr<content::HostZoomMap::Subscription> browser_zoom_subscription_; | 190 scoped_ptr<content::HostZoomMap::Subscription> browser_zoom_subscription_; |
191 content::NotificationRegistrar registrar_; | 191 content::NotificationRegistrar registrar_; |
192 | 192 |
193 DISALLOW_COPY_AND_ASSIGN(WrenchMenuModel); | 193 DISALLOW_COPY_AND_ASSIGN(WrenchMenuModel); |
194 }; | 194 }; |
195 | 195 |
196 #endif // CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ | 196 #endif // CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ |
OLD | NEW |