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 #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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 52 } |
53 | 53 |
54 // DiskMountManager override. | 54 // DiskMountManager override. |
55 virtual void RemoveObserver(Observer* observer) OVERRIDE { | 55 virtual void RemoveObserver(Observer* observer) OVERRIDE { |
56 observers_.RemoveObserver(observer); | 56 observers_.RemoveObserver(observer); |
57 } | 57 } |
58 | 58 |
59 // DiskMountManager override. | 59 // DiskMountManager override. |
60 virtual void MountPath(const std::string& source_path, | 60 virtual void MountPath(const std::string& source_path, |
61 const std::string& source_format, | 61 const std::string& source_format, |
| 62 const std::string& mount_label, |
62 MountType type) OVERRIDE { | 63 MountType type) OVERRIDE { |
63 // Hidden and non-existent devices should not be mounted. | 64 // Hidden and non-existent devices should not be mounted. |
64 if (type == MOUNT_TYPE_DEVICE) { | 65 if (type == MOUNT_TYPE_DEVICE) { |
65 DiskMap::const_iterator it = disks_.find(source_path); | 66 DiskMap::const_iterator it = disks_.find(source_path); |
66 if (it == disks_.end() || it->second->is_hidden()) { | 67 if (it == disks_.end() || it->second->is_hidden()) { |
67 OnMountCompleted(MOUNT_ERROR_INTERNAL, source_path, type, ""); | 68 OnMountCompleted(MOUNT_ERROR_INTERNAL, source_path, type, ""); |
68 return; | 69 return; |
69 } | 70 } |
70 } | 71 } |
71 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 72 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
72 cros_disks_client_->Mount( | 73 cros_disks_client_->Mount( |
73 source_path, | 74 source_path, |
74 source_format, | 75 source_format, |
| 76 mount_label, |
75 type, | 77 type, |
76 // When succeeds, OnMountCompleted will be called by | 78 // When succeeds, OnMountCompleted will be called by |
77 // "MountCompleted" signal instead. | 79 // "MountCompleted" signal instead. |
78 base::Bind(&base::DoNothing), | 80 base::Bind(&base::DoNothing), |
79 base::Bind(&DiskMountManagerImpl::OnMountCompleted, | 81 base::Bind(&DiskMountManagerImpl::OnMountCompleted, |
80 weak_ptr_factory_.GetWeakPtr(), | 82 weak_ptr_factory_.GetWeakPtr(), |
81 MOUNT_ERROR_INTERNAL, | 83 MOUNT_ERROR_INTERNAL, |
82 source_path, | 84 source_path, |
83 type, | 85 type, |
84 "")); | 86 "")); |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 VLOG(1) << "DiskMountManager Shutdown completed"; | 687 VLOG(1) << "DiskMountManager Shutdown completed"; |
686 } | 688 } |
687 | 689 |
688 // static | 690 // static |
689 DiskMountManager* DiskMountManager::GetInstance() { | 691 DiskMountManager* DiskMountManager::GetInstance() { |
690 return g_disk_mount_manager; | 692 return g_disk_mount_manager; |
691 } | 693 } |
692 | 694 |
693 } // namespace disks | 695 } // namespace disks |
694 } // namespace chromeos | 696 } // namespace chromeos |
OLD | NEW |