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 "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/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/common/extensions/manifest_url_handler.h" | |
13 #include "extensions/common/error_utils.h" | 12 #include "extensions/common/error_utils.h" |
14 #include "extensions/common/extension.h" | 13 #include "extensions/common/extension.h" |
15 #include "extensions/common/manifest.h" | 14 #include "extensions/common/manifest.h" |
16 #include "extensions/common/manifest_constants.h" | 15 #include "extensions/common/manifest_constants.h" |
| 16 #include "extensions/common/manifest_handlers/options_page_info.h" |
17 | 17 |
18 namespace extensions { | 18 namespace extensions { |
19 | 19 |
20 namespace keys = manifest_keys; | 20 namespace keys = manifest_keys; |
21 namespace errors = manifest_errors; | 21 namespace errors = manifest_errors; |
22 | 22 |
23 InputComponentInfo::InputComponentInfo() | 23 InputComponentInfo::InputComponentInfo() |
24 : type(INPUT_COMPONENT_TYPE_NONE), | 24 : type(INPUT_COMPONENT_TYPE_NONE), |
25 shortcut_alt(false), | 25 shortcut_alt(false), |
26 shortcut_ctrl(false), | 26 shortcut_ctrl(false), |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 if (module_value->GetString(keys::kImeOptionsPage, &options_page_str)) { | 201 if (module_value->GetString(keys::kImeOptionsPage, &options_page_str)) { |
202 options_page_url = extension->GetResourceURL(options_page_str); | 202 options_page_url = extension->GetResourceURL(options_page_str); |
203 if (!options_page_url.is_valid()) { | 203 if (!options_page_url.is_valid()) { |
204 *error = ErrorUtils::FormatErrorMessageUTF16( | 204 *error = ErrorUtils::FormatErrorMessageUTF16( |
205 errors::kInvalidOptionsPage, | 205 errors::kInvalidOptionsPage, |
206 base::IntToString(i)); | 206 base::IntToString(i)); |
207 return false; | 207 return false; |
208 } | 208 } |
209 } else { | 209 } else { |
210 // Fall back to extension's options page for backward compatibility. | 210 // Fall back to extension's options page for backward compatibility. |
211 options_page_url = extensions::ManifestURL::GetOptionsPage(extension); | 211 options_page_url = extensions::OptionsPageInfo::GetOptionsPage(extension); |
212 } | 212 } |
213 | 213 |
214 info->input_components.push_back(InputComponentInfo()); | 214 info->input_components.push_back(InputComponentInfo()); |
215 info->input_components.back().name = name_str; | 215 info->input_components.back().name = name_str; |
216 info->input_components.back().type = type; | 216 info->input_components.back().type = type; |
217 info->input_components.back().id = id_str; | 217 info->input_components.back().id = id_str; |
218 info->input_components.back().description = description_str; | 218 info->input_components.back().description = description_str; |
219 info->input_components.back().languages = languages; | 219 info->input_components.back().languages = languages; |
220 info->input_components.back().layouts.insert(layouts.begin(), | 220 info->input_components.back().layouts.insert(layouts.begin(), |
221 layouts.end()); | 221 layouts.end()); |
(...skipping 11 matching lines...) Expand all Loading... |
233 const std::vector<std::string> | 233 const std::vector<std::string> |
234 InputComponentsHandler::PrerequisiteKeys() const { | 234 InputComponentsHandler::PrerequisiteKeys() const { |
235 return SingleKey(keys::kOptionsPage); | 235 return SingleKey(keys::kOptionsPage); |
236 } | 236 } |
237 | 237 |
238 const std::vector<std::string> InputComponentsHandler::Keys() const { | 238 const std::vector<std::string> InputComponentsHandler::Keys() const { |
239 return SingleKey(keys::kInputComponents); | 239 return SingleKey(keys::kInputComponents); |
240 } | 240 } |
241 | 241 |
242 } // namespace extensions | 242 } // namespace extensions |
OLD | NEW |