| 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/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/spellchecker/spellcheck_factory.h" | 9 #include "chrome/browser/spellchecker/spellcheck_factory.h" |
| 10 #include "chrome/browser/spellchecker/spellcheck_service.h" | 10 #include "chrome/browser/spellchecker/spellcheck_service.h" |
| 11 #include "chrome/common/extensions/api/spellcheck/spellcheck_handler.h" | 11 #include "chrome/common/extensions/api/spellcheck/spellcheck_handler.h" |
| 12 #include "chrome/common/extensions/extension_manifest_constants.h" | 12 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 13 #include "content/public/browser/notification_details.h" | 13 #include "content/public/browser/notification_details.h" |
| 14 #include "content/public/browser/notification_source.h" | 14 #include "content/public/browser/notification_source.h" |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 | 17 |
| 18 namespace keys = extension_manifest_keys; | |
| 19 namespace errors = extension_manifest_errors; | 18 namespace errors = extension_manifest_errors; |
| 20 | 19 |
| 21 namespace { | 20 namespace { |
| 22 | 21 |
| 23 SpellcheckDictionaryInfo* GetSpellcheckDictionaryInfo( | 22 SpellcheckDictionaryInfo* GetSpellcheckDictionaryInfo( |
| 24 const Extension* extension) { | 23 const Extension* extension) { |
| 25 SpellcheckDictionaryInfo *spellcheck_info = | 24 SpellcheckDictionaryInfo *spellcheck_info = |
| 26 static_cast<SpellcheckDictionaryInfo*>( | 25 static_cast<SpellcheckDictionaryInfo*>( |
| 27 extension->GetManifestData(keys::kSpellcheck)); | 26 extension->GetManifestData(manifest_keys::kSpellcheck)); |
| 28 return spellcheck_info; | 27 return spellcheck_info; |
| 29 } | 28 } |
| 30 | 29 |
| 31 SpellcheckService::DictionaryFormat GetDictionaryFormat(std::string format) { | 30 SpellcheckService::DictionaryFormat GetDictionaryFormat(std::string format) { |
| 32 if (format == "hunspell") { | 31 if (format == "hunspell") { |
| 33 return SpellcheckService::DICT_HUNSPELL; | 32 return SpellcheckService::DICT_HUNSPELL; |
| 34 } else if (format == "text") { | 33 } else if (format == "text") { |
| 35 return SpellcheckService::DICT_TEXT; | 34 return SpellcheckService::DICT_TEXT; |
| 36 } else { | 35 } else { |
| 37 return SpellcheckService::DICT_UNKNOWN; | 36 return SpellcheckService::DICT_UNKNOWN; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 NOTREACHED(); | 95 NOTREACHED(); |
| 97 } | 96 } |
| 98 } | 97 } |
| 99 | 98 |
| 100 template <> | 99 template <> |
| 101 void ProfileKeyedAPIFactory<SpellcheckAPI>::DeclareFactoryDependencies() { | 100 void ProfileKeyedAPIFactory<SpellcheckAPI>::DeclareFactoryDependencies() { |
| 102 DependsOn(SpellcheckServiceFactory::GetInstance()); | 101 DependsOn(SpellcheckServiceFactory::GetInstance()); |
| 103 } | 102 } |
| 104 | 103 |
| 105 } // namespace extensions | 104 } // namespace extensions |
| OLD | NEW |