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

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

Issue 2244083002: Componentize spellcheck [4]: spellcheck/browser and android java-side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "chrome/browser/profiles/profile_attributes_storage.h" 44 #include "chrome/browser/profiles/profile_attributes_storage.h"
45 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 45 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
46 #include "chrome/browser/profiles/profile_io_data.h" 46 #include "chrome/browser/profiles/profile_io_data.h"
47 #include "chrome/browser/profiles/profile_manager.h" 47 #include "chrome/browser/profiles/profile_manager.h"
48 #include "chrome/browser/profiles/profile_window.h" 48 #include "chrome/browser/profiles/profile_window.h"
49 #include "chrome/browser/renderer_context_menu/context_menu_content_type_factory .h" 49 #include "chrome/browser/renderer_context_menu/context_menu_content_type_factory .h"
50 #include "chrome/browser/renderer_context_menu/open_with_menu_factory.h" 50 #include "chrome/browser/renderer_context_menu/open_with_menu_factory.h"
51 #include "chrome/browser/renderer_context_menu/spelling_menu_observer.h" 51 #include "chrome/browser/renderer_context_menu/spelling_menu_observer.h"
52 #include "chrome/browser/search/search.h" 52 #include "chrome/browser/search/search.h"
53 #include "chrome/browser/search_engines/template_url_service_factory.h" 53 #include "chrome/browser/search_engines/template_url_service_factory.h"
54 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h"
55 #include "chrome/browser/spellchecker/spellcheck_service.h" 54 #include "chrome/browser/spellchecker/spellcheck_service.h"
56 #include "chrome/browser/tab_contents/retargeting_details.h" 55 #include "chrome/browser/tab_contents/retargeting_details.h"
57 #include "chrome/browser/translate/chrome_translate_client.h" 56 #include "chrome/browser/translate/chrome_translate_client.h"
58 #include "chrome/browser/translate/translate_service.h" 57 #include "chrome/browser/translate/translate_service.h"
59 #include "chrome/browser/ui/browser_commands.h" 58 #include "chrome/browser/ui/browser_commands.h"
60 #include "chrome/browser/ui/browser_finder.h" 59 #include "chrome/browser/ui/browser_finder.h"
61 #include "chrome/browser/ui/browser_navigator_params.h" 60 #include "chrome/browser/ui/browser_navigator_params.h"
62 #include "chrome/browser/ui/chrome_pages.h" 61 #include "chrome/browser/ui/chrome_pages.h"
63 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 62 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
64 #include "chrome/browser/ui/tabs/tab_strip_model.h" 63 #include "chrome/browser/ui/tabs/tab_strip_model.h"
65 #include "chrome/common/chrome_constants.h" 64 #include "chrome/common/chrome_constants.h"
66 #include "chrome/common/chrome_switches.h" 65 #include "chrome/common/chrome_switches.h"
67 #include "chrome/common/content_restriction.h" 66 #include "chrome/common/content_restriction.h"
68 #include "chrome/common/pref_names.h" 67 #include "chrome/common/pref_names.h"
69 #include "chrome/common/render_messages.h" 68 #include "chrome/common/render_messages.h"
70 #include "chrome/common/url_constants.h" 69 #include "chrome/common/url_constants.h"
71 #include "chrome/grit/generated_resources.h" 70 #include "chrome/grit/generated_resources.h"
72 #include "components/autofill/core/common/password_generation_util.h" 71 #include "components/autofill/core/common/password_generation_util.h"
73 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade rs.h" 72 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade rs.h"
74 #include "components/google/core/browser/google_util.h" 73 #include "components/google/core/browser/google_util.h"
75 #include "components/metrics/proto/omnibox_input_type.pb.h" 74 #include "components/metrics/proto/omnibox_input_type.pb.h"
76 #include "components/omnibox/browser/autocomplete_classifier.h" 75 #include "components/omnibox/browser/autocomplete_classifier.h"
77 #include "components/omnibox/browser/autocomplete_match.h" 76 #include "components/omnibox/browser/autocomplete_match.h"
78 #include "components/password_manager/core/common/experiments.h" 77 #include "components/password_manager/core/common/experiments.h"
79 #include "components/prefs/pref_member.h" 78 #include "components/prefs/pref_member.h"
80 #include "components/prefs/pref_service.h" 79 #include "components/prefs/pref_service.h"
81 #include "components/search_engines/template_url.h" 80 #include "components/search_engines/template_url.h"
82 #include "components/search_engines/template_url_service.h" 81 #include "components/search_engines/template_url_service.h"
82 #include "components/spellcheck/browser/pref_names.h"
83 #include "components/spellcheck/browser/spellcheck_host_metrics.h"
83 #include "components/spellcheck/common/spellcheck_common.h" 84 #include "components/spellcheck/common/spellcheck_common.h"
84 #include "components/translate/core/browser/translate_download_manager.h" 85 #include "components/translate/core/browser/translate_download_manager.h"
85 #include "components/translate/core/browser/translate_manager.h" 86 #include "components/translate/core/browser/translate_manager.h"
86 #include "components/translate/core/browser/translate_prefs.h" 87 #include "components/translate/core/browser/translate_prefs.h"
87 #include "components/url_formatter/url_formatter.h" 88 #include "components/url_formatter/url_formatter.h"
88 #include "components/user_prefs/user_prefs.h" 89 #include "components/user_prefs/user_prefs.h"
89 #include "components/web_modal/web_contents_modal_dialog_manager.h" 90 #include "components/web_modal/web_contents_modal_dialog_manager.h"
90 #include "content/public/browser/child_process_security_policy.h" 91 #include "content/public/browser/child_process_security_policy.h"
91 #include "content/public/browser/download_manager.h" 92 #include "content/public/browser/download_manager.h"
92 #include "content/public/browser/download_save_info.h" 93 #include "content/public/browser/download_save_info.h"
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after
1435 if (id == IDC_SAVE_PAGE && 1436 if (id == IDC_SAVE_PAGE &&
1436 (content_restrictions & CONTENT_RESTRICTION_SAVE)) { 1437 (content_restrictions & CONTENT_RESTRICTION_SAVE)) {
1437 return false; 1438 return false;
1438 } 1439 }
1439 1440
1440 PrefService* prefs = GetPrefs(browser_context_); 1441 PrefService* prefs = GetPrefs(browser_context_);
1441 1442
1442 // 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.
1443 if ((id >= IDC_SPELLCHECK_LANGUAGES_FIRST) && 1444 if ((id >= IDC_SPELLCHECK_LANGUAGES_FIRST) &&
1444 (id < IDC_SPELLCHECK_LANGUAGES_LAST)) { 1445 (id < IDC_SPELLCHECK_LANGUAGES_LAST)) {
1445 return prefs->GetBoolean(prefs::kEnableContinuousSpellcheck); 1446 return prefs->GetBoolean(spellcheck::prefs::kEnableContinuousSpellcheck);
1446 } 1447 }
1447 1448
1448 // Extension items. 1449 // Extension items.
1449 if (ContextMenuMatcher::IsExtensionsCustomCommandId(id)) 1450 if (ContextMenuMatcher::IsExtensionsCustomCommandId(id))
1450 return extension_items_.IsCommandIdEnabled(id); 1451 return extension_items_.IsCommandIdEnabled(id);
1451 1452
1452 if (id >= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST && 1453 if (id >= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST &&
1453 id <= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_LAST) { 1454 id <= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_LAST) {
1454 return true; 1455 return true;
1455 } 1456 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 1587
1587 case IDC_PRINT: 1588 case IDC_PRINT:
1588 return IsPrintPreviewEnabled(); 1589 return IsPrintPreviewEnabled();
1589 1590
1590 case IDC_CONTENT_CONTEXT_SEARCHWEBFOR: 1591 case IDC_CONTENT_CONTEXT_SEARCHWEBFOR:
1591 case IDC_CONTENT_CONTEXT_GOTOURL: 1592 case IDC_CONTENT_CONTEXT_GOTOURL:
1592 case IDC_SPELLPANEL_TOGGLE: 1593 case IDC_SPELLPANEL_TOGGLE:
1593 case IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS: 1594 case IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS:
1594 return true; 1595 return true;
1595 case IDC_CHECK_SPELLING_WHILE_TYPING: 1596 case IDC_CHECK_SPELLING_WHILE_TYPING:
1596 return prefs->GetBoolean(prefs::kEnableContinuousSpellcheck); 1597 return prefs->GetBoolean(spellcheck::prefs::kEnableContinuousSpellcheck);
1597 1598
1598 #if !defined(OS_MACOSX) && defined(OS_POSIX) 1599 #if !defined(OS_MACOSX) && defined(OS_POSIX)
1599 // TODO(suzhe): this should not be enabled for password fields. 1600 // TODO(suzhe): this should not be enabled for password fields.
1600 case IDC_INPUT_METHODS_MENU: 1601 case IDC_INPUT_METHODS_MENU:
1601 return true; 1602 return true;
1602 #endif 1603 #endif
1603 1604
1604 case IDC_SPELLCHECK_MENU: 1605 case IDC_SPELLCHECK_MENU:
1605 case IDC_CONTENT_CONTEXT_OPENLINKWITH: 1606 case IDC_CONTENT_CONTEXT_OPENLINKWITH:
1606 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
2449 void RenderViewContextMenu::PluginActionAt( 2450 void RenderViewContextMenu::PluginActionAt(
2450 const gfx::Point& location, 2451 const gfx::Point& location,
2451 const WebPluginAction& action) { 2452 const WebPluginAction& action) {
2452 source_web_contents_->GetRenderViewHost()-> 2453 source_web_contents_->GetRenderViewHost()->
2453 ExecutePluginActionAtLocation(location, action); 2454 ExecutePluginActionAtLocation(location, action);
2454 } 2455 }
2455 2456
2456 Browser* RenderViewContextMenu::GetBrowser() const { 2457 Browser* RenderViewContextMenu::GetBrowser() const {
2457 return chrome::FindBrowserWithWebContents(embedder_web_contents_); 2458 return chrome::FindBrowserWithWebContents(embedder_web_contents_);
2458 } 2459 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698