| 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_factory_service.h" | 5 #include "chromeos/dbus/ibus/ibus_engine_factory_service.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 LOG(ERROR) << "Expected argument is string."; | 66 LOG(ERROR) << "Expected argument is string."; |
| 67 return; | 67 return; |
| 68 } | 68 } |
| 69 if (create_engine_callback_map_[engine_name].is_null()) { | 69 if (create_engine_callback_map_[engine_name].is_null()) { |
| 70 LOG(WARNING) << "The CreateEngine handler for " << engine_name | 70 LOG(WARNING) << "The CreateEngine handler for " << engine_name |
| 71 << " is NULL."; | 71 << " is NULL."; |
| 72 } else { | 72 } else { |
| 73 create_engine_callback_map_[engine_name].Run( | 73 create_engine_callback_map_[engine_name].Run( |
| 74 base::Bind(&IBusEngineFactoryServiceImpl::CreateEngineSendReply, | 74 base::Bind(&IBusEngineFactoryServiceImpl::CreateEngineSendReply, |
| 75 weak_ptr_factory_.GetWeakPtr(), | 75 weak_ptr_factory_.GetWeakPtr(), |
| 76 dbus::Response::FromMethodCall(method_call), | 76 base::Passed(dbus::Response::FromMethodCall(method_call)), |
| 77 response_sender)); | 77 response_sender)); |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 // Sends reply message for CreateEngine method call. | 81 // Sends reply message for CreateEngine method call. |
| 82 void CreateEngineSendReply( | 82 void CreateEngineSendReply( |
| 83 dbus::Response* response, | 83 scoped_ptr<dbus::Response> response, |
| 84 const dbus::ExportedObject::ResponseSender response_sender, | 84 const dbus::ExportedObject::ResponseSender response_sender, |
| 85 const dbus::ObjectPath& path) { | 85 const dbus::ObjectPath& path) { |
| 86 dbus::MessageWriter writer(response); | 86 dbus::MessageWriter writer(response.get()); |
| 87 writer.AppendObjectPath(path); | 87 writer.AppendObjectPath(path); |
| 88 response_sender.Run(response); | 88 response_sender.Run(response.Pass()); |
| 89 } | 89 } |
| 90 | 90 |
| 91 // Called when the CreateEngine method is exported. | 91 // Called when the CreateEngine method is exported. |
| 92 void CreateEngineExported(const std::string& interface_name, | 92 void CreateEngineExported(const std::string& interface_name, |
| 93 const std::string& method_name, | 93 const std::string& method_name, |
| 94 bool success) { | 94 bool success) { |
| 95 DCHECK(success) << "Failed to export: " | 95 DCHECK(success) << "Failed to export: " |
| 96 << interface_name << "." << method_name; | 96 << interface_name << "." << method_name; |
| 97 } | 97 } |
| 98 | 98 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 IBusEngineFactoryService* IBusEngineFactoryService::Create( | 141 IBusEngineFactoryService* IBusEngineFactoryService::Create( |
| 142 dbus::Bus* bus, | 142 dbus::Bus* bus, |
| 143 DBusClientImplementationType type) { | 143 DBusClientImplementationType type) { |
| 144 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 144 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
| 145 return new IBusEngineFactoryServiceImpl(bus); | 145 return new IBusEngineFactoryServiceImpl(bus); |
| 146 else | 146 else |
| 147 return new IBusEngineFactoryServiceDaemonlessImpl(); | 147 return new IBusEngineFactoryServiceDaemonlessImpl(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace chromeos | 150 } // namespace chromeos |
| OLD | NEW |