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

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

Issue 2410553002: Show Media Router toolbar icon ephemerally for MR dialogs (Closed)
Patch Set: Deleted the first patch set on accident, responded to Mark's comments inline below Created 4 years, 2 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_controller.h
diff --git a/chrome/browser/ui/toolbar/media_router_action_controller.h b/chrome/browser/ui/toolbar/media_router_action_controller.h
index 9965f6b3c2e04380e4c762a919d5934457aad0dd..938f8fd948bc01df93a1169e34db646808e4ce3c 100644
--- a/chrome/browser/ui/toolbar/media_router_action_controller.h
+++ b/chrome/browser/ui/toolbar/media_router_action_controller.h
@@ -15,6 +15,10 @@
using extensions::ComponentMigrationHelper;
+namespace media_router {
+class MockMediaRouterActionController;
+} // namespace media_router
+
// Controller for MediaRouterAction that determines when to show and hide the
// action icon on the toolbar. There should be one instance of this class per
// profile, and it should only be used on the UI thread.
@@ -32,9 +36,17 @@ class MediaRouterActionController : public media_router::IssuesObserver,
const std::vector<media_router::MediaRoute::Id>&
joinable_route_ids) override;
+ // Overridden in tests.
mark a. foltz 2016/10/17 18:57:40 While that's true, can you also document what thes
takumif 2016/10/27 23:06:38 Done.
+ virtual void OnDialogShown();
+ virtual void OnDialogHidden();
+
private:
friend class MediaRouterActionControllerUnitTest;
- FRIEND_TEST_ALL_PREFIXES(MediaRouterActionControllerUnitTest, EphemeralIcon);
+ friend class media_router::MockMediaRouterActionController;
+ FRIEND_TEST_ALL_PREFIXES(MediaRouterActionControllerUnitTest,
+ EphemeralIconForRoutesAndIssues);
+ FRIEND_TEST_ALL_PREFIXES(MediaRouterActionControllerUnitTest,
+ EphemeralIconForDialog);
// Constructor for injecting dependencies in tests.
mark a. foltz 2016/10/17 18:57:40 Would prefer making this public versus having to f
takumif 2016/10/27 23:06:38 Done.
MediaRouterActionController(
@@ -46,8 +58,8 @@ class MediaRouterActionController : public media_router::IssuesObserver,
// Adds or removes the Media Router action icon to/from
// |component_action_delegate_| if necessary, depending on whether or not
- // we have issues or local routes.
- void MaybeAddOrRemoveAction();
+ // we have issues, local routes or a dialog.
+ virtual void MaybeAddOrRemoveAction();
// Returns |true| if the Media Router action should be present on the toolbar
// or the overflow menu.
@@ -69,6 +81,9 @@ class MediaRouterActionController : public media_router::IssuesObserver,
bool has_issue_ = false;
bool has_local_display_route_ = false;
+ // The number of dialogs that are currently open.
+ size_t dialog_count_ = 0;
+
PrefChangeRegistrar pref_change_registrar_;
DISALLOW_COPY_AND_ASSIGN(MediaRouterActionController);

Powered by Google App Engine
This is Rietveld 408576698