| 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 "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/scoped_observer.h" | 9 #include "base/scoped_observer.h" |
| 10 #include "chrome/browser/media/router/issues_observer.h" | 10 #include "chrome/browser/media/router/issues_observer.h" |
| 11 #include "chrome/browser/media/router/media_routes_observer.h" | 11 #include "chrome/browser/media/router/media_routes_observer.h" |
| 12 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 12 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
| 13 #include "chrome/browser/ui/toolbar/media_router_contextual_menu.h" | 13 #include "chrome/browser/ui/toolbar/media_router_contextual_menu.h" |
| 14 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" | 14 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" |
| 15 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" | 15 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" |
| 16 #include "ui/gfx/vector_icons_public.h" |
| 16 | 17 |
| 17 class Browser; | 18 class Browser; |
| 18 class MediaRouterActionPlatformDelegate; | 19 class MediaRouterActionPlatformDelegate; |
| 19 class TabStripModel; | 20 class TabStripModel; |
| 20 | 21 |
| 21 namespace media_router { | 22 namespace media_router { |
| 22 class MediaRouterDialogControllerImpl; | 23 class MediaRouterDialogControllerImpl; |
| 23 } // namespace media_router | 24 } // namespace media_router |
| 24 | 25 |
| 25 // The class for the Media Router component action that will be shown in | 26 // The class for the Media Router component action that will be shown in |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 virtual media_router::MediaRouterDialogControllerImpl* | 85 virtual media_router::MediaRouterDialogControllerImpl* |
| 85 GetMediaRouterDialogController(); | 86 GetMediaRouterDialogController(); |
| 86 | 87 |
| 87 // Overridden by tests. | 88 // Overridden by tests. |
| 88 virtual MediaRouterActionPlatformDelegate* GetPlatformDelegate(); | 89 virtual MediaRouterActionPlatformDelegate* GetPlatformDelegate(); |
| 89 | 90 |
| 90 // Checks if the current icon of MediaRouterAction has changed. If so, | 91 // Checks if the current icon of MediaRouterAction has changed. If so, |
| 91 // updates |current_icon_|. | 92 // updates |current_icon_|. |
| 92 void MaybeUpdateIcon(); | 93 void MaybeUpdateIcon(); |
| 93 | 94 |
| 94 const gfx::Image* GetCurrentIcon() const; | 95 gfx::VectorIconId GetCurrentIcon() const; |
| 95 | |
| 96 // Cached icons. | |
| 97 // Indicates that the current Chrome profile is using at least one device. | |
| 98 const gfx::Image media_router_active_icon_; | |
| 99 // Indicates a failure, e.g. session launch failure. | |
| 100 const gfx::Image media_router_error_icon_; | |
| 101 // Indicates that the current Chrome profile is not using any devices. | |
| 102 // Devices may or may not be available. | |
| 103 const gfx::Image media_router_idle_icon_; | |
| 104 // Indicates there is a warning message. | |
| 105 const gfx::Image media_router_warning_icon_; | |
| 106 | 96 |
| 107 // The current icon to show. This is updated based on the current issues and | 97 // The current icon to show. This is updated based on the current issues and |
| 108 // routes since |this| is an IssueObserver and MediaRoutesObserver. | 98 // routes since |this| is an IssueObserver and MediaRoutesObserver. |
| 109 const gfx::Image* current_icon_; | 99 gfx::VectorIconId current_icon_; |
| 110 | 100 |
| 111 // The current issue shown in the Media Router WebUI. Can be null. It is set | 101 // The current issue shown in the Media Router WebUI. Can be null. It is set |
| 112 // in OnIssueUpdated(), which is called by the IssueManager. | 102 // in OnIssueUpdated(), which is called by the IssueManager. |
| 113 std::unique_ptr<media_router::Issue> issue_; | 103 std::unique_ptr<media_router::Issue> issue_; |
| 114 | 104 |
| 115 // Whether a local displayable active route exists. | 105 // Whether a local displayable active route exists. |
| 116 bool has_local_display_route_; | 106 bool has_local_display_route_; |
| 117 | 107 |
| 118 ToolbarActionViewDelegate* delegate_; | 108 ToolbarActionViewDelegate* delegate_; |
| 119 | 109 |
| 120 Browser* const browser_; | 110 Browser* const browser_; |
| 121 ToolbarActionsBar* const toolbar_actions_bar_; | 111 ToolbarActionsBar* const toolbar_actions_bar_; |
| 122 | 112 |
| 123 // The delegate to handle platform-specific implementations. | 113 // The delegate to handle platform-specific implementations. |
| 124 std::unique_ptr<MediaRouterActionPlatformDelegate> platform_delegate_; | 114 std::unique_ptr<MediaRouterActionPlatformDelegate> platform_delegate_; |
| 125 | 115 |
| 126 MediaRouterContextualMenu contextual_menu_; | 116 MediaRouterContextualMenu contextual_menu_; |
| 127 | 117 |
| 128 ScopedObserver<TabStripModel, TabStripModelObserver> | 118 ScopedObserver<TabStripModel, TabStripModelObserver> |
| 129 tab_strip_model_observer_; | 119 tab_strip_model_observer_; |
| 130 | 120 |
| 131 base::WeakPtrFactory<MediaRouterAction> weak_ptr_factory_; | 121 base::WeakPtrFactory<MediaRouterAction> weak_ptr_factory_; |
| 132 | 122 |
| 133 DISALLOW_COPY_AND_ASSIGN(MediaRouterAction); | 123 DISALLOW_COPY_AND_ASSIGN(MediaRouterAction); |
| 134 }; | 124 }; |
| 135 | 125 |
| 136 #endif // CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_ACTION_H_ | 126 #endif // CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_ACTION_H_ |
| OLD | NEW |