OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SYNC_REMOVE_PERFORMER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_SYNC_REMOVE_PERFORMER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_SYNC_REMOVE_PERFORMER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_SYNC_REMOVE_PERFORMER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "chrome/browser/chromeos/drive/file_errors.h" | 12 #include "chrome/browser/chromeos/drive/file_errors.h" |
13 #include "google_apis/drive/gdata_errorcode.h" | 13 #include "google_apis/drive/gdata_errorcode.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class SequencedTaskRunner; | 16 class SequencedTaskRunner; |
17 } | 17 } |
18 | 18 |
19 namespace google_apis { | 19 namespace google_apis { |
20 class FileResource; | 20 class FileResource; |
21 } | 21 } |
22 | 22 |
23 namespace drive { | 23 namespace drive { |
24 | 24 |
25 class JobScheduler; | 25 class JobScheduler; |
26 class ResourceEntry; | 26 class ResourceEntry; |
27 struct ClientContext; | 27 struct ClientContext; |
28 | 28 |
29 namespace file_system { | 29 namespace file_system { |
30 class OperationObserver; | 30 class OperationDelegate; |
31 } // namespace file_system | 31 } // namespace file_system |
32 | 32 |
33 namespace internal { | 33 namespace internal { |
34 | 34 |
35 class EntryRevertPerformer; | 35 class EntryRevertPerformer; |
36 class ResourceMetadata; | 36 class ResourceMetadata; |
37 | 37 |
38 // This class encapsulates the drive Remove function. It is responsible for | 38 // This class encapsulates the drive Remove function. It is responsible for |
39 // sending the request to the drive API, then updating the local state and | 39 // sending the request to the drive API, then updating the local state and |
40 // metadata to reflect the new state. | 40 // metadata to reflect the new state. |
41 class RemovePerformer { | 41 class RemovePerformer { |
42 public: | 42 public: |
43 RemovePerformer(base::SequencedTaskRunner* blocking_task_runner, | 43 RemovePerformer(base::SequencedTaskRunner* blocking_task_runner, |
44 file_system::OperationObserver* observer, | 44 file_system::OperationDelegate* delegate, |
45 JobScheduler* scheduler, | 45 JobScheduler* scheduler, |
46 ResourceMetadata* metadata); | 46 ResourceMetadata* metadata); |
47 ~RemovePerformer(); | 47 ~RemovePerformer(); |
48 | 48 |
49 // Removes the resource. | 49 // Removes the resource. |
50 // | 50 // |
51 // |callback| must not be null. | 51 // |callback| must not be null. |
52 void Remove(const std::string& local_id, | 52 void Remove(const std::string& local_id, |
53 const ClientContext& context, | 53 const ClientContext& context, |
54 const FileOperationCallback& callback); | 54 const FileOperationCallback& callback); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 google_apis::GDataErrorCode status, | 87 google_apis::GDataErrorCode status, |
88 scoped_ptr<google_apis::FileResource> file_resource); | 88 scoped_ptr<google_apis::FileResource> file_resource); |
89 | 89 |
90 // Part of UnparentResource(). | 90 // Part of UnparentResource(). |
91 void UnparentResourceAfterUpdateRemoteState( | 91 void UnparentResourceAfterUpdateRemoteState( |
92 const FileOperationCallback& callback, | 92 const FileOperationCallback& callback, |
93 const std::string& local_id, | 93 const std::string& local_id, |
94 google_apis::GDataErrorCode status); | 94 google_apis::GDataErrorCode status); |
95 | 95 |
96 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 96 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
97 file_system::OperationObserver* observer_; | 97 file_system::OperationDelegate* delegate_; |
98 JobScheduler* scheduler_; | 98 JobScheduler* scheduler_; |
99 ResourceMetadata* metadata_; | 99 ResourceMetadata* metadata_; |
100 scoped_ptr<EntryRevertPerformer> entry_revert_performer_; | 100 scoped_ptr<EntryRevertPerformer> entry_revert_performer_; |
101 | 101 |
102 // Note: This should remain the last member so it'll be destroyed and | 102 // Note: This should remain the last member so it'll be destroyed and |
103 // invalidate the weak pointers before any other members are destroyed. | 103 // invalidate the weak pointers before any other members are destroyed. |
104 base::WeakPtrFactory<RemovePerformer> weak_ptr_factory_; | 104 base::WeakPtrFactory<RemovePerformer> weak_ptr_factory_; |
105 DISALLOW_COPY_AND_ASSIGN(RemovePerformer); | 105 DISALLOW_COPY_AND_ASSIGN(RemovePerformer); |
106 }; | 106 }; |
107 | 107 |
108 } // namespace internal | 108 } // namespace internal |
109 } // namespace drive | 109 } // namespace drive |
110 | 110 |
111 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_SYNC_REMOVE_PERFORMER_H_ | 111 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_SYNC_REMOVE_PERFORMER_H_ |
OLD | NEW |