Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(558)

Side by Side Diff: chrome/browser/chromeos/drive/sync/entry_revert_performer.h

Issue 102133008: drive: Call OnDirectoryChanged from EntryRevertPerformer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "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 } // namespace base 17 } // namespace base
18 18
19 namespace google_apis { 19 namespace google_apis {
20 class ResourceEntry; 20 class ResourceEntry;
21 } // namespace google_apis 21 } // namespace google_apis
22 22
23 namespace drive { 23 namespace drive {
24 24
25 class JobScheduler; 25 class JobScheduler;
26 class ResourceEntry; 26 class ResourceEntry;
27 27
28 namespace file_system {
29 class OperationObserver;
30 } // namespace file_system
31
28 namespace internal { 32 namespace internal {
29 33
30 class ResourceMetadata; 34 class ResourceMetadata;
31 35
32 // This class is responsible to revert local changes of an entry. 36 // This class is responsible to revert local changes of an entry.
33 class EntryRevertPerformer { 37 class EntryRevertPerformer {
34 public: 38 public:
35 EntryRevertPerformer(base::SequencedTaskRunner* blocking_task_runner, 39 EntryRevertPerformer(base::SequencedTaskRunner* blocking_task_runner,
40 file_system::OperationObserver* observer,
36 JobScheduler* scheduler, 41 JobScheduler* scheduler,
37 ResourceMetadata* metadata); 42 ResourceMetadata* metadata);
38 ~EntryRevertPerformer(); 43 ~EntryRevertPerformer();
39 44
40 // Requests the server for metadata of the entry specified by |local_id| 45 // Requests the server for metadata of the entry specified by |local_id|
41 // and overwrites the locally stored entry with it. 46 // and overwrites the locally stored entry with it.
42 // Invokes |callback| when finished with the result of the operation. 47 // Invokes |callback| when finished with the result of the operation.
43 // |callback| must not be null. 48 // |callback| must not be null.
44 void RevertEntry(const std::string& local_id, 49 void RevertEntry(const std::string& local_id,
45 const FileOperationCallback& callback); 50 const FileOperationCallback& callback);
46 51
47 private: 52 private:
48 // Part of RevertEntry(). Called after local metadata look up. 53 // Part of RevertEntry(). Called after local metadata look up.
49 void RevertEntryAfterPrepare(const FileOperationCallback& callback, 54 void RevertEntryAfterPrepare(const FileOperationCallback& callback,
50 scoped_ptr<ResourceEntry> entry, 55 scoped_ptr<ResourceEntry> entry,
51 FileError error); 56 FileError error);
52 57
53 // Part of RevertEntry(). Called after GetResourceEntry is completed. 58 // Part of RevertEntry(). Called after GetResourceEntry is completed.
54 void RevertEntryAfterGetResourceEntry( 59 void RevertEntryAfterGetResourceEntry(
55 const FileOperationCallback& callback, 60 const FileOperationCallback& callback,
56 const std::string& local_id, 61 const std::string& local_id,
57 google_apis::GDataErrorCode status, 62 google_apis::GDataErrorCode status,
58 scoped_ptr<google_apis::ResourceEntry> resource_entry); 63 scoped_ptr<google_apis::ResourceEntry> resource_entry);
59 64
65 // Part of RevertEntry(). Called after local metadata is updated.
66 void RevertEntryAfterFinishRevert(
67 const FileOperationCallback& callback,
68 const std::vector<base::FilePath>* changed_directories,
69 FileError error);
70
60 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 71 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
72 file_system::OperationObserver* observer_;
61 JobScheduler* scheduler_; 73 JobScheduler* scheduler_;
62 ResourceMetadata* metadata_; 74 ResourceMetadata* metadata_;
63 75
64 // Note: This should remain the last member so it'll be destroyed and 76 // Note: This should remain the last member so it'll be destroyed and
65 // invalidate the weak pointers before any other members are destroyed. 77 // invalidate the weak pointers before any other members are destroyed.
66 base::WeakPtrFactory<EntryRevertPerformer> weak_ptr_factory_; 78 base::WeakPtrFactory<EntryRevertPerformer> weak_ptr_factory_;
67 DISALLOW_COPY_AND_ASSIGN(EntryRevertPerformer); 79 DISALLOW_COPY_AND_ASSIGN(EntryRevertPerformer);
68 }; 80 };
69 81
70 } // namespace internal 82 } // namespace internal
71 } // namespace drive 83 } // namespace drive
72 84
73 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_SYNC_ENTRY_REVERT_PERFORMER_H_ 85 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_SYNC_ENTRY_REVERT_PERFORMER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698