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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 // |mount_path|. | 269 // |mount_path|. |
270 void UnmountChildMounts(const std::string& mount_path_in) { | 270 void UnmountChildMounts(const std::string& mount_path_in) { |
271 std::string mount_path = mount_path_in; | 271 std::string mount_path = mount_path_in; |
272 // Let's make sure mount path has trailing slash. | 272 // Let's make sure mount path has trailing slash. |
273 if (mount_path[mount_path.length() - 1] != '/') | 273 if (mount_path[mount_path.length() - 1] != '/') |
274 mount_path += '/'; | 274 mount_path += '/'; |
275 | 275 |
276 for (MountPointMap::iterator it = mount_points_.begin(); | 276 for (MountPointMap::iterator it = mount_points_.begin(); |
277 it != mount_points_.end(); | 277 it != mount_points_.end(); |
278 ++it) { | 278 ++it) { |
279 if (base::StartsWithASCII(it->second.source_path, mount_path, | 279 if (base::StartsWith(it->second.source_path, mount_path, |
280 true /*case sensitive*/)) { | 280 base::CompareCase::SENSITIVE)) { |
281 // TODO(tbarzic): Handle the case where this fails. | 281 // TODO(tbarzic): Handle the case where this fails. |
282 UnmountPath(it->second.mount_path, | 282 UnmountPath(it->second.mount_path, |
283 UNMOUNT_OPTIONS_NONE, | 283 UNMOUNT_OPTIONS_NONE, |
284 UnmountPathCallback()); | 284 UnmountPathCallback()); |
285 } | 285 } |
286 } | 286 } |
287 } | 287 } |
288 | 288 |
289 // Callback for UnmountDeviceRecursively. | 289 // Callback for UnmountDeviceRecursively. |
290 void OnUnmountDeviceRecursively( | 290 void OnUnmountDeviceRecursively( |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 } | 599 } |
600 | 600 |
601 // Finds system path prefix from |system_path|. | 601 // Finds system path prefix from |system_path|. |
602 const std::string& FindSystemPathPrefix(const std::string& system_path) { | 602 const std::string& FindSystemPathPrefix(const std::string& system_path) { |
603 if (system_path.empty()) | 603 if (system_path.empty()) |
604 return base::EmptyString(); | 604 return base::EmptyString(); |
605 for (SystemPathPrefixSet::const_iterator it = system_path_prefixes_.begin(); | 605 for (SystemPathPrefixSet::const_iterator it = system_path_prefixes_.begin(); |
606 it != system_path_prefixes_.end(); | 606 it != system_path_prefixes_.end(); |
607 ++it) { | 607 ++it) { |
608 const std::string& prefix = *it; | 608 const std::string& prefix = *it; |
609 if (base::StartsWithASCII(system_path, prefix, true)) | 609 if (base::StartsWith(system_path, prefix, base::CompareCase::SENSITIVE)) |
610 return prefix; | 610 return prefix; |
611 } | 611 } |
612 return base::EmptyString(); | 612 return base::EmptyString(); |
613 } | 613 } |
614 | 614 |
615 // Mount event change observers. | 615 // Mount event change observers. |
616 base::ObserverList<Observer> observers_; | 616 base::ObserverList<Observer> observers_; |
617 | 617 |
618 CrosDisksClient* cros_disks_client_; | 618 CrosDisksClient* cros_disks_client_; |
619 | 619 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 VLOG(1) << "DiskMountManager Shutdown completed"; | 752 VLOG(1) << "DiskMountManager Shutdown completed"; |
753 } | 753 } |
754 | 754 |
755 // static | 755 // static |
756 DiskMountManager* DiskMountManager::GetInstance() { | 756 DiskMountManager* DiskMountManager::GetInstance() { |
757 return g_disk_mount_manager; | 757 return g_disk_mount_manager; |
758 } | 758 } |
759 | 759 |
760 } // namespace disks | 760 } // namespace disks |
761 } // namespace chromeos | 761 } // namespace chromeos |
OLD | NEW |