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_APP_MENU_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_APP_MENU_MODEL_H_ |
6 #define CHROME_BROWSER_UI_TOOLBAR_APP_MENU_MODEL_H_ | 6 #define CHROME_BROWSER_UI_TOOLBAR_APP_MENU_MODEL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 MENU_ACTION_FEEDBACK = 39, | 68 MENU_ACTION_FEEDBACK = 39, |
69 MENU_ACTION_TOGGLE_REQUEST_TABLET_SITE = 40, | 69 MENU_ACTION_TOGGLE_REQUEST_TABLET_SITE = 40, |
70 MENU_ACTION_EXIT = 43, | 70 MENU_ACTION_EXIT = 43, |
71 MENU_ACTION_RECENT_TAB = 41, | 71 MENU_ACTION_RECENT_TAB = 41, |
72 MENU_ACTION_BOOKMARK_OPEN = 42, | 72 MENU_ACTION_BOOKMARK_OPEN = 42, |
73 MENU_ACTION_UPGRADE_DIALOG = 44, | 73 MENU_ACTION_UPGRADE_DIALOG = 44, |
74 MENU_ACTION_CAST = 45, | 74 MENU_ACTION_CAST = 45, |
75 LIMIT_MENU_ACTION | 75 LIMIT_MENU_ACTION |
76 }; | 76 }; |
77 | 77 |
78 // A menu model that builds the contents of an encoding menu. | |
79 class EncodingMenuModel : public ui::SimpleMenuModel, | |
80 public ui::SimpleMenuModel::Delegate { | |
81 public: | |
82 explicit EncodingMenuModel(Browser* browser); | |
83 ~EncodingMenuModel() override; | |
84 | |
85 // Overridden from ui::SimpleMenuModel::Delegate: | |
86 bool IsCommandIdChecked(int command_id) const override; | |
87 bool IsCommandIdEnabled(int command_id) const override; | |
88 void ExecuteCommand(int command_id, int event_flags) override; | |
89 | |
90 private: | |
91 void Build(); | |
92 | |
93 Browser* browser_; // weak | |
94 | |
95 DISALLOW_COPY_AND_ASSIGN(EncodingMenuModel); | |
96 }; | |
97 | |
98 // A menu model that builds the contents of the zoom menu. | 78 // A menu model that builds the contents of the zoom menu. |
99 class ZoomMenuModel : public ui::SimpleMenuModel { | 79 class ZoomMenuModel : public ui::SimpleMenuModel { |
100 public: | 80 public: |
101 explicit ZoomMenuModel(ui::SimpleMenuModel::Delegate* delegate); | 81 explicit ZoomMenuModel(ui::SimpleMenuModel::Delegate* delegate); |
102 ~ZoomMenuModel() override; | 82 ~ZoomMenuModel() override; |
103 | 83 |
104 private: | 84 private: |
105 void Build(); | 85 void Build(); |
106 | 86 |
107 DISALLOW_COPY_AND_ASSIGN(ZoomMenuModel); | 87 DISALLOW_COPY_AND_ASSIGN(ZoomMenuModel); |
108 }; | 88 }; |
109 | 89 |
110 class ToolsMenuModel : public ui::SimpleMenuModel { | 90 class ToolsMenuModel : public ui::SimpleMenuModel { |
111 public: | 91 public: |
112 ToolsMenuModel(ui::SimpleMenuModel::Delegate* delegate, Browser* browser); | 92 ToolsMenuModel(ui::SimpleMenuModel::Delegate* delegate, Browser* browser); |
113 ~ToolsMenuModel() override; | 93 ~ToolsMenuModel() override; |
114 | 94 |
115 private: | 95 private: |
116 void Build(Browser* browser); | 96 void Build(Browser* browser); |
117 | 97 |
118 std::unique_ptr<EncodingMenuModel> encoding_menu_model_; | |
119 | |
120 DISALLOW_COPY_AND_ASSIGN(ToolsMenuModel); | 98 DISALLOW_COPY_AND_ASSIGN(ToolsMenuModel); |
121 }; | 99 }; |
122 | 100 |
123 // A menu model that builds the contents of the app menu. | 101 // A menu model that builds the contents of the app menu. |
124 class AppMenuModel : public ui::SimpleMenuModel, | 102 class AppMenuModel : public ui::SimpleMenuModel, |
125 public ui::SimpleMenuModel::Delegate, | 103 public ui::SimpleMenuModel::Delegate, |
126 public ui::ButtonMenuItemModel::Delegate, | 104 public ui::ButtonMenuItemModel::Delegate, |
127 public TabStripModelObserver, | 105 public TabStripModelObserver, |
128 public content::NotificationObserver { | 106 public content::NotificationObserver { |
129 public: | 107 public: |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 Browser* browser_; // weak | 223 Browser* browser_; // weak |
246 | 224 |
247 std::unique_ptr<content::HostZoomMap::Subscription> | 225 std::unique_ptr<content::HostZoomMap::Subscription> |
248 browser_zoom_subscription_; | 226 browser_zoom_subscription_; |
249 content::NotificationRegistrar registrar_; | 227 content::NotificationRegistrar registrar_; |
250 | 228 |
251 DISALLOW_COPY_AND_ASSIGN(AppMenuModel); | 229 DISALLOW_COPY_AND_ASSIGN(AppMenuModel); |
252 }; | 230 }; |
253 | 231 |
254 #endif // CHROME_BROWSER_UI_TOOLBAR_APP_MENU_MODEL_H_ | 232 #endif // CHROME_BROWSER_UI_TOOLBAR_APP_MENU_MODEL_H_ |
OLD | NEW |