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

Unified Diff: chrome/browser/tab_contents/spelling_menu_observer.cc

Issue 9289007: Profiles: Move the Spelling system onto a ProfileKeyedServiceFactory. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove stray mark Created 8 years, 11 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
diff --git a/chrome/browser/tab_contents/spelling_menu_observer.cc b/chrome/browser/tab_contents/spelling_menu_observer.cc
index 50a1caca51e8541572350b24529b3ed75d8b3012..dffe2ddbd1ec44fd0be97fd3019eba32cfadcd80 100644
--- a/chrome/browser/tab_contents/spelling_menu_observer.cc
+++ b/chrome/browser/tab_contents/spelling_menu_observer.cc
@@ -15,6 +15,7 @@
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/spellchecker/spellcheck_factory.h"
#include "chrome/browser/spellchecker/spellcheck_host.h"
#include "chrome/browser/spellchecker/spellcheck_host_metrics.h"
#include "chrome/browser/spellchecker/spellcheck_platform_mac.h"
@@ -113,7 +114,8 @@ void SpellingMenuObserver::InitMenu(const ContextMenuParams& params) {
// |spellcheck_host| can be null when the suggested word is
// provided by Web SpellCheck API.
- SpellCheckHost* spellcheck_host = profile->GetSpellCheckHost();
+ SpellCheckHost* spellcheck_host =
+ SpellCheckFactory::GetHostForProfile(profile);
if (spellcheck_host && spellcheck_host->GetMetrics())
spellcheck_host->GetMetrics()->RecordSuggestionStats(1);
}
@@ -201,7 +203,8 @@ void SpellingMenuObserver::ExecuteCommand(int command_id) {
// provided by Web SpellCheck API.
Profile* profile = proxy_->GetProfile();
if (profile) {
- SpellCheckHost* spellcheck_host = profile->GetSpellCheckHost();
+ SpellCheckHost* spellcheck_host =
+ SpellCheckFactory::GetHostForProfile(profile);
if (spellcheck_host && spellcheck_host->GetMetrics())
spellcheck_host->GetMetrics()->RecordReplacedWordStats(1);
}
@@ -218,11 +221,14 @@ void SpellingMenuObserver::ExecuteCommand(int command_id) {
if (command_id == IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION ||
command_id == IDC_SPELLCHECK_ADD_TO_DICTIONARY) {
- // GetSpellCheckHost() can return null when the suggested word is
+ // GetHostForProfile() can return null when the suggested word is
// provided by Web SpellCheck API.
Profile* profile = proxy_->GetProfile();
- if (profile && profile->GetSpellCheckHost())
- profile->GetSpellCheckHost()->AddWord(UTF16ToUTF8(misspelled_word_));
+ if (profile) {
+ SpellCheckHost* host = SpellCheckFactory::GetHostForProfile(profile);
+ if (host)
+ host->AddWord(UTF16ToUTF8(misspelled_word_));
+ }
#if defined(OS_MACOSX)
spellcheck_mac::AddWord(misspelled_word_);
#endif

Powered by Google App Engine
This is Rietveld 408576698