Chromium Code Reviews| 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 | |
| 13 namespace content { | |
| 14 class WebUI; | |
| 15 } | |
| 16 | |
| 17 namespace gfx { | |
| 18 class Point; | |
| 19 } | |
| 20 | |
| 21 namespace views { | |
| 22 class MenuRunner; | |
| 23 } | |
| 24 | |
| 25 // A menu model that builds the contents of the other device menu. This menu | |
| 26 // is displayed when a device on the ntp_search device page is clicked and | |
| 27 // contains the session for that device. This is implemented natively rather | |
| 28 // than in JavaScript to allow the menu to extend into the natively-rendered | |
| 29 // section of the NTP. | |
| 30 class OtherDeviceMenu : public ui::SimpleMenuModel::Delegate { | |
| 31 | |
|
dhollowa
2012/10/08 19:15:09
nit: remove blank line.
jeremycho
2012/10/09 01:52:13
Done.
| |
| 32 public: | |
| 33 OtherDeviceMenu(content::WebUI* web_ui, | |
| 34 const std::string& session_id, | |
| 35 const gfx::Point& location); | |
| 36 virtual ~OtherDeviceMenu(); | |
| 37 | |
| 38 // Displays the menu. | |
| 39 void ShowMenu(); | |
| 40 | |
| 41 // ui::SimpleMenuModel::Delegate overrides: | |
| 42 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | |
| 43 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | |
| 44 virtual void ExecuteCommand(int command_id) OVERRIDE; | |
| 45 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | |
| 46 virtual bool GetAcceleratorForCommandId( | |
| 47 int command_id, | |
| 48 ui::Accelerator* accelerator) OVERRIDE; | |
| 49 | |
| 50 private: | |
| 51 typedef std::vector<linked_ptr<DictionaryValue> > TabData; | |
| 52 | |
| 53 // Adds the tabs of the |session_id_| session to the menu. | |
| 54 void AddDeviceTabs(); | |
| 55 | |
| 56 content::WebUI* web_ui_; // weak | |
| 57 const std::string& session_id_; | |
|
dhollowa
2012/10/08 19:15:09
This should be a copy not a reference. You're cur
jeremycho
2012/10/09 01:52:13
Done.
| |
| 58 // The anchor point for the top-left corner of the menu. | |
| 59 const gfx::Point& location_; | |
|
dhollowa
2012/10/08 19:15:09
Similarly, this should be a copy not a reference.
jeremycho
2012/10/09 01:52:13
Done.
| |
| 60 ui::SimpleMenuModel menu_model_; | |
| 61 scoped_ptr<views::MenuRunner> menu_runner_; | |
| 62 | |
| 63 // The tab data for each menu item, in the order in which they're displayed. | |
| 64 // |command_id| i corresponds to index i. | |
| 65 TabData tab_data_; | |
| 66 | |
| 67 DISALLOW_COPY_AND_ASSIGN(OtherDeviceMenu); | |
| 68 }; | |
| 69 | |
| 70 #endif // CHROME_BROWSER_UI_SEARCH_OTHER_DEVICE_MENU_H_ | |
| OLD | NEW |