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 "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_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h
" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h
" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSyste
m.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSyste
m.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
18 #include "webkit/chromeos/fileapi/file_access_permissions.h" | 18 #include "webkit/chromeos/fileapi/file_access_permissions.h" |
| 19 #include "webkit/fileapi/file_system_operation.h" |
19 #include "webkit/fileapi/file_system_util.h" | 20 #include "webkit/fileapi/file_system_util.h" |
20 #include "webkit/fileapi/native_file_util.h" | 21 #include "webkit/fileapi/native_file_util.h" |
21 #include "webkit/glue/webkit_glue.h" | 22 #include "webkit/glue/webkit_glue.h" |
22 | 23 |
23 namespace chromeos { | 24 namespace chromeos { |
24 | 25 |
25 typedef struct { | 26 typedef struct { |
26 const char* local_root_path; | 27 const char* local_root_path; |
27 const char* web_root_path; | 28 const char* web_root_path; |
28 } FixedExposedPaths; | 29 } FixedExposedPaths; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 ++iter) { | 171 ++iter) { |
171 root_dirs.push_back(iter->second.Append(iter->first)); | 172 root_dirs.push_back(iter->second.Append(iter->first)); |
172 } | 173 } |
173 return root_dirs; | 174 return root_dirs; |
174 } | 175 } |
175 | 176 |
176 fileapi::FileSystemFileUtil* CrosMountPointProvider::GetFileUtil() { | 177 fileapi::FileSystemFileUtil* CrosMountPointProvider::GetFileUtil() { |
177 return local_file_util_.get(); | 178 return local_file_util_.get(); |
178 } | 179 } |
179 | 180 |
| 181 FileSystemOperationInterface* CrosMountPointProvider::CreateFileSystemOperation( |
| 182 const GURL& origin_url, |
| 183 FileSystemType file_system_type, |
| 184 const FilePath& virtual_path, |
| 185 scoped_ptr<FileSystemCallbackDispatcher> dispatcher, |
| 186 base::MessageLoopProxy* file_proxy, |
| 187 FileSystemContext* context) const { |
| 188 // TODO(satorux,zel): instantiate appropriate FileSystemOperation that |
| 189 // implements async/remote operations. |
| 190 return new FileSystemOperation(dispatcher.Pass(), file_proxy, context); |
| 191 } |
| 192 |
180 bool CrosMountPointProvider::GetVirtualPath(const FilePath& filesystem_path, | 193 bool CrosMountPointProvider::GetVirtualPath(const FilePath& filesystem_path, |
181 FilePath* virtual_path) { | 194 FilePath* virtual_path) { |
182 for (MountPointMap::const_iterator iter = mount_point_map_.begin(); | 195 for (MountPointMap::const_iterator iter = mount_point_map_.begin(); |
183 iter != mount_point_map_.end(); | 196 iter != mount_point_map_.end(); |
184 ++iter) { | 197 ++iter) { |
185 FilePath mount_prefix = iter->second.Append(iter->first); | 198 FilePath mount_prefix = iter->second.Append(iter->first); |
186 *virtual_path = FilePath(iter->first); | 199 *virtual_path = FilePath(iter->first); |
187 if (mount_prefix.AppendRelativePath(filesystem_path, virtual_path)) { | 200 if (mount_prefix.AppendRelativePath(filesystem_path, virtual_path)) { |
188 return true; | 201 return true; |
189 } else if (mount_prefix == filesystem_path) { | 202 } else if (mount_prefix == filesystem_path) { |
190 FilePath root = FilePath(FILE_PATH_LITERAL("/")); | 203 FilePath root = FilePath(FILE_PATH_LITERAL("/")); |
191 *virtual_path = root.Append(iter->first); | 204 *virtual_path = root.Append(iter->first); |
192 return true; | 205 return true; |
193 } | 206 } |
194 } | 207 } |
195 return false; | 208 return false; |
196 } | 209 } |
197 | 210 |
198 } // namespace chromeos | 211 } // namespace chromeos |
OLD | NEW |