Chromium Code Reviews| Index: chrome/browser/ui/search/other_device_menu.h |
| diff --git a/chrome/browser/ui/search/other_device_menu.h b/chrome/browser/ui/search/other_device_menu.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b809a5bf7a101c42b57cb8b3097dd72e052c0f60 |
| --- /dev/null |
| +++ b/chrome/browser/ui/search/other_device_menu.h |
| @@ -0,0 +1,70 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_UI_SEARCH_OTHER_DEVICE_MENU_H_ |
| +#define CHROME_BROWSER_UI_SEARCH_OTHER_DEVICE_MENU_H_ |
| + |
| +#include "base/memory/linked_ptr.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/values.h" |
| +#include "ui/base/models/simple_menu_model.h" |
| + |
| +namespace content { |
| +class WebUI; |
| +} |
| + |
| +namespace gfx { |
| +class Point; |
| +} |
| + |
| +namespace views { |
| +class MenuRunner; |
| +} |
| + |
| +// A menu model that builds the contents of the other device menu. This menu |
| +// is displayed when a device on the ntp_search device page is clicked and |
| +// contains the session for that device. This is implemented natively rather |
| +// than in JavaScript to allow the menu to extend into the natively-rendered |
| +// section of the NTP. |
| +class OtherDeviceMenu : public ui::SimpleMenuModel::Delegate { |
| + |
|
dhollowa
2012/10/08 19:15:09
nit: remove blank line.
jeremycho
2012/10/09 01:52:13
Done.
|
| + public: |
| + OtherDeviceMenu(content::WebUI* web_ui, |
| + const std::string& session_id, |
| + const gfx::Point& location); |
| + virtual ~OtherDeviceMenu(); |
| + |
| + // Displays the menu. |
| + void ShowMenu(); |
| + |
| + // ui::SimpleMenuModel::Delegate overrides: |
| + virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; |
| + virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |
| + virtual void ExecuteCommand(int command_id) OVERRIDE; |
| + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; |
| + virtual bool GetAcceleratorForCommandId( |
| + int command_id, |
| + ui::Accelerator* accelerator) OVERRIDE; |
| + |
| + private: |
| + typedef std::vector<linked_ptr<DictionaryValue> > TabData; |
| + |
| + // Adds the tabs of the |session_id_| session to the menu. |
| + void AddDeviceTabs(); |
| + |
| + content::WebUI* web_ui_; // weak |
| + 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.
|
| + // The anchor point for the top-left corner of the menu. |
| + 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.
|
| + ui::SimpleMenuModel menu_model_; |
| + scoped_ptr<views::MenuRunner> menu_runner_; |
| + |
| + // The tab data for each menu item, in the order in which they're displayed. |
| + // |command_id| i corresponds to index i. |
| + TabData tab_data_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(OtherDeviceMenu); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_SEARCH_OTHER_DEVICE_MENU_H_ |