OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 #include "ui/views/mus/input_method_mus.h" | 5 #include "ui/views/mus/input_method_mus.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "services/ui/public/cpp/window.h" | 9 #include "services/ui/public/cpp/window.h" |
10 #include "services/ui/public/interfaces/constants.mojom.h" | 10 #include "services/ui/public/interfaces/constants.mojom.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 116 } |
117 | 117 |
118 void InputMethodMus::OnDidChangeFocusedClient( | 118 void InputMethodMus::OnDidChangeFocusedClient( |
119 ui::TextInputClient* focused_before, | 119 ui::TextInputClient* focused_before, |
120 ui::TextInputClient* focused) { | 120 ui::TextInputClient* focused) { |
121 InputMethodBase::OnDidChangeFocusedClient(focused_before, focused); | 121 InputMethodBase::OnDidChangeFocusedClient(focused_before, focused); |
122 UpdateTextInputType(); | 122 UpdateTextInputType(); |
123 | 123 |
124 text_input_client_ = base::MakeUnique<TextInputClientImpl>(focused); | 124 text_input_client_ = base::MakeUnique<TextInputClientImpl>(focused); |
125 ime_server_->StartSession(text_input_client_->CreateInterfacePtrAndBind(), | 125 ime_server_->StartSession(text_input_client_->CreateInterfacePtrAndBind(), |
126 GetProxy(&input_method_)); | 126 MakeRequest(&input_method_)); |
127 } | 127 } |
128 | 128 |
129 void InputMethodMus::UpdateTextInputType() { | 129 void InputMethodMus::UpdateTextInputType() { |
130 ui::TextInputType type = GetTextInputType(); | 130 ui::TextInputType type = GetTextInputType(); |
131 mojo::TextInputStatePtr state = mojo::TextInputState::New(); | 131 mojo::TextInputStatePtr state = mojo::TextInputState::New(); |
132 state->type = mojo::ConvertTo<mojo::TextInputType>(type); | 132 state->type = mojo::ConvertTo<mojo::TextInputType>(type); |
133 if (window_) { | 133 if (window_) { |
134 if (type != ui::TEXT_INPUT_TYPE_NONE) | 134 if (type != ui::TEXT_INPUT_TYPE_NONE) |
135 window_->SetImeVisibility(true, std::move(state)); | 135 window_->SetImeVisibility(true, std::move(state)); |
136 else | 136 else |
(...skipping 18 matching lines...) Expand all Loading... |
155 event_result = EventResult::HANDLED; | 155 event_result = EventResult::HANDLED; |
156 } | 156 } |
157 // |ack_callback| can be null if the standard form of DispatchKeyEvent() is | 157 // |ack_callback| can be null if the standard form of DispatchKeyEvent() is |
158 // called instead of the version which provides a callback. In mus+ash we | 158 // called instead of the version which provides a callback. In mus+ash we |
159 // use the version with callback, but some unittests use the standard form. | 159 // use the version with callback, but some unittests use the standard form. |
160 if (ack_callback) | 160 if (ack_callback) |
161 ack_callback->Run(event_result); | 161 ack_callback->Run(event_result); |
162 } | 162 } |
163 | 163 |
164 } // namespace views | 164 } // namespace views |
OLD | NEW |