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/media/router/issues_observer.h" | 8 #include "chrome/browser/media/router/issues_observer.h" |
9 #include "chrome/browser/media/router/media_routes_observer.h" | 9 #include "chrome/browser/media/router/media_routes_observer.h" |
10 #include "chrome/browser/ui/toolbar/media_router_contextual_menu.h" | 10 #include "chrome/browser/ui/toolbar/media_router_contextual_menu.h" |
11 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" | 11 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" |
12 | 12 |
13 class Browser; | 13 class Browser; |
14 class MediaRouterActionPlatformDelegate; | 14 class MediaRouterActionPlatformDelegate; |
15 | 15 |
16 namespace media_router { | 16 namespace media_router { |
17 class MediaRouterDialogController; | 17 class MediaRouterDialogController; |
18 } // namespace media_router | 18 } // namespace media_router |
19 | 19 |
20 // The class for the Media Router component action that will be shown in | 20 // The class for the Media Router component action that will be shown in |
21 // the toolbar. | 21 // the toolbar. |
22 class MediaRouterAction : public ToolbarActionViewController, | 22 class MediaRouterAction : public ToolbarActionViewController, |
23 public media_router::IssuesObserver, | 23 public media_router::IssuesObserver, |
24 public media_router::MediaRoutesObserver { | 24 public media_router::MediaRoutesObserver { |
25 public: | 25 public: |
26 explicit MediaRouterAction(Browser* browser); | 26 explicit MediaRouterAction(Browser* browser); |
27 ~MediaRouterAction() override; | 27 ~MediaRouterAction() override; |
28 | 28 |
29 // ToolbarActionViewController implementation. | 29 // ToolbarActionViewController implementation. |
30 const std::string& GetId() const override; | 30 std::string GetId() const override; |
31 void SetDelegate(ToolbarActionViewDelegate* delegate) override; | 31 void SetDelegate(ToolbarActionViewDelegate* delegate) override; |
32 gfx::Image GetIcon(content::WebContents* web_contents, | 32 gfx::Image GetIcon(content::WebContents* web_contents, |
33 const gfx::Size& size) override; | 33 const gfx::Size& size) override; |
34 base::string16 GetActionName() const override; | 34 base::string16 GetActionName() const override; |
35 base::string16 GetAccessibleName(content::WebContents* web_contents) | 35 base::string16 GetAccessibleName(content::WebContents* web_contents) |
36 const override; | 36 const override; |
37 base::string16 GetTooltip(content::WebContents* web_contents) | 37 base::string16 GetTooltip(content::WebContents* web_contents) |
38 const override; | 38 const override; |
39 bool IsEnabled(content::WebContents* web_contents) const override; | 39 bool IsEnabled(content::WebContents* web_contents) const override; |
40 bool WantsToRun(content::WebContents* web_contents) const override; | 40 bool WantsToRun(content::WebContents* web_contents) const override; |
(...skipping 21 matching lines...) Expand all Loading... |
62 | 62 |
63 // Overridden by tests. | 63 // Overridden by tests. |
64 virtual media_router::MediaRouter* GetMediaRouter(Browser* browser); | 64 virtual media_router::MediaRouter* GetMediaRouter(Browser* browser); |
65 | 65 |
66 // Checks if the current icon of MediaRouterAction has changed. If so, | 66 // Checks if the current icon of MediaRouterAction has changed. If so, |
67 // updates |current_icon_|. | 67 // updates |current_icon_|. |
68 void MaybeUpdateIcon(); | 68 void MaybeUpdateIcon(); |
69 | 69 |
70 const gfx::Image* GetCurrentIcon() const; | 70 const gfx::Image* GetCurrentIcon() const; |
71 | 71 |
72 const std::string id_; | |
73 | |
74 // Cached icons. | 72 // Cached icons. |
75 // Indicates that the current Chrome profile is using at least one device. | 73 // Indicates that the current Chrome profile is using at least one device. |
76 const gfx::Image media_router_active_icon_; | 74 const gfx::Image media_router_active_icon_; |
77 // Indicates a failure, e.g. session launch failure. | 75 // Indicates a failure, e.g. session launch failure. |
78 const gfx::Image media_router_error_icon_; | 76 const gfx::Image media_router_error_icon_; |
79 // Indicates that the current Chrome profile is not using any devices. | 77 // Indicates that the current Chrome profile is not using any devices. |
80 // Devices may or may not be available. | 78 // Devices may or may not be available. |
81 const gfx::Image media_router_idle_icon_; | 79 const gfx::Image media_router_idle_icon_; |
82 // Indicates there is a warning message. | 80 // Indicates there is a warning message. |
83 const gfx::Image media_router_warning_icon_; | 81 const gfx::Image media_router_warning_icon_; |
(...skipping 13 matching lines...) Expand all Loading... |
97 | 95 |
98 // The delegate to handle platform-specific implementations. | 96 // The delegate to handle platform-specific implementations. |
99 scoped_ptr<MediaRouterActionPlatformDelegate> platform_delegate_; | 97 scoped_ptr<MediaRouterActionPlatformDelegate> platform_delegate_; |
100 | 98 |
101 MediaRouterContextualMenu contextual_menu_; | 99 MediaRouterContextualMenu contextual_menu_; |
102 | 100 |
103 DISALLOW_COPY_AND_ASSIGN(MediaRouterAction); | 101 DISALLOW_COPY_AND_ASSIGN(MediaRouterAction); |
104 }; | 102 }; |
105 | 103 |
106 #endif // CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_ACTION_H_ | 104 #endif // CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_ACTION_H_ |
OLD | NEW |