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

Side by Side Diff: device/devices_app/usb/device_manager_impl.cc

Issue 1369643002: Add configuration and interface permission checks to DeviceImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add new method ot Android USB mocks. Created 5 years, 2 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
OLDNEW
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 "device/devices_app/usb/device_manager_impl.h" 5 #include "device/devices_app/usb/device_manager_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 197 }
198 198
199 void DeviceManagerImpl::OnGetDevicePermissionCheckComplete( 199 void DeviceManagerImpl::OnGetDevicePermissionCheckComplete(
200 scoped_refptr<UsbDevice> device, 200 scoped_refptr<UsbDevice> device,
201 mojo::InterfaceRequest<Device> device_request, 201 mojo::InterfaceRequest<Device> device_request,
202 mojo::Array<mojo::String> allowed_guids) { 202 mojo::Array<mojo::String> allowed_guids) {
203 if (allowed_guids.size() == 0) 203 if (allowed_guids.size() == 0)
204 return; 204 return;
205 205
206 DCHECK(allowed_guids.size() == 1); 206 DCHECK(allowed_guids.size() == 1);
207 new DeviceImpl(device, device_request.Pass()); 207 PermissionProviderPtr permission_provider;
208 permission_provider_->Bind(mojo::GetProxy(&permission_provider));
209 new DeviceImpl(device, permission_provider.Pass(), device_request.Pass());
208 } 210 }
209 211
210 void DeviceManagerImpl::OnGetDevices(EnumerationOptionsPtr options, 212 void DeviceManagerImpl::OnGetDevices(EnumerationOptionsPtr options,
211 const GetDevicesCallback& callback, 213 const GetDevicesCallback& callback,
212 const DeviceList& devices) { 214 const DeviceList& devices) {
213 std::vector<UsbDeviceFilter> filters; 215 std::vector<UsbDeviceFilter> filters;
214 if (options) 216 if (options)
215 filters = options->filters.To<std::vector<UsbDeviceFilter>>(); 217 filters = options->filters.To<std::vector<UsbDeviceFilter>>();
216 218
217 std::map<std::string, scoped_refptr<UsbDevice>> device_map; 219 std::map<std::string, scoped_refptr<UsbDevice>> device_map;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 callback.Run(notification.Pass()); 296 callback.Run(notification.Pass());
295 device_change_callbacks_.pop(); 297 device_change_callbacks_.pop();
296 } 298 }
297 299
298 if (devices_added_.size() > 0 || !devices_removed_.empty()) 300 if (devices_added_.size() > 0 || !devices_removed_.empty())
299 MaybeRunDeviceChangesCallback(); 301 MaybeRunDeviceChangesCallback();
300 } 302 }
301 303
302 } // namespace usb 304 } // namespace usb
303 } // namespace device 305 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698