File: input_method_descriptor.h

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (95 lines) | stat: -rw-r--r-- 3,412 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_BASE_IME_ASH_INPUT_METHOD_DESCRIPTOR_H_
#define UI_BASE_IME_ASH_INPUT_METHOD_DESCRIPTOR_H_

#include <optional>
#include <string>
#include <vector>

#include "base/component_export.h"
#include "url/gurl.h"

namespace ash {
namespace input_method {

// A structure which represents an input method.
class COMPONENT_EXPORT(UI_BASE_IME_ASH) InputMethodDescriptor {
 public:
  InputMethodDescriptor();
  InputMethodDescriptor(const std::string& id,
                        const std::string& name,
                        const std::string& indicator,
                        const std::string& keyboard_layout,
                        const std::vector<std::string>& language_codes,
                        bool is_login_keyboard,
                        const GURL& options_page_url,
                        const GURL& input_view_url,
                        const std::optional<std::string>& handwriting_language);
  InputMethodDescriptor(const InputMethodDescriptor& other);
  ~InputMethodDescriptor();

  // Accessors
  const std::string& id() const { return id_; }
  const std::string& name() const { return name_; }
  const std::string& indicator() const { return indicator_; }
  const std::vector<std::string>& language_codes() const {
    return language_codes_;
  }
  const GURL& options_page_url() const { return options_page_url_; }
  const GURL& input_view_url() const { return input_view_url_; }
  const std::string& keyboard_layout() const { return keyboard_layout_; }
  bool is_login_keyboard() const { return is_login_keyboard_; }
  const std::optional<std::string>& handwriting_language() const {
    return handwriting_language_;
  }

  std::u16string GetIndicator() const;

 private:
  // An ID that identifies an input method engine (e.g., "t:latn-post",
  // "pinyin", "hangul").
  std::string id_;

  // A name used to specify the user-visible name of this input method.  It is
  // only used by extension IMEs, and should be blank for internal IMEs.
  std::string name_;

  // A physical keyboard XKB layout for the input method (e.g., "us",
  // "us(dvorak)", "jp"). Comma separated layout names do NOT appear.
  std::string keyboard_layout_;

  // Language code like "ko", "ja", "en-US", and "zh-CN".
  std::vector<std::string> language_codes_;

  // A short indicator string that is displayed when the input method
  // is selected, like "US".
  std::string indicator_;

  // True if this input method can be used on login screen.
  bool is_login_keyboard_;

  // Options page URL e.g.
  // "chrome-extension://ceaajjmckiakobniehbjpdcidfpohlin/options.html".
  // This field is valid only for input method extension.
  GURL options_page_url_;

  // Input View URL e.g.
  // "chrome-extension://ceaajjmckiakobniehbjpdcidfpohlin/my_input_view.html".
  // This field is valid only for input method extension.
  GURL input_view_url_;

  // An ID that identifies a handwriting model language ID for this input
  // method, like "en" or "ja".
  // This field is valid only for 1P Google ChromeOS input methods.
  std::optional<std::string> handwriting_language_;
};

using InputMethodDescriptors = std::vector<InputMethodDescriptor>;

}  // namespace input_method
}  // namespace ash

#endif  // UI_BASE_IME_ASH_INPUT_METHOD_DESCRIPTOR_H_