| 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_callback_dispatcher.h" | |
| 20 #include "webkit/fileapi/file_system_operation.h" | 19 #include "webkit/fileapi/file_system_operation.h" |
| 21 #include "webkit/fileapi/file_system_util.h" | 20 #include "webkit/fileapi/file_system_util.h" |
| 22 #include "webkit/fileapi/native_file_util.h" | 21 #include "webkit/fileapi/native_file_util.h" |
| 23 #include "webkit/glue/webkit_glue.h" | 22 #include "webkit/glue/webkit_glue.h" |
| 24 | 23 |
| 25 namespace chromeos { | 24 namespace chromeos { |
| 26 | 25 |
| 27 typedef struct { | 26 typedef struct { |
| 28 const char* local_root_path; | 27 const char* local_root_path; |
| 29 const char* web_root_path; | 28 const char* web_root_path; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 176 |
| 178 fileapi::FileSystemFileUtil* CrosMountPointProvider::GetFileUtil() { | 177 fileapi::FileSystemFileUtil* CrosMountPointProvider::GetFileUtil() { |
| 179 return local_file_util_.get(); | 178 return local_file_util_.get(); |
| 180 } | 179 } |
| 181 | 180 |
| 182 fileapi::FileSystemOperationInterface* | 181 fileapi::FileSystemOperationInterface* |
| 183 CrosMountPointProvider::CreateFileSystemOperation( | 182 CrosMountPointProvider::CreateFileSystemOperation( |
| 184 const GURL& origin_url, | 183 const GURL& origin_url, |
| 185 fileapi::FileSystemType file_system_type, | 184 fileapi::FileSystemType file_system_type, |
| 186 const FilePath& virtual_path, | 185 const FilePath& virtual_path, |
| 187 scoped_ptr<fileapi::FileSystemCallbackDispatcher> dispatcher, | |
| 188 base::MessageLoopProxy* file_proxy, | 186 base::MessageLoopProxy* file_proxy, |
| 189 fileapi::FileSystemContext* context) const { | 187 fileapi::FileSystemContext* context) const { |
| 190 // TODO(satorux,zel): instantiate appropriate FileSystemOperation that | 188 // TODO(satorux,zel): instantiate appropriate FileSystemOperation that |
| 191 // implements async/remote operations. | 189 // implements async/remote operations. |
| 192 return new fileapi::FileSystemOperation( | 190 return new fileapi::FileSystemOperation(file_proxy, context); |
| 193 dispatcher.Pass(), file_proxy, context); | |
| 194 } | 191 } |
| 195 | 192 |
| 196 bool CrosMountPointProvider::GetVirtualPath(const FilePath& filesystem_path, | 193 bool CrosMountPointProvider::GetVirtualPath(const FilePath& filesystem_path, |
| 197 FilePath* virtual_path) { | 194 FilePath* virtual_path) { |
| 198 for (MountPointMap::const_iterator iter = mount_point_map_.begin(); | 195 for (MountPointMap::const_iterator iter = mount_point_map_.begin(); |
| 199 iter != mount_point_map_.end(); | 196 iter != mount_point_map_.end(); |
| 200 ++iter) { | 197 ++iter) { |
| 201 FilePath mount_prefix = iter->second.Append(iter->first); | 198 FilePath mount_prefix = iter->second.Append(iter->first); |
| 202 *virtual_path = FilePath(iter->first); | 199 *virtual_path = FilePath(iter->first); |
| 203 if (mount_prefix == filesystem_path) { | 200 if (mount_prefix == filesystem_path) { |
| 204 return true; | 201 return true; |
| 205 } else if (mount_prefix.AppendRelativePath(filesystem_path, virtual_path)) { | 202 } else if (mount_prefix.AppendRelativePath(filesystem_path, virtual_path)) { |
| 206 return true; | 203 return true; |
| 207 } | 204 } |
| 208 } | 205 } |
| 209 return false; | 206 return false; |
| 210 } | 207 } |
| 211 | 208 |
| 212 } // namespace chromeos | 209 } // namespace chromeos |
| OLD | NEW |