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