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/ui/webui/options/language_options_handler_common.h" | 5 #include "chrome/browser/ui/webui/options/language_options_handler_common.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 void LanguageOptionsHandlerCommon::RetrySpellcheckDictionaryDownload( | 243 void LanguageOptionsHandlerCommon::RetrySpellcheckDictionaryDownload( |
244 const ListValue* args) { | 244 const ListValue* args) { |
245 GetHunspellDictionary()->RetryDownloadDictionary( | 245 GetHunspellDictionary()->RetryDownloadDictionary( |
246 Profile::FromWebUI(web_ui())->GetRequestContext()); | 246 Profile::FromWebUI(web_ui())->GetRequestContext()); |
247 } | 247 } |
248 | 248 |
249 void LanguageOptionsHandlerCommon::RefreshHunspellDictionary() { | 249 void LanguageOptionsHandlerCommon::RefreshHunspellDictionary() { |
250 if (hunspell_dictionary_.get()) | 250 if (hunspell_dictionary_.get()) |
251 hunspell_dictionary_->RemoveObserver(this); | 251 hunspell_dictionary_->RemoveObserver(this); |
252 hunspell_dictionary_.reset(); | 252 hunspell_dictionary_.reset(); |
253 hunspell_dictionary_ = SpellcheckServiceFactory::GetForProfile( | 253 SpellcheckService* service = SpellcheckServiceFactory::GetForContext( |
254 Profile::FromWebUI(web_ui()))->GetHunspellDictionary()->AsWeakPtr(); | 254 Profile::FromWebUI(web_ui())); |
| 255 hunspell_dictionary_ = service->GetHunspellDictionary()->AsWeakPtr(); |
255 hunspell_dictionary_->AddObserver(this); | 256 hunspell_dictionary_->AddObserver(this); |
256 } | 257 } |
257 | 258 |
258 base::WeakPtr<SpellcheckHunspellDictionary>& | 259 base::WeakPtr<SpellcheckHunspellDictionary>& |
259 LanguageOptionsHandlerCommon::GetHunspellDictionary() { | 260 LanguageOptionsHandlerCommon::GetHunspellDictionary() { |
260 if (!hunspell_dictionary_.get()) | 261 if (!hunspell_dictionary_.get()) |
261 RefreshHunspellDictionary(); | 262 RefreshHunspellDictionary(); |
262 return hunspell_dictionary_; | 263 return hunspell_dictionary_; |
263 } | 264 } |
264 | 265 |
265 } // namespace options | 266 } // namespace options |
OLD | NEW |