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 #ifndef CHROMEOS_IME_INPUT_METHOD_DESCRIPTOR_H_ | 5 #ifndef CHROMEOS_IME_INPUT_METHOD_DESCRIPTOR_H_ |
6 #define CHROMEOS_IME_INPUT_METHOD_DESCRIPTOR_H_ | 6 #define CHROMEOS_IME_INPUT_METHOD_DESCRIPTOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "chromeos/chromeos_export.h" | 12 #include "chromeos/chromeos_export.h" |
13 | 13 |
14 namespace chromeos { | 14 namespace chromeos { |
15 namespace input_method { | 15 namespace input_method { |
16 | 16 |
17 class InputMethodWhitelist; | |
18 | |
19 // A structure which represents an input method. | 17 // A structure which represents an input method. |
20 class CHROMEOS_EXPORT InputMethodDescriptor { | 18 class CHROMEOS_EXPORT InputMethodDescriptor { |
21 public: | 19 public: |
22 InputMethodDescriptor(); | 20 InputMethodDescriptor(); |
23 InputMethodDescriptor(const std::string& id, | 21 InputMethodDescriptor(const std::string& id, |
24 const std::string& name, | 22 const std::string& name, |
25 const std::string& keyboard_layout, | 23 const std::vector<std::string>& keyboard_layouts, |
26 const std::string& language_code, | 24 const std::string& language_code, |
27 const std::string& options_page_url); | 25 const std::string& options_page_url); |
28 ~InputMethodDescriptor(); | 26 ~InputMethodDescriptor(); |
29 | 27 |
| 28 // Accessors |
30 const std::string& id() const { return id_; } | 29 const std::string& id() const { return id_; } |
31 const std::string& name() const { return name_; } | 30 const std::string& name() const { return name_; } |
32 const std::string& keyboard_layout() const { return keyboard_layout_; } | |
33 const std::string& language_code() const { return language_code_; } | 31 const std::string& language_code() const { return language_code_; } |
34 const std::string& options_page_url() const { return options_page_url_; } | 32 const std::string& options_page_url() const { return options_page_url_; } |
| 33 const std::vector<std::string>& keyboard_layouts() const { |
| 34 return keyboard_layouts_; |
| 35 } |
| 36 |
| 37 // Returns preferred keyboard layout. |
| 38 std::string GetPreferredKeyboardLayout() const; |
35 | 39 |
36 private: | 40 private: |
37 // An ID that identifies an input method engine (e.g., "t:latn-post", | 41 // An ID that identifies an input method engine (e.g., "t:latn-post", |
38 // "pinyin", "hangul"). | 42 // "pinyin", "hangul"). |
39 std::string id_; | 43 std::string id_; |
| 44 |
40 // A name used to specify the user-visible name of this input method. It is | 45 // A name used to specify the user-visible name of this input method. It is |
41 // only used by extension IMEs, and should be blank for internal IMEs. | 46 // only used by extension IMEs, and should be blank for internal IMEs. |
42 std::string name_; | 47 std::string name_; |
| 48 |
43 // A preferred physical keyboard layout for the input method (e.g., "us", | 49 // A preferred physical keyboard layout for the input method (e.g., "us", |
44 // "us(dvorak)", "jp"). Comma separated layout names do NOT appear. | 50 // "us(dvorak)", "jp"). Comma separated layout names do NOT appear. |
45 std::string keyboard_layout_; | 51 std::vector<std::string> keyboard_layouts_; |
| 52 |
46 // Language code like "ko", "ja", "en-US", and "zh-CN". | 53 // Language code like "ko", "ja", "en-US", and "zh-CN". |
47 std::string language_code_; | 54 std::string language_code_; |
| 55 |
48 // Options page URL e.g. | 56 // Options page URL e.g. |
49 // "chrome-extension://ceaajjmckiakobniehbjpdcidfpohlin/options.html". | 57 // "chrome-extension://ceaajjmckiakobniehbjpdcidfpohlin/options.html". |
50 // We can't use GURL here due to dependency policy. This field is valid only | 58 // We can't use GURL here due to dependency policy. This field is valid only |
51 // for input method extension. | 59 // for input method extension. |
52 std::string options_page_url_; | 60 std::string options_page_url_; |
53 }; | 61 }; |
54 | 62 |
55 typedef std::vector<InputMethodDescriptor> InputMethodDescriptors; | 63 typedef std::vector<InputMethodDescriptor> InputMethodDescriptors; |
56 | 64 |
57 } // namespace input_method | 65 } // namespace input_method |
58 } // namespace chromeos | 66 } // namespace chromeos |
59 | 67 |
60 #endif // CHROMEOS_IME_INPUT_METHOD_DESCRIPTOR_H_ | 68 #endif // CHROMEOS_IME_INPUT_METHOD_DESCRIPTOR_H_ |
OLD | NEW |