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

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

Issue 11293241: Cleaning up the custom dictionary code relative to the SpellcheckService to make the custom diction… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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/spelling_menu_observer.h" 5 #include "chrome/browser/tab_contents/spelling_menu_observer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/i18n/case_conversion.h" 8 #include "base/i18n/case_conversion.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 212
213 if (command_id == IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION || 213 if (command_id == IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION ||
214 command_id == IDC_SPELLCHECK_ADD_TO_DICTIONARY) { 214 command_id == IDC_SPELLCHECK_ADD_TO_DICTIONARY) {
215 // GetHostForProfile() can return null when the suggested word is 215 // GetHostForProfile() can return null when the suggested word is
216 // provided by Web SpellCheck API. 216 // provided by Web SpellCheck API.
217 Profile* profile = proxy_->GetProfile(); 217 Profile* profile = proxy_->GetProfile();
218 if (profile) { 218 if (profile) {
219 SpellcheckService* spellcheck_service = 219 SpellcheckService* spellcheck_service =
220 SpellcheckServiceFactory::GetForProfile(profile); 220 SpellcheckServiceFactory::GetForProfile(profile);
221 if (spellcheck_service) 221 if (spellcheck_service)
222 spellcheck_service->AddWord(UTF16ToUTF8(misspelled_word_)); 222 spellcheck_service->GetCustomDictionary()->AddWord(
223 UTF16ToUTF8(misspelled_word_));
223 } 224 }
224 #if defined(OS_MACOSX) 225 #if defined(OS_MACOSX)
225 spellcheck_mac::AddWord(misspelled_word_); 226 spellcheck_mac::AddWord(misspelled_word_);
226 #endif 227 #endif
227 } 228 }
228 229
229 // The spelling service can be toggled by the user only if it is not managed. 230 // The spelling service can be toggled by the user only if it is not managed.
230 if (command_id == IDC_CONTENT_CONTEXT_SPELLING_TOGGLE && 231 if (command_id == IDC_CONTENT_CONTEXT_SPELLING_TOGGLE &&
231 integrate_spelling_service_.IsUserModifiable()) { 232 integrate_spelling_service_.IsUserModifiable()) {
232 // When a user enables the "Ask Google for spelling suggestions" item, we 233 // When a user enables the "Ask Google for spelling suggestions" item, we
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 void SpellingMenuObserver::OnAnimationTimerExpired() { 294 void SpellingMenuObserver::OnAnimationTimerExpired() {
294 // Append '.' characters to the end of "Checking". 295 // Append '.' characters to the end of "Checking".
295 loading_frame_ = (loading_frame_ + 1) & 3; 296 loading_frame_ = (loading_frame_ + 1) & 3;
296 string16 loading_message = loading_message_ + string16(loading_frame_,'.'); 297 string16 loading_message = loading_message_ + string16(loading_frame_,'.');
297 298
298 // Update the menu item with the text. We disable this item to prevent users 299 // Update the menu item with the text. We disable this item to prevent users
299 // from selecting it. 300 // from selecting it.
300 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, 301 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false,
301 loading_message); 302 loading_message);
302 } 303 }
OLDNEW
« no previous file with comments | « chrome/browser/spellchecker/spellcheck_service_unittest.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698