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/extensions/api/spellcheck/spellcheck_api.h" | 5 #include "chrome/browser/extensions/api/spellcheck/spellcheck_api.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "chrome/browser/spellchecker/spellcheck_factory.h" | 8 #include "chrome/browser/spellchecker/spellcheck_factory.h" |
9 #include "chrome/browser/spellchecker/spellcheck_service.h" | 9 #include "chrome/browser/spellchecker/spellcheck_service.h" |
10 #include "chrome/common/extensions/api/spellcheck/spellcheck_handler.h" | 10 #include "chrome/common/extensions/api/spellcheck/spellcheck_handler.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 spellcheck->LoadExternalDictionary( | 67 spellcheck->LoadExternalDictionary( |
68 spellcheck_info->language, | 68 spellcheck_info->language, |
69 spellcheck_info->locale, | 69 spellcheck_info->locale, |
70 spellcheck_info->path, | 70 spellcheck_info->path, |
71 GetDictionaryFormat(spellcheck_info->format)); | 71 GetDictionaryFormat(spellcheck_info->format)); |
72 } | 72 } |
73 } | 73 } |
74 void SpellcheckAPI::OnExtensionUnloaded( | 74 void SpellcheckAPI::OnExtensionUnloaded( |
75 content::BrowserContext* browser_context, | 75 content::BrowserContext* browser_context, |
76 const Extension* extension, | 76 const Extension* extension, |
77 UnloadedExtensionInfo::Reason reason) { | 77 UnloadedExtensionReason reason) { |
78 SpellcheckDictionaryInfo* spellcheck_info = | 78 SpellcheckDictionaryInfo* spellcheck_info = |
79 GetSpellcheckDictionaryInfo(extension); | 79 GetSpellcheckDictionaryInfo(extension); |
80 if (spellcheck_info) { | 80 if (spellcheck_info) { |
81 // TODO(rlp): Handle unload failure. | 81 // TODO(rlp): Handle unload failure. |
82 SpellcheckService* spellcheck = | 82 SpellcheckService* spellcheck = |
83 SpellcheckServiceFactory::GetForContext(browser_context); | 83 SpellcheckServiceFactory::GetForContext(browser_context); |
84 spellcheck->UnloadExternalDictionary(spellcheck_info->path); | 84 spellcheck->UnloadExternalDictionary(spellcheck_info->path); |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 template <> | 88 template <> |
89 void | 89 void |
90 BrowserContextKeyedAPIFactory<SpellcheckAPI>::DeclareFactoryDependencies() { | 90 BrowserContextKeyedAPIFactory<SpellcheckAPI>::DeclareFactoryDependencies() { |
91 DependsOn(SpellcheckServiceFactory::GetInstance()); | 91 DependsOn(SpellcheckServiceFactory::GetInstance()); |
92 } | 92 } |
93 | 93 |
94 } // namespace extensions | 94 } // namespace extensions |
OLD | NEW |