| OLD | NEW |
| 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::TextInputClientInformationPtr client_info, |
| 15 ui::mojom::TextInputClientPtr remote_client) | 16 ui::mojom::TextInputClientPtr remote_client) |
| 16 : remote_client_(std::move(remote_client)) {} | 17 : remote_client_(std::move(remote_client)), |
| 18 text_input_type_(client_info->text_input_type), |
| 19 text_input_mode_(client_info->text_input_mode), |
| 20 text_direction_(client_info->text_direction), |
| 21 text_input_flags_(client_info->text_input_flags), |
| 22 caret_bounds_(client_info->caret_bounds) {} |
| 17 | 23 |
| 18 RemoteTextInputClient::~RemoteTextInputClient() {} | 24 RemoteTextInputClient::~RemoteTextInputClient() {} |
| 19 | 25 |
| 26 void RemoteTextInputClient::SetTextInputType( |
| 27 ui::TextInputType text_input_type) { |
| 28 text_input_type_ = text_input_type; |
| 29 } |
| 30 |
| 31 void RemoteTextInputClient::SetCaretBounds(const gfx::Rect& caret_bounds) { |
| 32 caret_bounds_ = caret_bounds; |
| 33 } |
| 34 |
| 20 void RemoteTextInputClient::SetCompositionText( | 35 void RemoteTextInputClient::SetCompositionText( |
| 21 const ui::CompositionText& composition) { | 36 const ui::CompositionText& composition) { |
| 22 remote_client_->SetCompositionText(composition); | 37 remote_client_->SetCompositionText(composition); |
| 23 } | 38 } |
| 24 | 39 |
| 25 void RemoteTextInputClient::ConfirmCompositionText() { | 40 void RemoteTextInputClient::ConfirmCompositionText() { |
| 26 remote_client_->ConfirmCompositionText(); | 41 remote_client_->ConfirmCompositionText(); |
| 27 } | 42 } |
| 28 | 43 |
| 29 void RemoteTextInputClient::ClearCompositionText() { | 44 void RemoteTextInputClient::ClearCompositionText() { |
| 30 remote_client_->ClearCompositionText(); | 45 remote_client_->ClearCompositionText(); |
| 31 } | 46 } |
| 32 | 47 |
| 33 void RemoteTextInputClient::InsertText(const base::string16& text) { | 48 void RemoteTextInputClient::InsertText(const base::string16& text) { |
| 34 remote_client_->InsertText(base::UTF16ToUTF8(text)); | 49 remote_client_->InsertText(base::UTF16ToUTF8(text)); |
| 35 } | 50 } |
| 36 | 51 |
| 37 void RemoteTextInputClient::InsertChar(const ui::KeyEvent& event) { | 52 void RemoteTextInputClient::InsertChar(const ui::KeyEvent& event) { |
| 38 remote_client_->InsertChar(ui::Event::Clone(event)); | 53 remote_client_->InsertChar(ui::Event::Clone(event)); |
| 39 } | 54 } |
| 40 | 55 |
| 41 ui::TextInputType RemoteTextInputClient::GetTextInputType() const { | 56 ui::TextInputType RemoteTextInputClient::GetTextInputType() const { |
| 42 // TODO(moshayedi): crbug.com/631527. | 57 return text_input_type_; |
| 43 NOTIMPLEMENTED(); | |
| 44 return ui::TEXT_INPUT_TYPE_TEXT; | |
| 45 } | 58 } |
| 46 | 59 |
| 47 ui::TextInputMode RemoteTextInputClient::GetTextInputMode() const { | 60 ui::TextInputMode RemoteTextInputClient::GetTextInputMode() const { |
| 48 // TODO(moshayedi): crbug.com/631527. | 61 return text_input_mode_; |
| 49 NOTIMPLEMENTED(); | |
| 50 return ui::TEXT_INPUT_MODE_DEFAULT; | |
| 51 } | 62 } |
| 52 | 63 |
| 53 base::i18n::TextDirection RemoteTextInputClient::GetTextDirection() const { | 64 base::i18n::TextDirection RemoteTextInputClient::GetTextDirection() const { |
| 54 // TODO(moshayedi): crbug.com/631527. | 65 return text_direction_; |
| 55 NOTIMPLEMENTED(); | |
| 56 return base::i18n::UNKNOWN_DIRECTION; | |
| 57 } | 66 } |
| 58 | 67 |
| 59 int RemoteTextInputClient::GetTextInputFlags() const { | 68 int RemoteTextInputClient::GetTextInputFlags() const { |
| 60 // TODO(moshayedi): crbug.com/631527. | 69 return text_input_flags_; |
| 61 NOTIMPLEMENTED(); | |
| 62 return 0; | |
| 63 } | 70 } |
| 64 | 71 |
| 65 bool RemoteTextInputClient::CanComposeInline() const { | 72 bool RemoteTextInputClient::CanComposeInline() const { |
| 66 // If we return false here, ui::InputMethodChromeOS will try to create a | 73 // If we return false here, ui::InputMethodChromeOS will try to create a |
| 67 // composition window. But here we are at IMEDriver, and composition | 74 // composition window. But here we are at IMEDriver, and composition |
| 68 // window shouldn't be created by IMEDriver. | 75 // window shouldn't be created by IMEDriver. |
| 69 return true; | 76 return true; |
| 70 } | 77 } |
| 71 | 78 |
| 72 gfx::Rect RemoteTextInputClient::GetCaretBounds() const { | 79 gfx::Rect RemoteTextInputClient::GetCaretBounds() const { |
| 73 // TODO(moshayedi): crbug.com/631527. | 80 return caret_bounds_; |
| 74 NOTIMPLEMENTED(); | |
| 75 return gfx::Rect(); | |
| 76 } | 81 } |
| 77 | 82 |
| 78 bool RemoteTextInputClient::GetCompositionCharacterBounds( | 83 bool RemoteTextInputClient::GetCompositionCharacterBounds( |
| 79 uint32_t index, | 84 uint32_t index, |
| 80 gfx::Rect* rect) const { | 85 gfx::Rect* rect) const { |
| 81 // TODO(moshayedi): crbug.com/631527. | 86 // TODO(moshayedi): crbug.com/631527. |
| 82 NOTIMPLEMENTED(); | 87 NOTIMPLEMENTED(); |
| 83 return false; | 88 return false; |
| 84 } | 89 } |
| 85 | 90 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // TODO(moshayedi): crbug.com/631527. | 159 // TODO(moshayedi): crbug.com/631527. |
| 155 NOTIMPLEMENTED(); | 160 NOTIMPLEMENTED(); |
| 156 return false; | 161 return false; |
| 157 } | 162 } |
| 158 | 163 |
| 159 void RemoteTextInputClient::SetTextEditCommandForNextKeyEvent( | 164 void RemoteTextInputClient::SetTextEditCommandForNextKeyEvent( |
| 160 ui::TextEditCommand command) { | 165 ui::TextEditCommand command) { |
| 161 // TODO(moshayedi): crbug.com/631527. | 166 // TODO(moshayedi): crbug.com/631527. |
| 162 NOTIMPLEMENTED(); | 167 NOTIMPLEMENTED(); |
| 163 } | 168 } |
| OLD | NEW |