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 // chromeos::StorageMonitorCros implementation. | 5 // chromeos::StorageMonitorCros implementation. |
6 | 6 |
7 #include "chrome/browser/storage_monitor/storage_monitor_chromeos.h" | 7 #include "chrome/browser/storage_monitor/storage_monitor_chromeos.h" |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 225 |
226 MountMap::const_iterator info_it = mount_map_.find(current.value()); | 226 MountMap::const_iterator info_it = mount_map_.find(current.value()); |
227 if (info_it == mount_map_.end()) | 227 if (info_it == mount_map_.end()) |
228 return false; | 228 return false; |
229 | 229 |
230 if (device_info) | 230 if (device_info) |
231 *device_info = info_it->second; | 231 *device_info = info_it->second; |
232 return true; | 232 return true; |
233 } | 233 } |
234 | 234 |
235 uint64 StorageMonitorCros::GetStorageSize( | |
236 const std::string& device_location) const { | |
237 MountMap::const_iterator info_it = mount_map_.find(device_location); | |
238 return (info_it != mount_map_.end()) ? | |
239 info_it->second.total_size_in_bytes : 0; | |
240 } | |
241 | |
242 // Callback executed when the unmount call is run by DiskMountManager. | 235 // Callback executed when the unmount call is run by DiskMountManager. |
243 // Forwards result to |EjectDevice| caller. | 236 // Forwards result to |EjectDevice| caller. |
244 void NotifyUnmountResult( | 237 void NotifyUnmountResult( |
245 base::Callback<void(chrome::StorageMonitor::EjectStatus)> callback, | 238 base::Callback<void(chrome::StorageMonitor::EjectStatus)> callback, |
246 chromeos::MountError error_code) { | 239 chromeos::MountError error_code) { |
247 if (error_code == MOUNT_ERROR_NONE) | 240 if (error_code == MOUNT_ERROR_NONE) |
248 callback.Run(chrome::StorageMonitor::EJECT_OK); | 241 callback.Run(chrome::StorageMonitor::EJECT_OK); |
249 else | 242 else |
250 callback.Run(chrome::StorageMonitor::EJECT_FAILURE); | 243 callback.Run(chrome::StorageMonitor::EJECT_FAILURE); |
251 } | 244 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 vendor_name, | 327 vendor_name, |
335 model_name, | 328 model_name, |
336 storage_size_in_bytes); | 329 storage_size_in_bytes); |
337 | 330 |
338 mount_map_.insert(std::make_pair(mount_info.mount_path, object_info)); | 331 mount_map_.insert(std::make_pair(mount_info.mount_path, object_info)); |
339 | 332 |
340 receiver()->ProcessAttach(object_info); | 333 receiver()->ProcessAttach(object_info); |
341 } | 334 } |
342 | 335 |
343 } // namespace chromeos | 336 } // namespace chromeos |
OLD | NEW |