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

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

Issue 8907016: Spellchecker should recheck after changing language. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Patch 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 case IDC_CONTENT_CONTEXT_SPELLING_TOGGLE: 161 case IDC_CONTENT_CONTEXT_SPELLING_TOGGLE:
162 return true; 162 return true;
163 } 163 }
164 164
165 return false; 165 return false;
166 } 166 }
167 167
168 void SpellCheckerSubMenuObserver::ExecuteCommand(int command_id) { 168 void SpellCheckerSubMenuObserver::ExecuteCommand(int command_id) {
169 DCHECK(IsCommandIdSupported(command_id)); 169 DCHECK(IsCommandIdSupported(command_id));
170 170
171 RenderViewHost* rvh = proxy_->GetRenderViewHost();
172
171 // Check to see if one of the spell check language ids have been clicked. 173 // Check to see if one of the spell check language ids have been clicked.
172 if (command_id >= IDC_SPELLCHECK_LANGUAGES_FIRST && 174 if (command_id >= IDC_SPELLCHECK_LANGUAGES_FIRST &&
173 command_id < IDC_SPELLCHECK_LANGUAGES_LAST) { 175 command_id < IDC_SPELLCHECK_LANGUAGES_LAST) {
174 Profile* profile = proxy_->GetProfile(); 176 Profile* profile = proxy_->GetProfile();
175 const size_t language = command_id - IDC_SPELLCHECK_LANGUAGES_FIRST; 177 const size_t language = command_id - IDC_SPELLCHECK_LANGUAGES_FIRST;
176 if (profile && language < languages_.size()) { 178 if (profile && language < languages_.size()) {
177 StringPrefMember dictionary_language; 179 StringPrefMember dictionary_language;
178 dictionary_language.Init(prefs::kSpellCheckDictionary, 180 dictionary_language.Init(prefs::kSpellCheckDictionary,
179 profile->GetPrefs(), 181 profile->GetPrefs(),
180 NULL); 182 NULL);
181 dictionary_language.SetValue(languages_[language]); 183 dictionary_language.SetValue(languages_[language]);
184 rvh->RequestTextChecking();
182 } 185 }
183 return; 186 return;
184 } 187 }
185 188
186 RenderViewHost* rvh = proxy_->GetRenderViewHost();
187 switch (command_id) { 189 switch (command_id) {
188 case IDC_CHECK_SPELLING_OF_THIS_FIELD: 190 case IDC_CHECK_SPELLING_OF_THIS_FIELD:
189 rvh->Send(new SpellCheckMsg_ToggleSpellCheck(rvh->routing_id())); 191 rvh->Send(new SpellCheckMsg_ToggleSpellCheck(rvh->routing_id()));
190 break; 192 break;
191 193
192 #if defined(OS_WIN) 194 #if defined(OS_WIN)
193 case IDC_CONTENT_CONTEXT_SPELLING_TOGGLE: 195 case IDC_CONTENT_CONTEXT_SPELLING_TOGGLE:
194 // When a user chooses the "Ask Google for spelling suggestions" item, we 196 // When a user chooses the "Ask Google for spelling suggestions" item, we
195 // show a bubble to confirm it. On the other hand, when a user chooses the 197 // show a bubble to confirm it. On the other hand, when a user chooses the
196 // "Stop asking Google for spelling suggestions" item, we directly update 198 // "Stop asking Google for spelling suggestions" item, we directly update
197 // the profile and stop integrating the spelling service immediately. 199 // the profile and stop integrating the spelling service immediately.
198 if (!integrate_spelling_service_) { 200 if (!integrate_spelling_service_) {
199 gfx::Rect rect = rvh->view()->GetViewBounds(); 201 gfx::Rect rect = rvh->view()->GetViewBounds();
200 ConfirmBubbleModel::Show(rvh->view()->GetNativeView(), 202 ConfirmBubbleModel::Show(rvh->view()->GetNativeView(),
201 gfx::Point(rect.CenterPoint().x(), rect.y()), 203 gfx::Point(rect.CenterPoint().x(), rect.y()),
202 new SpellingBubbleModel(proxy_->GetProfile())); 204 new SpellingBubbleModel(proxy_->GetProfile()));
203 } else { 205 } else {
204 Profile* profile = proxy_->GetProfile(); 206 Profile* profile = proxy_->GetProfile();
205 if (profile) 207 if (profile)
206 profile->GetPrefs()->SetBoolean(prefs::kSpellCheckUseSpellingService, 208 profile->GetPrefs()->SetBoolean(prefs::kSpellCheckUseSpellingService,
207 false); 209 false);
208 } 210 }
209 break; 211 break;
210 #endif 212 #endif
211 } 213 }
212 } 214 }
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698