Roll v8-i18n 181:182.
[chromium-blink-merge.git] / chromeos / ime / input_method_whitelist.cc
blob0f9078746a4ddac7220385e3c8d0608107610aef
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chromeos/ime/input_method_whitelist.h"
7 #include <vector>
9 #include "chromeos/ime/input_method_descriptor.h"
10 #include "chromeos/ime/input_methods.h"
12 namespace chromeos {
13 namespace input_method {
15 InputMethodWhitelist::InputMethodWhitelist() {
16 for (size_t i = 0; i < arraysize(kInputMethods); ++i) {
17 supported_input_methods_.insert(kInputMethods[i].input_method_id);
21 InputMethodWhitelist::~InputMethodWhitelist() {
24 bool InputMethodWhitelist::InputMethodIdIsWhitelisted(
25 const std::string& input_method_id) const {
26 return supported_input_methods_.count(input_method_id) > 0;
29 scoped_ptr<InputMethodDescriptors>
30 InputMethodWhitelist::GetSupportedInputMethods() const {
31 scoped_ptr<InputMethodDescriptors> input_methods(new InputMethodDescriptors);
32 input_methods->reserve(arraysize(kInputMethods));
33 for (size_t i = 0; i < arraysize(kInputMethods); ++i) {
34 std::vector<std::string> layouts;
35 layouts.push_back(kInputMethods[i].xkb_layout_id);
37 input_methods->push_back(InputMethodDescriptor(
38 kInputMethods[i].input_method_id,
39 "",
40 layouts,
41 kInputMethods[i].language_code,
42 GURL())); // options page url, not available for non-extension input
43 // method.
45 return input_methods.Pass();
48 } // namespace input_method
49 } // namespace chromeos