| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  269 void LanguageOptionsHandlerCommon::RetrySpellcheckDictionaryDownload( |  269 void LanguageOptionsHandlerCommon::RetrySpellcheckDictionaryDownload( | 
|  270     const ListValue* args) { |  270     const ListValue* args) { | 
|  271   GetHunspellDictionary()->RetryDownloadDictionary( |  271   GetHunspellDictionary()->RetryDownloadDictionary( | 
|  272       Profile::FromWebUI(web_ui())->GetRequestContext()); |  272       Profile::FromWebUI(web_ui())->GetRequestContext()); | 
|  273 } |  273 } | 
|  274  |  274  | 
|  275 void LanguageOptionsHandlerCommon::RefreshHunspellDictionary() { |  275 void LanguageOptionsHandlerCommon::RefreshHunspellDictionary() { | 
|  276   if (hunspell_dictionary_.get()) |  276   if (hunspell_dictionary_.get()) | 
|  277     hunspell_dictionary_->RemoveObserver(this); |  277     hunspell_dictionary_->RemoveObserver(this); | 
|  278   hunspell_dictionary_.reset(); |  278   hunspell_dictionary_.reset(); | 
|  279   hunspell_dictionary_ = SpellcheckServiceFactory::GetForProfile( |  279   SpellcheckService* service = SpellcheckServiceFactory::GetForContext( | 
|  280       Profile::FromWebUI(web_ui()))->GetHunspellDictionary()->AsWeakPtr(); |  280       Profile::FromWebUI(web_ui())); | 
 |  281   hunspell_dictionary_ = service->GetHunspellDictionary()->AsWeakPtr(); | 
|  281   hunspell_dictionary_->AddObserver(this); |  282   hunspell_dictionary_->AddObserver(this); | 
|  282 } |  283 } | 
|  283  |  284  | 
|  284 base::WeakPtr<SpellcheckHunspellDictionary>& |  285 base::WeakPtr<SpellcheckHunspellDictionary>& | 
|  285     LanguageOptionsHandlerCommon::GetHunspellDictionary() { |  286     LanguageOptionsHandlerCommon::GetHunspellDictionary() { | 
|  286   if (!hunspell_dictionary_.get()) |  287   if (!hunspell_dictionary_.get()) | 
|  287     RefreshHunspellDictionary(); |  288     RefreshHunspellDictionary(); | 
|  288   return hunspell_dictionary_; |  289   return hunspell_dictionary_; | 
|  289 } |  290 } | 
|  290  |  291  | 
|  291 }  // namespace options |  292 }  // namespace options | 
| OLD | NEW |