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_ENTRY_REVERT_PERFORMER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_SYNC_ENTRY_REVERT_PERFORMER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_SYNC_ENTRY_REVERT_PERFORMER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_SYNC_ENTRY_REVERT_PERFORMER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 } // namespace google_apis | 23 } // namespace google_apis |
24 | 24 |
25 namespace drive { | 25 namespace drive { |
26 | 26 |
27 class FileChange; | 27 class FileChange; |
28 class JobScheduler; | 28 class JobScheduler; |
29 class ResourceEntry; | 29 class ResourceEntry; |
30 struct ClientContext; | 30 struct ClientContext; |
31 | 31 |
32 namespace file_system { | 32 namespace file_system { |
33 class OperationObserver; | 33 class OperationDelegate; |
34 } // namespace file_system | 34 } // namespace file_system |
35 | 35 |
36 namespace internal { | 36 namespace internal { |
37 | 37 |
38 class ResourceMetadata; | 38 class ResourceMetadata; |
39 | 39 |
40 // This class is responsible to revert local changes of an entry. | 40 // This class is responsible to revert local changes of an entry. |
41 class EntryRevertPerformer { | 41 class EntryRevertPerformer { |
42 public: | 42 public: |
43 EntryRevertPerformer(base::SequencedTaskRunner* blocking_task_runner, | 43 EntryRevertPerformer(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 ~EntryRevertPerformer(); | 47 ~EntryRevertPerformer(); |
48 | 48 |
49 // Requests the server for metadata of the entry specified by |local_id| | 49 // Requests the server for metadata of the entry specified by |local_id| |
50 // and overwrites the locally stored entry with it. | 50 // and overwrites the locally stored entry with it. |
51 // Invokes |callback| when finished with the result of the operation. | 51 // Invokes |callback| when finished with the result of the operation. |
52 // |callback| must not be null. | 52 // |callback| must not be null. |
53 void RevertEntry(const std::string& local_id, | 53 void RevertEntry(const std::string& local_id, |
54 const ClientContext& context, | 54 const ClientContext& context, |
(...skipping 12 matching lines...) Expand all Loading... |
67 const std::string& local_id, | 67 const std::string& local_id, |
68 google_apis::GDataErrorCode status, | 68 google_apis::GDataErrorCode status, |
69 scoped_ptr<google_apis::FileResource> entry); | 69 scoped_ptr<google_apis::FileResource> entry); |
70 | 70 |
71 // Part of RevertEntry(). Called after local metadata is updated. | 71 // Part of RevertEntry(). Called after local metadata is updated. |
72 void RevertEntryAfterFinishRevert(const FileOperationCallback& callback, | 72 void RevertEntryAfterFinishRevert(const FileOperationCallback& callback, |
73 const FileChange* changed_files, | 73 const FileChange* changed_files, |
74 FileError error); | 74 FileError error); |
75 | 75 |
76 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 76 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
77 file_system::OperationObserver* observer_; | 77 file_system::OperationDelegate* delegate_; |
78 JobScheduler* scheduler_; | 78 JobScheduler* scheduler_; |
79 ResourceMetadata* metadata_; | 79 ResourceMetadata* metadata_; |
80 | 80 |
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<EntryRevertPerformer> weak_ptr_factory_; | 83 base::WeakPtrFactory<EntryRevertPerformer> weak_ptr_factory_; |
84 DISALLOW_COPY_AND_ASSIGN(EntryRevertPerformer); | 84 DISALLOW_COPY_AND_ASSIGN(EntryRevertPerformer); |
85 }; | 85 }; |
86 | 86 |
87 } // namespace internal | 87 } // namespace internal |
88 } // namespace drive | 88 } // namespace drive |
89 | 89 |
90 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_SYNC_ENTRY_REVERT_PERFORMER_H_ | 90 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_SYNC_ENTRY_REVERT_PERFORMER_H_ |
OLD | NEW |