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

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: Fix test 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/sync/entry_revert_performer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <set>
9
8 #include "base/basictypes.h" 10 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/chromeos/drive/file_errors.h" 14 #include "chrome/browser/chromeos/drive/file_errors.h"
13 #include "google_apis/drive/gdata_errorcode.h" 15 #include "google_apis/drive/gdata_errorcode.h"
14 16
15 namespace base { 17 namespace base {
16 class SequencedTaskRunner; 18 class SequencedTaskRunner;
17 } // namespace base 19 } // namespace base
18 20
19 namespace google_apis { 21 namespace google_apis {
20 class ResourceEntry; 22 class ResourceEntry;
21 } // namespace google_apis 23 } // namespace google_apis
22 24
23 namespace drive { 25 namespace drive {
24 26
25 class JobScheduler; 27 class JobScheduler;
26 class ResourceEntry; 28 class ResourceEntry;
27 29
30 namespace file_system {
31 class OperationObserver;
32 } // namespace file_system
33
28 namespace internal { 34 namespace internal {
29 35
30 class ResourceMetadata; 36 class ResourceMetadata;
31 37
32 // This class is responsible to revert local changes of an entry. 38 // This class is responsible to revert local changes of an entry.
33 class EntryRevertPerformer { 39 class EntryRevertPerformer {
34 public: 40 public:
35 EntryRevertPerformer(base::SequencedTaskRunner* blocking_task_runner, 41 EntryRevertPerformer(base::SequencedTaskRunner* blocking_task_runner,
42 file_system::OperationObserver* observer,
36 JobScheduler* scheduler, 43 JobScheduler* scheduler,
37 ResourceMetadata* metadata); 44 ResourceMetadata* metadata);
38 ~EntryRevertPerformer(); 45 ~EntryRevertPerformer();
39 46
40 // Requests the server for metadata of the entry specified by |local_id| 47 // Requests the server for metadata of the entry specified by |local_id|
41 // and overwrites the locally stored entry with it. 48 // and overwrites the locally stored entry with it.
42 // Invokes |callback| when finished with the result of the operation. 49 // Invokes |callback| when finished with the result of the operation.
43 // |callback| must not be null. 50 // |callback| must not be null.
44 void RevertEntry(const std::string& local_id, 51 void RevertEntry(const std::string& local_id,
45 const FileOperationCallback& callback); 52 const FileOperationCallback& callback);
46 53
47 private: 54 private:
48 // Part of RevertEntry(). Called after local metadata look up. 55 // Part of RevertEntry(). Called after local metadata look up.
49 void RevertEntryAfterPrepare(const FileOperationCallback& callback, 56 void RevertEntryAfterPrepare(const FileOperationCallback& callback,
50 scoped_ptr<ResourceEntry> entry, 57 scoped_ptr<ResourceEntry> entry,
51 FileError error); 58 FileError error);
52 59
53 // Part of RevertEntry(). Called after GetResourceEntry is completed. 60 // Part of RevertEntry(). Called after GetResourceEntry is completed.
54 void RevertEntryAfterGetResourceEntry( 61 void RevertEntryAfterGetResourceEntry(
55 const FileOperationCallback& callback, 62 const FileOperationCallback& callback,
56 const std::string& local_id, 63 const std::string& local_id,
57 google_apis::GDataErrorCode status, 64 google_apis::GDataErrorCode status,
58 scoped_ptr<google_apis::ResourceEntry> resource_entry); 65 scoped_ptr<google_apis::ResourceEntry> resource_entry);
59 66
67 // Part of RevertEntry(). Called after local metadata is updated.
68 void RevertEntryAfterFinishRevert(
69 const FileOperationCallback& callback,
70 const std::set<base::FilePath>* changed_directories,
71 FileError error);
72
60 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 73 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
74 file_system::OperationObserver* observer_;
61 JobScheduler* scheduler_; 75 JobScheduler* scheduler_;
62 ResourceMetadata* metadata_; 76 ResourceMetadata* metadata_;
63 77
64 // Note: This should remain the last member so it'll be destroyed and 78 // Note: This should remain the last member so it'll be destroyed and
65 // invalidate the weak pointers before any other members are destroyed. 79 // invalidate the weak pointers before any other members are destroyed.
66 base::WeakPtrFactory<EntryRevertPerformer> weak_ptr_factory_; 80 base::WeakPtrFactory<EntryRevertPerformer> weak_ptr_factory_;
67 DISALLOW_COPY_AND_ASSIGN(EntryRevertPerformer); 81 DISALLOW_COPY_AND_ASSIGN(EntryRevertPerformer);
68 }; 82 };
69 83
70 } // namespace internal 84 } // namespace internal
71 } // namespace drive 85 } // namespace drive
72 86
73 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_SYNC_ENTRY_REVERT_PERFORMER_H_ 87 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_SYNC_ENTRY_REVERT_PERFORMER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/sync/entry_revert_performer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698