| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/dbus/dbus_external_service.h" | 5 #include "mojo/dbus/dbus_external_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 void DBusExternalServiceBase::ExportMethods() { | 61 void DBusExternalServiceBase::ExportMethods() { |
| 62 CHECK(exported_object_); | 62 CHECK(exported_object_); |
| 63 CHECK(exported_object_->ExportMethodAndBlock( | 63 CHECK(exported_object_->ExportMethodAndBlock( |
| 64 kMojoDBusInterface, kMojoDBusConnectMethod, | 64 kMojoDBusInterface, kMojoDBusConnectMethod, |
| 65 base::Bind(&DBusExternalServiceBase::ConnectChannel, | 65 base::Bind(&DBusExternalServiceBase::ConnectChannel, |
| 66 base::Unretained(this)))); | 66 base::Unretained(this)))); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void DBusExternalServiceBase::InitializeDBus() { | 69 void DBusExternalServiceBase::InitializeDBus() { |
| 70 CHECK(!bus_); | 70 CHECK(!bus_.get()); |
| 71 dbus::Bus::Options options; | 71 dbus::Bus::Options options; |
| 72 options.bus_type = dbus::Bus::SESSION; | 72 options.bus_type = dbus::Bus::SESSION; |
| 73 bus_ = new dbus::Bus(options); | 73 bus_ = new dbus::Bus(options); |
| 74 CHECK(bus_->Connect()); | 74 CHECK(bus_->Connect()); |
| 75 CHECK(bus_->SetUpAsyncOperations()); | 75 CHECK(bus_->SetUpAsyncOperations()); |
| 76 | 76 |
| 77 exported_object_ = | 77 exported_object_ = |
| 78 bus_->GetExportedObject(dbus::ObjectPath(kMojoDBusImplPath)); | 78 bus_->GetExportedObject(dbus::ObjectPath(kMojoDBusImplPath)); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void DBusExternalServiceBase::TakeDBusServiceOwnership() { | 81 void DBusExternalServiceBase::TakeDBusServiceOwnership() { |
| 82 CHECK(bus_->RequestOwnershipAndBlock( | 82 CHECK(bus_->RequestOwnershipAndBlock( |
| 83 service_name_, | 83 service_name_, |
| 84 dbus::Bus::REQUIRE_PRIMARY_ALLOW_REPLACEMENT)) | 84 dbus::Bus::REQUIRE_PRIMARY_ALLOW_REPLACEMENT)) |
| 85 << "Unable to take ownership of " << service_name_; | 85 << "Unable to take ownership of " << service_name_; |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace mojo | 88 } // namespace mojo |
| OLD | NEW |