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

Side by Side Diff: chrome/browser/tab_contents/spellchecker_submenu_observer_hunspell.cc

Issue 9562002: Use a check item instead of changing its text. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
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 "chrome/browser/tab_contents/spellchecker_submenu_observer.h" 5 #include "chrome/browser/tab_contents/spellchecker_submenu_observer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/prefs/pref_member.h" 10 #include "chrome/browser/prefs/pref_member.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 submenu_model_.AddItemWithStringId( 63 submenu_model_.AddItemWithStringId(
64 IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS, 64 IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS,
65 IDS_CONTENT_CONTEXT_LANGUAGE_SETTINGS); 65 IDS_CONTENT_CONTEXT_LANGUAGE_SETTINGS);
66 66
67 // Add a 'Check the spelling of this field' item in the sub menu. 67 // Add a 'Check the spelling of this field' item in the sub menu.
68 submenu_model_.AddCheckItem( 68 submenu_model_.AddCheckItem(
69 IDC_CHECK_SPELLING_OF_THIS_FIELD, 69 IDC_CHECK_SPELLING_OF_THIS_FIELD,
70 l10n_util::GetStringUTF16( 70 l10n_util::GetStringUTF16(
71 IDS_CONTENT_CONTEXT_CHECK_SPELLING_OF_THIS_FIELD)); 71 IDS_CONTENT_CONTEXT_CHECK_SPELLING_OF_THIS_FIELD));
72 72
73 // If we have not integrated the spelling service, we show an "Ask Google for 73 // Add a check item "Ask Google for spelling suggestions" item. (This class
74 // spelling suggestions" item. On the other hand, if we have integrated the 74 // does not handle this item because the SpellingMenuObserver class handles it
75 // spelling service, we show "Stop asking Google for spelling suggestions" 75 // on behalf of this class.)
76 // item.
77 bool integrate_spelling_service =
78 profile->GetPrefs()->GetBoolean(prefs::kSpellCheckUseSpellingService);
79 int spelling_message = integrate_spelling_service ?
80 IDS_CONTENT_CONTEXT_SPELLING_STOP_ASKING_GOOGLE :
81 IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE;
82 submenu_model_.AddCheckItem(IDC_CONTENT_CONTEXT_SPELLING_TOGGLE, 76 submenu_model_.AddCheckItem(IDC_CONTENT_CONTEXT_SPELLING_TOGGLE,
83 l10n_util::GetStringUTF16(spelling_message)); 77 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE));
84 78
85 proxy_->AddSubMenu( 79 proxy_->AddSubMenu(
86 IDC_SPELLCHECK_MENU, 80 IDC_SPELLCHECK_MENU,
87 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLCHECK_MENU), 81 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLCHECK_MENU),
88 &submenu_model_); 82 &submenu_model_);
89 } 83 }
90 84
91 bool SpellCheckerSubMenuObserver::IsCommandIdSupported(int command_id) { 85 bool SpellCheckerSubMenuObserver::IsCommandIdSupported(int command_id) {
92 // Allow Spell Check language items on sub menu for text area context menu. 86 // Allow Spell Check language items on sub menu for text area context menu.
93 if (command_id >= IDC_SPELLCHECK_LANGUAGES_FIRST && 87 if (command_id >= IDC_SPELLCHECK_LANGUAGES_FIRST &&
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 return; 166 return;
173 } 167 }
174 168
175 RenderViewHost* rvh = proxy_->GetRenderViewHost(); 169 RenderViewHost* rvh = proxy_->GetRenderViewHost();
176 switch (command_id) { 170 switch (command_id) {
177 case IDC_CHECK_SPELLING_OF_THIS_FIELD: 171 case IDC_CHECK_SPELLING_OF_THIS_FIELD:
178 rvh->Send(new SpellCheckMsg_ToggleSpellCheck(rvh->routing_id())); 172 rvh->Send(new SpellCheckMsg_ToggleSpellCheck(rvh->routing_id()));
179 break; 173 break;
180 } 174 }
181 } 175 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/render_view_context_menu.cc ('k') | chrome/browser/tab_contents/spelling_menu_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698