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

Side by Side Diff: chrome/browser/renderer_context_menu/render_view_context_menu.cc

Issue 2214323003: Revert of Disable Print in the context menu when a modal dialog is shown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/renderer_context_menu/render_view_context_menu.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" 5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 1576
1577 case IDC_CONTENT_CONTEXT_SELECTALL: 1577 case IDC_CONTENT_CONTEXT_SELECTALL:
1578 return !!(params_.edit_flags & WebContextMenuData::CanSelectAll); 1578 return !!(params_.edit_flags & WebContextMenuData::CanSelectAll);
1579 1579
1580 case IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD: 1580 case IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD:
1581 return !browser_context_->IsOffTheRecord() && 1581 return !browser_context_->IsOffTheRecord() &&
1582 params_.link_url.is_valid() && 1582 params_.link_url.is_valid() &&
1583 incognito_avail != IncognitoModePrefs::DISABLED; 1583 incognito_avail != IncognitoModePrefs::DISABLED;
1584 1584
1585 case IDC_PRINT: 1585 case IDC_PRINT:
1586 return IsPrintPreviewEnabled(); 1586 return prefs->GetBoolean(prefs::kPrintingEnabled) &&
1587 (params_.media_type == WebContextMenuData::MediaTypeNone ||
1588 params_.media_flags & WebContextMenuData::MediaCanPrint);
1587 1589
1588 case IDC_CONTENT_CONTEXT_SEARCHWEBFOR: 1590 case IDC_CONTENT_CONTEXT_SEARCHWEBFOR:
1589 case IDC_CONTENT_CONTEXT_GOTOURL: 1591 case IDC_CONTENT_CONTEXT_GOTOURL:
1590 case IDC_SPELLPANEL_TOGGLE: 1592 case IDC_SPELLPANEL_TOGGLE:
1591 case IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS: 1593 case IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS:
1592 return true; 1594 return true;
1593 case IDC_CHECK_SPELLING_WHILE_TYPING: 1595 case IDC_CHECK_SPELLING_WHILE_TYPING:
1594 return prefs->GetBoolean(prefs::kEnableContinuousSpellcheck); 1596 return prefs->GetBoolean(prefs::kEnableContinuousSpellcheck);
1595 1597
1596 #if !defined(OS_MACOSX) && defined(OS_POSIX) 1598 #if !defined(OS_MACOSX) && defined(OS_POSIX)
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
2073 2075
2074 bool RenderViewContextMenu::IsPasteAndMatchStyleEnabled() const { 2076 bool RenderViewContextMenu::IsPasteAndMatchStyleEnabled() const {
2075 if (!(params_.edit_flags & WebContextMenuData::CanPaste)) 2077 if (!(params_.edit_flags & WebContextMenuData::CanPaste))
2076 return false; 2078 return false;
2077 2079
2078 return ui::Clipboard::GetForCurrentThread()->IsFormatAvailable( 2080 return ui::Clipboard::GetForCurrentThread()->IsFormatAvailable(
2079 ui::Clipboard::GetPlainTextFormatType(), 2081 ui::Clipboard::GetPlainTextFormatType(),
2080 ui::CLIPBOARD_TYPE_COPY_PASTE); 2082 ui::CLIPBOARD_TYPE_COPY_PASTE);
2081 } 2083 }
2082 2084
2083 bool RenderViewContextMenu::IsPrintPreviewEnabled() const {
2084 if (params_.media_type != WebContextMenuData::MediaTypeNone &&
2085 !(params_.media_flags & WebContextMenuData::MediaCanPrint)) {
2086 return false;
2087 }
2088
2089 // |browser| is a nullptr if a modal dialog is open.
2090 Browser* browser = chrome::FindBrowserWithWebContents(source_web_contents_);
2091 return browser && chrome::CanPrint(browser);
2092 }
2093
2094 bool RenderViewContextMenu::IsRouteMediaEnabled() const { 2085 bool RenderViewContextMenu::IsRouteMediaEnabled() const {
2095 if (!media_router::MediaRouterEnabled(browser_context_)) 2086 if (!media_router::MediaRouterEnabled(browser_context_))
2096 return false; 2087 return false;
2097 2088
2098 Browser* browser = chrome::FindBrowserWithWebContents(source_web_contents_); 2089 Browser* browser = chrome::FindBrowserWithWebContents(source_web_contents_);
2099 if (!browser) 2090 if (!browser)
2100 return false; 2091 return false;
2101 2092
2102 // Disable the command if there is an active modal dialog. 2093 // Disable the command if there is an active modal dialog.
2103 // We don't use |source_web_contents_| here because it could be the 2094 // We don't use |source_web_contents_| here because it could be the
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
2447 source_web_contents_->GetRenderViewHost()-> 2438 source_web_contents_->GetRenderViewHost()->
2448 ExecuteMediaPlayerActionAtLocation(location, action); 2439 ExecuteMediaPlayerActionAtLocation(location, action);
2449 } 2440 }
2450 2441
2451 void RenderViewContextMenu::PluginActionAt( 2442 void RenderViewContextMenu::PluginActionAt(
2452 const gfx::Point& location, 2443 const gfx::Point& location,
2453 const WebPluginAction& action) { 2444 const WebPluginAction& action) {
2454 source_web_contents_->GetRenderViewHost()-> 2445 source_web_contents_->GetRenderViewHost()->
2455 ExecutePluginActionAtLocation(location, action); 2446 ExecutePluginActionAtLocation(location, action);
2456 } 2447 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_context_menu/render_view_context_menu.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698