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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/tabs/tab_strip_model_observer.h" | 11 #include "chrome/browser/tabs/tab_strip_model_observer.h" |
11 #include "content/common/notification_observer.h" | 12 #include "content/common/notification_observer.h" |
12 #include "content/common/notification_registrar.h" | 13 #include "content/common/notification_registrar.h" |
13 #include "ui/base/models/accelerator.h" | 14 #include "ui/base/models/accelerator.h" |
14 #include "ui/base/models/button_menu_item_model.h" | 15 #include "ui/base/models/button_menu_item_model.h" |
15 #include "ui/base/models/simple_menu_model.h" | 16 #include "ui/base/models/simple_menu_model.h" |
16 | 17 |
17 class Browser; | 18 class Browser; |
18 class TabStripModel; | 19 class TabStripModel; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 BookmarkSubMenuModel(ui::SimpleMenuModel::Delegate* delegate, | 75 BookmarkSubMenuModel(ui::SimpleMenuModel::Delegate* delegate, |
75 Browser* browser); | 76 Browser* browser); |
76 virtual ~BookmarkSubMenuModel(); | 77 virtual ~BookmarkSubMenuModel(); |
77 | 78 |
78 private: | 79 private: |
79 void Build(Browser* browser); | 80 void Build(Browser* browser); |
80 | 81 |
81 DISALLOW_COPY_AND_ASSIGN(BookmarkSubMenuModel); | 82 DISALLOW_COPY_AND_ASSIGN(BookmarkSubMenuModel); |
82 }; | 83 }; |
83 | 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 COMMAND_SWITCH_TO_PROFILE, |
| 101 }; |
| 102 |
| 103 void Build(); |
| 104 |
| 105 Browser* browser_; // weak |
| 106 ui::SimpleMenuModel::Delegate* delegate_; // weak |
| 107 |
| 108 DISALLOW_COPY_AND_ASSIGN(ProfilesSubMenuModel); |
| 109 }; |
| 110 |
84 // A menu model that builds the contents of the wrench menu. | 111 // A menu model that builds the contents of the wrench menu. |
85 class WrenchMenuModel : public ui::SimpleMenuModel, | 112 class WrenchMenuModel : public ui::SimpleMenuModel, |
86 public ui::SimpleMenuModel::Delegate, | 113 public ui::SimpleMenuModel::Delegate, |
87 public ui::ButtonMenuItemModel::Delegate, | 114 public ui::ButtonMenuItemModel::Delegate, |
88 public TabStripModelObserver, | 115 public TabStripModelObserver, |
89 public NotificationObserver { | 116 public NotificationObserver { |
90 public: | 117 public: |
91 WrenchMenuModel(ui::AcceleratorProvider* provider, Browser* browser); | 118 WrenchMenuModel(ui::AcceleratorProvider* provider, Browser* browser); |
92 virtual ~WrenchMenuModel(); | 119 virtual ~WrenchMenuModel(); |
93 | 120 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 176 |
150 // Label of the zoom label in the zoom menu item. | 177 // Label of the zoom label in the zoom menu item. |
151 string16 zoom_label_; | 178 string16 zoom_label_; |
152 | 179 |
153 // Tools menu. | 180 // Tools menu. |
154 scoped_ptr<ToolsMenuModel> tools_menu_model_; | 181 scoped_ptr<ToolsMenuModel> tools_menu_model_; |
155 | 182 |
156 // Bookmark submenu. | 183 // Bookmark submenu. |
157 scoped_ptr<BookmarkSubMenuModel> bookmark_sub_menu_model_; | 184 scoped_ptr<BookmarkSubMenuModel> bookmark_sub_menu_model_; |
158 | 185 |
| 186 // Profiles submenu. |
| 187 scoped_ptr<ProfilesSubMenuModel> profiles_sub_menu_model_; |
| 188 |
159 ui::AcceleratorProvider* provider_; // weak | 189 ui::AcceleratorProvider* provider_; // weak |
160 | 190 |
161 Browser* browser_; // weak | 191 Browser* browser_; // weak |
162 TabStripModel* tabstrip_model_; // weak | 192 TabStripModel* tabstrip_model_; // weak |
163 | 193 |
164 NotificationRegistrar registrar_; | 194 NotificationRegistrar registrar_; |
165 | 195 |
166 DISALLOW_COPY_AND_ASSIGN(WrenchMenuModel); | 196 DISALLOW_COPY_AND_ASSIGN(WrenchMenuModel); |
167 }; | 197 }; |
168 | 198 |
169 #endif // CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ | 199 #endif // CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ |
OLD | NEW |