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

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

Issue 1233453011: Revert of Remove some legacy versions of StartsWith and EndsWith. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « components/search/search.cc ('k') | components/test_runner/web_test_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "components/storage_monitor/volume_mount_watcher_win.h" 5 #include "components/storage_monitor/volume_mount_watcher_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <dbt.h> 9 #include <dbt.h>
10 #include <fileapi.h> 10 #include <fileapi.h>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 if (drive_type == DRIVE_FIXED || drive_type == DRIVE_REMOTE || 63 if (drive_type == DRIVE_FIXED || drive_type == DRIVE_REMOTE ||
64 drive_type == DRIVE_RAMDISK) { 64 drive_type == DRIVE_RAMDISK) {
65 return FIXED; 65 return FIXED;
66 } 66 }
67 if (drive_type != DRIVE_REMOVABLE) 67 if (drive_type != DRIVE_REMOVABLE)
68 return FLOPPY; 68 return FLOPPY;
69 69
70 // Check device strings of the form "X:" and "\\.\X:" 70 // Check device strings of the form "X:" and "\\.\X:"
71 // For floppy drives, these will return strings like "/Device/Floppy0" 71 // For floppy drives, these will return strings like "/Device/Floppy0"
72 base::string16 device = mount_point; 72 base::string16 device = mount_point;
73 if (base::EndsWith(mount_point, L"\\", base::CompareCase::INSENSITIVE_ASCII)) 73 if (base::EndsWith(mount_point, L"\\", false))
74 device = mount_point.substr(0, mount_point.length() - 1); 74 device = mount_point.substr(0, mount_point.length() - 1);
75 base::string16 device_path; 75 base::string16 device_path;
76 base::string16 device_path_slash; 76 base::string16 device_path_slash;
77 DWORD dos_device = QueryDosDevice( 77 DWORD dos_device = QueryDosDevice(
78 device.c_str(), base::WriteInto(&device_path, kMaxPathBufLen), 78 device.c_str(), base::WriteInto(&device_path, kMaxPathBufLen),
79 kMaxPathBufLen); 79 kMaxPathBufLen);
80 base::string16 device_slash = base::string16(L"\\\\.\\"); 80 base::string16 device_slash = base::string16(L"\\\\.\\");
81 device_slash += device; 81 device_slash += device;
82 DWORD dos_device_slash = QueryDosDevice( 82 DWORD dos_device_slash = QueryDosDevice(
83 device_slash.c_str(), base::WriteInto(&device_path_slash, kMaxPathBufLen), 83 device_slash.c_str(), base::WriteInto(&device_path_slash, kMaxPathBufLen),
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 callback.Run(StorageMonitor::EJECT_FAILURE); 544 callback.Run(StorageMonitor::EJECT_FAILURE);
545 return; 545 return;
546 } 546 }
547 547
548 device_info_task_runner_->PostTask( 548 device_info_task_runner_->PostTask(
549 FROM_HERE, base::Bind(&EjectDeviceInThreadPool, device, callback, 549 FROM_HERE, base::Bind(&EjectDeviceInThreadPool, device, callback,
550 device_info_task_runner_, 0)); 550 device_info_task_runner_, 0));
551 } 551 }
552 552
553 } // namespace storage_monitor 553 } // namespace storage_monitor
OLDNEW
« no previous file with comments | « components/search/search.cc ('k') | components/test_runner/web_test_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698