| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/common/extensions/api/spellcheck/spellcheck_handler.h" | 5 #include "chrome/common/extensions/api/spellcheck/spellcheck_handler.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "extensions/common/manifest_constants.h" | 8 #include "extensions/common/manifest_constants.h" |
| 9 | 9 |
| 10 namespace extensions { | 10 namespace extensions { |
| 11 | 11 |
| 12 namespace keys = manifest_keys; | 12 namespace keys = manifest_keys; |
| 13 namespace errors = manifest_errors; | 13 namespace errors = manifest_errors; |
| 14 | 14 |
| 15 SpellcheckDictionaryInfo::SpellcheckDictionaryInfo() { | 15 SpellcheckDictionaryInfo::SpellcheckDictionaryInfo() { |
| 16 } | 16 } |
| 17 | 17 |
| 18 SpellcheckDictionaryInfo::~SpellcheckDictionaryInfo() { | 18 SpellcheckDictionaryInfo::~SpellcheckDictionaryInfo() { |
| 19 } | 19 } |
| 20 | 20 |
| 21 SpellcheckHandler::SpellcheckHandler() { | 21 SpellcheckHandler::SpellcheckHandler() { |
| 22 } | 22 } |
| 23 | 23 |
| 24 SpellcheckHandler::~SpellcheckHandler() { | 24 SpellcheckHandler::~SpellcheckHandler() { |
| 25 } | 25 } |
| 26 | 26 |
| 27 bool SpellcheckHandler::Parse(Extension* extension, string16* error) { | 27 bool SpellcheckHandler::Parse(Extension* extension, base::string16* error) { |
| 28 const base::DictionaryValue* spellcheck_value = NULL; | 28 const base::DictionaryValue* spellcheck_value = NULL; |
| 29 if (!extension->manifest()->GetDictionary(keys::kSpellcheck, | 29 if (!extension->manifest()->GetDictionary(keys::kSpellcheck, |
| 30 &spellcheck_value)) { | 30 &spellcheck_value)) { |
| 31 *error = ASCIIToUTF16(errors::kInvalidSpellcheck); | 31 *error = ASCIIToUTF16(errors::kInvalidSpellcheck); |
| 32 return false; | 32 return false; |
| 33 } | 33 } |
| 34 scoped_ptr<SpellcheckDictionaryInfo> spellcheck_info( | 34 scoped_ptr<SpellcheckDictionaryInfo> spellcheck_info( |
| 35 new SpellcheckDictionaryInfo); | 35 new SpellcheckDictionaryInfo); |
| 36 if (!spellcheck_value->HasKey(keys::kSpellcheckDictionaryLanguage) || | 36 if (!spellcheck_value->HasKey(keys::kSpellcheckDictionaryLanguage) || |
| 37 !spellcheck_value->GetString(keys::kSpellcheckDictionaryLanguage, | 37 !spellcheck_value->GetString(keys::kSpellcheckDictionaryLanguage, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 59 } | 59 } |
| 60 extension->SetManifestData(keys::kSpellcheck, spellcheck_info.release()); | 60 extension->SetManifestData(keys::kSpellcheck, spellcheck_info.release()); |
| 61 return true; | 61 return true; |
| 62 } | 62 } |
| 63 | 63 |
| 64 const std::vector<std::string> SpellcheckHandler::Keys() const { | 64 const std::vector<std::string> SpellcheckHandler::Keys() const { |
| 65 return SingleKey(keys::kSpellcheck); | 65 return SingleKey(keys::kSpellcheck); |
| 66 } | 66 } |
| 67 | 67 |
| 68 } // namespace extensions | 68 } // namespace extensions |
| OLD | NEW |