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/spellchecker/spellcheck_service.h" | 5 #include "chrome/browser/spellchecker/spellcheck_service.h" |
6 | 6 |
7 #include "base/platform_file.h" | 7 #include "base/platform_file.h" |
8 #include "base/prefs/pref_member.h" | 8 #include "base/prefs/pref_member.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 prefs::kEnableContinuousSpellcheck, | 65 prefs::kEnableContinuousSpellcheck, |
66 base::Bind(&SpellcheckService::InitForAllRenderers, | 66 base::Bind(&SpellcheckService::InitForAllRenderers, |
67 base::Unretained(this))); | 67 base::Unretained(this))); |
68 | 68 |
69 OnSpellCheckDictionaryChanged(); | 69 OnSpellCheckDictionaryChanged(); |
70 | 70 |
71 custom_dictionary_.reset(new SpellcheckCustomDictionary(profile_->GetPath())); | 71 custom_dictionary_.reset(new SpellcheckCustomDictionary(profile_->GetPath())); |
72 custom_dictionary_->AddObserver(this); | 72 custom_dictionary_->AddObserver(this); |
73 custom_dictionary_->Load(); | 73 custom_dictionary_->Load(); |
74 | 74 |
75 registrar_.Add(weak_ptr_factory_.GetWeakPtr(), | 75 registrar_.Add(this, |
76 content::NOTIFICATION_RENDERER_PROCESS_CREATED, | 76 content::NOTIFICATION_RENDERER_PROCESS_CREATED, |
77 content::NotificationService::AllSources()); | 77 content::NotificationService::AllSources()); |
78 } | 78 } |
79 | 79 |
80 SpellcheckService::~SpellcheckService() { | 80 SpellcheckService::~SpellcheckService() { |
81 // Remove pref observers | 81 // Remove pref observers |
82 pref_change_registrar_.RemoveAll(); | 82 pref_change_registrar_.RemoveAll(); |
83 } | 83 } |
84 | 84 |
85 // static | 85 // static |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 dictionary, &language_code, &country_code); | 304 dictionary, &language_code, &country_code); |
305 feedback_sender_->OnLanguageCountryChange(language_code, country_code); | 305 feedback_sender_->OnLanguageCountryChange(language_code, country_code); |
306 } | 306 } |
307 | 307 |
308 void SpellcheckService::OnUseSpellingServiceChanged() { | 308 void SpellcheckService::OnUseSpellingServiceChanged() { |
309 bool enabled = pref_change_registrar_.prefs()->GetBoolean( | 309 bool enabled = pref_change_registrar_.prefs()->GetBoolean( |
310 prefs::kSpellCheckUseSpellingService); | 310 prefs::kSpellCheckUseSpellingService); |
311 if (metrics_) | 311 if (metrics_) |
312 metrics_->RecordSpellingServiceStats(enabled); | 312 metrics_->RecordSpellingServiceStats(enabled); |
313 } | 313 } |
OLD | NEW |