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 <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 errors::kInvalidInputComponentDescription, | 117 errors::kInvalidInputComponentDescription, |
118 base::IntToString(i)); | 118 base::IntToString(i)); |
119 return false; | 119 return false; |
120 } | 120 } |
121 | 121 |
122 // Get input_components[i].language. | 122 // Get input_components[i].language. |
123 // Both string and list of string are allowed to be compatibile with old | 123 // Both string and list of string are allowed to be compatibile with old |
124 // input_ime manifest specification. | 124 // input_ime manifest specification. |
125 const base::Value* language_value = NULL; | 125 const base::Value* language_value = NULL; |
126 if (module_value->Get(keys::kLanguage, &language_value)) { | 126 if (module_value->Get(keys::kLanguage, &language_value)) { |
127 if (language_value->GetType() == base::Value::TYPE_STRING) { | 127 if (language_value->GetType() == base::Value::Type::STRING) { |
128 std::string language_str; | 128 std::string language_str; |
129 language_value->GetAsString(&language_str); | 129 language_value->GetAsString(&language_str); |
130 languages.insert(language_str); | 130 languages.insert(language_str); |
131 } else if (language_value->GetType() == base::Value::TYPE_LIST) { | 131 } else if (language_value->GetType() == base::Value::Type::LIST) { |
132 const base::ListValue* language_list = NULL; | 132 const base::ListValue* language_list = NULL; |
133 language_value->GetAsList(&language_list); | 133 language_value->GetAsList(&language_list); |
134 for (size_t j = 0; j < language_list->GetSize(); ++j) { | 134 for (size_t j = 0; j < language_list->GetSize(); ++j) { |
135 std::string language_str; | 135 std::string language_str; |
136 if (language_list->GetString(j, &language_str)) | 136 if (language_list->GetString(j, &language_str)) |
137 languages.insert(language_str); | 137 languages.insert(language_str); |
138 } | 138 } |
139 } | 139 } |
140 } | 140 } |
141 | 141 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 const std::vector<std::string> | 239 const std::vector<std::string> |
240 InputComponentsHandler::PrerequisiteKeys() const { | 240 InputComponentsHandler::PrerequisiteKeys() const { |
241 return SingleKey(keys::kOptionsPage); | 241 return SingleKey(keys::kOptionsPage); |
242 } | 242 } |
243 | 243 |
244 const std::vector<std::string> InputComponentsHandler::Keys() const { | 244 const std::vector<std::string> InputComponentsHandler::Keys() const { |
245 return SingleKey(keys::kInputComponents); | 245 return SingleKey(keys::kInputComponents); |
246 } | 246 } |
247 | 247 |
248 } // namespace extensions | 248 } // namespace extensions |
OLD | NEW |