| 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" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 public: | 29 public: |
| 30 // The ResultCallback is used for both the RequestPathAccess and | 30 // The ResultCallback is used for both the RequestPathAccess and |
| 31 // RequestUsbAccess methods. Its boolean parameter represents the result of | 31 // RequestUsbAccess methods. Its boolean parameter represents the result of |
| 32 // the operation that it was submitted alongside. | 32 // the operation that it was submitted alongside. |
| 33 typedef base::Callback<void(bool)> ResultCallback; | 33 typedef base::Callback<void(bool)> ResultCallback; |
| 34 | 34 |
| 35 ~PermissionBrokerClient() override; | 35 ~PermissionBrokerClient() override; |
| 36 | 36 |
| 37 static PermissionBrokerClient* Create(); | 37 static PermissionBrokerClient* Create(); |
| 38 | 38 |
| 39 // CheckPathAccess requests a hint from the permission broker about whether |
| 40 // a later call to RequestPathAccess will be successful. It presumes that |
| 41 // the |interface_id| value passed to RequestPathAccess will be |
| 42 // UsbDevicePermissionsData::ANY_INTERFACE). |
| 43 virtual void CheckPathAccess(const std::string& path, |
| 44 const ResultCallback& callback) = 0; |
| 45 |
| 39 // RequestPathAccess requests access to a single device node identified by | 46 // RequestPathAccess requests access to a single device node identified by |
| 40 // |path|. If |interface_id| value is passed (different than | 47 // |path|. If |interface_id| value is passed (different than |
| 41 // UsbDevicePermissionData::ANY_INTERFACE), the request will check if a | 48 // UsbDevicePermissionData::ANY_INTERFACE), the request will check if a |
| 42 // specific interface is claimed while requesting access. | 49 // specific interface is claimed while requesting access. |
| 43 // This allows devices with multiple interfaces to be accessed even if | 50 // This allows devices with multiple interfaces to be accessed even if |
| 44 // some of them are already claimed by kernel. | 51 // some of them are already claimed by kernel. |
| 45 virtual void RequestPathAccess(const std::string& path, | 52 virtual void RequestPathAccess(const std::string& path, |
| 46 int interface_id, | 53 int interface_id, |
| 47 const ResultCallback& callback) = 0; | 54 const ResultCallback& callback) = 0; |
| 48 | 55 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 protected: | 88 protected: |
| 82 PermissionBrokerClient(); | 89 PermissionBrokerClient(); |
| 83 | 90 |
| 84 private: | 91 private: |
| 85 DISALLOW_COPY_AND_ASSIGN(PermissionBrokerClient); | 92 DISALLOW_COPY_AND_ASSIGN(PermissionBrokerClient); |
| 86 }; | 93 }; |
| 87 | 94 |
| 88 } // namespace chromeos | 95 } // namespace chromeos |
| 89 | 96 |
| 90 #endif // CHROMEOS_DBUS_PERMISSION_BROKER_CLIENT_H_ | 97 #endif // CHROMEOS_DBUS_PERMISSION_BROKER_CLIENT_H_ |
| OLD | NEW |