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

Unified Diff: chrome/browser/tab_contents/spelling_menu_observer.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, 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/tab_contents/spelling_menu_observer.cc
===================================================================
--- chrome/browser/tab_contents/spelling_menu_observer.cc (revision 124915)
+++ chrome/browser/tab_contents/spelling_menu_observer.cc (working copy)
@@ -107,9 +107,8 @@
spellcheck_host->GetMetrics()->RecordSuggestionStats(1);
}
- // If word is misspelled, give option for "Add to dictionary" and "Ask Google
- // for suggestions". (The SpellCheckerSubMenuObserver class handles the "Ask
- // Goole for suggestions" item so this class does not have to handle it.)
+ // If word is misspelled, give option for "Add to dictionary" and a check item
+ // "Ask Google for suggestions".
if (!params.misspelled_word.empty()) {
if (params.dictionary_suggestions.empty()) {
proxy_->AddMenuItem(IDC_CONTENT_CONTEXT_NO_SPELLING_SUGGESTIONS,
@@ -122,11 +121,8 @@
integrate_spelling_service_ =
profile->GetPrefs()->GetBoolean(prefs::kSpellCheckUseSpellingService);
- int spelling_message = integrate_spelling_service_ ?
- IDS_CONTENT_CONTEXT_SPELLING_STOP_ASKING_GOOGLE :
- IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE;
- proxy_->AddMenuItem(IDC_CONTENT_CONTEXT_SPELLING_TOGGLE,
- l10n_util::GetStringUTF16(spelling_message));
+ proxy_->AddCheckItem(IDC_CONTENT_CONTEXT_SPELLING_TOGGLE,
+ l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE));
proxy_->AddSeparator();
}
@@ -150,6 +146,14 @@
return false;
}
+bool SpellingMenuObserver::IsCommandIdChecked(int command_id) {
+ DCHECK(IsCommandIdSupported(command_id));
+
+ if (command_id == IDC_CONTENT_CONTEXT_SPELLING_TOGGLE)
+ return integrate_spelling_service_;
+ return false;
+}
+
bool SpellingMenuObserver::IsCommandIdEnabled(int command_id) {
DCHECK(IsCommandIdSupported(command_id));
@@ -219,10 +223,10 @@
}
if (command_id == IDC_CONTENT_CONTEXT_SPELLING_TOGGLE) {
- // When a user chooses the "Ask Google for spelling suggestions" item, we
- // show a bubble to confirm it. On the other hand, when a user chooses the
- // "Stop asking Google for spelling suggestions" item, we directly update
- // the profile and stop integrating the spelling service immediately.
+ // When a user enables the "Ask Google for spelling suggestions" item, we
+ // show a bubble to confirm it. On the other hand, when a user disables this
+ // item, we directly update/ the profile and stop integrating the spelling
+ // service immediately.
if (!integrate_spelling_service_) {
RenderViewHost* rvh = proxy_->GetRenderViewHost();
gfx::Rect rect = rvh->view()->GetViewBounds();

Powered by Google App Engine
This is Rietveld 408576698