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

Side by Side Diff: chrome/browser/storage_monitor/portable_device_watcher_win.cc

Issue 120983002: Update some uses of UTF conversions in chrome/browser 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/storage_monitor/portable_device_watcher_win.h" 9 #include "chrome/browser/storage_monitor/portable_device_watcher_win.h"
10 10
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 // |storage_id|. On success, returns true and fills in |device_storage_id|. 243 // |storage_id|. On success, returns true and fills in |device_storage_id|.
244 bool ConstructDeviceStorageUniqueId(const base::string16& device_serial_num, 244 bool ConstructDeviceStorageUniqueId(const base::string16& device_serial_num,
245 const base::string16& storage_id, 245 const base::string16& storage_id,
246 std::string* device_storage_id) { 246 std::string* device_storage_id) {
247 if (device_serial_num.empty() && storage_id.empty()) 247 if (device_serial_num.empty() && storage_id.empty())
248 return false; 248 return false;
249 249
250 DCHECK(device_storage_id); 250 DCHECK(device_storage_id);
251 *device_storage_id = StorageInfo::MakeDeviceId( 251 *device_storage_id = StorageInfo::MakeDeviceId(
252 StorageInfo::MTP_OR_PTP, 252 StorageInfo::MTP_OR_PTP,
253 UTF16ToUTF8(storage_id + L':' + device_serial_num)); 253 base::UTF16ToUTF8(storage_id + L':' + device_serial_num));
254 return true; 254 return true;
255 } 255 }
256 256
257 // Gets a list of removable storage object identifiers present in |device|. 257 // Gets a list of removable storage object identifiers present in |device|.
258 // On success, returns true and fills in |storage_object_ids|. 258 // On success, returns true and fills in |storage_object_ids|.
259 bool GetRemovableStorageObjectIds( 259 bool GetRemovableStorageObjectIds(
260 IPortableDevice* device, 260 IPortableDevice* device,
261 PortableDeviceWatcherWin::StorageObjectIDs* storage_object_ids) { 261 PortableDeviceWatcherWin::StorageObjectIDs* storage_object_ids) {
262 DCHECK(device); 262 DCHECK(device);
263 DCHECK(storage_object_ids); 263 DCHECK(storage_object_ids);
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 } 535 }
536 return false; 536 return false;
537 } 537 }
538 538
539 // static 539 // static
540 base::string16 PortableDeviceWatcherWin::GetStoragePathFromStorageId( 540 base::string16 PortableDeviceWatcherWin::GetStoragePathFromStorageId(
541 const std::string& storage_unique_id) { 541 const std::string& storage_unique_id) {
542 // Construct a dummy device path using the storage name. This is only used 542 // Construct a dummy device path using the storage name. This is only used
543 // for registering the device media file system. 543 // for registering the device media file system.
544 DCHECK(!storage_unique_id.empty()); 544 DCHECK(!storage_unique_id.empty());
545 return UTF8ToUTF16("\\\\" + storage_unique_id); 545 return base::UTF8ToUTF16("\\\\" + storage_unique_id);
546 } 546 }
547 547
548 void PortableDeviceWatcherWin::SetNotifications( 548 void PortableDeviceWatcherWin::SetNotifications(
549 StorageMonitor::Receiver* notifications) { 549 StorageMonitor::Receiver* notifications) {
550 storage_notifications_ = notifications; 550 storage_notifications_ = notifications;
551 } 551 }
552 552
553 void PortableDeviceWatcherWin::EjectDevice( 553 void PortableDeviceWatcherWin::EjectDevice(
554 const std::string& device_id, 554 const std::string& device_id,
555 base::Callback<void(StorageMonitor::EjectStatus)> callback) { 555 base::Callback<void(StorageMonitor::EjectStatus)> callback) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 MTPStorageMap::iterator storage_map_iter = storage_map_.find(storage_id); 658 MTPStorageMap::iterator storage_map_iter = storage_map_.find(storage_id);
659 DCHECK(storage_map_iter != storage_map_.end()); 659 DCHECK(storage_map_iter != storage_map_.end());
660 if (storage_notifications_) { 660 if (storage_notifications_) {
661 storage_notifications_->ProcessDetach( 661 storage_notifications_->ProcessDetach(
662 storage_map_iter->second.device_id()); 662 storage_map_iter->second.device_id());
663 } 663 }
664 storage_map_.erase(storage_map_iter); 664 storage_map_.erase(storage_map_iter);
665 } 665 }
666 device_map_.erase(device_iter); 666 device_map_.erase(device_iter);
667 } 667 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698