| 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_bridge_impl.h" | 5 #include "components/arc/ime/arc_ime_bridge_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 ArcBridgeService* bridge_service) | 81 ArcBridgeService* bridge_service) |
| 82 : binding_(this), delegate_(delegate), bridge_service_(bridge_service) { | 82 : binding_(this), delegate_(delegate), bridge_service_(bridge_service) { |
| 83 bridge_service_->ime()->AddObserver(this); | 83 bridge_service_->ime()->AddObserver(this); |
| 84 } | 84 } |
| 85 | 85 |
| 86 ArcImeBridgeImpl::~ArcImeBridgeImpl() { | 86 ArcImeBridgeImpl::~ArcImeBridgeImpl() { |
| 87 bridge_service_->ime()->RemoveObserver(this); | 87 bridge_service_->ime()->RemoveObserver(this); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void ArcImeBridgeImpl::OnInstanceReady() { | 90 void ArcImeBridgeImpl::OnInstanceReady() { |
| 91 bridge_service_->ime()->instance()->Init( | 91 auto* instance = bridge_service_->ime()->GetInstanceForMethod("Init"); |
| 92 binding_.CreateInterfacePtrAndBind()); | 92 CHECK(instance); |
| 93 instance->Init(binding_.CreateInterfacePtrAndBind()); |
| 93 } | 94 } |
| 94 | 95 |
| 95 void ArcImeBridgeImpl::SendSetCompositionText( | 96 void ArcImeBridgeImpl::SendSetCompositionText( |
| 96 const ui::CompositionText& composition) { | 97 const ui::CompositionText& composition) { |
| 97 auto* ime_instance = | 98 auto* ime_instance = |
| 98 bridge_service_->ime()->GetInstanceForMethod("SetCompositionText"); | 99 bridge_service_->ime()->GetInstanceForMethod("SetCompositionText"); |
| 99 if (!ime_instance) | 100 if (!ime_instance) |
| 100 return; | 101 return; |
| 101 | 102 |
| 102 ime_instance->SetCompositionText(base::UTF16ToUTF8(composition.text), | 103 ime_instance->SetCompositionText(base::UTF16ToUTF8(composition.text), |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 154 |
| 154 void ArcImeBridgeImpl::OnCancelComposition() { | 155 void ArcImeBridgeImpl::OnCancelComposition() { |
| 155 delegate_->OnCancelComposition(); | 156 delegate_->OnCancelComposition(); |
| 156 } | 157 } |
| 157 | 158 |
| 158 void ArcImeBridgeImpl::ShowImeIfNeeded() { | 159 void ArcImeBridgeImpl::ShowImeIfNeeded() { |
| 159 delegate_->ShowImeIfNeeded(); | 160 delegate_->ShowImeIfNeeded(); |
| 160 } | 161 } |
| 161 | 162 |
| 162 } // namespace arc | 163 } // namespace arc |
| OLD | NEW |