Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 // chrome::MediaStorageUtil implementation. | 5 // chrome::MediaStorageUtil implementation. |
| 6 | 6 |
| 7 #include "chrome/browser/system_monitor/media_storage_util.h" | 7 #include "chrome/browser/system_monitor/media_storage_util.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 } | 179 } |
| 180 | 180 |
| 181 // static | 181 // static |
| 182 void MediaStorageUtil::SetGetDeviceInfoFromPathFunctionForTesting( | 182 void MediaStorageUtil::SetGetDeviceInfoFromPathFunctionForTesting( |
| 183 GetDeviceInfoFromPathFunction function) { | 183 GetDeviceInfoFromPathFunction function) { |
| 184 g_test_get_device_info_from_path_function = function; | 184 g_test_get_device_info_from_path_function = function; |
| 185 } | 185 } |
| 186 | 186 |
| 187 MediaStorageUtil::MediaStorageUtil() {} | 187 MediaStorageUtil::MediaStorageUtil() {} |
| 188 | 188 |
| 189 #if !defined(OS_LINUX) || defined(OS_CHROMEOS) | 189 #if !defined(OS_LINUX) |
|
vandebo (ex-Chrome)
2012/09/16 23:03:19
Remove this change or rebase on to the mentioned C
kmadhusu
2012/09/17 21:47:55
Done.
| |
| 190 // static | 190 // static |
| 191 bool MediaStorageUtil::GetDeviceInfoFromPathImpl(const FilePath& path, | 191 bool MediaStorageUtil::GetDeviceInfoFromPathImpl(const FilePath& path, |
| 192 std::string* device_id, | 192 std::string* device_id, |
| 193 string16* device_name, | 193 string16* device_name, |
| 194 FilePath* relative_path) { | 194 FilePath* relative_path) { |
| 195 // TODO(vandebo) This needs to be implemented per platform. Below is no | 195 // TODO(vandebo) This needs to be implemented per platform. Below is no |
| 196 // worse than what the code already does. | 196 // worse than what the code already does. |
| 197 // * Find mount point parent (determines relative file path) | 197 // * Find mount point parent (determines relative file path) |
| 198 // * Search System monitor, just in case. | 198 // * Search System monitor, just in case. |
| 199 // * If it's a removable device, generate device id, else use device root | 199 // * If it's a removable device, generate device id, else use device root |
| 200 // path as id | 200 // path as id |
| 201 if (device_id) | 201 if (device_id) |
| 202 *device_id = MakeDeviceId(FIXED_MASS_STORAGE, path.AsUTF8Unsafe()); | 202 *device_id = MakeDeviceId(FIXED_MASS_STORAGE, path.AsUTF8Unsafe()); |
| 203 if (device_name) | 203 if (device_name) |
| 204 *device_name = path.BaseName().LossyDisplayName(); | 204 *device_name = path.BaseName().LossyDisplayName(); |
| 205 if (relative_path) | 205 if (relative_path) |
| 206 *relative_path = FilePath(); | 206 *relative_path = FilePath(); |
| 207 return true; | 207 return true; |
| 208 } | 208 } |
| 209 #endif | 209 #endif |
| 210 | 210 |
| 211 } // namespace chrome | 211 } // namespace chrome |
| OLD | NEW |