| 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_path_manager.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; |
| 30 } FixedExposedPaths; | 29 } FixedExposedPaths; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 return false; | 76 return false; |
| 78 } | 77 } |
| 79 *root_path = iter->second; | 78 *root_path = iter->second; |
| 80 return true; | 79 return true; |
| 81 } | 80 } |
| 82 | 81 |
| 83 void CrosMountPointProvider::ValidateFileSystemRootAndGetURL( | 82 void CrosMountPointProvider::ValidateFileSystemRootAndGetURL( |
| 84 const GURL& origin_url, | 83 const GURL& origin_url, |
| 85 fileapi::FileSystemType type, | 84 fileapi::FileSystemType type, |
| 86 bool create, | 85 bool create, |
| 87 const fileapi::FileSystemPathManager::GetRootPathCallback& callback) { | 86 const GetRootPathCallback& callback) { |
| 88 DCHECK(type == fileapi::kFileSystemTypeExternal); | 87 DCHECK(type == fileapi::kFileSystemTypeExternal); |
| 89 std::string name(GetOriginIdentifierFromURL(origin_url)); | 88 std::string name(GetOriginIdentifierFromURL(origin_url)); |
| 90 name += ':'; | 89 name += ':'; |
| 91 name += fileapi::kExternalName; | 90 name += fileapi::kExternalName; |
| 92 FilePath root_path; | 91 FilePath root_path; |
| 93 root_path = FilePath(fileapi::kExternalDir); | 92 root_path = FilePath(fileapi::kExternalDir); |
| 94 callback.Run(true, root_path, name); | 93 callback.Run(true, root_path, name); |
| 95 } | 94 } |
| 96 | 95 |
| 97 FilePath CrosMountPointProvider::ValidateFileSystemRootAndGetPathOnFileThread( | 96 FilePath CrosMountPointProvider::ValidateFileSystemRootAndGetPathOnFileThread( |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 } else if (mount_prefix == filesystem_path) { | 194 } else if (mount_prefix == filesystem_path) { |
| 196 FilePath root = FilePath(FILE_PATH_LITERAL("/")); | 195 FilePath root = FilePath(FILE_PATH_LITERAL("/")); |
| 197 *virtual_path = root.Append(iter->first); | 196 *virtual_path = root.Append(iter->first); |
| 198 return true; | 197 return true; |
| 199 } | 198 } |
| 200 } | 199 } |
| 201 return false; | 200 return false; |
| 202 } | 201 } |
| 203 | 202 |
| 204 } // namespace chromeos | 203 } // namespace chromeos |
| OLD | NEW |