| 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/ime.mojom.h" | 10 #include "services/ui/public/interfaces/ime.mojom.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // mean for displaying candidate list popup. | 107 // mean for displaying candidate list popup. |
| 108 return false; | 108 return false; |
| 109 } | 109 } |
| 110 | 110 |
| 111 void InputMethodMus::OnDidChangeFocusedClient( | 111 void InputMethodMus::OnDidChangeFocusedClient( |
| 112 ui::TextInputClient* focused_before, | 112 ui::TextInputClient* focused_before, |
| 113 ui::TextInputClient* focused) { | 113 ui::TextInputClient* focused) { |
| 114 InputMethodBase::OnDidChangeFocusedClient(focused_before, focused); | 114 InputMethodBase::OnDidChangeFocusedClient(focused_before, focused); |
| 115 UpdateTextInputType(); | 115 UpdateTextInputType(); |
| 116 | 116 |
| 117 text_input_client_.reset(new TextInputClientImpl(focused, this)); | 117 text_input_client_ = base::MakeUnique<TextInputClientImpl>(focused, this); |
| 118 ime_server_->StartSession(text_input_client_->CreateInterfacePtrAndBind(), | 118 ime_server_->StartSession(text_input_client_->CreateInterfacePtrAndBind(), |
| 119 GetProxy(&input_method_)); | 119 GetProxy(&input_method_)); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void InputMethodMus::UpdateTextInputType() { | 122 void InputMethodMus::UpdateTextInputType() { |
| 123 ui::TextInputType type = GetTextInputType(); | 123 ui::TextInputType type = GetTextInputType(); |
| 124 mojo::TextInputStatePtr state = mojo::TextInputState::New(); | 124 mojo::TextInputStatePtr state = mojo::TextInputState::New(); |
| 125 state->type = mojo::ConvertTo<mojo::TextInputType>(type); | 125 state->type = mojo::ConvertTo<mojo::TextInputType>(type); |
| 126 if (window_) { | 126 if (window_) { |
| 127 if (type != ui::TEXT_INPUT_TYPE_NONE) | 127 if (type != ui::TEXT_INPUT_TYPE_NONE) |
| 128 window_->SetImeVisibility(true, std::move(state)); | 128 window_->SetImeVisibility(true, std::move(state)); |
| 129 else | 129 else |
| 130 window_->SetTextInputState(std::move(state)); | 130 window_->SetTextInputState(std::move(state)); |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 } // namespace views | 134 } // namespace views |
| OLD | NEW |