OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 BookmarkSubMenuModel(ui::SimpleMenuModel::Delegate* delegate, | 75 BookmarkSubMenuModel(ui::SimpleMenuModel::Delegate* delegate, |
76 Browser* browser); | 76 Browser* browser); |
77 virtual ~BookmarkSubMenuModel(); | 77 virtual ~BookmarkSubMenuModel(); |
78 | 78 |
79 private: | 79 private: |
80 void Build(Browser* browser); | 80 void Build(Browser* browser); |
81 | 81 |
82 DISALLOW_COPY_AND_ASSIGN(BookmarkSubMenuModel); | 82 DISALLOW_COPY_AND_ASSIGN(BookmarkSubMenuModel); |
83 }; | 83 }; |
84 | 84 |
85 class ProfilesSubMenuModel : public ui::SimpleMenuModel, | |
86 public ui::SimpleMenuModel::Delegate { | |
87 public: | |
88 ProfilesSubMenuModel(ui::SimpleMenuModel::Delegate* delegate, | |
89 Browser* browser); | |
90 | |
91 virtual void ExecuteCommand(int command_id) OVERRIDE; | |
92 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | |
93 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | |
94 virtual bool GetAcceleratorForCommandId( | |
95 int command_id, | |
96 ui::Accelerator* accelerator) OVERRIDE; | |
97 | |
98 private: | |
99 enum { | |
100 // The profiles submenu contains a menu item for each profile. For | |
101 // the i'th profile the command ID is COMMAND_SWITCH_TO_PROFILE + i. | |
102 // If the profile matches the profile of the wrench button's browser | |
103 // then the menu item is checked. | |
104 COMMAND_SWITCH_TO_PROFILE, | |
105 }; | |
106 | |
107 void Build(); | |
108 | |
109 Browser* browser_; // weak | |
110 ui::SimpleMenuModel::Delegate* delegate_; // weak | |
111 | |
112 DISALLOW_COPY_AND_ASSIGN(ProfilesSubMenuModel); | |
113 }; | |
114 | |
115 // A menu model that builds the contents of the wrench menu. | 85 // A menu model that builds the contents of the wrench menu. |
116 class WrenchMenuModel : public ui::SimpleMenuModel, | 86 class WrenchMenuModel : public ui::SimpleMenuModel, |
117 public ui::SimpleMenuModel::Delegate, | 87 public ui::SimpleMenuModel::Delegate, |
118 public ui::ButtonMenuItemModel::Delegate, | 88 public ui::ButtonMenuItemModel::Delegate, |
119 public TabStripModelObserver, | 89 public TabStripModelObserver, |
120 public NotificationObserver { | 90 public NotificationObserver { |
121 public: | 91 public: |
122 WrenchMenuModel(ui::AcceleratorProvider* provider, Browser* browser); | 92 WrenchMenuModel(ui::AcceleratorProvider* provider, Browser* browser); |
123 virtual ~WrenchMenuModel(); | 93 virtual ~WrenchMenuModel(); |
124 | 94 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 150 |
181 // Label of the zoom label in the zoom menu item. | 151 // Label of the zoom label in the zoom menu item. |
182 string16 zoom_label_; | 152 string16 zoom_label_; |
183 | 153 |
184 // Tools menu. | 154 // Tools menu. |
185 scoped_ptr<ToolsMenuModel> tools_menu_model_; | 155 scoped_ptr<ToolsMenuModel> tools_menu_model_; |
186 | 156 |
187 // Bookmark submenu. | 157 // Bookmark submenu. |
188 scoped_ptr<BookmarkSubMenuModel> bookmark_sub_menu_model_; | 158 scoped_ptr<BookmarkSubMenuModel> bookmark_sub_menu_model_; |
189 | 159 |
190 // Profiles submenu. | |
191 scoped_ptr<ProfilesSubMenuModel> profiles_sub_menu_model_; | |
192 | |
193 ui::AcceleratorProvider* provider_; // weak | 160 ui::AcceleratorProvider* provider_; // weak |
194 | 161 |
195 Browser* browser_; // weak | 162 Browser* browser_; // weak |
196 TabStripModel* tabstrip_model_; // weak | 163 TabStripModel* tabstrip_model_; // weak |
197 | 164 |
198 NotificationRegistrar registrar_; | 165 NotificationRegistrar registrar_; |
199 | 166 |
200 DISALLOW_COPY_AND_ASSIGN(WrenchMenuModel); | 167 DISALLOW_COPY_AND_ASSIGN(WrenchMenuModel); |
201 }; | 168 }; |
202 | 169 |
203 #endif // CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ | 170 #endif // CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ |
OLD | NEW |