| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_) | 139 if (engine_handler_) |
| 140 engine_handler_->Disable(); | 140 engine_handler_->Disable(); |
| 141 engine_handler_ = handler; | 141 engine_handler_ = handler; |
| 142 } | 142 } |
| 143 | 143 |
| 144 // IBusEngineService override. | 144 // IBusEngineService override. |
| 145 virtual void UnsetEngine() OVERRIDE { | 145 virtual void UnsetEngine(IBusEngineHandlerInterface* handler) OVERRIDE { |
| 146 LOG_IF(ERROR, engine_handler_ == NULL) << "There is no engine."; | 146 if (engine_handler_ == handler) |
| 147 engine_handler_ = NULL; | 147 engine_handler_ = NULL; |
| 148 } | 148 } |
| 149 | 149 |
| 150 // IBusEngineService override. | 150 // IBusEngineService override. |
| 151 virtual void RegisterProperties( | 151 virtual void RegisterProperties( |
| 152 const IBusPropertyList& property_list) OVERRIDE { | 152 const IBusPropertyList& property_list) OVERRIDE { |
| 153 dbus::Signal signal(ibus::engine::kServiceInterface, | 153 dbus::Signal signal(ibus::engine::kServiceInterface, |
| 154 ibus::engine::kRegisterPropertiesSignal); | 154 ibus::engine::kRegisterPropertiesSignal); |
| 155 dbus::MessageWriter writer(&signal); | 155 dbus::MessageWriter writer(&signal); |
| 156 AppendIBusPropertyList(property_list, &writer); | 156 AppendIBusPropertyList(property_list, &writer); |
| 157 exported_object_->SendSignal(&signal); | 157 exported_object_->SendSignal(&signal); |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 public: | 479 public: |
| 480 IBusEngineServiceDaemonlessImpl() {} | 480 IBusEngineServiceDaemonlessImpl() {} |
| 481 virtual ~IBusEngineServiceDaemonlessImpl() {} | 481 virtual ~IBusEngineServiceDaemonlessImpl() {} |
| 482 | 482 |
| 483 // IBusEngineService override. | 483 // IBusEngineService override. |
| 484 virtual void SetEngine(IBusEngineHandlerInterface* handler) OVERRIDE { | 484 virtual void SetEngine(IBusEngineHandlerInterface* handler) OVERRIDE { |
| 485 IBusBridge::Get()->SetEngineHandler(handler); | 485 IBusBridge::Get()->SetEngineHandler(handler); |
| 486 } | 486 } |
| 487 | 487 |
| 488 // IBusEngineService override. | 488 // IBusEngineService override. |
| 489 virtual void UnsetEngine() OVERRIDE { | 489 virtual void UnsetEngine(IBusEngineHandlerInterface* handler) OVERRIDE { |
| 490 IBusBridge::Get()->SetEngineHandler(NULL); | 490 if (IBusBridge::Get()->GetEngineHandler() == handler) |
| 491 IBusBridge::Get()->SetEngineHandler(NULL); |
| 491 } | 492 } |
| 492 | 493 |
| 493 // IBusEngineService override. | 494 // IBusEngineService override. |
| 494 virtual void RegisterProperties( | 495 virtual void RegisterProperties( |
| 495 const IBusPropertyList& property_list) OVERRIDE { | 496 const IBusPropertyList& property_list) OVERRIDE { |
| 496 IBusPanelPropertyHandlerInterface* property = | 497 IBusPanelPropertyHandlerInterface* property = |
| 497 IBusBridge::Get()->GetPropertyHandler(); | 498 IBusBridge::Get()->GetPropertyHandler(); |
| 498 if (property) | 499 if (property) |
| 499 property->RegisterProperties(property_list); | 500 property->RegisterProperties(property_list); |
| 500 } | 501 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 DBusClientImplementationType type, | 577 DBusClientImplementationType type, |
| 577 dbus::Bus* bus, | 578 dbus::Bus* bus, |
| 578 const dbus::ObjectPath& object_path) { | 579 const dbus::ObjectPath& object_path) { |
| 579 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 580 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
| 580 return new IBusEngineServiceImpl(bus, object_path); | 581 return new IBusEngineServiceImpl(bus, object_path); |
| 581 else | 582 else |
| 582 return new IBusEngineServiceDaemonlessImpl(); | 583 return new IBusEngineServiceDaemonlessImpl(); |
| 583 } | 584 } |
| 584 | 585 |
| 585 } // namespace chromeos | 586 } // namespace chromeos |
| OLD | NEW |