| 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/local_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 | 16 |
| 17 class Browser; | 17 class Browser; |
| 18 class MediaRouterActionPlatformDelegate; | 18 class MediaRouterActionPlatformDelegate; |
| 19 class TabStripModel; | 19 class TabStripModel; |
| 20 | 20 |
| 21 namespace media_router { | 21 namespace media_router { |
| 22 class MediaRouterDialogControllerImpl; | 22 class MediaRouterDialogControllerImpl; |
| 23 } // namespace media_router | 23 } // namespace media_router |
| 24 | 24 |
| 25 // The class for the Media Router component action that will be shown in | 25 // The class for the Media Router component action that will be shown in |
| 26 // the toolbar. | 26 // the toolbar. |
| 27 class MediaRouterAction : public ToolbarActionViewController, | 27 class MediaRouterAction : public ToolbarActionViewController, |
| 28 public media_router::IssuesObserver, | 28 public media_router::IssuesObserver, |
| 29 public media_router::LocalMediaRoutesObserver, | 29 public media_router::MediaRoutesObserver, |
| 30 public TabStripModelObserver { | 30 public TabStripModelObserver { |
| 31 public: | 31 public: |
| 32 MediaRouterAction(Browser* browser, ToolbarActionsBar* toolbar_actions_bar); | 32 MediaRouterAction(Browser* browser, ToolbarActionsBar* toolbar_actions_bar); |
| 33 ~MediaRouterAction() override; | 33 ~MediaRouterAction() override; |
| 34 | 34 |
| 35 // ToolbarActionViewController implementation. | 35 // ToolbarActionViewController implementation. |
| 36 std::string GetId() const override; | 36 std::string GetId() const override; |
| 37 void SetDelegate(ToolbarActionViewDelegate* delegate) override; | 37 void SetDelegate(ToolbarActionViewDelegate* delegate) override; |
| 38 gfx::Image GetIcon(content::WebContents* web_contents, | 38 gfx::Image GetIcon(content::WebContents* web_contents, |
| 39 const gfx::Size& size) override; | 39 const gfx::Size& size) override; |
| 40 base::string16 GetActionName() const override; | 40 base::string16 GetActionName() const override; |
| 41 base::string16 GetAccessibleName(content::WebContents* web_contents) | 41 base::string16 GetAccessibleName(content::WebContents* web_contents) |
| 42 const override; | 42 const override; |
| 43 base::string16 GetTooltip(content::WebContents* web_contents) | 43 base::string16 GetTooltip(content::WebContents* web_contents) |
| 44 const override; | 44 const override; |
| 45 bool IsEnabled(content::WebContents* web_contents) const override; | 45 bool IsEnabled(content::WebContents* web_contents) const override; |
| 46 bool WantsToRun(content::WebContents* web_contents) const override; | 46 bool WantsToRun(content::WebContents* web_contents) const override; |
| 47 bool HasPopup(content::WebContents* web_contents) const override; | 47 bool HasPopup(content::WebContents* web_contents) const override; |
| 48 void HidePopup() override; | 48 void HidePopup() override; |
| 49 gfx::NativeView GetPopupNativeView() override; | 49 gfx::NativeView GetPopupNativeView() override; |
| 50 ui::MenuModel* GetContextMenu() override; | 50 ui::MenuModel* GetContextMenu() override; |
| 51 bool ExecuteAction(bool by_user) override; | 51 bool ExecuteAction(bool by_user) override; |
| 52 void UpdateState() override; | 52 void UpdateState() override; |
| 53 bool DisabledClickOpensMenu() const override; | 53 bool DisabledClickOpensMenu() const override; |
| 54 | 54 |
| 55 // media_router::IssuesObserver: | 55 // media_router::IssuesObserver: |
| 56 void OnIssueUpdated(const media_router::Issue* issue) override; | 56 void OnIssueUpdated(const media_router::Issue* issue) override; |
| 57 | 57 |
| 58 // media_router::LocalMediaRoutesObserver: | 58 // media_router::MediaRoutesObserver: |
| 59 void OnHasLocalDisplayRouteUpdated(bool has_local_display_route) override; | 59 void OnRoutesUpdated(const std::vector<media_router::MediaRoute>& routes, |
| 60 const std::vector<media_router::MediaRoute::Id>& |
| 61 joinable_route_ids) override; |
| 60 | 62 |
| 61 // ToolbarStripModelObserver: | 63 // ToolbarStripModelObserver: |
| 62 void ActiveTabChanged(content::WebContents* old_contents, | 64 void ActiveTabChanged(content::WebContents* old_contents, |
| 63 content::WebContents* new_contents, | 65 content::WebContents* new_contents, |
| 64 int index, | 66 int index, |
| 65 int reason) override; | 67 int reason) override; |
| 66 | 68 |
| 67 void OnPopupHidden(); | 69 void OnPopupHidden(); |
| 68 void OnPopupShown(); | 70 void OnPopupShown(); |
| 69 | 71 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 127 |
| 126 ScopedObserver<TabStripModel, TabStripModelObserver> | 128 ScopedObserver<TabStripModel, TabStripModelObserver> |
| 127 tab_strip_model_observer_; | 129 tab_strip_model_observer_; |
| 128 | 130 |
| 129 base::WeakPtrFactory<MediaRouterAction> weak_ptr_factory_; | 131 base::WeakPtrFactory<MediaRouterAction> weak_ptr_factory_; |
| 130 | 132 |
| 131 DISALLOW_COPY_AND_ASSIGN(MediaRouterAction); | 133 DISALLOW_COPY_AND_ASSIGN(MediaRouterAction); |
| 132 }; | 134 }; |
| 133 | 135 |
| 134 #endif // CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_ACTION_H_ | 136 #endif // CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_ACTION_H_ |
| OLD | NEW |