OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/chromeos/disks/disk_mount_manager.h" | 5 #include "chrome/browser/chromeos/disks/disk_mount_manager.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include <sys/statvfs.h> | 10 #include <sys/statvfs.h> |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 NotifyDiskStatusUpdate(MOUNT_DISK_REMOVED, disk); | 405 NotifyDiskStatusUpdate(MOUNT_DISK_REMOVED, disk); |
406 delete iter->second; | 406 delete iter->second; |
407 disks_.erase(iter++); | 407 disks_.erase(iter++); |
408 } else { | 408 } else { |
409 ++iter; | 409 ++iter; |
410 } | 410 } |
411 } | 411 } |
412 } | 412 } |
413 | 413 |
414 // Callback to handle mount event signals. | 414 // Callback to handle mount event signals. |
415 void OnMountEvent(MountEventType event, std::string device_path) { | 415 void OnMountEvent(MountEventType event, const std::string& device_path_arg) { |
| 416 // Take a copy of the argument so we can modify it below. |
| 417 std::string device_path = device_path_arg; |
416 DiskMountManagerEventType type = MOUNT_DEVICE_ADDED; | 418 DiskMountManagerEventType type = MOUNT_DEVICE_ADDED; |
417 switch (event) { | 419 switch (event) { |
418 case DISK_ADDED: { | 420 case DISK_ADDED: { |
419 cros_disks_client_->GetDeviceProperties( | 421 cros_disks_client_->GetDeviceProperties( |
420 device_path, | 422 device_path, |
421 base::Bind(&DiskMountManagerImpl::OnGetDeviceProperties, | 423 base::Bind(&DiskMountManagerImpl::OnGetDeviceProperties, |
422 weak_ptr_factory_.GetWeakPtr()), | 424 weak_ptr_factory_.GetWeakPtr()), |
423 base::Bind(&DoNothing)); | 425 base::Bind(&DoNothing)); |
424 return; | 426 return; |
425 } | 427 } |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 VLOG(1) << "DiskMountManager Shutdown completed"; | 666 VLOG(1) << "DiskMountManager Shutdown completed"; |
665 } | 667 } |
666 | 668 |
667 // static | 669 // static |
668 DiskMountManager* DiskMountManager::GetInstance() { | 670 DiskMountManager* DiskMountManager::GetInstance() { |
669 return g_disk_mount_manager; | 671 return g_disk_mount_manager; |
670 } | 672 } |
671 | 673 |
672 } // namespace disks | 674 } // namespace disks |
673 } // namespace chromeos | 675 } // namespace chromeos |
OLD | NEW |