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