OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 "ui/base/ime/chromeos/input_method_whitelist.h" | 5 #include "ui/base/ime/chromeos/input_method_whitelist.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 } | 27 } |
28 | 28 |
29 InputMethodWhitelist::~InputMethodWhitelist() { | 29 InputMethodWhitelist::~InputMethodWhitelist() { |
30 } | 30 } |
31 | 31 |
32 bool InputMethodWhitelist::InputMethodIdIsWhitelisted( | 32 bool InputMethodWhitelist::InputMethodIdIsWhitelisted( |
33 const std::string& input_method_id) const { | 33 const std::string& input_method_id) const { |
34 return supported_input_methods_.count(input_method_id) > 0; | 34 return supported_input_methods_.count(input_method_id) > 0; |
35 } | 35 } |
36 | 36 |
37 scoped_ptr<InputMethodDescriptors> | 37 std::unique_ptr<InputMethodDescriptors> |
38 InputMethodWhitelist::GetSupportedInputMethods() const { | 38 InputMethodWhitelist::GetSupportedInputMethods() const { |
39 scoped_ptr<InputMethodDescriptors> input_methods(new InputMethodDescriptors); | 39 std::unique_ptr<InputMethodDescriptors> input_methods( |
| 40 new InputMethodDescriptors); |
40 input_methods->reserve(arraysize(kInputMethods)); | 41 input_methods->reserve(arraysize(kInputMethods)); |
41 for (size_t i = 0; i < arraysize(kInputMethods); ++i) { | 42 for (size_t i = 0; i < arraysize(kInputMethods); ++i) { |
42 std::vector<std::string> layouts; | 43 std::vector<std::string> layouts; |
43 layouts.push_back(kInputMethods[i].xkb_layout_id); | 44 layouts.push_back(kInputMethods[i].xkb_layout_id); |
44 | 45 |
45 std::vector<std::string> languages = base::SplitString( | 46 std::vector<std::string> languages = base::SplitString( |
46 kInputMethods[i].language_code, kLanguageDelimiter, | 47 kInputMethods[i].language_code, kLanguageDelimiter, |
47 base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | 48 base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
48 DCHECK(!languages.empty()); | 49 DCHECK(!languages.empty()); |
49 | 50 |
50 input_methods->push_back(InputMethodDescriptor( | 51 input_methods->push_back(InputMethodDescriptor( |
51 extension_ime_util::GetInputMethodIDByEngineID( | 52 extension_ime_util::GetInputMethodIDByEngineID( |
52 kInputMethods[i].input_method_id), | 53 kInputMethods[i].input_method_id), |
53 "", | 54 "", |
54 kInputMethods[i].indicator, | 55 kInputMethods[i].indicator, |
55 layouts, | 56 layouts, |
56 languages, | 57 languages, |
57 kInputMethods[i].is_login_keyboard, | 58 kInputMethods[i].is_login_keyboard, |
58 GURL(), // options page url. | 59 GURL(), // options page url. |
59 GURL() // input view page url. | 60 GURL() // input view page url. |
60 )); | 61 )); |
61 } | 62 } |
62 return input_methods; | 63 return input_methods; |
63 } | 64 } |
64 | 65 |
65 } // namespace input_method | 66 } // namespace input_method |
66 } // namespace chromeos | 67 } // namespace chromeos |
OLD | NEW |