Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_H_ |
| 6 | #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | #include <vector> |
| 10 | |
| 11 | #include "base/memory/scoped_ptr.h" |
| 12 | #include "base/memory/weak_ptr.h" |
| 13 | #include "base/observer_list.h" |
| 14 | #include "chrome/browser/chromeos/drive/change_list_loader_observer.h" |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 15 | #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" |
| 16 | #include "chrome/browser/chromeos/drive/file_system_interface.h" |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 17 | #include "chrome/browser/google_apis/gdata_errorcode.h" |
| 18 | |
| 19 | class PrefChangeRegistrar; |
Ben Murdoch | 7dbb3d5 | 2013-07-17 14:55:54 +0100 | [diff] [blame] | 20 | class PrefService; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 21 | |
| 22 | namespace base { |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 23 | class SequencedTaskRunner; |
Ben Murdoch | bb1529c | 2013-08-08 10:24:53 +0100 | [diff] [blame^] | 24 | } // namespace base |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 25 | |
| 26 | namespace google_apis { |
| 27 | class AboutResource; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 28 | class ResourceEntry; |
Ben Murdoch | bb1529c | 2013-08-08 10:24:53 +0100 | [diff] [blame^] | 29 | } // namespace google_apis |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 30 | |
| 31 | namespace drive { |
| 32 | |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 33 | class DriveServiceInterface; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 34 | class FileCacheEntry; |
| 35 | class FileSystemObserver; |
| 36 | class JobScheduler; |
| 37 | |
| 38 | namespace internal { |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame] | 39 | class ChangeListLoader; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 40 | class ResourceMetadata; |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 41 | class SyncClient; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 42 | } // namespace internal |
| 43 | |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 44 | namespace file_system { |
| 45 | class CopyOperation; |
| 46 | class CreateDirectoryOperation; |
| 47 | class CreateFileOperation; |
| 48 | class DownloadOperation; |
| 49 | class MoveOperation; |
Ben Murdoch | 7dbb3d5 | 2013-07-17 14:55:54 +0100 | [diff] [blame] | 50 | class OpenFileOperation; |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 51 | class OperationObserver; |
| 52 | class RemoveOperation; |
| 53 | class SearchOperation; |
| 54 | class TouchOperation; |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 55 | class TruncateOperation; |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 56 | class UpdateOperation; |
| 57 | } // namespace file_system |
| 58 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 59 | // The production implementation of FileSystemInterface. |
| 60 | class FileSystem : public FileSystemInterface, |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame] | 61 | public internal::ChangeListLoaderObserver, |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 62 | public file_system::OperationObserver { |
| 63 | public: |
Ben Murdoch | 7dbb3d5 | 2013-07-17 14:55:54 +0100 | [diff] [blame] | 64 | FileSystem(PrefService* pref_service, |
Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 65 | internal::FileCache* cache, |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 66 | DriveServiceInterface* drive_service, |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 67 | JobScheduler* scheduler, |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 68 | internal::ResourceMetadata* resource_metadata, |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 69 | base::SequencedTaskRunner* blocking_task_runner, |
| 70 | const base::FilePath& temporary_file_directory); |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 71 | virtual ~FileSystem(); |
| 72 | |
| 73 | // FileSystemInterface overrides. |
| 74 | virtual void Initialize() OVERRIDE; |
| 75 | virtual void AddObserver(FileSystemObserver* observer) OVERRIDE; |
| 76 | virtual void RemoveObserver(FileSystemObserver* observer) OVERRIDE; |
| 77 | virtual void CheckForUpdates() OVERRIDE; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 78 | virtual void Search(const std::string& search_query, |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 79 | const GURL& next_url, |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 80 | const SearchCallback& callback) OVERRIDE; |
| 81 | virtual void SearchMetadata(const std::string& query, |
| 82 | int options, |
| 83 | int at_most_num_matches, |
| 84 | const SearchMetadataCallback& callback) OVERRIDE; |
| 85 | virtual void TransferFileFromRemoteToLocal( |
| 86 | const base::FilePath& remote_src_file_path, |
| 87 | const base::FilePath& local_dest_file_path, |
| 88 | const FileOperationCallback& callback) OVERRIDE; |
| 89 | virtual void TransferFileFromLocalToRemote( |
| 90 | const base::FilePath& local_src_file_path, |
| 91 | const base::FilePath& remote_dest_file_path, |
| 92 | const FileOperationCallback& callback) OVERRIDE; |
| 93 | virtual void OpenFile(const base::FilePath& file_path, |
Ben Murdoch | 7dbb3d5 | 2013-07-17 14:55:54 +0100 | [diff] [blame] | 94 | OpenMode open_mode, |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 95 | const OpenFileCallback& callback) OVERRIDE; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 96 | virtual void Copy(const base::FilePath& src_file_path, |
| 97 | const base::FilePath& dest_file_path, |
| 98 | const FileOperationCallback& callback) OVERRIDE; |
| 99 | virtual void Move(const base::FilePath& src_file_path, |
| 100 | const base::FilePath& dest_file_path, |
| 101 | const FileOperationCallback& callback) OVERRIDE; |
| 102 | virtual void Remove(const base::FilePath& file_path, |
| 103 | bool is_recursive, |
| 104 | const FileOperationCallback& callback) OVERRIDE; |
| 105 | virtual void CreateDirectory(const base::FilePath& directory_path, |
| 106 | bool is_exclusive, |
| 107 | bool is_recursive, |
| 108 | const FileOperationCallback& callback) OVERRIDE; |
| 109 | virtual void CreateFile(const base::FilePath& file_path, |
| 110 | bool is_exclusive, |
| 111 | const FileOperationCallback& callback) OVERRIDE; |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame] | 112 | virtual void TouchFile(const base::FilePath& file_path, |
| 113 | const base::Time& last_access_time, |
| 114 | const base::Time& last_modified_time, |
| 115 | const FileOperationCallback& callback) OVERRIDE; |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 116 | virtual void TruncateFile(const base::FilePath& file_path, |
| 117 | int64 length, |
| 118 | const FileOperationCallback& callback) OVERRIDE; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 119 | virtual void Pin(const base::FilePath& file_path, |
| 120 | const FileOperationCallback& callback) OVERRIDE; |
| 121 | virtual void Unpin(const base::FilePath& file_path, |
| 122 | const FileOperationCallback& callback) OVERRIDE; |
| 123 | virtual void GetFileByPath(const base::FilePath& file_path, |
| 124 | const GetFileCallback& callback) OVERRIDE; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 125 | virtual void GetFileContentByPath( |
| 126 | const base::FilePath& file_path, |
| 127 | const GetFileContentInitializedCallback& initialized_callback, |
| 128 | const google_apis::GetContentCallback& get_content_callback, |
| 129 | const FileOperationCallback& completion_callback) OVERRIDE; |
Torne (Richard Coles) | a93a17c | 2013-05-15 11:34:50 +0100 | [diff] [blame] | 130 | virtual void GetResourceEntryByPath( |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 131 | const base::FilePath& file_path, |
Torne (Richard Coles) | a93a17c | 2013-05-15 11:34:50 +0100 | [diff] [blame] | 132 | const GetResourceEntryCallback& callback) OVERRIDE; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 133 | virtual void ReadDirectoryByPath( |
| 134 | const base::FilePath& directory_path, |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 135 | const ReadDirectoryCallback& callback) OVERRIDE; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 136 | virtual void GetAvailableSpace( |
| 137 | const GetAvailableSpaceCallback& callback) OVERRIDE; |
Ben Murdoch | bbcdd45 | 2013-07-25 10:06:34 +0100 | [diff] [blame] | 138 | virtual void GetShareUrl( |
| 139 | const base::FilePath& file_path, |
| 140 | const GURL& embed_origin, |
| 141 | const GetShareUrlCallback& callback) OVERRIDE; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 142 | virtual void GetMetadata( |
| 143 | const GetFilesystemMetadataCallback& callback) OVERRIDE; |
| 144 | virtual void MarkCacheFileAsMounted( |
| 145 | const base::FilePath& drive_file_path, |
Ben Murdoch | a3f7b4e | 2013-07-24 10:36:34 +0100 | [diff] [blame] | 146 | const MarkMountedCallback& callback) OVERRIDE; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 147 | virtual void MarkCacheFileAsUnmounted( |
| 148 | const base::FilePath& cache_file_path, |
| 149 | const FileOperationCallback& callback) OVERRIDE; |
| 150 | virtual void GetCacheEntryByResourceId( |
| 151 | const std::string& resource_id, |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 152 | const GetCacheEntryCallback& callback) OVERRIDE; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 153 | virtual void Reload() OVERRIDE; |
| 154 | |
| 155 | // file_system::OperationObserver overrides. |
| 156 | virtual void OnDirectoryChangedByOperation( |
| 157 | const base::FilePath& directory_path) OVERRIDE; |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 158 | virtual void OnCacheFileUploadNeededByOperation( |
| 159 | const std::string& resource_id) OVERRIDE; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 160 | |
| 161 | // ChangeListLoader::Observer overrides. |
| 162 | // Used to propagate events from ChangeListLoader. |
| 163 | virtual void OnDirectoryChanged( |
| 164 | const base::FilePath& directory_path) OVERRIDE; |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 165 | virtual void OnLoadFromServerComplete() OVERRIDE; |
| 166 | virtual void OnInitialLoadComplete() OVERRIDE; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 167 | |
Ben Murdoch | bb1529c | 2013-08-08 10:24:53 +0100 | [diff] [blame^] | 168 | // Used by tests. |
| 169 | internal::ChangeListLoader* change_list_loader_for_testing() { |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame] | 170 | return change_list_loader_.get(); |
| 171 | } |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 172 | internal::SyncClient* sync_client_for_testing() { return sync_client_.get(); } |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 173 | |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 174 | private: |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 175 | // Used to implement Reload(). |
| 176 | void ReloadAfterReset(FileError error); |
| 177 | |
| 178 | // Sets up ChangeListLoader. |
| 179 | void SetupChangeListLoader(); |
| 180 | |
| 181 | // Called on preference change. |
| 182 | void OnDisableDriveHostedFilesChanged(); |
| 183 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 184 | // Part of CreateDirectory(). Called after ChangeListLoader::LoadIfNeeded() |
| 185 | // is called and made sure that the resource metadata is loaded. |
| 186 | void CreateDirectoryAfterLoad(const base::FilePath& directory_path, |
| 187 | bool is_exclusive, |
| 188 | bool is_recursive, |
| 189 | const FileOperationCallback& callback, |
| 190 | FileError load_error); |
| 191 | |
| 192 | // Used to implement Pin(). |
Torne (Richard Coles) | a93a17c | 2013-05-15 11:34:50 +0100 | [diff] [blame] | 193 | void PinAfterGetResourceEntryByPath(const FileOperationCallback& callback, |
| 194 | FileError error, |
| 195 | scoped_ptr<ResourceEntry> entry); |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 196 | void FinishPin(const FileOperationCallback& callback, |
| 197 | const std::string& resource_id, |
| 198 | FileError error); |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 199 | |
| 200 | // Used to implement Unpin(). |
Torne (Richard Coles) | a93a17c | 2013-05-15 11:34:50 +0100 | [diff] [blame] | 201 | void UnpinAfterGetResourceEntryByPath(const FileOperationCallback& callback, |
| 202 | FileError error, |
| 203 | scoped_ptr<ResourceEntry> entry); |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 204 | void FinishUnpin(const FileOperationCallback& callback, |
| 205 | const std::string& resource_id, |
| 206 | FileError error); |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 207 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 208 | // Callback for handling about resource fetch. |
| 209 | void OnGetAboutResource( |
| 210 | const GetAvailableSpaceCallback& callback, |
| 211 | google_apis::GDataErrorCode status, |
| 212 | scoped_ptr<google_apis::AboutResource> about_resource); |
| 213 | |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 214 | // Part of CheckForUpdates(). Called when |
| 215 | // ChangeListLoader::CheckForUpdates() is complete. |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 216 | void OnUpdateChecked(FileError error); |
| 217 | |
| 218 | // Changes state of hosted documents visibility, triggers directory refresh. |
| 219 | void SetHideHostedDocuments(bool hide); |
| 220 | |
| 221 | // Initializes preference change observer. |
| 222 | void InitializePreferenceObserver(); |
| 223 | |
Torne (Richard Coles) | a93a17c | 2013-05-15 11:34:50 +0100 | [diff] [blame] | 224 | // Part of GetResourceEntryByPath() |
Ben Murdoch | 558790d | 2013-07-30 15:19:42 +0100 | [diff] [blame] | 225 | // 1) Called when GetLocallyStoredResourceEntry() is complete. |
| 226 | // 2) Called when LoadDirectoryIfNeeded() is complete. |
| 227 | void GetResourceEntryByPathAfterGetEntry( |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 228 | const base::FilePath& file_path, |
Torne (Richard Coles) | a93a17c | 2013-05-15 11:34:50 +0100 | [diff] [blame] | 229 | const GetResourceEntryCallback& callback, |
Ben Murdoch | 558790d | 2013-07-30 15:19:42 +0100 | [diff] [blame] | 230 | scoped_ptr<ResourceEntry> entry, |
| 231 | FileError error); |
Torne (Richard Coles) | a93a17c | 2013-05-15 11:34:50 +0100 | [diff] [blame] | 232 | void GetResourceEntryByPathAfterLoad(const base::FilePath& file_path, |
| 233 | const GetResourceEntryCallback& callback, |
| 234 | FileError error); |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 235 | |
Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 236 | // Loads the entry info of the children of |directory_path| to resource |
| 237 | // metadata. |callback| must not be null. |
| 238 | void LoadDirectoryIfNeeded(const base::FilePath& directory_path, |
| 239 | const FileOperationCallback& callback); |
| 240 | void LoadDirectoryIfNeededAfterGetEntry( |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 241 | const base::FilePath& directory_path, |
Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 242 | const FileOperationCallback& callback, |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 243 | FileError error, |
| 244 | scoped_ptr<ResourceEntry> entry); |
Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 245 | |
| 246 | // Part of ReadDirectoryByPath() |
| 247 | // 1) Called when LoadDirectoryIfNeeded() is complete. |
| 248 | // 2) Called when ResourceMetadata::ReadDirectoryByPath() is complete. |
| 249 | // |callback| must not be null. |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 250 | void ReadDirectoryByPathAfterLoad( |
| 251 | const base::FilePath& directory_path, |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 252 | const ReadDirectoryCallback& callback, |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 253 | FileError error); |
| 254 | void ReadDirectoryByPathAfterRead( |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 255 | const ReadDirectoryCallback& callback, |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 256 | FileError error, |
| 257 | scoped_ptr<ResourceEntryVector> entries); |
| 258 | |
Torne (Richard Coles) | a93a17c | 2013-05-15 11:34:50 +0100 | [diff] [blame] | 259 | // Part of MarkCacheFileAsMounted. Called after GetResourceEntryByPath is |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 260 | // completed. |callback| must not be null. |
Torne (Richard Coles) | a93a17c | 2013-05-15 11:34:50 +0100 | [diff] [blame] | 261 | void MarkCacheFileAsMountedAfterGetResourceEntry( |
Ben Murdoch | a3f7b4e | 2013-07-24 10:36:34 +0100 | [diff] [blame] | 262 | const MarkMountedCallback& callback, |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 263 | FileError error, |
| 264 | scoped_ptr<ResourceEntry> entry); |
| 265 | |
Ben Murdoch | bbcdd45 | 2013-07-25 10:06:34 +0100 | [diff] [blame] | 266 | // Part of GetShareUrl. Resolves the resource entry to get the resource it, |
| 267 | // and then uses it to ask for the share url. |callback| must not be null. |
| 268 | void GetShareUrlAfterGetResourceEntry( |
| 269 | const base::FilePath& file_path, |
| 270 | const GURL& embed_origin, |
| 271 | const GetShareUrlCallback& callback, |
| 272 | FileError error, |
| 273 | scoped_ptr<ResourceEntry> entry); |
| 274 | void OnGetResourceEntryForGetShareUrl( |
| 275 | const GetShareUrlCallback& callback, |
| 276 | google_apis::GDataErrorCode status, |
| 277 | const GURL& share_url); |
| 278 | |
Ben Murdoch | 7dbb3d5 | 2013-07-17 14:55:54 +0100 | [diff] [blame] | 279 | // Used to get Drive related preferences. |
| 280 | PrefService* pref_service_; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 281 | |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame] | 282 | // Sub components owned by DriveIntegrationService. |
Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 283 | internal::FileCache* cache_; |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 284 | DriveServiceInterface* drive_service_; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 285 | JobScheduler* scheduler_; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 286 | internal::ResourceMetadata* resource_metadata_; |
| 287 | |
| 288 | // Time of the last update check. |
| 289 | base::Time last_update_check_time_; |
| 290 | |
| 291 | // Error of the last update check. |
| 292 | FileError last_update_check_error_; |
| 293 | |
| 294 | // True if hosted documents should be hidden. |
| 295 | bool hide_hosted_docs_; |
| 296 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 297 | scoped_ptr<PrefChangeRegistrar> pref_registrar_; |
| 298 | |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 299 | scoped_ptr<internal::SyncClient> sync_client_; |
| 300 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 301 | // The loader is used to load the change lists. |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame] | 302 | scoped_ptr<internal::ChangeListLoader> change_list_loader_; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 303 | |
| 304 | ObserverList<FileSystemObserver> observers_; |
| 305 | |
| 306 | scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 307 | |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 308 | base::FilePath temporary_file_directory_; |
| 309 | |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 310 | // Implementation of each file system operation. |
| 311 | scoped_ptr<file_system::CopyOperation> copy_operation_; |
| 312 | scoped_ptr<file_system::CreateDirectoryOperation> create_directory_operation_; |
| 313 | scoped_ptr<file_system::CreateFileOperation> create_file_operation_; |
| 314 | scoped_ptr<file_system::MoveOperation> move_operation_; |
Ben Murdoch | 7dbb3d5 | 2013-07-17 14:55:54 +0100 | [diff] [blame] | 315 | scoped_ptr<file_system::OpenFileOperation> open_file_operation_; |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 316 | scoped_ptr<file_system::RemoveOperation> remove_operation_; |
| 317 | scoped_ptr<file_system::TouchOperation> touch_operation_; |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 318 | scoped_ptr<file_system::TruncateOperation> truncate_operation_; |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 319 | scoped_ptr<file_system::DownloadOperation> download_operation_; |
| 320 | scoped_ptr<file_system::UpdateOperation> update_operation_; |
| 321 | scoped_ptr<file_system::SearchOperation> search_operation_; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 322 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 323 | // Note: This should remain the last member so it'll be destroyed and |
| 324 | // invalidate the weak pointers before any other members are destroyed. |
| 325 | base::WeakPtrFactory<FileSystem> weak_ptr_factory_; |
| 326 | |
| 327 | DISALLOW_COPY_AND_ASSIGN(FileSystem); |
| 328 | }; |
| 329 | |
| 330 | } // namespace drive |
| 331 | |
| 332 | #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_H_ |