| 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 "dbus/bus.h" | 5 #include "dbus/bus.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 ObjectProxy::TIMEOUT_USE_DEFAULT, | 884 ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 885 error.get()); | 885 error.get()); |
| 886 if (!response_message) { | 886 if (!response_message) { |
| 887 if (options == REPORT_ERRORS) { | 887 if (options == REPORT_ERRORS) { |
| 888 LOG(ERROR) << "Failed to get name owner. Got " << error.name() << ": " | 888 LOG(ERROR) << "Failed to get name owner. Got " << error.name() << ": " |
| 889 << error.message(); | 889 << error.message(); |
| 890 } | 890 } |
| 891 return ""; | 891 return ""; |
| 892 } | 892 } |
| 893 | 893 |
| 894 scoped_ptr<Response> response(Response::FromRawMessage(response_message)); | 894 std::unique_ptr<Response> response( |
| 895 Response::FromRawMessage(response_message)); |
| 895 MessageReader reader(response.get()); | 896 MessageReader reader(response.get()); |
| 896 | 897 |
| 897 std::string service_owner; | 898 std::string service_owner; |
| 898 if (!reader.PopString(&service_owner)) | 899 if (!reader.PopString(&service_owner)) |
| 899 service_owner.clear(); | 900 service_owner.clear(); |
| 900 return service_owner; | 901 return service_owner; |
| 901 } | 902 } |
| 902 | 903 |
| 903 void Bus::GetServiceOwner(const std::string& service_name, | 904 void Bus::GetServiceOwner(const std::string& service_name, |
| 904 const GetServiceOwnerCallback& callback) { | 905 const GetServiceOwnerCallback& callback) { |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 this)); | 1108 this)); |
| 1108 } | 1109 } |
| 1109 | 1110 |
| 1110 void Bus::OnServiceOwnerChanged(DBusMessage* message) { | 1111 void Bus::OnServiceOwnerChanged(DBusMessage* message) { |
| 1111 DCHECK(message); | 1112 DCHECK(message); |
| 1112 AssertOnDBusThread(); | 1113 AssertOnDBusThread(); |
| 1113 | 1114 |
| 1114 // |message| will be unrefed on exit of the function. Increment the | 1115 // |message| will be unrefed on exit of the function. Increment the |
| 1115 // reference so we can use it in Signal::FromRawMessage() below. | 1116 // reference so we can use it in Signal::FromRawMessage() below. |
| 1116 dbus_message_ref(message); | 1117 dbus_message_ref(message); |
| 1117 scoped_ptr<Signal> signal(Signal::FromRawMessage(message)); | 1118 std::unique_ptr<Signal> signal(Signal::FromRawMessage(message)); |
| 1118 | 1119 |
| 1119 // Confirm the validity of the NameOwnerChanged signal. | 1120 // Confirm the validity of the NameOwnerChanged signal. |
| 1120 if (signal->GetMember() != kNameOwnerChangedSignal || | 1121 if (signal->GetMember() != kNameOwnerChangedSignal || |
| 1121 signal->GetInterface() != DBUS_INTERFACE_DBUS || | 1122 signal->GetInterface() != DBUS_INTERFACE_DBUS || |
| 1122 signal->GetSender() != DBUS_SERVICE_DBUS) { | 1123 signal->GetSender() != DBUS_SERVICE_DBUS) { |
| 1123 return; | 1124 return; |
| 1124 } | 1125 } |
| 1125 | 1126 |
| 1126 MessageReader reader(signal.get()); | 1127 MessageReader reader(signal.get()); |
| 1127 std::string service_name; | 1128 std::string service_name; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 kNameOwnerChangedSignal)) { | 1214 kNameOwnerChangedSignal)) { |
| 1214 Bus* self = static_cast<Bus*>(data); | 1215 Bus* self = static_cast<Bus*>(data); |
| 1215 self->OnServiceOwnerChanged(message); | 1216 self->OnServiceOwnerChanged(message); |
| 1216 } | 1217 } |
| 1217 // Always return unhandled to let others, e.g. ObjectProxies, handle the same | 1218 // Always return unhandled to let others, e.g. ObjectProxies, handle the same |
| 1218 // signal. | 1219 // signal. |
| 1219 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | 1220 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; |
| 1220 } | 1221 } |
| 1221 | 1222 |
| 1222 } // namespace dbus | 1223 } // namespace dbus |
| OLD | NEW |