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

Unified Diff: chrome/browser/renderer_context_menu/render_view_context_menu.cc

Issue 1647723002: [win/cros/lin] Add back the spellcheck menu. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
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 efaa96a83b148475144cece67fb5ef52641a5848..82f504d02cd92b09656858f5315219499c0a8201 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -120,6 +120,10 @@
#include "ui/gfx/path.h"
#include "ui/gfx/text_elider.h"
+#if !defined(USE_BROWSER_SPELLCHECKER)
+#include "chrome/browser/renderer_context_menu/spellchecker_submenu_observer.h"
+#endif
+
#if defined(ENABLE_EXTENSIONS)
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
#endif
@@ -270,9 +274,10 @@ const struct UmaEnumCommandIdPair {
{69, -1, IDC_CONTENT_CONTEXT_COPYLINKTEXT},
{70, -1, IDC_CONTENT_CONTEXT_OPENLINKINPROFILE},
{71, -1, IDC_OPEN_LINK_IN_PROFILE_FIRST},
+ {72, -1, IDC_SPELLCHECK_MULTI_LINGUAL},
// Add new items here and use |enum_id| from the next line.
// Also, add new items to RenderViewContextMenuItem enum in histograms.xml.
- {72, -1, 0}, // Must be the last. Increment |enum_id| when new IDC
+ {73, -1, 0}, // Must be the last. Increment |enum_id| when new IDC
// was added.
};
@@ -441,6 +446,8 @@ void OnProfileCreated(chrome::HostDesktopType desktop_type,
}
}
+const int kSpellcheckRadioGroup = 1;
+
} // namespace
// static
@@ -1183,7 +1190,7 @@ void RenderViewContextMenu::AppendEditableItems() {
const bool use_spellcheck_and_search = !chrome::IsRunningInForcedAppMode();
if (use_spellcheck_and_search)
- AppendSpellingSuggestionsSubMenu();
+ AppendSpellcheckSuggestionItems();
// 'Undo' and 'Redo' for text input with no suggestions and no text selected.
// We make an exception for OS X as context clicking will select the closest
@@ -1221,13 +1228,24 @@ void RenderViewContextMenu::AppendEditableItems() {
void RenderViewContextMenu::AppendLanguageSettings() {
const bool use_spellcheck_and_search = !chrome::IsRunningInForcedAppMode();
+ if (!use_spellcheck_and_search)
+ return;
- if (use_spellcheck_and_search)
+#if defined(USE_BROWSER_SPELLCHECKER)
menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS,
IDS_CONTENT_CONTEXT_LANGUAGE_SETTINGS);
+#else
+ if (!spellchecker_submenu_observer_.get()) {
lazyboy 2016/01/28 20:36:24 .get() is unnecessary.
please use gerrit instead 2016/01/28 21:41:59 Done.
+ spellchecker_submenu_observer_.reset(
+ new SpellCheckerSubMenuObserver(this, this, kSpellcheckRadioGroup));
+ }
+
+ spellchecker_submenu_observer_->InitMenu(params_);
+ observers_.AddObserver(spellchecker_submenu_observer_.get());
+#endif
}
-void RenderViewContextMenu::AppendSpellingSuggestionsSubMenu() {
+void RenderViewContextMenu::AppendSpellcheckSuggestionItems() {
lazyboy 2016/01/28 20:36:24 I always get confused by Spelling*Menu and Spellch
please use gerrit instead 2016/01/28 21:41:59 Changed everything to use the word "Spelling" inst
lazyboy 2016/02/01 19:23:33 Got it, thanks.
if (!spelling_menu_observer_.get())
spelling_menu_observer_.reset(new SpellingMenuObserver(this));
observers_.AddObserver(spelling_menu_observer_.get());

Powered by Google App Engine
This is Rietveld 408576698