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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include <memory> |
| 10 |
10 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
12 #include "base/values.h" | 13 #include "base/values.h" |
13 #include "extensions/common/error_utils.h" | 14 #include "extensions/common/error_utils.h" |
14 #include "extensions/common/manifest.h" | 15 #include "extensions/common/manifest.h" |
15 #include "extensions/common/manifest_constants.h" | 16 #include "extensions/common/manifest_constants.h" |
16 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
17 | 18 |
18 namespace extensions { | 19 namespace extensions { |
19 | 20 |
(...skipping 26 matching lines...) Expand all Loading... |
46 } | 47 } |
47 | 48 |
48 TtsEngineManifestHandler::TtsEngineManifestHandler() { | 49 TtsEngineManifestHandler::TtsEngineManifestHandler() { |
49 } | 50 } |
50 | 51 |
51 TtsEngineManifestHandler::~TtsEngineManifestHandler() { | 52 TtsEngineManifestHandler::~TtsEngineManifestHandler() { |
52 } | 53 } |
53 | 54 |
54 bool TtsEngineManifestHandler::Parse(Extension* extension, | 55 bool TtsEngineManifestHandler::Parse(Extension* extension, |
55 base::string16* error) { | 56 base::string16* error) { |
56 scoped_ptr<TtsVoices> info(new TtsVoices); | 57 std::unique_ptr<TtsVoices> info(new TtsVoices); |
57 const base::DictionaryValue* tts_dict = NULL; | 58 const base::DictionaryValue* tts_dict = NULL; |
58 if (!extension->manifest()->GetDictionary(keys::kTtsEngine, &tts_dict)) { | 59 if (!extension->manifest()->GetDictionary(keys::kTtsEngine, &tts_dict)) { |
59 *error = base::ASCIIToUTF16(errors::kInvalidTts); | 60 *error = base::ASCIIToUTF16(errors::kInvalidTts); |
60 return false; | 61 return false; |
61 } | 62 } |
62 | 63 |
63 if (!tts_dict->HasKey(keys::kTtsVoices)) | 64 if (!tts_dict->HasKey(keys::kTtsVoices)) |
64 return true; | 65 return true; |
65 | 66 |
66 const base::ListValue* tts_voices = NULL; | 67 const base::ListValue* tts_voices = NULL; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 147 |
147 extension->SetManifestData(keys::kTtsVoices, info.release()); | 148 extension->SetManifestData(keys::kTtsVoices, info.release()); |
148 return true; | 149 return true; |
149 } | 150 } |
150 | 151 |
151 const std::vector<std::string> TtsEngineManifestHandler::Keys() const { | 152 const std::vector<std::string> TtsEngineManifestHandler::Keys() const { |
152 return SingleKey(keys::kTtsEngine); | 153 return SingleKey(keys::kTtsEngine); |
153 } | 154 } |
154 | 155 |
155 } // namespace extensions | 156 } // namespace extensions |
OLD | NEW |