OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chromeos/dbus/ibus/ibus_engine_service.h" | 5 #include "chromeos/dbus/ibus/ibus_engine_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "chromeos/dbus/ibus/ibus_constants.h" | 10 #include "chromeos/dbus/ibus/ibus_constants.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 weak_ptr_factory_.GetWeakPtr())); | 129 weak_ptr_factory_.GetWeakPtr())); |
130 } | 130 } |
131 | 131 |
132 virtual ~IBusEngineServiceImpl() { | 132 virtual ~IBusEngineServiceImpl() { |
133 bus_->UnregisterExportedObject(object_path_); | 133 bus_->UnregisterExportedObject(object_path_); |
134 } | 134 } |
135 | 135 |
136 // IBusEngineService override. | 136 // IBusEngineService override. |
137 virtual void SetEngine(IBusEngineHandlerInterface* handler) OVERRIDE { | 137 virtual void SetEngine(IBusEngineHandlerInterface* handler) OVERRIDE { |
138 DVLOG_IF(1, engine_handler_ != NULL) << "Replace engine."; | 138 DVLOG_IF(1, engine_handler_ != NULL) << "Replace engine."; |
| 139 if (engine_handler_) |
| 140 engine_handler_->Disable(); |
139 engine_handler_ = handler; | 141 engine_handler_ = handler; |
140 } | 142 } |
141 | 143 |
142 // IBusEngineService override. | 144 // IBusEngineService override. |
143 virtual void UnsetEngine() OVERRIDE { | 145 virtual void UnsetEngine() OVERRIDE { |
144 LOG_IF(ERROR, engine_handler_ == NULL) << "There is no engine."; | 146 LOG_IF(ERROR, engine_handler_ == NULL) << "There is no engine."; |
145 engine_handler_ = NULL; | 147 engine_handler_ = NULL; |
146 } | 148 } |
147 | 149 |
148 // IBusEngineService override. | 150 // IBusEngineService override. |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 DBusClientImplementationType type, | 576 DBusClientImplementationType type, |
575 dbus::Bus* bus, | 577 dbus::Bus* bus, |
576 const dbus::ObjectPath& object_path) { | 578 const dbus::ObjectPath& object_path) { |
577 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 579 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
578 return new IBusEngineServiceImpl(bus, object_path); | 580 return new IBusEngineServiceImpl(bus, object_path); |
579 else | 581 else |
580 return new IBusEngineServiceDaemonlessImpl(); | 582 return new IBusEngineServiceDaemonlessImpl(); |
581 } | 583 } |
582 | 584 |
583 } // namespace chromeos | 585 } // namespace chromeos |
OLD | NEW |