Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: chrome/browser/ui/views/ime_driver/remote_text_input_client.cc

Issue 2626983003: IME for Mus: Send TextInputClient information to IMEDriver. (Closed)
Patch Set: Addressed feedback. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 // Reduce number of log messages by logging each NOTIMPLEMENTED() only once. 5 // Reduce number of log messages by logging each NOTIMPLEMENTED() only once.
6 // This has to be before any other includes, else default is picked up. 6 // This has to be before any other includes, else default is picked up.
7 // See base/logging.h for details on this. 7 // See base/logging.h for details on this.
8 #define NOTIMPLEMENTED_POLICY 5 8 #define NOTIMPLEMENTED_POLICY 5
9 9
10 #include "chrome/browser/ui/views/ime_driver/remote_text_input_client.h" 10 #include "chrome/browser/ui/views/ime_driver/remote_text_input_client.h"
11 11
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 13
14 RemoteTextInputClient::RemoteTextInputClient( 14 RemoteTextInputClient::RemoteTextInputClient(
15 ui::mojom::TextInputClientPtr remote_client) 15 ui::mojom::TextInputClientPtr remote_client,
16 : remote_client_(std::move(remote_client)) {} 16 ui::TextInputType text_input_type,
17 ui::TextInputMode text_input_mode,
18 base::i18n::TextDirection text_direction,
19 int text_input_flags,
20 gfx::Rect caret_bounds)
21 : remote_client_(std::move(remote_client)),
22 text_input_type_(text_input_type),
23 text_input_mode_(text_input_mode),
24 text_direction_(text_direction),
25 text_input_flags_(text_input_flags),
26 caret_bounds_(caret_bounds) {}
17 27
18 RemoteTextInputClient::~RemoteTextInputClient() {} 28 RemoteTextInputClient::~RemoteTextInputClient() {}
19 29
30 void RemoteTextInputClient::SetTextInputType(
31 ui::TextInputType text_input_type) {
32 text_input_type_ = text_input_type;
33 }
34
35 void RemoteTextInputClient::SetCaretBounds(const gfx::Rect& caret_bounds) {
36 caret_bounds_ = caret_bounds;
37 }
38
20 void RemoteTextInputClient::SetCompositionText( 39 void RemoteTextInputClient::SetCompositionText(
21 const ui::CompositionText& composition) { 40 const ui::CompositionText& composition) {
22 remote_client_->SetCompositionText(composition); 41 remote_client_->SetCompositionText(composition);
23 } 42 }
24 43
25 void RemoteTextInputClient::ConfirmCompositionText() { 44 void RemoteTextInputClient::ConfirmCompositionText() {
26 remote_client_->ConfirmCompositionText(); 45 remote_client_->ConfirmCompositionText();
27 } 46 }
28 47
29 void RemoteTextInputClient::ClearCompositionText() { 48 void RemoteTextInputClient::ClearCompositionText() {
30 remote_client_->ClearCompositionText(); 49 remote_client_->ClearCompositionText();
31 } 50 }
32 51
33 void RemoteTextInputClient::InsertText(const base::string16& text) { 52 void RemoteTextInputClient::InsertText(const base::string16& text) {
34 remote_client_->InsertText(base::UTF16ToUTF8(text)); 53 remote_client_->InsertText(base::UTF16ToUTF8(text));
35 } 54 }
36 55
37 void RemoteTextInputClient::InsertChar(const ui::KeyEvent& event) { 56 void RemoteTextInputClient::InsertChar(const ui::KeyEvent& event) {
38 remote_client_->InsertChar(ui::Event::Clone(event)); 57 remote_client_->InsertChar(ui::Event::Clone(event));
39 } 58 }
40 59
41 ui::TextInputType RemoteTextInputClient::GetTextInputType() const { 60 ui::TextInputType RemoteTextInputClient::GetTextInputType() const {
42 // TODO(moshayedi): crbug.com/631527. 61 return text_input_type_;
43 NOTIMPLEMENTED();
44 return ui::TEXT_INPUT_TYPE_TEXT;
45 } 62 }
46 63
47 ui::TextInputMode RemoteTextInputClient::GetTextInputMode() const { 64 ui::TextInputMode RemoteTextInputClient::GetTextInputMode() const {
48 // TODO(moshayedi): crbug.com/631527. 65 return text_input_mode_;
49 NOTIMPLEMENTED();
50 return ui::TEXT_INPUT_MODE_DEFAULT;
51 } 66 }
52 67
53 base::i18n::TextDirection RemoteTextInputClient::GetTextDirection() const { 68 base::i18n::TextDirection RemoteTextInputClient::GetTextDirection() const {
54 // TODO(moshayedi): crbug.com/631527. 69 return text_direction_;
55 NOTIMPLEMENTED();
56 return base::i18n::UNKNOWN_DIRECTION;
57 } 70 }
58 71
59 int RemoteTextInputClient::GetTextInputFlags() const { 72 int RemoteTextInputClient::GetTextInputFlags() const {
60 // TODO(moshayedi): crbug.com/631527. 73 return text_input_flags_;
61 NOTIMPLEMENTED();
62 return 0;
63 } 74 }
64 75
65 bool RemoteTextInputClient::CanComposeInline() const { 76 bool RemoteTextInputClient::CanComposeInline() const {
66 // If we return false here, ui::InputMethodChromeOS will try to create a 77 // If we return false here, ui::InputMethodChromeOS will try to create a
67 // composition window. But here we are at IMEDriver, and composition 78 // composition window. But here we are at IMEDriver, and composition
68 // window shouldn't be created by IMEDriver. 79 // window shouldn't be created by IMEDriver.
69 return true; 80 return true;
70 } 81 }
71 82
72 gfx::Rect RemoteTextInputClient::GetCaretBounds() const { 83 gfx::Rect RemoteTextInputClient::GetCaretBounds() const {
73 // TODO(moshayedi): crbug.com/631527. 84 return caret_bounds_;
74 NOTIMPLEMENTED();
75 return gfx::Rect();
76 } 85 }
77 86
78 bool RemoteTextInputClient::GetCompositionCharacterBounds( 87 bool RemoteTextInputClient::GetCompositionCharacterBounds(
79 uint32_t index, 88 uint32_t index,
80 gfx::Rect* rect) const { 89 gfx::Rect* rect) const {
81 // TODO(moshayedi): crbug.com/631527. 90 // TODO(moshayedi): crbug.com/631527.
82 NOTIMPLEMENTED(); 91 NOTIMPLEMENTED();
83 return false; 92 return false;
84 } 93 }
85 94
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // TODO(moshayedi): crbug.com/631527. 163 // TODO(moshayedi): crbug.com/631527.
155 NOTIMPLEMENTED(); 164 NOTIMPLEMENTED();
156 return false; 165 return false;
157 } 166 }
158 167
159 void RemoteTextInputClient::SetTextEditCommandForNextKeyEvent( 168 void RemoteTextInputClient::SetTextEditCommandForNextKeyEvent(
160 ui::TextEditCommand command) { 169 ui::TextEditCommand command) {
161 // TODO(moshayedi): crbug.com/631527. 170 // TODO(moshayedi): crbug.com/631527.
162 NOTIMPLEMENTED(); 171 NOTIMPLEMENTED();
163 } 172 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698