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

Unified Diff: chrome/browser/ui/webui/media_router/media_router_dialog_controller_impl.h

Issue 2155293002: Show the Cast toolbar icon ephemerally when Cast is in use (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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/webui/media_router/media_router_dialog_controller_impl.h
diff --git a/chrome/browser/ui/webui/media_router/media_router_dialog_controller_impl.h b/chrome/browser/ui/webui/media_router/media_router_dialog_controller_impl.h
index 809bee83c5a88bc9d6b9ce71d5ba456bb5e1cf01..80535bd362f67a8ec1f20fe1c23a50112441202a 100644
--- a/chrome/browser/ui/webui/media_router/media_router_dialog_controller_impl.h
+++ b/chrome/browser/ui/webui/media_router/media_router_dialog_controller_impl.h
@@ -8,7 +8,9 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
+#include "base/scoped_observer.h"
#include "chrome/browser/media/router/media_router_dialog_controller.h"
+#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
@@ -22,7 +24,8 @@ namespace media_router {
// This class is not thread safe and must be called on the UI thread.
class MediaRouterDialogControllerImpl :
public content::WebContentsUserData<MediaRouterDialogControllerImpl>,
- public MediaRouterDialogController {
+ public MediaRouterDialogController,
+ public TabStripModelObserver {
public:
~MediaRouterDialogControllerImpl() override;
@@ -41,6 +44,18 @@ class MediaRouterDialogControllerImpl :
void UpdateMaxDialogSize();
+ bool ShowMediaRouterDialog() override;
msw 2016/07/26 19:59:32 nit: order immediately before IsShowingMediaRouter
takumif 2016/07/28 20:04:12 Done.
+
+ // ToolbarStripModelObserver:
+ void ActiveTabChanged(content::WebContents* old_contents,
msw 2016/07/26 19:59:32 optional nit: order immediately after MediaRouterD
takumif 2016/07/28 20:04:12 Done.
+ content::WebContents* new_contents,
+ int index,
+ int reason) override;
+
+ void OnDialogClosed();
+
+ MediaRouterAction* action_for_test() { return action_.get(); }
+
private:
class DialogWebContentsObserver;
friend class content::WebContentsUserData<MediaRouterDialogControllerImpl>;
@@ -60,12 +75,17 @@ class MediaRouterDialogControllerImpl :
void PopulateDialog(content::WebContents* media_router_dialog);
+ void ShowMediaRouterAction();
+
std::unique_ptr<DialogWebContentsObserver> dialog_observer_;
// True if the controller is waiting for a new media router dialog to be
// created.
bool media_router_dialog_pending_;
+ ScopedObserver<TabStripModel, TabStripModelObserver>
+ tab_strip_model_observer_;
+
// |action_| refers to the MediaRouterAction on the toolbar, rather than
// overflow menu. A MediaRouterAction is always created for the toolbar
// first. Any subsequent creations for the overflow menu will not be set as

Powered by Google App Engine
This is Rietveld 408576698