OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_CHROMEOS_DOM_UI_NETWORK_MENU_UI_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DOM_UI_NETWORK_MENU_UI_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DOM_UI_NETWORK_MENU_UI_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DOM_UI_NETWORK_MENU_UI_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/chromeos/dom_ui/menu_ui.h" | 9 #include "chrome/browser/chromeos/dom_ui/menu_ui.h" |
10 | 10 |
11 namespace views { | 11 namespace views { |
12 class Menu2; | 12 class Menu2; |
13 } // namespace views | 13 } // namespace views |
14 | 14 |
15 namespace menus { | 15 namespace menus { |
16 class MenuModel; | 16 class MenuModel; |
17 } // namespace menus | 17 } // namespace menus |
18 | 18 |
19 namespace chromeos { | 19 namespace chromeos { |
20 | 20 |
21 class NetworkMenuUI : public MenuUI { | 21 class NetworkMenuUI : public MenuUI { |
22 public: | 22 public: |
23 explicit NetworkMenuUI(TabContents* contents); | 23 explicit NetworkMenuUI(TabContents* contents); |
24 | 24 |
25 // A callback method that is invoked when the JavaScript wants | 25 // A callback method that is invoked when the JavaScript wants |
26 // to invoke an action in the model. | 26 // to invoke an action in the model. |
27 // By convention the first member of 'values' describes the action. | 27 // By convention the first member of 'values' describes the action. |
28 void ModelAction(const menus::MenuModel* model, | 28 // Returns true if the menu should be closed. |
| 29 bool ModelAction(const menus::MenuModel* model, |
29 const ListValue* values); | 30 const ListValue* values); |
30 | 31 |
31 // MenuUI overrides | 32 // MenuUI overrides |
32 virtual DictionaryValue* CreateMenuItem(const menus::MenuModel* model, | 33 virtual DictionaryValue* CreateMenuItem(const menus::MenuModel* model, |
33 int index, | 34 int index, |
34 const char* type, | 35 const char* type, |
35 int* max_icon_width, | 36 int* max_icon_width, |
36 bool* has_accel) const; | 37 bool* has_accel) const; |
37 virtual void AddCustomConfigValues(DictionaryValue* config) const; | 38 virtual void AddCustomConfigValues(DictionaryValue* config) const; |
38 virtual void AddLocalizedStrings(DictionaryValue* localized_strings) const; | 39 virtual void AddLocalizedStrings(DictionaryValue* localized_strings) const; |
39 | 40 |
40 // A convenient factory method to create Menu2 for the network menu. | 41 // A convenient factory method to create Menu2 for the network menu. |
41 static views::Menu2* CreateMenu2(menus::MenuModel* model); | 42 static views::Menu2* CreateMenu2(menus::MenuModel* model); |
42 | 43 |
43 private: | 44 private: |
44 | 45 |
45 DISALLOW_COPY_AND_ASSIGN(NetworkMenuUI); | 46 DISALLOW_COPY_AND_ASSIGN(NetworkMenuUI); |
46 }; | 47 }; |
47 | 48 |
48 } // namespace chromeos | 49 } // namespace chromeos |
49 | 50 |
50 #endif // CHROME_BROWSER_CHROMEOS_DOM_UI_NETWORK_MENU_UI_H_ | 51 #endif // CHROME_BROWSER_CHROMEOS_DOM_UI_NETWORK_MENU_UI_H_ |
OLD | NEW |