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" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "chrome/browser/chromeos/drive/file_errors.h" | 14 #include "chrome/browser/chromeos/drive/file_errors.h" |
15 #include "google_apis/drive/gdata_errorcode.h" | 15 #include "google_apis/drive/gdata_errorcode.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class SequencedTaskRunner; | 18 class SequencedTaskRunner; |
19 } // namespace base | 19 } // namespace base |
20 | 20 |
21 namespace google_apis { | 21 namespace google_apis { |
22 class ResourceEntry; | 22 class FileResource; |
23 } // namespace google_apis | 23 } // namespace google_apis |
24 | 24 |
25 namespace drive { | 25 namespace drive { |
26 | 26 |
27 class JobScheduler; | 27 class JobScheduler; |
28 class ResourceEntry; | 28 class ResourceEntry; |
29 struct ClientContext; | 29 struct ClientContext; |
30 | 30 |
31 namespace file_system { | 31 namespace file_system { |
32 class OperationObserver; | 32 class OperationObserver; |
(...skipping 20 matching lines...) Expand all Loading... |
53 const ClientContext& context, | 53 const ClientContext& context, |
54 const FileOperationCallback& callback); | 54 const FileOperationCallback& callback); |
55 | 55 |
56 private: | 56 private: |
57 // Part of RevertEntry(). Called after local metadata look up. | 57 // Part of RevertEntry(). Called after local metadata look up. |
58 void RevertEntryAfterPrepare(const ClientContext& context, | 58 void RevertEntryAfterPrepare(const ClientContext& context, |
59 const FileOperationCallback& callback, | 59 const FileOperationCallback& callback, |
60 scoped_ptr<ResourceEntry> entry, | 60 scoped_ptr<ResourceEntry> entry, |
61 FileError error); | 61 FileError error); |
62 | 62 |
63 // Part of RevertEntry(). Called after GetResourceEntry is completed. | 63 // Part of RevertEntry(). Called after GetFileResource is completed. |
64 void RevertEntryAfterGetResourceEntry( | 64 void RevertEntryAfterGetFileResource( |
65 const FileOperationCallback& callback, | 65 const FileOperationCallback& callback, |
66 const std::string& local_id, | 66 const std::string& local_id, |
67 google_apis::GDataErrorCode status, | 67 google_apis::GDataErrorCode status, |
68 scoped_ptr<google_apis::ResourceEntry> resource_entry); | 68 scoped_ptr<google_apis::FileResource> entry); |
69 | 69 |
70 // Part of RevertEntry(). Called after local metadata is updated. | 70 // Part of RevertEntry(). Called after local metadata is updated. |
71 void RevertEntryAfterFinishRevert( | 71 void RevertEntryAfterFinishRevert( |
72 const FileOperationCallback& callback, | 72 const FileOperationCallback& callback, |
73 const std::set<base::FilePath>* changed_directories, | 73 const std::set<base::FilePath>* changed_directories, |
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::OperationObserver* observer_; |
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 |