OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_SEARCH_OTHER_DEVICE_MENU_H_ | |
6 #define CHROME_BROWSER_UI_SEARCH_OTHER_DEVICE_MENU_H_ | |
7 | |
8 #include "base/memory/linked_ptr.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/values.h" | |
11 #include "ui/base/models/simple_menu_model.h" | |
12 #include "ui/gfx/point.h" | |
Dan Beam
2012/10/12 01:10:57
nit: can you not forward this class because it's i
jeremycho
2012/10/12 03:51:08
Correct.
| |
13 | |
14 namespace content { | |
15 class WebUI; | |
16 } | |
17 | |
18 namespace views { | |
19 class MenuRunner; | |
20 } | |
21 | |
22 // A menu model that builds the contents of the other device menu. This menu | |
23 // is displayed when a device on the ntp_search device page is clicked and | |
24 // contains the session for that device. This is implemented natively rather | |
25 // than in JavaScript to allow the menu to extend into the natively-rendered | |
26 // section of the NTP. | |
27 class OtherDeviceMenu : public ui::SimpleMenuModel::Delegate { | |
28 public: | |
29 OtherDeviceMenu(content::WebUI* web_ui, | |
30 const std::string& session_id, | |
31 const gfx::Point& location); | |
32 virtual ~OtherDeviceMenu(); | |
33 | |
34 // Displays the menu. | |
35 void ShowMenu(); | |
36 | |
37 // ui::SimpleMenuModel::Delegate overrides: | |
Dan Beam
2012/10/12 01:10:57
nit: make these private until somebody needs to in
jeremycho
2012/10/12 03:51:08
Done.
| |
38 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | |
39 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | |
40 virtual void ExecuteCommand(int command_id) OVERRIDE; | |
41 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | |
42 virtual bool GetAcceleratorForCommandId( | |
43 int command_id, | |
44 ui::Accelerator* accelerator) OVERRIDE; | |
45 | |
46 private: | |
47 typedef std::vector<linked_ptr<DictionaryValue> > TabData; | |
48 | |
49 // Adds the tabs of the |session_id_| session to the menu. | |
50 void AddDeviceTabs(); | |
51 | |
Dan Beam
2012/10/12 01:10:57
nit: I think you could describe some of these a li
jeremycho
2012/10/12 03:51:08
Done.
| |
52 content::WebUI* web_ui_; // weak | |
53 std::string session_id_; | |
54 // The anchor point for the top-left corner of the menu. | |
55 gfx::Point location_; | |
56 ui::SimpleMenuModel menu_model_; | |
57 scoped_ptr<views::MenuRunner> menu_runner_; | |
58 | |
59 // The tab data for each menu item, in the order in which they're displayed. | |
60 // |command_id| i corresponds to index i. | |
61 TabData tab_data_; | |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(OtherDeviceMenu); | |
64 }; | |
65 | |
66 #endif // CHROME_BROWSER_UI_SEARCH_OTHER_DEVICE_MENU_H_ | |
OLD | NEW |