Chromium Code Reviews| Index: chrome/browser/ui/toolbar/media_router_action.h |
| diff --git a/chrome/browser/ui/toolbar/media_router_action.h b/chrome/browser/ui/toolbar/media_router_action.h |
| index ace06a32f18e0cdfe7f86ea861e907c9cdadf917..96d4ebae85bae6fba1302e86b1eed3c69cbef7ce 100644 |
| --- a/chrome/browser/ui/toolbar/media_router_action.h |
| +++ b/chrome/browser/ui/toolbar/media_router_action.h |
| @@ -5,6 +5,9 @@ |
| #ifndef CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_ACTION_H_ |
| #define CHROME_BROWSER_UI_TOOLBAR_MEDIA_ROUTER_ACTION_H_ |
| +#include <memory> |
| +#include <string> |
| + |
| #include "base/macros.h" |
| #include "base/scoped_observer.h" |
| #include "chrome/browser/media/router/issues_observer.h" |
| @@ -13,6 +16,7 @@ |
| #include "chrome/browser/ui/toolbar/media_router_contextual_menu.h" |
| #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" |
| #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" |
| +#include "chrome/browser/ui/toolbar/toolbar_actions_bar_observer.h" |
| #include "ui/gfx/vector_icons_public.h" |
| class Browser; |
| @@ -28,7 +32,8 @@ class MediaRouterDialogControllerImpl; |
| class MediaRouterAction : public ToolbarActionViewController, |
| public media_router::IssuesObserver, |
| public media_router::MediaRoutesObserver, |
| - public TabStripModelObserver { |
| + public TabStripModelObserver, |
| + public ToolbarActionsBarObserver { |
| public: |
| MediaRouterAction(Browser* browser, ToolbarActionsBar* toolbar_actions_bar); |
| ~MediaRouterAction() override; |
| @@ -67,16 +72,30 @@ class MediaRouterAction : public ToolbarActionViewController, |
| int index, |
| int reason) override; |
| - void OnPopupHidden(); |
| - void OnPopupShown(); |
| + // ToolbarActionsBarObserver: |
| + void OnToolbarActionsBarAnimationEnded() override; |
| + |
| + void OnDialogHidden(); |
| + void OnDialogShown(); |
| + |
| + // Gets or sets the "Always show icon" option. |
| + bool GetAlwaysShowActionPref() const; |
| + void SetAlwaysShowActionPref(bool always_show); |
|
Devlin
2016/09/15 21:19:17
Is this used?
takumif
2016/09/16 21:19:22
Yes, by the ContextualMenu.
|
| + |
| + protected: |
| + // For accessing from tests. |
| + base::WeakPtr<MediaRouterAction> GetWeakPtr(); |
| private: |
| - // Called when a new browser window is opened, the user switches tabs in the |
| - // browser window, or when |delegate_| is swapped out to be non-null and has |
| - // a valid WebContents. |
| + // Registers |this| with the MediaRouterDialogControllerImpl associated with |
| + // |delegate_|'s current WebContents if |this| is not shown in overflow mode. |
| + void RegisterWithDialogController(); |
| + |
| + // Called when a new browser window is opened or when |delegate_| is swapped |
| + // out to be non-null and has a valid WebContents. |
| // This updates the pressed/unpressed state of the icon, which is different |
| // on a per-tab basis. |
| - void UpdatePopupState(); |
| + void UpdateDialogState(); |
| // Returns a reference to the MediaRouterDialogControllerImpl associated with |
| // |delegate_|'s current WebContents. Guaranteed to be non-null. |
| @@ -105,6 +124,10 @@ class MediaRouterAction : public ToolbarActionViewController, |
| // Whether a local displayable active route exists. |
| bool has_local_display_route_; |
| + // Whether the Media Router dialog is shown in the current tab. |
| + // This should only be updated in OnDialogShown() and OnDialogHidden(). |
| + bool has_dialog_; |
| + |
| ToolbarActionViewDelegate* delegate_; |
| Browser* const browser_; |
| @@ -117,6 +140,8 @@ class MediaRouterAction : public ToolbarActionViewController, |
| ScopedObserver<TabStripModel, TabStripModelObserver> |
| tab_strip_model_observer_; |
| + ScopedObserver<ToolbarActionsBar, ToolbarActionsBarObserver> |
| + toolbar_actions_bar_observer_; |
| base::WeakPtrFactory<MediaRouterAction> weak_ptr_factory_; |