| OLD | NEW |
| 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 // TestVolumeMountWatcherWin implementation. | 5 // TestVolumeMountWatcherWin implementation. |
| 6 | 6 |
| 7 #include "chrome/browser/storage_monitor/test_volume_mount_watcher_win.h" | 7 #include "chrome/browser/storage_monitor/test_volume_mount_watcher_win.h" |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 DCHECK(info); | 57 DCHECK(info); |
| 58 | 58 |
| 59 // Truncate to root path. | 59 // Truncate to root path. |
| 60 base::FilePath path(device_path); | 60 base::FilePath path(device_path); |
| 61 if (device_path.value().length() > 3) | 61 if (device_path.value().length() > 3) |
| 62 path = base::FilePath(device_path.value().substr(0, 3)); | 62 path = base::FilePath(device_path.value().substr(0, 3)); |
| 63 if (path.value()[0] < L'A' || path.value()[0] > L'Z') | 63 if (path.value()[0] < L'A' || path.value()[0] > L'Z') |
| 64 return false; | 64 return false; |
| 65 | 65 |
| 66 StorageInfo::Type type = StorageInfo::FIXED_MASS_STORAGE; | 66 StorageInfo::Type type = StorageInfo::FIXED_MASS_STORAGE; |
| 67 if (path.value() != ASCIIToUTF16("N:\\") && | 67 if (path.value() != base::ASCIIToUTF16("N:\\") && |
| 68 path.value() != ASCIIToUTF16("C:\\") && | 68 path.value() != base::ASCIIToUTF16("C:\\") && |
| 69 path.value() != GetTempRoot().value()) { | 69 path.value() != GetTempRoot().value()) { |
| 70 type = StorageInfo::REMOVABLE_MASS_STORAGE_WITH_DCIM; | 70 type = StorageInfo::REMOVABLE_MASS_STORAGE_WITH_DCIM; |
| 71 } | 71 } |
| 72 std::string unique_id = | 72 std::string unique_id = |
| 73 "\\\\?\\Volume{00000000-0000-0000-0000-000000000000}\\"; | 73 "\\\\?\\Volume{00000000-0000-0000-0000-000000000000}\\"; |
| 74 unique_id[11] = device_path.value()[0]; | 74 unique_id[11] = device_path.value()[0]; |
| 75 std::string device_id = StorageInfo::MakeDeviceId(type, unique_id); | 75 std::string device_id = StorageInfo::MakeDeviceId(type, unique_id); |
| 76 base::string16 storage_label = path.Append(L" Drive").LossyDisplayName(); | 76 base::string16 storage_label = path.Append(L" Drive").LossyDisplayName(); |
| 77 *info = StorageInfo(device_id, base::string16(), path.value(), storage_label, | 77 *info = StorageInfo(device_id, base::string16(), path.value(), storage_label, |
| 78 base::string16(), base::string16(), 1000000); | 78 base::string16(), base::string16(), 1000000); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 VolumeMountWatcherWin::GetAttachedDevicesCallbackType | 144 VolumeMountWatcherWin::GetAttachedDevicesCallbackType |
| 145 TestVolumeMountWatcherWin::GetAttachedDevicesCallback() const { | 145 TestVolumeMountWatcherWin::GetAttachedDevicesCallback() const { |
| 146 if (attached_devices_fake_) | 146 if (attached_devices_fake_) |
| 147 return base::Bind(&FakeGetAttachedDevices); | 147 return base::Bind(&FakeGetAttachedDevices); |
| 148 return base::Bind(&FakeGetSingleAttachedDevice); | 148 return base::Bind(&FakeGetSingleAttachedDevice); |
| 149 } | 149 } |
| 150 | 150 |
| 151 void TestVolumeMountWatcherWin::ShutdownWorkerPool() { | 151 void TestVolumeMountWatcherWin::ShutdownWorkerPool() { |
| 152 device_info_worker_pool_->Shutdown(); | 152 device_info_worker_pool_->Shutdown(); |
| 153 } | 153 } |
| OLD | NEW |