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 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
14 #include "chrome/browser/chromeos/drive/change_list_loader_observer.h" | 14 #include "chrome/browser/chromeos/drive/change_list_loader_observer.h" |
15 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" | 15 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" |
16 #include "chrome/browser/chromeos/drive/file_system/operations.h" | |
17 #include "chrome/browser/chromeos/drive/file_system_interface.h" | 16 #include "chrome/browser/chromeos/drive/file_system_interface.h" |
18 #include "chrome/browser/chromeos/drive/file_system_util.h" | 17 #include "chrome/browser/chromeos/drive/file_system_util.h" |
19 #include "chrome/browser/chromeos/drive/job_list.h" | 18 #include "chrome/browser/chromeos/drive/job_list.h" |
20 #include "chrome/browser/google_apis/gdata_errorcode.h" | 19 #include "chrome/browser/google_apis/gdata_errorcode.h" |
21 | 20 |
22 class PrefChangeRegistrar; | 21 class PrefChangeRegistrar; |
23 class Profile; | 22 class Profile; |
24 | 23 |
25 namespace base { | 24 namespace base { |
26 struct PlatformFileInfo; | 25 struct PlatformFileInfo; |
(...skipping 10 matching lines...) Expand all Loading... |
37 | 36 |
38 class FileCacheEntry; | 37 class FileCacheEntry; |
39 class FileSystemObserver; | 38 class FileSystemObserver; |
40 class JobScheduler; | 39 class JobScheduler; |
41 | 40 |
42 namespace internal { | 41 namespace internal { |
43 class ChangeListLoader; | 42 class ChangeListLoader; |
44 class ResourceMetadata; | 43 class ResourceMetadata; |
45 } // namespace internal | 44 } // namespace internal |
46 | 45 |
| 46 namespace file_system { |
| 47 class CopyOperation; |
| 48 class CreateDirectoryOperation; |
| 49 class CreateFileOperation; |
| 50 class DownloadOperation; |
| 51 class MoveOperation; |
| 52 class OperationObserver; |
| 53 class RemoveOperation; |
| 54 class SearchOperation; |
| 55 class TouchOperation; |
| 56 class UpdateOperation; |
| 57 } // namespace file_system |
| 58 |
47 // The production implementation of FileSystemInterface. | 59 // The production implementation of FileSystemInterface. |
48 class FileSystem : public FileSystemInterface, | 60 class FileSystem : public FileSystemInterface, |
49 public internal::ChangeListLoaderObserver, | 61 public internal::ChangeListLoaderObserver, |
50 public file_system::OperationObserver { | 62 public file_system::OperationObserver { |
51 public: | 63 public: |
52 FileSystem(Profile* profile, | 64 FileSystem(Profile* profile, |
53 internal::FileCache* cache, | 65 internal::FileCache* cache, |
54 google_apis::DriveServiceInterface* drive_service, | 66 google_apis::DriveServiceInterface* drive_service, |
55 JobScheduler* scheduler, | 67 JobScheduler* scheduler, |
56 internal::ResourceMetadata* resource_metadata, | 68 internal::ResourceMetadata* resource_metadata, |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 180 |
169 private: | 181 private: |
170 friend class DriveFileSystemTest; | 182 friend class DriveFileSystemTest; |
171 | 183 |
172 // Used to implement Reload(). | 184 // Used to implement Reload(). |
173 void ReloadAfterReset(FileError error); | 185 void ReloadAfterReset(FileError error); |
174 | 186 |
175 // Sets up ChangeListLoader. | 187 // Sets up ChangeListLoader. |
176 void SetupChangeListLoader(); | 188 void SetupChangeListLoader(); |
177 | 189 |
| 190 // Sets up file_system::XXXOperation instances. |
| 191 void SetupOperations(); |
| 192 |
178 // Called on preference change. | 193 // Called on preference change. |
179 void OnDisableDriveHostedFilesChanged(); | 194 void OnDisableDriveHostedFilesChanged(); |
180 | 195 |
181 // Part of CreateDirectory(). Called after ChangeListLoader::LoadIfNeeded() | 196 // Part of CreateDirectory(). Called after ChangeListLoader::LoadIfNeeded() |
182 // is called and made sure that the resource metadata is loaded. | 197 // is called and made sure that the resource metadata is loaded. |
183 void CreateDirectoryAfterLoad(const base::FilePath& directory_path, | 198 void CreateDirectoryAfterLoad(const base::FilePath& directory_path, |
184 bool is_exclusive, | 199 bool is_exclusive, |
185 bool is_recursive, | 200 bool is_recursive, |
186 const FileOperationCallback& callback, | 201 const FileOperationCallback& callback, |
187 FileError load_error); | 202 FileError load_error); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 | 375 |
361 scoped_ptr<PrefChangeRegistrar> pref_registrar_; | 376 scoped_ptr<PrefChangeRegistrar> pref_registrar_; |
362 | 377 |
363 // The loader is used to load the change lists. | 378 // The loader is used to load the change lists. |
364 scoped_ptr<internal::ChangeListLoader> change_list_loader_; | 379 scoped_ptr<internal::ChangeListLoader> change_list_loader_; |
365 | 380 |
366 ObserverList<FileSystemObserver> observers_; | 381 ObserverList<FileSystemObserver> observers_; |
367 | 382 |
368 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 383 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
369 | 384 |
370 file_system::Operations operations_; | 385 // Implementation of each file system operation. |
| 386 scoped_ptr<file_system::CopyOperation> copy_operation_; |
| 387 scoped_ptr<file_system::CreateDirectoryOperation> create_directory_operation_; |
| 388 scoped_ptr<file_system::CreateFileOperation> create_file_operation_; |
| 389 scoped_ptr<file_system::MoveOperation> move_operation_; |
| 390 scoped_ptr<file_system::RemoveOperation> remove_operation_; |
| 391 scoped_ptr<file_system::TouchOperation> touch_operation_; |
| 392 scoped_ptr<file_system::DownloadOperation> download_operation_; |
| 393 scoped_ptr<file_system::UpdateOperation> update_operation_; |
| 394 scoped_ptr<file_system::SearchOperation> search_operation_; |
371 | 395 |
372 // Polling interval for checking updates in seconds. | 396 // Polling interval for checking updates in seconds. |
373 int polling_interval_sec_; | 397 int polling_interval_sec_; |
374 | 398 |
375 // Note: This should remain the last member so it'll be destroyed and | 399 // Note: This should remain the last member so it'll be destroyed and |
376 // invalidate the weak pointers before any other members are destroyed. | 400 // invalidate the weak pointers before any other members are destroyed. |
377 base::WeakPtrFactory<FileSystem> weak_ptr_factory_; | 401 base::WeakPtrFactory<FileSystem> weak_ptr_factory_; |
378 | 402 |
379 DISALLOW_COPY_AND_ASSIGN(FileSystem); | 403 DISALLOW_COPY_AND_ASSIGN(FileSystem); |
380 }; | 404 }; |
381 | 405 |
382 } // namespace drive | 406 } // namespace drive |
383 | 407 |
384 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_H_ | 408 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_H_ |
OLD | NEW |