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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 "Invalid FD.").PassAs<dbus::Response>()); | 54 "Invalid FD.").PassAs<dbus::Response>()); |
55 return; | 55 return; |
56 } | 56 } |
57 wrapped_fd.CheckValidity(); | 57 wrapped_fd.CheckValidity(); |
58 channel_init_.reset(new mojo::common::ChannelInit); | 58 channel_init_.reset(new mojo::common::ChannelInit); |
59 mojo::ScopedMessagePipeHandle message_pipe = | 59 mojo::ScopedMessagePipeHandle message_pipe = |
60 channel_init_->Init(wrapped_fd.TakeValue(), | 60 channel_init_->Init(wrapped_fd.TakeValue(), |
61 base::MessageLoopProxy::current()); | 61 base::MessageLoopProxy::current()); |
62 CHECK(message_pipe.is_valid()); | 62 CHECK(message_pipe.is_valid()); |
63 | 63 |
64 Connect(mojo::ScopedExternalServiceHostHandle::From(message_pipe.Pass())); | 64 Connect(message_pipe.Pass()); |
65 sender.Run(dbus::Response::FromMethodCall(method_call)); | 65 sender.Run(dbus::Response::FromMethodCall(method_call)); |
66 } | 66 } |
67 | 67 |
68 void DBusExternalServiceBase::ExportMethods() { | 68 void DBusExternalServiceBase::ExportMethods() { |
69 CHECK(exported_object_); | 69 CHECK(exported_object_); |
70 CHECK(exported_object_->ExportMethodAndBlock( | 70 CHECK(exported_object_->ExportMethodAndBlock( |
71 kMojoDBusInterface, kMojoDBusConnectMethod, | 71 kMojoDBusInterface, kMojoDBusConnectMethod, |
72 base::Bind(&DBusExternalServiceBase::ConnectChannel, | 72 base::Bind(&DBusExternalServiceBase::ConnectChannel, |
73 base::Unretained(this)))); | 73 base::Unretained(this)))); |
74 } | 74 } |
(...skipping 11 matching lines...) Expand all Loading... |
86 } | 86 } |
87 | 87 |
88 void DBusExternalServiceBase::TakeDBusServiceOwnership() { | 88 void DBusExternalServiceBase::TakeDBusServiceOwnership() { |
89 CHECK(bus_->RequestOwnershipAndBlock( | 89 CHECK(bus_->RequestOwnershipAndBlock( |
90 service_name_, | 90 service_name_, |
91 dbus::Bus::REQUIRE_PRIMARY_ALLOW_REPLACEMENT)) | 91 dbus::Bus::REQUIRE_PRIMARY_ALLOW_REPLACEMENT)) |
92 << "Unable to take ownership of " << service_name_; | 92 << "Unable to take ownership of " << service_name_; |
93 } | 93 } |
94 | 94 |
95 } // namespace mojo | 95 } // namespace mojo |
OLD | NEW |