Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5111)

Unified Diff: chrome/browser/ui/toolbar/media_router_action.h

Issue 2332693003: Show media router toolbar icon ephemerally for active local routes and issues (Closed)
Patch Set: Address Derek's comment Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..f5ea020cc26e414d4a6f151820fd833c2d30b8b9 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,22 @@ class MediaRouterAction : public ToolbarActionViewController,
int index,
int reason) override;
- void OnPopupHidden();
- void OnPopupShown();
+ // ToolbarActionsBarObserver:
+ void OnToolbarActionsBarAnimationEnded() override;
+
+ void OnDialogHidden();
+ void OnDialogShown();
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 +116,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 +132,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_;

Powered by Google App Engine
This is Rietveld 408576698