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

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: Rebase. Created 4 years, 10 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 557dd4007b432b7071b9e5ba6b9807254bb05679..e69f93ca97bb6e96641faef266cd384a4cc21980 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -121,6 +121,10 @@
#include "ui/gfx/path.h"
#include "ui/gfx/text_elider.h"
+#if !defined(USE_BROWSER_SPELLCHECKER)
+#include "chrome/browser/renderer_context_menu/spelling_options_submenu_observer.h"
+#endif
+
#if defined(ENABLE_EXTENSIONS)
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
#endif
@@ -272,9 +276,10 @@ const struct UmaEnumCommandIdPair {
{70, -1, IDC_CONTENT_CONTEXT_OPENLINKINPROFILE},
{71, -1, IDC_OPEN_LINK_IN_PROFILE_FIRST},
{72, -1, IDC_CONTENT_CONTEXT_GENERATEPASSWORD},
+ {73, -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.
- {73, -1, 0}, // Must be the last. Increment |enum_id| when new IDC
+ {74, -1, 0}, // Must be the last. Increment |enum_id| when new IDC
// was added.
};
@@ -1182,10 +1187,9 @@ void RenderViewContextMenu::AppendSearchProvider() {
}
void RenderViewContextMenu::AppendEditableItems() {
- const bool use_spellcheck_and_search = !chrome::IsRunningInForcedAppMode();
-
- if (use_spellcheck_and_search)
- AppendSpellingSuggestionsSubMenu();
+ const bool use_spelling = !chrome::IsRunningInForcedAppMode();
+ if (use_spelling)
+ AppendSpellingSuggestionItems();
// '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
@@ -1222,18 +1226,30 @@ void RenderViewContextMenu::AppendEditableItems() {
}
void RenderViewContextMenu::AppendLanguageSettings() {
- const bool use_spellcheck_and_search = !chrome::IsRunningInForcedAppMode();
+ const bool use_spelling = !chrome::IsRunningInForcedAppMode();
+ if (!use_spelling)
+ return;
- if (use_spellcheck_and_search)
- menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS,
- IDS_CONTENT_CONTEXT_LANGUAGE_SETTINGS);
+#if defined(OS_MACOSX)
+ menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS,
+ IDS_CONTENT_CONTEXT_LANGUAGE_SETTINGS);
+#else
+ if (!spelling_options_submenu_observer_) {
+ const int kLanguageRadioGroup = 1;
+ spelling_options_submenu_observer_.reset(
+ new SpellingOptionsSubMenuObserver(this, this, kLanguageRadioGroup));
+ }
+
+ spelling_options_submenu_observer_->InitMenu(params_);
+ observers_.AddObserver(spelling_options_submenu_observer_.get());
+#endif
}
-void RenderViewContextMenu::AppendSpellingSuggestionsSubMenu() {
- if (!spelling_menu_observer_.get())
- spelling_menu_observer_.reset(new SpellingMenuObserver(this));
- observers_.AddObserver(spelling_menu_observer_.get());
- spelling_menu_observer_->InitMenu(params_);
+void RenderViewContextMenu::AppendSpellingSuggestionItems() {
+ if (!spelling_suggestions_menu_observer_)
+ spelling_suggestions_menu_observer_.reset(new SpellingMenuObserver(this));
+ observers_.AddObserver(spelling_suggestions_menu_observer_.get());
+ spelling_suggestions_menu_observer_->InitMenu(params_);
}
void RenderViewContextMenu::AppendProtocolHandlerSubMenu() {

Powered by Google App Engine
This is Rietveld 408576698