| 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 #ifndef CHROMEOS_DBUS_PERMISSION_BROKER_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_PERMISSION_BROKER_CLIENT_H_ |
| 6 #define CHROMEOS_DBUS_PERMISSION_BROKER_CLIENT_H_ | 6 #define CHROMEOS_DBUS_PERMISSION_BROKER_CLIENT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "chromeos/chromeos_export.h" | 12 #include "chromeos/chromeos_export.h" |
| 13 #include "chromeos/dbus/dbus_client.h" | 13 #include "chromeos/dbus/dbus_client.h" |
| 14 | 14 |
| 15 namespace dbus { |
| 16 class FileDescriptor; |
| 17 } |
| 18 |
| 15 namespace chromeos { | 19 namespace chromeos { |
| 16 | 20 |
| 17 // PermissionBrokerClient is used to communicate with the permission broker, a | 21 // PermissionBrokerClient is used to communicate with the permission broker, a |
| 18 // process that allows requesting permission to access specific device nodes. | 22 // process that allows requesting permission to access specific device nodes. |
| 19 // For example, one place that this client is used is within the USB extension | 23 // For example, one place that this client is used is within the USB extension |
| 20 // API code, where it is used to request explicit access to USB peripherals | 24 // API code, where it is used to request explicit access to USB peripherals |
| 21 // which the user the browser runs under normally wouldn't have access to. For | 25 // which the user the browser runs under normally wouldn't have access to. For |
| 22 // more details on the permission broker see: | 26 // more details on the permission broker see: |
| 23 // http://git.chromium.org/gitweb/?p=chromiumos/platform/permission_broker.git | 27 // http://git.chromium.org/gitweb/?p=chromiumos/platform/permission_broker.git |
| 24 class CHROMEOS_EXPORT PermissionBrokerClient : public DBusClient { | 28 class CHROMEOS_EXPORT PermissionBrokerClient : public DBusClient { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 35 // RequestPathAccess requests access to a single device node identified by | 39 // RequestPathAccess requests access to a single device node identified by |
| 36 // |path|. If |interface_id| value is passed (different than | 40 // |path|. If |interface_id| value is passed (different than |
| 37 // UsbDevicePermissionData::ANY_INTERFACE), the request will check if a | 41 // UsbDevicePermissionData::ANY_INTERFACE), the request will check if a |
| 38 // specific interface is claimed while requesting access. | 42 // specific interface is claimed while requesting access. |
| 39 // This allows devices with multiple interfaces to be accessed even if | 43 // This allows devices with multiple interfaces to be accessed even if |
| 40 // some of them are already claimed by kernel. | 44 // some of them are already claimed by kernel. |
| 41 virtual void RequestPathAccess(const std::string& path, | 45 virtual void RequestPathAccess(const std::string& path, |
| 42 int interface_id, | 46 int interface_id, |
| 43 const ResultCallback& callback) = 0; | 47 const ResultCallback& callback) = 0; |
| 44 | 48 |
| 49 // Requests the |port| be opened on the firewall for incoming TCP/IP |
| 50 // connections received on |interface| (an empty string indicates all |
| 51 // interfaces). An open pipe must be passed as |lifeline_fd| so that the |
| 52 // permission broker can monitor the lifetime of the calling process. |
| 53 virtual void RequestTcpPortAccess(uint16 port, |
| 54 const std::string& interface, |
| 55 const dbus::FileDescriptor& lifeline_fd, |
| 56 const ResultCallback& callback) = 0; |
| 57 |
| 58 // Requests the |port| be opened on the firewall for incoming UDP packets |
| 59 // received on |interface| (an empty string indicates all interfaces). An open |
| 60 // pipe must be passed as |lifeline_fd| so that the permission broker can |
| 61 // monitor the lifetime of the calling process. |
| 62 virtual void RequestUdpPortAccess(uint16 port, |
| 63 const std::string& interface, |
| 64 const dbus::FileDescriptor& lifeline_fd, |
| 65 const ResultCallback& callback) = 0; |
| 66 |
| 67 // Releases a request for an open firewall port for TCP/IP connections. The |
| 68 // |port| and |interface| parameters must be the same as a previous call to |
| 69 // RequestTcpPortAccess. |
| 70 virtual void ReleaseTcpPort(uint16 port, |
| 71 const std::string& interface, |
| 72 const ResultCallback& callback) = 0; |
| 73 |
| 74 // Releases a request for an open firewall port for UDP packets. The |port| |
| 75 // and |interface| parameters must be the same as a previous call to |
| 76 // RequestUdpPortAccess. |
| 77 virtual void ReleaseUdpPort(uint16 port, |
| 78 const std::string& interface, |
| 79 const ResultCallback& callback) = 0; |
| 80 |
| 45 protected: | 81 protected: |
| 46 PermissionBrokerClient(); | 82 PermissionBrokerClient(); |
| 47 | 83 |
| 48 private: | 84 private: |
| 49 DISALLOW_COPY_AND_ASSIGN(PermissionBrokerClient); | 85 DISALLOW_COPY_AND_ASSIGN(PermissionBrokerClient); |
| 50 }; | 86 }; |
| 51 | 87 |
| 52 } // namespace chromeos | 88 } // namespace chromeos |
| 53 | 89 |
| 54 #endif // CHROMEOS_DBUS_PERMISSION_BROKER_CLIENT_H_ | 90 #endif // CHROMEOS_DBUS_PERMISSION_BROKER_CLIENT_H_ |
| OLD | NEW |