Add kSupportedVersion constant to net::websockets
[chromium-blink-merge.git] / chromeos / ime / input_method_whitelist.cc
blobc6cd097eaf059e5768934cf1c3480ec57324b9bb
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 "base/strings/string_util.h"
10 #include "chromeos/ime/input_method_descriptor.h"
11 #include "chromeos/ime/input_methods.h"
13 namespace chromeos {
14 namespace input_method {
16 const char kLanguageDelimiter[] = ",";
18 InputMethodWhitelist::InputMethodWhitelist() {
19 for (size_t i = 0; i < arraysize(kInputMethods); ++i) {
20 supported_input_methods_.insert(kInputMethods[i].input_method_id);
24 InputMethodWhitelist::~InputMethodWhitelist() {
27 bool InputMethodWhitelist::InputMethodIdIsWhitelisted(
28 const std::string& input_method_id) const {
29 return supported_input_methods_.count(input_method_id) > 0;
32 scoped_ptr<InputMethodDescriptors>
33 InputMethodWhitelist::GetSupportedInputMethods() const {
34 scoped_ptr<InputMethodDescriptors> input_methods(new InputMethodDescriptors);
35 input_methods->reserve(arraysize(kInputMethods));
36 for (size_t i = 0; i < arraysize(kInputMethods); ++i) {
37 std::vector<std::string> layouts;
38 layouts.push_back(kInputMethods[i].xkb_layout_id);
40 std::vector<std::string> languages;
41 Tokenize(kInputMethods[i].language_code, kLanguageDelimiter, &languages);
42 DCHECK(!languages.empty());
44 input_methods->push_back(InputMethodDescriptor(
45 kInputMethods[i].input_method_id,
46 "",
47 layouts,
48 languages,
49 kInputMethods[i].is_login_keyboard,
50 GURL(), // options page url.
51 GURL() // input view page url.
52 ));
54 return input_methods.Pass();
57 } // namespace input_method
58 } // namespace chromeos