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_REMOVE_OPERATION_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_REMOVE_OPERATION_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_REMOVE_OPERATION_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_REMOVE_OPERATION_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h" | 11 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h" |
12 #include "chrome/browser/google_apis/gdata_errorcode.h" | 12 #include "chrome/browser/google_apis/gdata_errorcode.h" |
13 | 13 |
14 class GURL; | 14 class GURL; |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class FilePath; | 17 class FilePath; |
18 } | 18 } |
19 | 19 |
20 namespace google_apis { | 20 namespace google_apis { |
21 } | 21 } |
22 | 22 |
23 namespace drive { | 23 namespace drive { |
24 | 24 |
25 class DriveCache; | 25 class DriveCache; |
26 class DriveEntryProto; | 26 class DriveEntryProto; |
27 class DriveFileSystem; | 27 class DriveFileSystem; |
28 class DriveScheduler; | 28 class JobScheduler; |
29 | 29 |
30 namespace file_system { | 30 namespace file_system { |
31 | 31 |
32 class OperationObserver; | 32 class OperationObserver; |
33 | 33 |
34 // This class encapsulates the drive Remove function. It is responsible for | 34 // This class encapsulates the drive Remove function. It is responsible for |
35 // sending the request to the drive API, then updating the local state and | 35 // sending the request to the drive API, then updating the local state and |
36 // metadata to reflect the new state. | 36 // metadata to reflect the new state. |
37 class RemoveOperation { | 37 class RemoveOperation { |
38 public: | 38 public: |
39 RemoveOperation(DriveScheduler* drive_scheduler, | 39 RemoveOperation(JobScheduler* job_scheduler, |
40 DriveCache* cache, | 40 DriveCache* cache, |
41 DriveResourceMetadata* metadata, | 41 DriveResourceMetadata* metadata, |
42 OperationObserver* observer); | 42 OperationObserver* observer); |
43 virtual ~RemoveOperation(); | 43 virtual ~RemoveOperation(); |
44 | 44 |
45 // Perform the remove operation on the file at drive path |file_path|. | 45 // Perform the remove operation on the file at drive path |file_path|. |
46 // Invokes |callback| when finished with the result of the operation. | 46 // Invokes |callback| when finished with the result of the operation. |
47 // |callback| must not be null. | 47 // |callback| must not be null. |
48 virtual void Remove(const base::FilePath& file_path, | 48 virtual void Remove(const base::FilePath& file_path, |
49 bool is_recursive, | 49 bool is_recursive, |
(...skipping 15 matching lines...) Expand all Loading... |
65 const std::string& resource_id, | 65 const std::string& resource_id, |
66 google_apis::GDataErrorCode status); | 66 google_apis::GDataErrorCode status); |
67 | 67 |
68 // Sends notification for directory changes. Notifies of directory changes, | 68 // Sends notification for directory changes. Notifies of directory changes, |
69 // and runs |callback| with |error|. |callback| must not be null. | 69 // and runs |callback| with |error|. |callback| must not be null. |
70 void NotifyDirectoryChanged( | 70 void NotifyDirectoryChanged( |
71 const FileOperationCallback& callback, | 71 const FileOperationCallback& callback, |
72 FileError error, | 72 FileError error, |
73 const base::FilePath& directory_path); | 73 const base::FilePath& directory_path); |
74 | 74 |
75 DriveScheduler* drive_scheduler_; | 75 JobScheduler* job_scheduler_; |
76 DriveCache* cache_; | 76 DriveCache* cache_; |
77 DriveResourceMetadata* metadata_; | 77 DriveResourceMetadata* metadata_; |
78 OperationObserver* observer_; | 78 OperationObserver* observer_; |
79 | 79 |
80 // WeakPtrFactory bound to the UI thread. | 80 // WeakPtrFactory bound to the UI thread. |
81 // Note: This should remain the last member so it'll be destroyed and | 81 // Note: This should remain the last member so it'll be destroyed and |
82 // invalidate the weak pointers before any other members are destroyed. | 82 // invalidate the weak pointers before any other members are destroyed. |
83 base::WeakPtrFactory<RemoveOperation> weak_ptr_factory_; | 83 base::WeakPtrFactory<RemoveOperation> weak_ptr_factory_; |
84 | 84 |
85 DISALLOW_COPY_AND_ASSIGN(RemoveOperation); | 85 DISALLOW_COPY_AND_ASSIGN(RemoveOperation); |
86 }; | 86 }; |
87 | 87 |
88 } // namespace file_system | 88 } // namespace file_system |
89 } // namespace drive | 89 } // namespace drive |
90 | 90 |
91 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_REMOVE_OPERATION_H_ | 91 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_REMOVE_OPERATION_H_ |
OLD | NEW |