| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // This file provides the core implementation of fileapi methods. | 5 // This file provides the core implementation of fileapi methods. |
| 6 // The functions should be called on UI thread. | 6 // The functions should be called on UI thread. |
| 7 // Note that most method invocation of fileapi is done on IO thread. The gap is | 7 // Note that most method invocation of fileapi is done on IO thread. The gap is |
| 8 // filled by FileSystemProxy. | 8 // filled by FileSystemProxy. |
| 9 // Also, the order of arguments for the functions which take FileSystemInterface | 9 // Also, the order of arguments for the functions which take FileSystemInterface |
| 10 // at the last is intentional. The instance of FileSystemInterface should be | 10 // at the last is intentional. The instance of FileSystemInterface should be |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "base/platform_file.h" | 27 #include "base/platform_file.h" |
| 28 #include "chrome/browser/chromeos/drive/file_errors.h" | 28 #include "chrome/browser/chromeos/drive/file_errors.h" |
| 29 #include "webkit/common/blob/scoped_file.h" | 29 #include "webkit/common/blob/scoped_file.h" |
| 30 | 30 |
| 31 namespace base { | 31 namespace base { |
| 32 class FilePath; | 32 class FilePath; |
| 33 } // namespace base | 33 } // namespace base |
| 34 | 34 |
| 35 namespace fileapi { | 35 namespace fileapi { |
| 36 struct DirectoryEntry; | 36 struct DirectoryEntry; |
| 37 class FileSystemURL; |
| 37 } // namespace fileapi | 38 } // namespace fileapi |
| 38 | 39 |
| 39 namespace drive { | 40 namespace drive { |
| 40 | 41 |
| 41 class FileSystemInterface; | 42 class FileSystemInterface; |
| 42 | 43 |
| 43 namespace fileapi_internal { | 44 namespace fileapi_internal { |
| 44 | 45 |
| 45 typedef base::Callback<FileSystemInterface*()> FileSystemGetter; | 46 typedef base::Callback<FileSystemInterface*()> FileSystemGetter; |
| 46 | 47 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 62 typedef base::Callback< | 63 typedef base::Callback< |
| 63 void(base::File::Error result, | 64 void(base::File::Error result, |
| 64 const base::FilePath& snapshot_file_path, | 65 const base::FilePath& snapshot_file_path, |
| 65 const base::Closure& close_callback)> | 66 const base::Closure& close_callback)> |
| 66 CreateWritableSnapshotFileCallback; | 67 CreateWritableSnapshotFileCallback; |
| 67 typedef base::Callback< | 68 typedef base::Callback< |
| 68 void(base::File::Error result, | 69 void(base::File::Error result, |
| 69 base::PlatformFile platform_file, | 70 base::PlatformFile platform_file, |
| 70 const base::Closure& close_callback)> OpenFileCallback; | 71 const base::Closure& close_callback)> OpenFileCallback; |
| 71 | 72 |
| 73 // Gets the profile of the Drive entry pointed by |url|. Used as |
| 74 // FileSystemGetter callback by binding an URL on the IO thread and passing to |
| 75 // the UI thread. |
| 76 FileSystemInterface* GetFileSystemFromUrl(const fileapi::FileSystemURL& url); |
| 77 |
| 72 // Runs |file_system_getter| to obtain the instance of FileSystemInstance, | 78 // Runs |file_system_getter| to obtain the instance of FileSystemInstance, |
| 73 // and then runs |callback| with it. | 79 // and then runs |callback| with it. |
| 74 // If |file_system_getter| returns NULL, runs |error_callback| instead. | 80 // If |file_system_getter| returns NULL, runs |error_callback| instead. |
| 75 // This function must be called on UI thread. | 81 // This function must be called on UI thread. |
| 76 // |file_system_getter| and |callback| must not be null, but | 82 // |file_system_getter| and |callback| must not be null, but |
| 77 // |error_callback| can be null (if no operation is necessary for error | 83 // |error_callback| can be null (if no operation is necessary for error |
| 78 // case). | 84 // case). |
| 79 void RunFileSystemCallback( | 85 void RunFileSystemCallback( |
| 80 const FileSystemGetter& file_system_getter, | 86 const FileSystemGetter& file_system_getter, |
| 81 const base::Callback<void(FileSystemInterface*)>& callback, | 87 const base::Callback<void(FileSystemInterface*)>& callback, |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 void TouchFile(const base::FilePath& file_path, | 176 void TouchFile(const base::FilePath& file_path, |
| 171 const base::Time& last_access_time, | 177 const base::Time& last_access_time, |
| 172 const base::Time& last_modified_time, | 178 const base::Time& last_modified_time, |
| 173 const StatusCallback& callback, | 179 const StatusCallback& callback, |
| 174 FileSystemInterface* file_system); | 180 FileSystemInterface* file_system); |
| 175 | 181 |
| 176 } // namespace fileapi_internal | 182 } // namespace fileapi_internal |
| 177 } // namespace drive | 183 } // namespace drive |
| 178 | 184 |
| 179 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILEAPI_FILEAPI_WORKER_H_ | 185 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILEAPI_FILEAPI_WORKER_H_ |
| OLD | NEW |