| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_DESCRIPTOR_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_DESCRIPTOR_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 #include <vector> |
| 11 |
| 12 #include "base/basictypes.h" |
| 13 |
| 14 namespace chromeos { |
| 15 namespace input_method { |
| 16 |
| 17 class InputMethodWhitelist; |
| 18 |
| 19 // A structure which represents an input method. |
| 20 class InputMethodDescriptor { |
| 21 public: |
| 22 InputMethodDescriptor(); |
| 23 InputMethodDescriptor(const InputMethodWhitelist& whitelist, |
| 24 const std::string& in_id, |
| 25 const std::string& in_name, |
| 26 const std::string& in_raw_layout, |
| 27 const std::string& in_language_code); |
| 28 ~InputMethodDescriptor(); |
| 29 |
| 30 bool operator==(const InputMethodDescriptor& other) const { |
| 31 return id() == other.id(); |
| 32 } |
| 33 |
| 34 // Debug print function. |
| 35 std::string ToString() const; |
| 36 |
| 37 const std::string& id() const { return id_; } |
| 38 const std::string& name() const { return name_; } |
| 39 const std::string& keyboard_layout() const { return keyboard_layout_; } |
| 40 const std::vector<std::string>& virtual_keyboard_layouts() const { |
| 41 return virtual_keyboard_layouts_; |
| 42 } |
| 43 const std::string& language_code() const { return language_code_; } |
| 44 |
| 45 // Returns the fallback input method descriptor (the very basic US |
| 46 // keyboard). This function is mostly used for testing, but may be used |
| 47 // as the fallback, when there is no other choice. |
| 48 static InputMethodDescriptor GetFallbackInputMethodDescriptor(); |
| 49 |
| 50 private: |
| 51 // For GetFallbackInputMethodDescriptor(). Use the public constructor instead. |
| 52 InputMethodDescriptor(const std::string& in_id, |
| 53 const std::string& in_name, |
| 54 const std::string& in_keyboard_layout, |
| 55 const std::string& in_virtual_keyboard_layouts, |
| 56 const std::string& in_language_code); |
| 57 |
| 58 // An ID that identifies an input method engine (e.g., "t:latn-post", |
| 59 // "pinyin", "hangul"). |
| 60 std::string id_; |
| 61 // A name used to specify the user-visible name of this input method. It is |
| 62 // only used by extension IMEs, and should be blank for internal IMEs. |
| 63 std::string name_; |
| 64 // A preferred physical keyboard layout for the input method (e.g., "us", |
| 65 // "us(dvorak)", "jp"). Comma separated layout names do NOT appear. |
| 66 std::string keyboard_layout_; |
| 67 // Preferred virtual keyboard layouts for the input method. Comma separated |
| 68 // layout names in order of priority, such as "handwriting,us", could appear. |
| 69 std::vector<std::string> virtual_keyboard_layouts_; |
| 70 // Language code like "ko", "ja", "en-US", and "zh-CN". |
| 71 std::string language_code_; |
| 72 }; |
| 73 |
| 74 typedef std::vector<InputMethodDescriptor> InputMethodDescriptors; |
| 75 |
| 76 } // namespace input_method |
| 77 } // namespace chromeos |
| 78 |
| 79 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_DESCRIPTOR_H_ |
| OLD | NEW |