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/input_ime/input_components_handler.h" | 5 #include "chrome/common/extensions/api/input_ime/input_components_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/string_util.h" | 12 #include "base/strings/string_util.h" |
12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
13 #include "base/values.h" | 14 #include "base/values.h" |
14 #include "extensions/common/error_utils.h" | 15 #include "extensions/common/error_utils.h" |
15 #include "extensions/common/extension.h" | 16 #include "extensions/common/extension.h" |
16 #include "extensions/common/manifest.h" | 17 #include "extensions/common/manifest.h" |
17 #include "extensions/common/manifest_constants.h" | 18 #include "extensions/common/manifest_constants.h" |
18 #include "extensions/common/manifest_handlers/options_page_info.h" | 19 #include "extensions/common/manifest_handlers/options_page_info.h" |
19 | 20 |
(...skipping 26 matching lines...) Expand all Loading... |
46 } | 47 } |
47 | 48 |
48 InputComponentsHandler::InputComponentsHandler() { | 49 InputComponentsHandler::InputComponentsHandler() { |
49 } | 50 } |
50 | 51 |
51 InputComponentsHandler::~InputComponentsHandler() { | 52 InputComponentsHandler::~InputComponentsHandler() { |
52 } | 53 } |
53 | 54 |
54 bool InputComponentsHandler::Parse(Extension* extension, | 55 bool InputComponentsHandler::Parse(Extension* extension, |
55 base::string16* error) { | 56 base::string16* error) { |
56 scoped_ptr<InputComponents> info(new InputComponents); | 57 std::unique_ptr<InputComponents> info(new InputComponents); |
57 const base::ListValue* list_value = NULL; | 58 const base::ListValue* list_value = NULL; |
58 if (!extension->manifest()->GetList(keys::kInputComponents, &list_value)) { | 59 if (!extension->manifest()->GetList(keys::kInputComponents, &list_value)) { |
59 *error = base::ASCIIToUTF16(errors::kInvalidInputComponents); | 60 *error = base::ASCIIToUTF16(errors::kInvalidInputComponents); |
60 return false; | 61 return false; |
61 } | 62 } |
62 for (size_t i = 0; i < list_value->GetSize(); ++i) { | 63 for (size_t i = 0; i < list_value->GetSize(); ++i) { |
63 const base::DictionaryValue* module_value = NULL; | 64 const base::DictionaryValue* module_value = NULL; |
64 std::string name_str; | 65 std::string name_str; |
65 InputComponentType type; | 66 InputComponentType type; |
66 std::string id_str; | 67 std::string id_str; |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 const std::vector<std::string> | 239 const std::vector<std::string> |
239 InputComponentsHandler::PrerequisiteKeys() const { | 240 InputComponentsHandler::PrerequisiteKeys() const { |
240 return SingleKey(keys::kOptionsPage); | 241 return SingleKey(keys::kOptionsPage); |
241 } | 242 } |
242 | 243 |
243 const std::vector<std::string> InputComponentsHandler::Keys() const { | 244 const std::vector<std::string> InputComponentsHandler::Keys() const { |
244 return SingleKey(keys::kInputComponents); | 245 return SingleKey(keys::kInputComponents); |
245 } | 246 } |
246 | 247 |
247 } // namespace extensions | 248 } // namespace extensions |
OLD | NEW |