OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer_context_menu/spelling_menu_observer.h" | 5 #include "chrome/browser/renderer_context_menu/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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 content::BrowserContext* browser_context = proxy_->GetBrowserContext(); | 285 content::BrowserContext* browser_context = proxy_->GetBrowserContext(); |
286 if (browser_context) { | 286 if (browser_context) { |
287 SpellcheckService* spellcheck = | 287 SpellcheckService* spellcheck = |
288 SpellcheckServiceFactory::GetForContext(browser_context); | 288 SpellcheckServiceFactory::GetForContext(browser_context); |
289 if (spellcheck) { | 289 if (spellcheck) { |
290 spellcheck->GetCustomDictionary()->AddWord(base::UTF16ToUTF8( | 290 spellcheck->GetCustomDictionary()->AddWord(base::UTF16ToUTF8( |
291 misspelled_word_)); | 291 misspelled_word_)); |
292 spellcheck->GetFeedbackSender()->AddedToDictionary(misspelling_hash_); | 292 spellcheck->GetFeedbackSender()->AddedToDictionary(misspelling_hash_); |
293 } | 293 } |
294 } | 294 } |
295 #if defined(USE_PLATFORM_SPELLCHECKER) | 295 #if defined(USE_BROWSER_SPELLCHECKER) |
296 spellcheck_platform::AddWord(misspelled_word_); | 296 spellcheck_platform::AddWord(misspelled_word_); |
297 #endif | 297 #endif |
298 } | 298 } |
299 | 299 |
300 Profile* profile = Profile::FromBrowserContext(proxy_->GetBrowserContext()); | 300 Profile* profile = Profile::FromBrowserContext(proxy_->GetBrowserContext()); |
301 | 301 |
302 // The spelling service can be toggled by the user only if it is not managed. | 302 // The spelling service can be toggled by the user only if it is not managed. |
303 if (command_id == IDC_CONTENT_CONTEXT_SPELLING_TOGGLE && | 303 if (command_id == IDC_CONTENT_CONTEXT_SPELLING_TOGGLE && |
304 integrate_spelling_service_.IsUserModifiable()) { | 304 integrate_spelling_service_.IsUserModifiable()) { |
305 // When a user enables the "Ask Google for spelling suggestions" item, we | 305 // When a user enables the "Ask Google for spelling suggestions" item, we |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 // Append '.' characters to the end of "Checking". | 409 // Append '.' characters to the end of "Checking". |
410 loading_frame_ = (loading_frame_ + 1) & 3; | 410 loading_frame_ = (loading_frame_ + 1) & 3; |
411 base::string16 loading_message = | 411 base::string16 loading_message = |
412 loading_message_ + base::string16(loading_frame_,'.'); | 412 loading_message_ + base::string16(loading_frame_,'.'); |
413 | 413 |
414 // Update the menu item with the text. We disable this item to prevent users | 414 // Update the menu item with the text. We disable this item to prevent users |
415 // from selecting it. | 415 // from selecting it. |
416 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, | 416 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, |
417 loading_message); | 417 loading_message); |
418 } | 418 } |
OLD | NEW |