Index: chrome/browser/chromeos/dbus/cros_dbus_service.cc |
diff --git a/chrome/browser/chromeos/dbus/cros_dbus_service.cc b/chrome/browser/chromeos/dbus/cros_dbus_service.cc |
index 5f912ed2ff2814da086a44c12a0b4cac3c2d82d6..8552aca9b081d16b9509965a1ed13e575b4edb5e 100644 |
--- a/chrome/browser/chromeos/dbus/cros_dbus_service.cc |
+++ b/chrome/browser/chromeos/dbus/cros_dbus_service.cc |
@@ -4,6 +4,7 @@ |
#include "chrome/browser/chromeos/dbus/cros_dbus_service.h" |
+#include "base/bind.h" |
#include "base/stl_util.h" |
#include "base/threading/platform_thread.h" |
#include "chrome/browser/chromeos/dbus/proxy_resolution_service_provider.h" |
@@ -39,8 +40,11 @@ class CrosDBusServiceImpl : public CrosDBusService { |
if (service_started_) |
return; |
+ bus_->RequestOwnership(kLibCrosServiceName, |
+ base::Bind(&CrosDBusServiceImpl::OnOwnership, |
+ base::Unretained(this))); |
+ |
exported_object_ = bus_->GetExportedObject( |
- kLibCrosServiceName, |
dbus::ObjectPath(kLibCrosServicePath)); |
for (size_t i = 0; i < service_providers_.size(); ++i) |
@@ -63,6 +67,12 @@ class CrosDBusServiceImpl : public CrosDBusService { |
return base::PlatformThread::CurrentId() == origin_thread_id_; |
} |
+ // Called when an ownership request is completed. |
+ void OnOwnership(const std::string& service_name, |
+ bool success) { |
+ LOG_IF(ERROR, !success) << "Failed to own: " << service_name; |
+ } |
+ |
bool service_started_; |
base::PlatformThreadId origin_thread_id_; |
dbus::Bus* bus_; |