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

Unified Diff: chrome/browser/ui/browser_commands.cc

Issue 1360323002: Add "Cast..." to overflow and contextual menus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 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
« no previous file with comments | « chrome/browser/ui/browser_commands.h ('k') | chrome/browser/ui/toolbar/wrench_menu_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_commands.cc
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
index cb8a4dc1a3bbd9776bbd3d171e4b6b0c7c39b657..f90be0c36d83ff4b07d2ef7409b1d3db46bd440f 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/devtools/devtools_window.h"
#include "chrome/browser/dom_distiller/tab_utils.h"
#include "chrome/browser/lifetime/application_lifetime.h"
+#include "chrome/browser/media/router/media_router_dialog_controller.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/profiles/profile.h"
@@ -911,6 +912,27 @@ bool CanBasicPrint(Browser* browser) {
}
#endif // ENABLE_BASIC_PRINTING
+bool CanRouteMedia(Browser* browser) {
+ if (!switches::MediaRouterEnabled() || browser->profile()->IsOffTheRecord())
+ return false;
+
+ // Do not allow user to open Media Router dialog when there is already an
+ // active modal dialog. This avoids overlapping dialogs.
+ return !IsShowingWebContentsModalDialog(browser);
+}
+
+void RouteMedia(Browser* browser) {
+ DCHECK(CanRouteMedia(browser));
+
+ media_router::MediaRouterDialogController* dialog_controller =
+ media_router::MediaRouterDialogController::GetOrCreateForWebContents(
+ browser->tab_strip_model()->GetActiveWebContents());
+ if (!dialog_controller)
+ return;
+
+ dialog_controller->ShowMediaRouterDialog();
+}
+
void EmailPageLocation(Browser* browser) {
content::RecordAction(UserMetricsAction("EmailPageLocation"));
WebContents* wc = browser->tab_strip_model()->GetActiveWebContents();
« no previous file with comments | « chrome/browser/ui/browser_commands.h ('k') | chrome/browser/ui/toolbar/wrench_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698