apacible | 86792f6 | 2015-04-19 03:40:00 | [diff] [blame] | 1 | // Copyright 2015 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_TOOLBAR_MEDIA_ROUTER_ACTION_H_ |
| 6 | #define CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_ACTION_H_ |
| 7 | |
| 8 | #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" |
| 9 | |
imcheng | 12fcff4 | 2015-06-04 18:37:12 | [diff] [blame] | 10 | namespace media_router { |
| 11 | class MediaRouterDialogController; |
| 12 | } // namespace media_router |
| 13 | |
apacible | 86792f6 | 2015-04-19 03:40:00 | [diff] [blame] | 14 | // The class for the Media Router component action that will be shown in |
| 15 | // the toolbar. |
| 16 | class MediaRouterAction : public ToolbarActionViewController { |
| 17 | public: |
| 18 | MediaRouterAction(); |
| 19 | ~MediaRouterAction() override; |
| 20 | |
| 21 | // ToolbarActionViewController implementation. |
| 22 | const std::string& GetId() const override; |
| 23 | void SetDelegate(ToolbarActionViewDelegate* delegate) override; |
rdevlin.cronin | 3a57a7f | 2015-07-06 21:22:43 | [diff] [blame] | 24 | gfx::Image GetIcon(content::WebContents* web_contents, |
| 25 | const gfx::Size& size) override; |
apacible | 86792f6 | 2015-04-19 03:40:00 | [diff] [blame] | 26 | base::string16 GetActionName() const override; |
| 27 | base::string16 GetAccessibleName(content::WebContents* web_contents) |
| 28 | const override; |
| 29 | base::string16 GetTooltip(content::WebContents* web_contents) |
| 30 | const override; |
| 31 | bool IsEnabled(content::WebContents* web_contents) const override; |
| 32 | bool WantsToRun(content::WebContents* web_contents) const override; |
| 33 | bool HasPopup(content::WebContents* web_contents) const override; |
| 34 | void HidePopup() override; |
| 35 | gfx::NativeView GetPopupNativeView() override; |
| 36 | ui::MenuModel* GetContextMenu() override; |
apacible | 86792f6 | 2015-04-19 03:40:00 | [diff] [blame] | 37 | bool CanDrag() const override; |
| 38 | bool ExecuteAction(bool by_user) override; |
| 39 | void UpdateState() override; |
rdevlin.cronin | ac27cf3 | 2015-07-09 17:12:34 | [diff] [blame^] | 40 | bool DisabledClickOpensMenu() const override; |
apacible | 86792f6 | 2015-04-19 03:40:00 | [diff] [blame] | 41 | |
| 42 | private: |
imcheng | 12fcff4 | 2015-06-04 18:37:12 | [diff] [blame] | 43 | // Returns a reference to the MediaRouterDialogController associated with |
| 44 | // |delegate_|'s current WebContents. Guaranteed to be non-null. |
| 45 | // |delegate_| and its current WebContents must not be null. |
| 46 | media_router::MediaRouterDialogController* GetMediaRouterDialogController(); |
| 47 | |
apacible | 86792f6 | 2015-04-19 03:40:00 | [diff] [blame] | 48 | const std::string id_; |
| 49 | const base::string16 name_; |
| 50 | |
| 51 | // Cached icons. |
| 52 | gfx::Image media_router_idle_icon_; |
| 53 | |
| 54 | ToolbarActionViewDelegate* delegate_; |
| 55 | |
| 56 | DISALLOW_COPY_AND_ASSIGN(MediaRouterAction); |
| 57 | }; |
| 58 | |
| 59 | #endif // CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_ACTION_H_ |