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

Side by Side Diff: chrome/browser/sync_file_system/drive/local_change_processor_delegate.h

Issue 14977008: [SyncFileSystem] Separate out ApplyLocalChange from DriveFileSyncService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix local_win case Created 7 years, 7 months 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_LOCAL_CHANGE_PROCESSOR_DELEGATE_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_LOCAL_CHANGE_PROCESSOR_DELEGATE_H_
7
8 #include "base/callback.h"
9 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/sync_file_system/drive_file_sync_service.h"
11 #include "chrome/browser/sync_file_system/sync_file_system.pb.h"
12 #include "webkit/fileapi/file_system_url.h"
13 #include "webkit/fileapi/syncable/file_change.h"
14 #include "webkit/fileapi/syncable/sync_callbacks.h"
15 #include "webkit/fileapi/syncable/sync_file_metadata.h"
16
17 namespace sync_file_system {
18
19 class DriveMetadataStore;
20
21 namespace drive {
22 class APIUtil;
23
24 class LocalChangeProcessorDelegate {
kinuko 2013/05/16 13:37:37 Can you add a class-level comment? Also please not
tzik 2013/05/17 05:14:10 Done.
25 public:
26 typedef RemoteChangeHandler::RemoteChange RemoteChange;
27
28 LocalChangeProcessorDelegate(
29 base::WeakPtr<DriveFileSyncService> sync_service,
30 const FileChange& change,
31 const base::FilePath& local_file_path,
32 const SyncFileMetadata& local_file_metadata,
33 const fileapi::FileSystemURL& url);
34 ~LocalChangeProcessorDelegate();
35
36 void Run(const SyncStatusCallback& callback);
37
38 private:
39 void DidGetOriginRoot(const SyncStatusCallback& callback,
40 SyncStatusCode status,
41 const std::string& resource_id);
42 void UploadNewFile(const SyncStatusCallback& callback);
43 void DidUploadNewFile(const SyncStatusCallback& callback,
44 google_apis::GDataErrorCode error,
45 const std::string& resource_id,
46 const std::string& md5);
47 void CreateDirectory(const SyncStatusCallback& callback);
48 void DidCreateDirectory(
49 const SyncStatusCallback& callback,
50 google_apis::GDataErrorCode error,
51 const std::string& resource_id);
52 void UploadExistingFile(const SyncStatusCallback& callback);
53 void DidUploadExistingFile(
54 const SyncStatusCallback& callback,
55 google_apis::GDataErrorCode error,
56 const std::string& resource_id,
57 const std::string& md5);
58 void DeleteFile(const SyncStatusCallback& callback);
59 void DeleteDirectory(const SyncStatusCallback& callback);
60 void DidDeleteFile(const SyncStatusCallback& callback,
61 google_apis::GDataErrorCode error);
62 void ResolveToLocal(const SyncStatusCallback& callback);
63 void DidDeleteFileToResolveToLocal(
64 const SyncStatusCallback& callback,
65 google_apis::GDataErrorCode error);
66 void ResolveToRemote(const SyncStatusCallback& callback);
67 void DidResolveToRemote(const SyncStatusCallback& callback,
68 SyncStatusCode status);
69 void DidApplyLocalChange(
70 const SyncStatusCallback& callback,
71 const google_apis::GDataErrorCode error,
72 SyncStatusCode status);
73
74 // Metadata manipulation.
75 void UpdateMetadata(const std::string& resource_id,
76 const std::string& md5,
77 DriveMetadata::ResourceType type,
78 const SyncStatusCallback& callback);
79 void ResetMD5(const std::string& resource_id,
80 DriveMetadata::ResourceType type,
81 const SyncStatusCallback& callback);
82 void SetToBeFetched(const std::string& resource_id,
83 DriveMetadata::ResourceType type,
84 const SyncStatusCallback& callback);
85 void DeleteMetadata(const SyncStatusCallback& callback);
86 void SetConflict(const std::string& resource_id,
87 const std::string& md5,
88 DriveMetadata::ResourceType type,
89 const SyncStatusCallback& callback);
kinuko 2013/05/16 13:37:37 Can we include 'Metadata' in all metadata-related
tzik 2013/05/17 05:14:10 Done.
90
91 // Conflict handling.
92 void HandleCreationConflict(
93 const std::string& resource_id,
94 DriveMetadata::ResourceType type,
95 const SyncStatusCallback& callback);
96 void HandleConflict(const SyncStatusCallback& callback);
97 void DidGetEntryForConflictResolution(
98 const SyncStatusCallback& callback,
99 google_apis::GDataErrorCode error,
100 scoped_ptr<google_apis::ResourceEntry> entry);
101
102 void HandleManualResolutionCase(const SyncStatusCallback& callback);
103 void HandleLocalWinCase(const SyncStatusCallback& callback);
104 void HandleRemoteWinCase(const SyncStatusCallback& callback);
105 void StartOver(const SyncStatusCallback& callback, SyncStatusCode status);
106
107 SyncStatusCode GDataErrorCodeToSyncStatusCodeWrapper(
108 google_apis::GDataErrorCode error);
109
110 DriveMetadataStore* metadata_store();
111 drive::APIUtilInterface* api_util();
112 RemoteChangeHandler* remote_change_handler();
113
114 base::WeakPtr<DriveFileSyncService> sync_service_;
115
116 fileapi::FileSystemURL url_;
117 FileChange local_change_;
118 base::FilePath local_path_;
119 SyncFileMetadata local_metadata_;
120 DriveMetadata drive_metadata_;
121 bool has_drive_metadata_;
122 RemoteChange remote_change_;
123 bool has_remote_change_;
124
125 std::string origin_resource_id_;
126
127 base::WeakPtrFactory<LocalChangeProcessorDelegate> weak_factory_;
128
129 DISALLOW_COPY_AND_ASSIGN(LocalChangeProcessorDelegate);
130 };
131
132 } // namespace drive
133 } // namespace sync_file_system
134
135 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_LOCAL_CHANGE_PROCESSOR_DELEGATE _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698