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 "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "chromeos/dbus/ibus/ibus_constants.h" | 8 #include "chromeos/dbus/ibus/ibus_constants.h" |
9 #include "dbus/bus.h" | 9 #include "dbus/bus.h" |
10 #include "dbus/message.h" | 10 #include "dbus/message.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 dbus::MessageReader reader(method_call); | 58 dbus::MessageReader reader(method_call); |
59 std::string engine_name; | 59 std::string engine_name; |
60 | 60 |
61 if (!reader.PopString(&engine_name)) { | 61 if (!reader.PopString(&engine_name)) { |
62 LOG(ERROR) << "Expected argument is string."; | 62 LOG(ERROR) << "Expected argument is string."; |
63 return; | 63 return; |
64 } | 64 } |
65 if(create_engine_handler_.is_null()) { | 65 if(create_engine_handler_.is_null()) { |
66 LOG(WARNING) << "The CreateEngine handler is NULL."; | 66 LOG(WARNING) << "The CreateEngine handler is NULL."; |
67 } else { | 67 } else { |
| 68 dbus::Response* response = dbus::Response::FromMethodCall(method_call); |
| 69 dbus::MessageWriter writer(response); |
68 const dbus::ObjectPath path = create_engine_handler_.Run(engine_name); | 70 const dbus::ObjectPath path = create_engine_handler_.Run(engine_name); |
69 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); | |
70 dbus::MessageWriter writer(response.get()); | |
71 writer.AppendObjectPath(path); | 71 writer.AppendObjectPath(path); |
72 response_sender.Run(response.get()); | 72 response_sender.Run(response); |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 // Called when the CreateEngine method is exported. | 76 // Called when the CreateEngine method is exported. |
77 void CreateEngineExported(const std::string& interface_name, | 77 void CreateEngineExported(const std::string& interface_name, |
78 const std::string& method_name, | 78 const std::string& method_name, |
79 bool success) { | 79 bool success) { |
80 DCHECK(success) << "Failed to export: " | 80 DCHECK(success) << "Failed to export: " |
81 << interface_name << "." << method_name; | 81 << interface_name << "." << method_name; |
82 } | 82 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 IBusEngineFactoryService* IBusEngineFactoryService::Create( | 115 IBusEngineFactoryService* IBusEngineFactoryService::Create( |
116 dbus::Bus* bus, | 116 dbus::Bus* bus, |
117 DBusClientImplementationType type) { | 117 DBusClientImplementationType type) { |
118 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 118 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
119 return new IBusEngineFactoryServiceImpl(bus); | 119 return new IBusEngineFactoryServiceImpl(bus); |
120 else | 120 else |
121 return new IBusEngineFactoryServiceStubImpl(); | 121 return new IBusEngineFactoryServiceStubImpl(); |
122 } | 122 } |
123 | 123 |
124 } // namespace chromeos | 124 } // namespace chromeos |
OLD | NEW |