Chromium Code Reviews| Index: chrome/browser/renderer_context_menu/render_view_context_menu.cc |
| diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc |
| index 753cd8a1a231a465ef133e9a3c782c5c0c9986cc..c66ba8997fbe9a11eb1fdf90f7e8112d7b03deb9 100644 |
| --- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc |
| +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc |
| @@ -123,6 +123,10 @@ |
| #endif // defined(ENABLE_PRINT_PREVIEW) |
| #endif // defined(ENABLE_PRINTING) |
| +#if defined(ENABLE_MEDIA_ROUTER) |
| +#include "chrome/browser/media/router/media_router_feature.h" |
| +#endif // defined(ENABLE_MEDIA_ROUTER) |
| + |
| using base::UserMetricsAction; |
| using blink::WebContextMenuData; |
| using blink::WebMediaPlayerAction; |
| @@ -954,9 +958,13 @@ void RenderViewContextMenu::AppendPrintItem() { |
| } |
| void RenderViewContextMenu::AppendMediaRouterItem() { |
| - if (switches::MediaRouterEnabled() && !browser_context_->IsOffTheRecord()) |
| +#if defined(ENABLE_MEDIA_ROUTER) |
| + if (media_router::MediaRouterEnabled() && |
| + !browser_context_->IsOffTheRecord()) { |
| menu_model_.AddItemWithStringId(IDC_ROUTE_MEDIA, |
| IDS_MEDIA_ROUTER_MENU_ITEM_TITLE); |
| + } |
| +#endif // defined(ENABLE_MEDIA_ROUTER) |
| } |
| void RenderViewContextMenu::AppendRotationItems() { |
| @@ -1415,7 +1423,8 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const { |
| return true; |
| case IDC_ROUTE_MEDIA: { |
| - DCHECK(switches::MediaRouterEnabled()); |
| +#if defined(ENABLE_MEDIA_ROUTER) |
| + DCHECK(media_router::MediaRouterEnabled()); |
| // Disable the command if there is an active modal dialog. |
| Browser* browser = |
| @@ -1432,6 +1441,9 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const { |
| web_modal::WebContentsModalDialogManager::FromWebContents( |
| web_contents); |
| return !manager || !manager->IsDialogActive(); |
| +#else |
| + return false; |
|
msw
2015/10/23 20:18:42
nit: add NOTREACHED(); in this block?
imcheng
2015/10/23 21:39:26
Done.
|
| +#endif // defined(ENABLE_MEDIA_ROUTER) |
| } |
| default: |
| @@ -1713,7 +1725,8 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) { |
| } |
| case IDC_ROUTE_MEDIA: { |
| - DCHECK(switches::MediaRouterEnabled()); |
| +#if defined(ENABLE_MEDIA_ROUTER) |
| + DCHECK(media_router::MediaRouterEnabled()); |
| Browser* browser = |
| chrome::FindBrowserWithWebContents(source_web_contents_); |
| @@ -1727,6 +1740,7 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) { |
| return; |
| dialog_controller->ShowMediaRouterDialog(); |
| +#endif // defined(ENABLE_MEDIA_ROUTER) |
|
msw
2015/10/23 20:18:43
nit: add an else block with NOTREACHED();?
imcheng
2015/10/23 21:39:26
Done.
|
| break; |
| } |