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