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 #include "components/arc/ime/arc_ime_ipc_host_impl.h" | 5 #include "components/arc/ime/arc_ime_ipc_host_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "components/arc/arc_bridge_service.h" | 9 #include "components/arc/arc_bridge_service.h" |
10 #include "ui/base/ime/composition_text.h" | 10 #include "ui/base/ime/composition_text.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 ArcBridgeService* bridge_service) | 73 ArcBridgeService* bridge_service) |
74 : binding_(this), delegate_(delegate), bridge_service_(bridge_service) { | 74 : binding_(this), delegate_(delegate), bridge_service_(bridge_service) { |
75 bridge_service_->AddObserver(this); | 75 bridge_service_->AddObserver(this); |
76 } | 76 } |
77 | 77 |
78 ArcImeIpcHostImpl::~ArcImeIpcHostImpl() { | 78 ArcImeIpcHostImpl::~ArcImeIpcHostImpl() { |
79 bridge_service_->RemoveObserver(this); | 79 bridge_service_->RemoveObserver(this); |
80 } | 80 } |
81 | 81 |
82 void ArcImeIpcHostImpl::OnImeInstanceReady() { | 82 void ArcImeIpcHostImpl::OnImeInstanceReady() { |
83 arc::ImeHostPtr host; | 83 bridge_service_->ime_instance()->Init(binding_.CreateInterfacePtrAndBind()); |
84 binding_.Bind(mojo::GetProxy(&host)); | |
85 bridge_service_->ime_instance()->Init(std::move(host)); | |
86 } | 84 } |
87 | 85 |
88 void ArcImeIpcHostImpl::SendSetCompositionText( | 86 void ArcImeIpcHostImpl::SendSetCompositionText( |
89 const ui::CompositionText& composition) { | 87 const ui::CompositionText& composition) { |
90 ImeInstance* ime_instance = bridge_service_->ime_instance(); | 88 ImeInstance* ime_instance = bridge_service_->ime_instance(); |
91 if (!ime_instance) { | 89 if (!ime_instance) { |
92 LOG(ERROR) << "ArcImeInstance method called before being ready."; | 90 LOG(ERROR) << "ArcImeInstance method called before being ready."; |
93 return; | 91 return; |
94 } | 92 } |
95 | 93 |
(...skipping 27 matching lines...) Expand all Loading... |
123 | 121 |
124 void ArcImeIpcHostImpl::OnCursorRectChanged(arc::CursorRectPtr rect) { | 122 void ArcImeIpcHostImpl::OnCursorRectChanged(arc::CursorRectPtr rect) { |
125 delegate_->OnCursorRectChanged(gfx::Rect( | 123 delegate_->OnCursorRectChanged(gfx::Rect( |
126 rect->left, | 124 rect->left, |
127 rect->top, | 125 rect->top, |
128 rect->right - rect->left, | 126 rect->right - rect->left, |
129 rect->bottom - rect->top)); | 127 rect->bottom - rect->top)); |
130 } | 128 } |
131 | 129 |
132 } // namespace arc | 130 } // namespace arc |
OLD | NEW |