| 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 | 275 |
| 276 manager->UnmountPath(mount_path, chromeos::UNMOUNT_OPTIONS_NONE, | 276 manager->UnmountPath(mount_path, chromeos::UNMOUNT_OPTIONS_NONE, |
| 277 base::Bind(NotifyUnmountResult, callback)); | 277 base::Bind(NotifyUnmountResult, callback)); |
| 278 } | 278 } |
| 279 | 279 |
| 280 device::MediaTransferProtocolManager* | 280 device::MediaTransferProtocolManager* |
| 281 StorageMonitorCros::media_transfer_protocol_manager() { | 281 StorageMonitorCros::media_transfer_protocol_manager() { |
| 282 return media_transfer_protocol_manager_.get(); | 282 return media_transfer_protocol_manager_.get(); |
| 283 } | 283 } |
| 284 | 284 |
| 285 std::vector<chrome::StorageInfo> |
| 286 StorageMonitorCros::GetAllAvailableStorages() const { |
| 287 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 288 std::vector<chrome::StorageInfo> results; |
| 289 |
| 290 for (MountMap::const_iterator it = mount_map_.begin(); |
| 291 it != mount_map_.end(); ++it) |
| 292 results.push_back(it->second); |
| 293 |
| 294 return results; |
| 295 } |
| 296 |
| 285 void StorageMonitorCros::AddMountedPath( | 297 void StorageMonitorCros::AddMountedPath( |
| 286 const disks::DiskMountManager::MountPointInfo& mount_info, bool has_dcim) { | 298 const disks::DiskMountManager::MountPointInfo& mount_info, bool has_dcim) { |
| 287 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 299 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 288 | 300 |
| 289 if (ContainsKey(mount_map_, mount_info.mount_path)) { | 301 if (ContainsKey(mount_map_, mount_info.mount_path)) { |
| 290 // CheckExistingMountPointsOnUIThread() added the mount point information | 302 // CheckExistingMountPointsOnUIThread() added the mount point information |
| 291 // in the map before the device attached handler is called. Therefore, an | 303 // in the map before the device attached handler is called. Therefore, an |
| 292 // entry for the device already exists in the map. | 304 // entry for the device already exists in the map. |
| 293 return; | 305 return; |
| 294 } | 306 } |
| 295 | 307 |
| 296 // Get the media device uuid and label if exists. | 308 // Get the media device uuid and label if exists. |
| 297 chrome::StorageInfo info; | 309 chrome::StorageInfo info; |
| 298 if (!GetDeviceInfo(mount_info, has_dcim, &info)) | 310 if (!GetDeviceInfo(mount_info, has_dcim, &info)) |
| 299 return; | 311 return; |
| 300 | 312 |
| 301 if (info.device_id().empty()) | 313 if (info.device_id().empty()) |
| 302 return; | 314 return; |
| 303 | 315 |
| 304 mount_map_.insert(std::make_pair(mount_info.mount_path, info)); | 316 mount_map_.insert(std::make_pair(mount_info.mount_path, info)); |
| 305 | 317 |
| 306 receiver()->ProcessAttach(info); | 318 receiver()->ProcessAttach(info); |
| 307 } | 319 } |
| 308 | 320 |
| 309 } // namespace chromeos | 321 } // namespace chromeos |
| OLD | NEW |