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 "webkit/chromeos/fileapi/cros_mount_point_provider.h" | 5 #include "webkit/chromeos/fileapi/cros_mount_point_provider.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_callback_factory.h" | 8 #include "base/memory/scoped_callback_factory.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 std::vector<FilePath> CrosMountPointProvider::GetRootDirectories() const { | 166 std::vector<FilePath> CrosMountPointProvider::GetRootDirectories() const { |
167 std::vector<FilePath> root_dirs; | 167 std::vector<FilePath> root_dirs; |
168 for (MountPointMap::const_iterator iter = mount_point_map_.begin(); | 168 for (MountPointMap::const_iterator iter = mount_point_map_.begin(); |
169 iter != mount_point_map_.end(); | 169 iter != mount_point_map_.end(); |
170 ++iter) { | 170 ++iter) { |
171 root_dirs.push_back(iter->second.Append(iter->first)); | 171 root_dirs.push_back(iter->second.Append(iter->first)); |
172 } | 172 } |
173 return root_dirs; | 173 return root_dirs; |
174 } | 174 } |
175 | 175 |
| 176 bool CrosMountPointProvider::GetVirtualPath(const FilePath& filesystem_path, |
| 177 FilePath* virtual_path) { |
| 178 for (MountPointMap::const_iterator iter = mount_point_map_.begin(); |
| 179 iter != mount_point_map_.end(); |
| 180 ++iter) { |
| 181 FilePath mount_prefix = iter->second.Append(iter->first); |
| 182 *virtual_path = FilePath(iter->first); |
| 183 if (mount_prefix.AppendRelativePath(filesystem_path, virtual_path)) { |
| 184 return true; |
| 185 } |
| 186 } |
| 187 return false; |
| 188 } |
| 189 |
176 } // namespace chromeos | 190 } // namespace chromeos |
177 | 191 |
OLD | NEW |