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 "chromeos/disks/disk_mount_manager.h" | 5 #include "chromeos/disks/disk_mount_manager.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 // |mount_path|. | 266 // |mount_path|. |
267 void UnmountChildMounts(const std::string& mount_path_in) { | 267 void UnmountChildMounts(const std::string& mount_path_in) { |
268 std::string mount_path = mount_path_in; | 268 std::string mount_path = mount_path_in; |
269 // Let's make sure mount path has trailing slash. | 269 // Let's make sure mount path has trailing slash. |
270 if (mount_path[mount_path.length() - 1] != '/') | 270 if (mount_path[mount_path.length() - 1] != '/') |
271 mount_path += '/'; | 271 mount_path += '/'; |
272 | 272 |
273 for (MountPointMap::iterator it = mount_points_.begin(); | 273 for (MountPointMap::iterator it = mount_points_.begin(); |
274 it != mount_points_.end(); | 274 it != mount_points_.end(); |
275 ++it) { | 275 ++it) { |
276 if (StartsWithASCII(it->second.source_path, mount_path, | 276 if (base::StartsWithASCII(it->second.source_path, mount_path, |
277 true /*case sensitive*/)) { | 277 true /*case sensitive*/)) { |
278 // TODO(tbarzic): Handle the case where this fails. | 278 // TODO(tbarzic): Handle the case where this fails. |
279 UnmountPath(it->second.mount_path, | 279 UnmountPath(it->second.mount_path, |
280 UNMOUNT_OPTIONS_NONE, | 280 UNMOUNT_OPTIONS_NONE, |
281 UnmountPathCallback()); | 281 UnmountPathCallback()); |
282 } | 282 } |
283 } | 283 } |
284 } | 284 } |
285 | 285 |
286 // Callback for UnmountDeviceRecursively. | 286 // Callback for UnmountDeviceRecursively. |
287 void OnUnmountDeviceRecursively( | 287 void OnUnmountDeviceRecursively( |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 } | 596 } |
597 | 597 |
598 // Finds system path prefix from |system_path|. | 598 // Finds system path prefix from |system_path|. |
599 const std::string& FindSystemPathPrefix(const std::string& system_path) { | 599 const std::string& FindSystemPathPrefix(const std::string& system_path) { |
600 if (system_path.empty()) | 600 if (system_path.empty()) |
601 return base::EmptyString(); | 601 return base::EmptyString(); |
602 for (SystemPathPrefixSet::const_iterator it = system_path_prefixes_.begin(); | 602 for (SystemPathPrefixSet::const_iterator it = system_path_prefixes_.begin(); |
603 it != system_path_prefixes_.end(); | 603 it != system_path_prefixes_.end(); |
604 ++it) { | 604 ++it) { |
605 const std::string& prefix = *it; | 605 const std::string& prefix = *it; |
606 if (StartsWithASCII(system_path, prefix, true)) | 606 if (base::StartsWithASCII(system_path, prefix, true)) |
607 return prefix; | 607 return prefix; |
608 } | 608 } |
609 return base::EmptyString(); | 609 return base::EmptyString(); |
610 } | 610 } |
611 | 611 |
612 // Mount event change observers. | 612 // Mount event change observers. |
613 base::ObserverList<Observer> observers_; | 613 base::ObserverList<Observer> observers_; |
614 | 614 |
615 CrosDisksClient* cros_disks_client_; | 615 CrosDisksClient* cros_disks_client_; |
616 | 616 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 VLOG(1) << "DiskMountManager Shutdown completed"; | 747 VLOG(1) << "DiskMountManager Shutdown completed"; |
748 } | 748 } |
749 | 749 |
750 // static | 750 // static |
751 DiskMountManager* DiskMountManager::GetInstance() { | 751 DiskMountManager* DiskMountManager::GetInstance() { |
752 return g_disk_mount_manager; | 752 return g_disk_mount_manager; |
753 } | 753 } |
754 | 754 |
755 } // namespace disks | 755 } // namespace disks |
756 } // namespace chromeos | 756 } // namespace chromeos |
OLD | NEW |