| OLD | NEW |
| 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/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 | 281 |
| 282 if (command_id == IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION || | 282 if (command_id == IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION || |
| 283 command_id == IDC_SPELLCHECK_ADD_TO_DICTIONARY) { | 283 command_id == IDC_SPELLCHECK_ADD_TO_DICTIONARY) { |
| 284 // GetHostForProfile() can return null when the suggested word is provided | 284 // GetHostForProfile() can return null when the suggested word is provided |
| 285 // by Web SpellCheck API. | 285 // by Web SpellCheck API. |
| 286 Profile* profile = proxy_->GetProfile(); | 286 Profile* profile = proxy_->GetProfile(); |
| 287 if (profile) { | 287 if (profile) { |
| 288 SpellcheckService* spellcheck = | 288 SpellcheckService* spellcheck = |
| 289 SpellcheckServiceFactory::GetForContext(profile); | 289 SpellcheckServiceFactory::GetForContext(profile); |
| 290 if (spellcheck) { | 290 if (spellcheck) { |
| 291 spellcheck->GetCustomDictionary()->AddWord(UTF16ToUTF8( | 291 spellcheck->GetCustomDictionary()->AddWord(base::UTF16ToUTF8( |
| 292 misspelled_word_)); | 292 misspelled_word_)); |
| 293 spellcheck->GetFeedbackSender()->AddedToDictionary(misspelling_hash_); | 293 spellcheck->GetFeedbackSender()->AddedToDictionary(misspelling_hash_); |
| 294 } | 294 } |
| 295 } | 295 } |
| 296 #if defined(OS_MACOSX) | 296 #if defined(OS_MACOSX) |
| 297 spellcheck_mac::AddWord(misspelled_word_); | 297 spellcheck_mac::AddWord(misspelled_word_); |
| 298 #endif | 298 #endif |
| 299 } | 299 } |
| 300 | 300 |
| 301 // The spelling service can be toggled by the user only if it is not managed. | 301 // The spelling service can be toggled by the user only if it is not managed. |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 // Append '.' characters to the end of "Checking". | 411 // Append '.' characters to the end of "Checking". |
| 412 loading_frame_ = (loading_frame_ + 1) & 3; | 412 loading_frame_ = (loading_frame_ + 1) & 3; |
| 413 base::string16 loading_message = | 413 base::string16 loading_message = |
| 414 loading_message_ + base::string16(loading_frame_,'.'); | 414 loading_message_ + base::string16(loading_frame_,'.'); |
| 415 | 415 |
| 416 // Update the menu item with the text. We disable this item to prevent users | 416 // Update the menu item with the text. We disable this item to prevent users |
| 417 // from selecting it. | 417 // from selecting it. |
| 418 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, | 418 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, |
| 419 loading_message); | 419 loading_message); |
| 420 } | 420 } |
| OLD | NEW |