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

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

Issue 1495653003: [Media Router] Check MediaRouterDialogControllerImpl only sets toolbar MediaRouterAction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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.cc
diff --git a/chrome/browser/ui/toolbar/media_router_action.cc b/chrome/browser/ui/toolbar/media_router_action.cc
index e397c6e95d786ffef427d45df563935610218389..3f1bfa149e91763b3fc525e59ec21bd0d57ee54b 100644
--- a/chrome/browser/ui/toolbar/media_router_action.cc
+++ b/chrome/browser/ui/toolbar/media_router_action.cc
@@ -36,7 +36,8 @@ media_router::MediaRouter* GetMediaRouter(Browser* browser) {
} // namespace
-MediaRouterAction::MediaRouterAction(Browser* browser)
+MediaRouterAction::MediaRouterAction(Browser* browser,
+ ToolbarActionsBar* toolbar_actions_bar)
: media_router::IssuesObserver(GetMediaRouter(browser)),
media_router::LocalMediaRoutesObserver(GetMediaRouter(browser)),
media_router_active_icon_(
@@ -53,11 +54,13 @@ MediaRouterAction::MediaRouterAction(Browser* browser)
has_local_display_route_(false),
delegate_(nullptr),
browser_(browser),
+ toolbar_actions_bar_(toolbar_actions_bar),
platform_delegate_(MediaRouterActionPlatformDelegate::Create(browser)),
contextual_menu_(browser),
tab_strip_model_observer_(this),
weak_ptr_factory_(this) {
DCHECK(browser_);
+ DCHECK(toolbar_actions_bar_);
tab_strip_model_observer_.Add(browser_->tab_strip_model());
RegisterObserver();
@@ -192,9 +195,10 @@ void MediaRouterAction::UpdatePopupState() {
if (!controller)
return;
- // Immediately keep track of MediaRouterAction in the controller. If it was
- // already set, this should be a no-op.
- controller->SetMediaRouterAction(weak_ptr_factory_.GetWeakPtr());
+ // Only call SetMediaRouterAction() if |this| lives on the toolbar rather
+ // than the overflow menu. If it was already set, this should be a no-op.
Peter Kasting 2015/12/03 04:48:53 This first sentence restates what the code does.
apacible 2015/12/03 21:53:10 Done.
+ if (!toolbar_actions_bar_->in_overflow_mode())
+ controller->SetMediaRouterAction(weak_ptr_factory_.GetWeakPtr());
// Update the button in case the pressed state is out of sync with dialog
// visibility.

Powered by Google App Engine
This is Rietveld 408576698