OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
6 #include <set> | 6 #include <set> |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 9 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
10 | 10 |
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 return !!(params_.edit_flags & WebContextMenuData::CanDelete); | 1322 return !!(params_.edit_flags & WebContextMenuData::CanDelete); |
1323 | 1323 |
1324 case IDC_CONTENT_CONTEXT_SELECTALL: | 1324 case IDC_CONTENT_CONTEXT_SELECTALL: |
1325 return !!(params_.edit_flags & WebContextMenuData::CanSelectAll); | 1325 return !!(params_.edit_flags & WebContextMenuData::CanSelectAll); |
1326 | 1326 |
1327 case IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD: | 1327 case IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD: |
1328 return !profile_->IsOffTheRecord() && params_.link_url.is_valid() && | 1328 return !profile_->IsOffTheRecord() && params_.link_url.is_valid() && |
1329 incognito_avail != IncognitoModePrefs::DISABLED; | 1329 incognito_avail != IncognitoModePrefs::DISABLED; |
1330 | 1330 |
1331 case IDC_PRINT: | 1331 case IDC_PRINT: |
1332 if (g_browser_process->local_state() && | 1332 return profile_->GetPrefs()->GetBoolean(prefs::kPrintingEnabled) && |
1333 !g_browser_process->local_state()->GetBoolean( | 1333 (params_.media_type == WebContextMenuData::MediaTypeNone || |
1334 prefs::kPrintingEnabled)) { | 1334 params_.media_flags & WebContextMenuData::MediaCanPrint); |
1335 return false; | |
1336 } | |
1337 return params_.media_type == WebContextMenuData::MediaTypeNone || | |
1338 params_.media_flags & WebContextMenuData::MediaCanPrint; | |
1339 | 1335 |
1340 case IDC_CONTENT_CONTEXT_SEARCHWEBFOR: | 1336 case IDC_CONTENT_CONTEXT_SEARCHWEBFOR: |
1341 case IDC_CONTENT_CONTEXT_GOTOURL: | 1337 case IDC_CONTENT_CONTEXT_GOTOURL: |
1342 case IDC_SPELLPANEL_TOGGLE: | 1338 case IDC_SPELLPANEL_TOGGLE: |
1343 case IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS: | 1339 case IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS: |
1344 case IDC_CONTENT_CONTEXT_VIEWFRAMEINFO: | 1340 case IDC_CONTENT_CONTEXT_VIEWFRAMEINFO: |
1345 return true; | 1341 return true; |
1346 | 1342 |
1347 case IDC_CHECK_SPELLING_WHILE_TYPING: | 1343 case IDC_CHECK_SPELLING_WHILE_TYPING: |
1348 return profile_->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck); | 1344 return profile_->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck); |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1687 // context of an external context menu. | 1683 // context of an external context menu. |
1688 source_web_contents_->GetController().Reload(!external_); | 1684 source_web_contents_->GetController().Reload(!external_); |
1689 break; | 1685 break; |
1690 | 1686 |
1691 case IDC_PRINT: | 1687 case IDC_PRINT: |
1692 if (params_.media_type == WebContextMenuData::MediaTypeNone) { | 1688 if (params_.media_type == WebContextMenuData::MediaTypeNone) { |
1693 TabContents* tab_contents = | 1689 TabContents* tab_contents = |
1694 TabContents::FromWebContents(source_web_contents_); | 1690 TabContents::FromWebContents(source_web_contents_); |
1695 if (!tab_contents) | 1691 if (!tab_contents) |
1696 break; | 1692 break; |
1697 if (g_browser_process->local_state()->GetBoolean( | 1693 if (profile_->GetPrefs()->GetBoolean(prefs::kPrintPreviewDisabled)) { |
1698 prefs::kPrintPreviewDisabled)) { | |
1699 tab_contents->print_view_manager()->PrintNow(); | 1694 tab_contents->print_view_manager()->PrintNow(); |
1700 } else { | 1695 } else { |
1701 tab_contents->print_view_manager()->PrintPreviewNow(); | 1696 tab_contents->print_view_manager()->PrintPreviewNow(); |
1702 } | 1697 } |
1703 } else { | 1698 } else { |
1704 rvh->Send(new PrintMsg_PrintNodeUnderContextMenu(rvh->GetRoutingID())); | 1699 rvh->Send(new PrintMsg_PrintNodeUnderContextMenu(rvh->GetRoutingID())); |
1705 } | 1700 } |
1706 break; | 1701 break; |
1707 | 1702 |
1708 case IDC_VIEW_SOURCE: | 1703 case IDC_VIEW_SOURCE: |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2005 source_web_contents_->GetRenderViewHost()-> | 2000 source_web_contents_->GetRenderViewHost()-> |
2006 ExecuteMediaPlayerActionAtLocation(location, action); | 2001 ExecuteMediaPlayerActionAtLocation(location, action); |
2007 } | 2002 } |
2008 | 2003 |
2009 void RenderViewContextMenu::PluginActionAt( | 2004 void RenderViewContextMenu::PluginActionAt( |
2010 const gfx::Point& location, | 2005 const gfx::Point& location, |
2011 const WebPluginAction& action) { | 2006 const WebPluginAction& action) { |
2012 source_web_contents_->GetRenderViewHost()-> | 2007 source_web_contents_->GetRenderViewHost()-> |
2013 ExecutePluginActionAtLocation(location, action); | 2008 ExecutePluginActionAtLocation(location, action); |
2014 } | 2009 } |
OLD | NEW |