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

Side by Side Diff: chrome/browser/media_galleries/win/mtp_device_operations_util.cc

Issue 113403006: Update some uses of char16 to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chrome/browser/media_galleries/win/mtp_device_operations_util.h" 5 #include "chrome/browser/media_galleries/win/mtp_device_operations_util.h"
6 6
7 #include <portabledevice.h> 7 #include <portabledevice.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // WPD_CONTENT_FUNCTIONAL_OBJECT. 102 // WPD_CONTENT_FUNCTIONAL_OBJECT.
103 return (content_type == WPD_CONTENT_TYPE_FOLDER || 103 return (content_type == WPD_CONTENT_TYPE_FOLDER ||
104 content_type == WPD_CONTENT_TYPE_FUNCTIONAL_OBJECT); 104 content_type == WPD_CONTENT_TYPE_FUNCTIONAL_OBJECT);
105 } 105 }
106 106
107 // Returns the friendly name of the object from the property key values 107 // Returns the friendly name of the object from the property key values
108 // specified by the |properties_values|. 108 // specified by the |properties_values|.
109 base::string16 GetObjectName(IPortableDeviceValues* properties_values, 109 base::string16 GetObjectName(IPortableDeviceValues* properties_values,
110 bool is_directory) { 110 bool is_directory) {
111 DCHECK(properties_values); 111 DCHECK(properties_values);
112 base::win::ScopedCoMem<char16> buffer; 112 base::win::ScopedCoMem<base::char16> buffer;
113 REFPROPERTYKEY key = 113 REFPROPERTYKEY key =
114 is_directory ? WPD_OBJECT_NAME : WPD_OBJECT_ORIGINAL_FILE_NAME; 114 is_directory ? WPD_OBJECT_NAME : WPD_OBJECT_ORIGINAL_FILE_NAME;
115 HRESULT hr = properties_values->GetStringValue(key, &buffer); 115 HRESULT hr = properties_values->GetStringValue(key, &buffer);
116 base::string16 result; 116 base::string16 result;
117 if (SUCCEEDED(hr)) 117 if (SUCCEEDED(hr))
118 result.assign(buffer); 118 result.assign(buffer);
119 return result; 119 return result;
120 } 120 }
121 121
122 // Gets the last modified time of the object from the property key values 122 // Gets the last modified time of the object from the property key values
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 base::win::ScopedComPtr<IEnumPortableDeviceObjectIDs> enum_object_ids = 262 base::win::ScopedComPtr<IEnumPortableDeviceObjectIDs> enum_object_ids =
263 GetDeviceObjectEnumerator(device, directory_object_id); 263 GetDeviceObjectEnumerator(device, directory_object_id);
264 if (!enum_object_ids) 264 if (!enum_object_ids)
265 return false; 265 return false;
266 266
267 // Loop calling Next() while S_OK is being returned. 267 // Loop calling Next() while S_OK is being returned.
268 const DWORD num_objects_to_request = 10; 268 const DWORD num_objects_to_request = 10;
269 const bool get_all_entries = object_name.empty(); 269 const bool get_all_entries = object_name.empty();
270 for (HRESULT hr = S_OK; hr == S_OK;) { 270 for (HRESULT hr = S_OK; hr == S_OK;) {
271 DWORD num_objects_fetched = 0; 271 DWORD num_objects_fetched = 0;
272 scoped_ptr<char16*[]> object_ids(new char16*[num_objects_to_request]); 272 scoped_ptr<base::char16*[]> object_ids(
273 new base::char16*[num_objects_to_request]);
273 hr = enum_object_ids->Next(num_objects_to_request, 274 hr = enum_object_ids->Next(num_objects_to_request,
274 object_ids.get(), 275 object_ids.get(),
275 &num_objects_fetched); 276 &num_objects_fetched);
276 for (DWORD index = 0; index < num_objects_fetched; ++index) { 277 for (DWORD index = 0; index < num_objects_fetched; ++index) {
277 MTPDeviceObjectEntry entry; 278 MTPDeviceObjectEntry entry;
278 if (GetMTPDeviceObjectEntry(device, 279 if (GetMTPDeviceObjectEntry(device,
279 object_ids[index], 280 object_ids[index],
280 &entry)) { 281 &entry)) {
281 if (get_all_entries) { 282 if (get_all_entries) {
282 object_entries->push_back(entry); 283 object_entries->push_back(entry);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 object_entries.empty()) 402 object_entries.empty())
402 return base::string16(); 403 return base::string16();
403 // TODO(thestig): This DCHECK can fail. Multiple MTP objects can have 404 // TODO(thestig): This DCHECK can fail. Multiple MTP objects can have
404 // the same name. Handle the situation gracefully. Refer to crbug.com/169930 405 // the same name. Handle the situation gracefully. Refer to crbug.com/169930
405 // for more details. 406 // for more details.
406 DCHECK_EQ(1U, object_entries.size()); 407 DCHECK_EQ(1U, object_entries.size());
407 return object_entries[0].object_id; 408 return object_entries[0].object_id;
408 } 409 }
409 410
410 } // namespace media_transfer_protocol 411 } // namespace media_transfer_protocol
OLDNEW
« no previous file with comments | « chrome/browser/importer/ie_importer_browsertest_win.cc ('k') | chrome/browser/profiles/profile_shortcut_manager_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698