| OLD | NEW |
| 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 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1436 if (id == IDC_SAVE_PAGE && | 1436 if (id == IDC_SAVE_PAGE && |
| 1437 (content_restrictions & CONTENT_RESTRICTION_SAVE)) { | 1437 (content_restrictions & CONTENT_RESTRICTION_SAVE)) { |
| 1438 return false; | 1438 return false; |
| 1439 } | 1439 } |
| 1440 | 1440 |
| 1441 PrefService* prefs = GetPrefs(browser_context_); | 1441 PrefService* prefs = GetPrefs(browser_context_); |
| 1442 | 1442 |
| 1443 // Allow Spell Check language items on sub menu for text area context menu. | 1443 // Allow Spell Check language items on sub menu for text area context menu. |
| 1444 if ((id >= IDC_SPELLCHECK_LANGUAGES_FIRST) && | 1444 if ((id >= IDC_SPELLCHECK_LANGUAGES_FIRST) && |
| 1445 (id < IDC_SPELLCHECK_LANGUAGES_LAST)) { | 1445 (id < IDC_SPELLCHECK_LANGUAGES_LAST)) { |
| 1446 return prefs->GetBoolean(spellcheck::prefs::kEnableContinuousSpellcheck); | 1446 return prefs->GetBoolean(spellcheck::prefs::kEnableSpellcheck); |
| 1447 } | 1447 } |
| 1448 | 1448 |
| 1449 // Extension items. | 1449 // Extension items. |
| 1450 if (ContextMenuMatcher::IsExtensionsCustomCommandId(id)) | 1450 if (ContextMenuMatcher::IsExtensionsCustomCommandId(id)) |
| 1451 return extension_items_.IsCommandIdEnabled(id); | 1451 return extension_items_.IsCommandIdEnabled(id); |
| 1452 | 1452 |
| 1453 if (id >= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST && | 1453 if (id >= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST && |
| 1454 id <= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_LAST) { | 1454 id <= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_LAST) { |
| 1455 return true; | 1455 return true; |
| 1456 } | 1456 } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1587 | 1587 |
| 1588 case IDC_PRINT: | 1588 case IDC_PRINT: |
| 1589 return IsPrintPreviewEnabled(); | 1589 return IsPrintPreviewEnabled(); |
| 1590 | 1590 |
| 1591 case IDC_CONTENT_CONTEXT_SEARCHWEBFOR: | 1591 case IDC_CONTENT_CONTEXT_SEARCHWEBFOR: |
| 1592 case IDC_CONTENT_CONTEXT_GOTOURL: | 1592 case IDC_CONTENT_CONTEXT_GOTOURL: |
| 1593 case IDC_SPELLPANEL_TOGGLE: | 1593 case IDC_SPELLPANEL_TOGGLE: |
| 1594 case IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS: | 1594 case IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS: |
| 1595 return true; | 1595 return true; |
| 1596 case IDC_CHECK_SPELLING_WHILE_TYPING: | 1596 case IDC_CHECK_SPELLING_WHILE_TYPING: |
| 1597 return prefs->GetBoolean(spellcheck::prefs::kEnableContinuousSpellcheck); | 1597 return prefs->GetBoolean(spellcheck::prefs::kEnableSpellcheck); |
| 1598 | 1598 |
| 1599 #if !defined(OS_MACOSX) && defined(OS_POSIX) | 1599 #if !defined(OS_MACOSX) && defined(OS_POSIX) |
| 1600 // TODO(suzhe): this should not be enabled for password fields. | 1600 // TODO(suzhe): this should not be enabled for password fields. |
| 1601 case IDC_INPUT_METHODS_MENU: | 1601 case IDC_INPUT_METHODS_MENU: |
| 1602 return true; | 1602 return true; |
| 1603 #endif | 1603 #endif |
| 1604 | 1604 |
| 1605 case IDC_SPELLCHECK_MENU: | 1605 case IDC_SPELLCHECK_MENU: |
| 1606 case IDC_CONTENT_CONTEXT_OPENLINKWITH: | 1606 case IDC_CONTENT_CONTEXT_OPENLINKWITH: |
| 1607 case IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_SETTINGS: | 1607 case IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_SETTINGS: |
| (...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2450 void RenderViewContextMenu::PluginActionAt( | 2450 void RenderViewContextMenu::PluginActionAt( |
| 2451 const gfx::Point& location, | 2451 const gfx::Point& location, |
| 2452 const WebPluginAction& action) { | 2452 const WebPluginAction& action) { |
| 2453 source_web_contents_->GetRenderViewHost()-> | 2453 source_web_contents_->GetRenderViewHost()-> |
| 2454 ExecutePluginActionAtLocation(location, action); | 2454 ExecutePluginActionAtLocation(location, action); |
| 2455 } | 2455 } |
| 2456 | 2456 |
| 2457 Browser* RenderViewContextMenu::GetBrowser() const { | 2457 Browser* RenderViewContextMenu::GetBrowser() const { |
| 2458 return chrome::FindBrowserWithWebContents(embedder_web_contents_); | 2458 return chrome::FindBrowserWithWebContents(embedder_web_contents_); |
| 2459 } | 2459 } |
| OLD | NEW |