| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <set> | 5 #include <set> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 class TestPermissionProvider : public PermissionProvider { | 31 class TestPermissionProvider : public PermissionProvider { |
| 32 public: | 32 public: |
| 33 TestPermissionProvider(mojo::InterfaceRequest<PermissionProvider> request) | 33 TestPermissionProvider(mojo::InterfaceRequest<PermissionProvider> request) |
| 34 : binding_(this, request.Pass()) {} | 34 : binding_(this, request.Pass()) {} |
| 35 ~TestPermissionProvider() override {} | 35 ~TestPermissionProvider() override {} |
| 36 | 36 |
| 37 void HasDevicePermission( | 37 void HasDevicePermission( |
| 38 mojo::Array<mojo::String> requested_guids, | 38 mojo::Array<DeviceInfoPtr> requested_devices, |
| 39 const HasDevicePermissionCallback& callback) override { | 39 const HasDevicePermissionCallback& callback) override { |
| 40 // Permission to access all devices granted. | 40 // Permission to access all devices granted. |
| 41 callback.Run(requested_guids.Pass()); | 41 mojo::Array<mojo::String> allowed_guids(requested_devices.size()); |
| 42 for (size_t i = 0; i < requested_devices.size(); ++i) |
| 43 allowed_guids[i] = requested_devices[i]->guid; |
| 44 callback.Run(allowed_guids.Pass()); |
| 42 } | 45 } |
| 43 | 46 |
| 44 private: | 47 private: |
| 45 mojo::StrongBinding<PermissionProvider> binding_; | 48 mojo::StrongBinding<PermissionProvider> binding_; |
| 46 }; | 49 }; |
| 47 | 50 |
| 48 class TestDeviceClient : public DeviceClient { | 51 class TestDeviceClient : public DeviceClient { |
| 49 public: | 52 public: |
| 50 TestDeviceClient() {} | 53 TestDeviceClient() {} |
| 51 ~TestDeviceClient() override {} | 54 ~TestDeviceClient() override {} |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 base::RunLoop loop; | 285 base::RunLoop loop; |
| 283 device_manager->GetDeviceChanges(base::Bind(&ExpectDeviceChangesAndThen, | 286 device_manager->GetDeviceChanges(base::Bind(&ExpectDeviceChangesAndThen, |
| 284 added_guids, removed_guids, | 287 added_guids, removed_guids, |
| 285 loop.QuitClosure())); | 288 loop.QuitClosure())); |
| 286 loop.Run(); | 289 loop.Run(); |
| 287 } | 290 } |
| 288 } | 291 } |
| 289 | 292 |
| 290 } // namespace usb | 293 } // namespace usb |
| 291 } // namespace device | 294 } // namespace device |
| OLD | NEW |