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

Side by Side Diff: components/storage_monitor/portable_device_watcher_win.cc

Issue 2870263002: Rename ScopedComPtr::Receive to ScopedComPtr::GetAddressOf (Closed)
Patch Set: Rebase to 2a6f440 Created 3 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // Any tasks that communicates with the portable device may take >100ms to 5 // Any tasks that communicates with the portable device may take >100ms to
6 // complete. Those tasks should be run on an blocking thread instead of the 6 // complete. Those tasks should be run on an blocking thread instead of the
7 // UI thread. 7 // UI thread.
8 8
9 #include "components/storage_monitor/portable_device_watcher_win.h" 9 #include "components/storage_monitor/portable_device_watcher_win.h"
10 10
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 204 }
205 205
206 // Constructs a unique identifier for the object specified by the |object_id|. 206 // Constructs a unique identifier for the object specified by the |object_id|.
207 // On success, returns true and fills in |unique_id|. 207 // On success, returns true and fills in |unique_id|.
208 bool GetObjectUniqueId(IPortableDevice* device, 208 bool GetObjectUniqueId(IPortableDevice* device,
209 const base::string16& object_id, 209 const base::string16& object_id,
210 base::string16* unique_id) { 210 base::string16* unique_id) {
211 DCHECK(device); 211 DCHECK(device);
212 DCHECK(unique_id); 212 DCHECK(unique_id);
213 base::win::ScopedComPtr<IPortableDeviceContent> content; 213 base::win::ScopedComPtr<IPortableDeviceContent> content;
214 HRESULT hr = device->Content(content.Receive()); 214 HRESULT hr = device->Content(content.GetAddressOf());
215 if (FAILED(hr)) { 215 if (FAILED(hr)) {
216 DPLOG(ERROR) << "Failed to get IPortableDeviceContent interface"; 216 DPLOG(ERROR) << "Failed to get IPortableDeviceContent interface";
217 return false; 217 return false;
218 } 218 }
219 219
220 base::win::ScopedComPtr<IPortableDeviceProperties> properties; 220 base::win::ScopedComPtr<IPortableDeviceProperties> properties;
221 hr = content->Properties(properties.Receive()); 221 hr = content->Properties(properties.GetAddressOf());
222 if (FAILED(hr)) { 222 if (FAILED(hr)) {
223 DPLOG(ERROR) << "Failed to get IPortableDeviceProperties interface"; 223 DPLOG(ERROR) << "Failed to get IPortableDeviceProperties interface";
224 return false; 224 return false;
225 } 225 }
226 226
227 base::win::ScopedComPtr<IPortableDeviceKeyCollection> properties_to_read; 227 base::win::ScopedComPtr<IPortableDeviceKeyCollection> properties_to_read;
228 if (!PopulatePropertyKeyCollection(object_id, &properties_to_read)) 228 if (!PopulatePropertyKeyCollection(object_id, &properties_to_read))
229 return false; 229 return false;
230 230
231 base::win::ScopedComPtr<IPortableDeviceValues> properties_values; 231 base::win::ScopedComPtr<IPortableDeviceValues> properties_values;
232 if (FAILED(properties->GetValues(object_id.c_str(), 232 if (FAILED(properties->GetValues(object_id.c_str(), properties_to_read.Get(),
233 properties_to_read.Get(), 233 properties_values.GetAddressOf()))) {
234 properties_values.Receive()))) {
235 return false; 234 return false;
236 } 235 }
237 236
238 REFPROPERTYKEY key = GetUniqueIdPropertyKey(object_id); 237 REFPROPERTYKEY key = GetUniqueIdPropertyKey(object_id);
239 return GetStringPropertyValue(properties_values.Get(), key, unique_id); 238 return GetStringPropertyValue(properties_values.Get(), key, unique_id);
240 } 239 }
241 240
242 // Constructs the device storage unique identifier using |device_serial_num| and 241 // Constructs the device storage unique identifier using |device_serial_num| and
243 // |storage_id|. On success, returns true and fills in |device_storage_id|. 242 // |storage_id|. On success, returns true and fills in |device_storage_id|.
244 bool ConstructDeviceStorageUniqueId(const base::string16& device_serial_num, 243 bool ConstructDeviceStorageUniqueId(const base::string16& device_serial_num,
(...skipping 10 matching lines...) Expand all
255 } 254 }
256 255
257 // Gets a list of removable storage object identifiers present in |device|. 256 // Gets a list of removable storage object identifiers present in |device|.
258 // On success, returns true and fills in |storage_object_ids|. 257 // On success, returns true and fills in |storage_object_ids|.
259 bool GetRemovableStorageObjectIds( 258 bool GetRemovableStorageObjectIds(
260 IPortableDevice* device, 259 IPortableDevice* device,
261 PortableDeviceWatcherWin::StorageObjectIDs* storage_object_ids) { 260 PortableDeviceWatcherWin::StorageObjectIDs* storage_object_ids) {
262 DCHECK(device); 261 DCHECK(device);
263 DCHECK(storage_object_ids); 262 DCHECK(storage_object_ids);
264 base::win::ScopedComPtr<IPortableDeviceCapabilities> capabilities; 263 base::win::ScopedComPtr<IPortableDeviceCapabilities> capabilities;
265 HRESULT hr = device->Capabilities(capabilities.Receive()); 264 HRESULT hr = device->Capabilities(capabilities.GetAddressOf());
266 if (FAILED(hr)) { 265 if (FAILED(hr)) {
267 DPLOG(ERROR) << "Failed to get IPortableDeviceCapabilities interface"; 266 DPLOG(ERROR) << "Failed to get IPortableDeviceCapabilities interface";
268 return false; 267 return false;
269 } 268 }
270 269
271 base::win::ScopedComPtr<IPortableDevicePropVariantCollection> storage_ids; 270 base::win::ScopedComPtr<IPortableDevicePropVariantCollection> storage_ids;
272 hr = capabilities->GetFunctionalObjects(WPD_FUNCTIONAL_CATEGORY_STORAGE, 271 hr = capabilities->GetFunctionalObjects(WPD_FUNCTIONAL_CATEGORY_STORAGE,
273 storage_ids.Receive()); 272 storage_ids.GetAddressOf());
274 if (FAILED(hr)) { 273 if (FAILED(hr)) {
275 DPLOG(ERROR) << "Failed to get IPortableDevicePropVariantCollection"; 274 DPLOG(ERROR) << "Failed to get IPortableDevicePropVariantCollection";
276 return false; 275 return false;
277 } 276 }
278 277
279 DWORD num_storage_obj_ids = 0; 278 DWORD num_storage_obj_ids = 0;
280 hr = storage_ids->GetCount(&num_storage_obj_ids); 279 hr = storage_ids->GetCount(&num_storage_obj_ids);
281 if (FAILED(hr)) 280 if (FAILED(hr))
282 return false; 281 return false;
283 282
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 if (storage_notifications_) { 665 if (storage_notifications_) {
667 storage_notifications_->ProcessDetach( 666 storage_notifications_->ProcessDetach(
668 storage_map_iter->second.device_id()); 667 storage_map_iter->second.device_id());
669 } 668 }
670 storage_map_.erase(storage_map_iter); 669 storage_map_.erase(storage_map_iter);
671 } 670 }
672 device_map_.erase(device_iter); 671 device_map_.erase(device_iter);
673 } 672 }
674 673
675 } // namespace storage_monitor 674 } // namespace storage_monitor
OLDNEW
« no previous file with comments | « chrome/utility/shell_handler_impl_win.cc ('k') | components/update_client/background_downloader_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698