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" |
11 #include "extensions/browser/extension_registry.h" | 11 #include "extensions/browser/extension_registry.h" |
12 #include "extensions/common/manifest_constants.h" | 12 #include "extensions/common/manifest_constants.h" |
13 | 13 |
14 namespace extensions { | 14 namespace extensions { |
15 | 15 |
16 namespace errors = manifest_errors; | 16 namespace errors = manifest_errors; |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 SpellcheckDictionaryInfo* GetSpellcheckDictionaryInfo( | 20 SpellcheckDictionaryInfo* GetSpellcheckDictionaryInfo( |
21 const Extension* extension) { | 21 const Extension* extension) { |
22 SpellcheckDictionaryInfo *spellcheck_info = | 22 SpellcheckDictionaryInfo *spellcheck_info = |
23 static_cast<SpellcheckDictionaryInfo*>( | 23 static_cast<SpellcheckDictionaryInfo*>( |
24 extension->GetManifestData(manifest_keys::kSpellcheck)); | 24 extension->GetManifestData(manifest_keys::kSpellcheck)); |
25 return spellcheck_info; | 25 return spellcheck_info; |
26 } | 26 } |
27 | 27 |
28 SpellcheckService::DictionaryFormat GetDictionaryFormat(std::string format) { | 28 SpellcheckService::DictionaryFormat GetDictionaryFormat( |
| 29 const std::string& format) { |
29 if (format == "hunspell") { | 30 if (format == "hunspell") { |
30 return SpellcheckService::DICT_HUNSPELL; | 31 return SpellcheckService::DICT_HUNSPELL; |
31 } else if (format == "text") { | 32 } else if (format == "text") { |
32 return SpellcheckService::DICT_TEXT; | 33 return SpellcheckService::DICT_TEXT; |
33 } else { | 34 } else { |
34 return SpellcheckService::DICT_UNKNOWN; | 35 return SpellcheckService::DICT_UNKNOWN; |
35 } | 36 } |
36 } | 37 } |
37 | 38 |
38 } // namespace | 39 } // namespace |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 84 } |
84 } | 85 } |
85 | 86 |
86 template <> | 87 template <> |
87 void | 88 void |
88 BrowserContextKeyedAPIFactory<SpellcheckAPI>::DeclareFactoryDependencies() { | 89 BrowserContextKeyedAPIFactory<SpellcheckAPI>::DeclareFactoryDependencies() { |
89 DependsOn(SpellcheckServiceFactory::GetInstance()); | 90 DependsOn(SpellcheckServiceFactory::GetInstance()); |
90 } | 91 } |
91 | 92 |
92 } // namespace extensions | 93 } // namespace extensions |
OLD | NEW |