Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / base / ime / chromeos / composition_text_chromeos.h
blob3350b0e09871f7749785ad65c43d3b5e6a066386
1 // Copyright 2014 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.
5 #ifndef UI_BASE_IME_CHROMEOS_COMPOSITION_TEXT_CHROMEOS_H_
6 #define UI_BASE_IME_CHROMEOS_COMPOSITION_TEXT_CHROMEOS_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/strings/string16.h"
13 #include "ui/base/ime/ui_base_ime_export.h"
15 namespace chromeos {
17 class UI_BASE_IME_EXPORT CompositionText {
18 public:
19 enum UnderlineType {
20 COMPOSITION_TEXT_UNDERLINE_SINGLE = 1,
21 COMPOSITION_TEXT_UNDERLINE_DOUBLE = 2,
22 COMPOSITION_TEXT_UNDERLINE_NONE = 4,
23 COMPOSITION_TEXT_UNDERLINE_ERROR = 8,
26 struct UnderlineAttribute {
27 UnderlineType type;
28 uint32 start_index; // The inclusive start index.
29 uint32 end_index; // The exclusive end index.
32 CompositionText();
33 virtual ~CompositionText();
35 // Accessors
36 const base::string16& text() const { return text_; }
37 void set_text(const base::string16& text) { text_ = text; }
39 const std::vector<UnderlineAttribute>& underline_attributes() const {
40 return underline_attributes_;
43 std::vector<UnderlineAttribute>* mutable_underline_attributes() {
44 return &underline_attributes_;
47 uint32 selection_start() const { return selection_start_; }
48 void set_selection_start(uint32 selection_start) {
49 selection_start_ = selection_start;
52 uint32 selection_end() const { return selection_end_; }
53 void set_selection_end(uint32 selection_end) {
54 selection_end_ = selection_end;
57 void CopyFrom(const CompositionText& obj);
59 private:
60 base::string16 text_;
61 std::vector<UnderlineAttribute> underline_attributes_;
62 uint32 selection_start_;
63 uint32 selection_end_;
65 DISALLOW_COPY_AND_ASSIGN(CompositionText);
68 } // namespace chromeos
70 #endif // UI_BASE_IME_CHROMEOS_COMPOSITION_TEXT_CHROMEOS_H_