Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: chromeos/dbus/permission_broker_client.cc

Issue 2291983002: chromeos: Remove dbus::FileDescriptor from PermissionBrokerClient (Closed)
Patch Set: Address comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromeos/dbus/permission_broker_client.h ('k') | chromeos/network/firewall_hole.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/permission_broker_client.h" 5 #include "chromeos/dbus/permission_broker_client.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 proxy_->CallMethodWithErrorCallback( 54 proxy_->CallMethodWithErrorCallback(
55 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 55 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
56 base::Bind(&PermissionBrokerClientImpl::OnOpenPathResponse, 56 base::Bind(&PermissionBrokerClientImpl::OnOpenPathResponse,
57 weak_ptr_factory_.GetWeakPtr(), callback), 57 weak_ptr_factory_.GetWeakPtr(), callback),
58 base::Bind(&PermissionBrokerClientImpl::OnError, 58 base::Bind(&PermissionBrokerClientImpl::OnError,
59 weak_ptr_factory_.GetWeakPtr(), error_callback)); 59 weak_ptr_factory_.GetWeakPtr(), error_callback));
60 } 60 }
61 61
62 void RequestTcpPortAccess(uint16_t port, 62 void RequestTcpPortAccess(uint16_t port,
63 const std::string& interface, 63 const std::string& interface,
64 const dbus::FileDescriptor& lifeline_fd, 64 int lifeline_fd,
65 const ResultCallback& callback) override { 65 const ResultCallback& callback) override {
66 dbus::MethodCall method_call(kPermissionBrokerInterface, 66 dbus::MethodCall method_call(kPermissionBrokerInterface,
67 kRequestTcpPortAccess); 67 kRequestTcpPortAccess);
68 dbus::MessageWriter writer(&method_call); 68 dbus::MessageWriter writer(&method_call);
69 writer.AppendUint16(port); 69 writer.AppendUint16(port);
70 writer.AppendString(interface); 70 writer.AppendString(interface);
71 writer.AppendFileDescriptor(lifeline_fd); 71 writer.AppendFileDescriptor(lifeline_fd);
72 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 72 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
73 base::Bind(&PermissionBrokerClientImpl::OnResponse, 73 base::Bind(&PermissionBrokerClientImpl::OnResponse,
74 weak_ptr_factory_.GetWeakPtr(), callback)); 74 weak_ptr_factory_.GetWeakPtr(), callback));
75 } 75 }
76 76
77 void RequestUdpPortAccess(uint16_t port, 77 void RequestUdpPortAccess(uint16_t port,
78 const std::string& interface, 78 const std::string& interface,
79 const dbus::FileDescriptor& lifeline_fd, 79 int lifeline_fd,
80 const ResultCallback& callback) override { 80 const ResultCallback& callback) override {
81 dbus::MethodCall method_call(kPermissionBrokerInterface, 81 dbus::MethodCall method_call(kPermissionBrokerInterface,
82 kRequestUdpPortAccess); 82 kRequestUdpPortAccess);
83 dbus::MessageWriter writer(&method_call); 83 dbus::MessageWriter writer(&method_call);
84 writer.AppendUint16(port); 84 writer.AppendUint16(port);
85 writer.AppendString(interface); 85 writer.AppendString(interface);
86 writer.AppendFileDescriptor(lifeline_fd); 86 writer.AppendFileDescriptor(lifeline_fd);
87 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 87 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
88 base::Bind(&PermissionBrokerClientImpl::OnResponse, 88 base::Bind(&PermissionBrokerClientImpl::OnResponse,
89 weak_ptr_factory_.GetWeakPtr(), callback)); 89 weak_ptr_factory_.GetWeakPtr(), callback));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 bool result = false; 133 bool result = false;
134 dbus::MessageReader reader(response); 134 dbus::MessageReader reader(response);
135 if (!reader.PopBool(&result)) 135 if (!reader.PopBool(&result))
136 LOG(WARNING) << "Could not parse response: " << response->ToString(); 136 LOG(WARNING) << "Could not parse response: " << response->ToString();
137 callback.Run(result); 137 callback.Run(result);
138 } 138 }
139 139
140 void OnOpenPathResponse(const OpenPathCallback& callback, 140 void OnOpenPathResponse(const OpenPathCallback& callback,
141 dbus::Response* response) { 141 dbus::Response* response) {
142 dbus::FileDescriptor fd; 142 base::ScopedFD fd;
143 dbus::MessageReader reader(response); 143 dbus::MessageReader reader(response);
144 if (!reader.PopFileDescriptor(&fd)) 144 if (!reader.PopFileDescriptor(&fd))
145 LOG(WARNING) << "Could not parse response: " << response->ToString(); 145 LOG(WARNING) << "Could not parse response: " << response->ToString();
146 callback.Run(std::move(fd)); 146 callback.Run(std::move(fd));
147 } 147 }
148 148
149 void OnError(const ErrorCallback& callback, dbus::ErrorResponse* response) { 149 void OnError(const ErrorCallback& callback, dbus::ErrorResponse* response) {
150 std::string error_name; 150 std::string error_name;
151 std::string error_message; 151 std::string error_message;
152 if (response) { 152 if (response) {
(...skipping 18 matching lines...) Expand all
171 171
172 PermissionBrokerClient::PermissionBrokerClient() {} 172 PermissionBrokerClient::PermissionBrokerClient() {}
173 173
174 PermissionBrokerClient::~PermissionBrokerClient() {} 174 PermissionBrokerClient::~PermissionBrokerClient() {}
175 175
176 PermissionBrokerClient* PermissionBrokerClient::Create() { 176 PermissionBrokerClient* PermissionBrokerClient::Create() {
177 return new PermissionBrokerClientImpl(); 177 return new PermissionBrokerClientImpl();
178 } 178 }
179 179
180 } // namespace chromeos 180 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/permission_broker_client.h ('k') | chromeos/network/firewall_hole.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698