| 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/media_router_contextual_menu.h" | 8 #include "chrome/browser/ui/toolbar/media_router_contextual_menu.h" |
| 9 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" | 9 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" |
| 10 | 10 |
| 11 class Browser; | 11 class Browser; |
| 12 class MediaRouterActionPlatformDelegate; | 12 class MediaRouterActionPlatformDelegate; |
| 13 | 13 |
| 14 namespace media_router { | 14 namespace media_router { |
| 15 class MediaRouterDialogControllerImpl; | 15 class MediaRouterDialogController; |
| 16 } // namespace media_router | 16 } // namespace media_router |
| 17 | 17 |
| 18 // The class for the Media Router component action that will be shown in | 18 // The class for the Media Router component action that will be shown in |
| 19 // the toolbar. | 19 // the toolbar. |
| 20 class MediaRouterAction : public ToolbarActionViewController { | 20 class MediaRouterAction : public ToolbarActionViewController { |
| 21 public: | 21 public: |
| 22 explicit MediaRouterAction(Browser* browser); | 22 explicit MediaRouterAction(Browser* browser); |
| 23 ~MediaRouterAction() override; | 23 ~MediaRouterAction() override; |
| 24 | 24 |
| 25 // ToolbarActionViewController implementation. | 25 // ToolbarActionViewController implementation. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 40 ui::MenuModel* GetContextMenu() override; | 40 ui::MenuModel* GetContextMenu() override; |
| 41 bool CanDrag() const override; | 41 bool CanDrag() const override; |
| 42 bool ExecuteAction(bool by_user) override; | 42 bool ExecuteAction(bool by_user) override; |
| 43 void UpdateState() override; | 43 void UpdateState() override; |
| 44 bool DisabledClickOpensMenu() const override; | 44 bool DisabledClickOpensMenu() const override; |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 // Returns a reference to the MediaRouterDialogController associated with | 47 // Returns a reference to the MediaRouterDialogController associated with |
| 48 // |delegate_|'s current WebContents. Guaranteed to be non-null. | 48 // |delegate_|'s current WebContents. Guaranteed to be non-null. |
| 49 // |delegate_| and its current WebContents must not be null. | 49 // |delegate_| and its current WebContents must not be null. |
| 50 media_router::MediaRouterDialogControllerImpl* | 50 media_router::MediaRouterDialogController* GetMediaRouterDialogController(); |
| 51 GetMediaRouterDialogController(); | |
| 52 | 51 |
| 53 const std::string id_; | 52 const std::string id_; |
| 54 const base::string16 name_; | 53 const base::string16 name_; |
| 55 | 54 |
| 56 // Cached icons. | 55 // Cached icons. |
| 57 gfx::Image media_router_idle_icon_; | 56 gfx::Image media_router_idle_icon_; |
| 58 | 57 |
| 59 ToolbarActionViewDelegate* delegate_; | 58 ToolbarActionViewDelegate* delegate_; |
| 60 | 59 |
| 61 // The delegate to handle platform-specific implementations. | 60 // The delegate to handle platform-specific implementations. |
| 62 scoped_ptr<MediaRouterActionPlatformDelegate> platform_delegate_; | 61 scoped_ptr<MediaRouterActionPlatformDelegate> platform_delegate_; |
| 63 | 62 |
| 64 MediaRouterContextualMenu contextual_menu_; | 63 MediaRouterContextualMenu contextual_menu_; |
| 65 | 64 |
| 66 DISALLOW_COPY_AND_ASSIGN(MediaRouterAction); | 65 DISALLOW_COPY_AND_ASSIGN(MediaRouterAction); |
| 67 }; | 66 }; |
| 68 | 67 |
| 69 #endif // CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_ACTION_H_ | 68 #endif // CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_ACTION_H_ |
| OLD | NEW |