| 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/common/extensions/api/speech/tts_engine_manifest_handler.h" | 5 #include "chrome/common/extensions/api/speech/tts_engine_manifest_handler.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 extension->GetManifestData(keys::kTtsVoices)); | 40 extension->GetManifestData(keys::kTtsVoices)); |
| 41 return info ? &info->voices : NULL; | 41 return info ? &info->voices : NULL; |
| 42 } | 42 } |
| 43 | 43 |
| 44 TtsEngineManifestHandler::TtsEngineManifestHandler() { | 44 TtsEngineManifestHandler::TtsEngineManifestHandler() { |
| 45 } | 45 } |
| 46 | 46 |
| 47 TtsEngineManifestHandler::~TtsEngineManifestHandler() { | 47 TtsEngineManifestHandler::~TtsEngineManifestHandler() { |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool TtsEngineManifestHandler::Parse(Extension* extension, string16* error) { | 50 bool TtsEngineManifestHandler::Parse(Extension* extension, |
| 51 base::string16* error) { |
| 51 scoped_ptr<TtsVoices> info(new TtsVoices); | 52 scoped_ptr<TtsVoices> info(new TtsVoices); |
| 52 const base::DictionaryValue* tts_dict = NULL; | 53 const base::DictionaryValue* tts_dict = NULL; |
| 53 if (!extension->manifest()->GetDictionary(keys::kTtsEngine, &tts_dict)) { | 54 if (!extension->manifest()->GetDictionary(keys::kTtsEngine, &tts_dict)) { |
| 54 *error = ASCIIToUTF16(errors::kInvalidTts); | 55 *error = ASCIIToUTF16(errors::kInvalidTts); |
| 55 return false; | 56 return false; |
| 56 } | 57 } |
| 57 | 58 |
| 58 if (!tts_dict->HasKey(keys::kTtsVoices)) | 59 if (!tts_dict->HasKey(keys::kTtsVoices)) |
| 59 return true; | 60 return true; |
| 60 | 61 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 142 |
| 142 extension->SetManifestData(keys::kTtsVoices, info.release()); | 143 extension->SetManifestData(keys::kTtsVoices, info.release()); |
| 143 return true; | 144 return true; |
| 144 } | 145 } |
| 145 | 146 |
| 146 const std::vector<std::string> TtsEngineManifestHandler::Keys() const { | 147 const std::vector<std::string> TtsEngineManifestHandler::Keys() const { |
| 147 return SingleKey(keys::kTtsEngine); | 148 return SingleKey(keys::kTtsEngine); |
| 148 } | 149 } |
| 149 | 150 |
| 150 } // namespace extensions | 151 } // namespace extensions |
| OLD | NEW |