| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 } | 177 } |
| 178 | 178 |
| 179 // static | 179 // static |
| 180 void MediaStorageUtil::SetGetDeviceInfoFromPathFunctionForTesting( | 180 void MediaStorageUtil::SetGetDeviceInfoFromPathFunctionForTesting( |
| 181 GetDeviceInfoFromPathFunction function) { | 181 GetDeviceInfoFromPathFunction function) { |
| 182 g_test_get_device_info_from_path_function = function; | 182 g_test_get_device_info_from_path_function = function; |
| 183 } | 183 } |
| 184 | 184 |
| 185 MediaStorageUtil::MediaStorageUtil() {} | 185 MediaStorageUtil::MediaStorageUtil() {} |
| 186 | 186 |
| 187 #if !defined(OS_LINUX) || defined(OS_CHROMEOS) | 187 #if !defined(OS_LINUX) |
| 188 // static | 188 // static |
| 189 void MediaStorageUtil::GetDeviceInfoFromPathImpl(const FilePath& path, | 189 void MediaStorageUtil::GetDeviceInfoFromPathImpl(const FilePath& path, |
| 190 std::string* device_id, | 190 std::string* device_id, |
| 191 string16* device_name, | 191 string16* device_name, |
| 192 FilePath* relative_path) { | 192 FilePath* relative_path) { |
| 193 // TODO(vandebo) This needs to be implemented per platform. Below is no | 193 // TODO(vandebo) This needs to be implemented per platform. Below is no |
| 194 // worse than what the code already does. | 194 // worse than what the code already does. |
| 195 // * Find mount point parent (determines relative file path) | 195 // * Find mount point parent (determines relative file path) |
| 196 // * Search System monitor, just in case. | 196 // * Search System monitor, just in case. |
| 197 // * If it's a removable device, generate device id, else use device root | 197 // * If it's a removable device, generate device id, else use device root |
| 198 // path as id | 198 // path as id |
| 199 if (device_id) | 199 if (device_id) |
| 200 *device_id = MakeDeviceId(FIXED_MASS_STORAGE, path.AsUTF8Unsafe()); | 200 *device_id = MakeDeviceId(FIXED_MASS_STORAGE, path.AsUTF8Unsafe()); |
| 201 if (device_name) | 201 if (device_name) |
| 202 *device_name = path.BaseName().LossyDisplayName(); | 202 *device_name = path.BaseName().LossyDisplayName(); |
| 203 if (relative_path) | 203 if (relative_path) |
| 204 *relative_path = FilePath(); | 204 *relative_path = FilePath(); |
| 205 } | 205 } |
| 206 #endif | 206 #endif |
| 207 | 207 |
| 208 } // namespace chrome | 208 } // namespace chrome |
| OLD | NEW |