chrome/browser/system_monitor/portable_device_watcher_win.cc
// Access the device and gets the device storage details. On success, returns
// true and populates |storage_objects| with device storage details.
Access the device and gets the device storage details. On success, returns
true and populates |storage_objects| with device storage details.
Access the device and gets the device storage details . On success returns true and populates |storage_objects| with device storage details .
bool GetDeviceStorageObjectsOnBlockingThread(
    const string16& pnp_device_id,
    PortableDeviceWatcherWin::StorageObjects* storage_objects) {
  DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
  DCHECK(storage_objects);
  base::win::ScopedComPtr<IPortableDevice> device;
  if (!SetUp(pnp_device_id, &device))
    return false;
  string16 device_serial_num;
  if (!GetObjectUniqueId(device.get(), WPD_DEVICE_OBJECT_ID,
                         &device_serial_num)) {
    return false;
  }
  PortableDeviceWatcherWin::StorageObjectIDs storage_obj_ids;
  if (!GetRemovableStorageObjectIds(device.get(), &storage_obj_ids))
    return false;
  for (PortableDeviceWatcherWin::StorageObjectIDs::const_iterator id_iter =
       storage_obj_ids.begin(); id_iter != storage_obj_ids.end(); ++id_iter) {
    string16 storage_persistent_id;
    if (!GetObjectUniqueId(device.get(), *id_iter, &storage_persistent_id))
      continue;
    std::string device_storage_id;
    if (ConstructDeviceStorageUniqueId(device_serial_num, storage_persistent_id,
                                       &device_storage_id)) {
      storage_objects->push_back(PortableDeviceWatcherWin::DeviceStorageObject(
          *id_iter, device_storage_id));
    }
  }
  return true;
}
bool GetDeviceStorageObjectsOnBlockingThread ( const string16 & pnp_device_id , PortableDeviceWatcherWin :: StorageObjects * storage_objects ) { DCHECK ( content :: BrowserThread :: GetBlockingPool ( ) -> RunsTasksOnCurrentThread ( ) ) ; DCHECK ( storage_objects ) ; base :: win :: ScopedComPtr < IPortableDevice > device ; if ( ! SetUp ( pnp_device_id , & device ) ) return false ; string16 device_serial_num ; if ( ! GetObjectUniqueId ( device . get ( ) , WPD_DEVICE_OBJECT_ID , & device_serial_num ) ) { return false ; } PortableDeviceWatcherWin :: StorageObjectIDs storage_obj_ids ; if ( ! GetRemovableStorageObjectIds ( device . get ( ) , & storage_obj_ids ) ) return false ; for ( PortableDeviceWatcherWin :: StorageObjectIDs :: const_iterator id_iter = storage_obj_ids . begin ( ) ; id_iter != storage_obj_ids . end ( ) ; ++ id_iter ) { string16 storage_persistent_id ; if ( ! GetObjectUniqueId ( device . get ( ) , * id_iter , & storage_persistent_id ) ) continue ; std :: string device_storage_id ; if ( ConstructDeviceStorageUniqueId ( device_serial_num , storage_persistent_id , & device_storage_id ) ) { storage_objects -> push_back ( PortableDeviceWatcherWin :: DeviceStorageObject ( * id_iter , device_storage_id ) ) ; } } return true ; }
Access the device and gets the device storage details.
Access the device and gets the device storage details .