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

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

Issue 14977008: [SyncFileSystem] Separate out ApplyLocalChange from DriveFileSyncService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: drop extra empty line 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_APPLY_LOCAL_CHANGE_DELEGATE_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_APPLY_LOCAL_CHANGE_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 ApplyLocalChangeDelegate {
kinuko 2013/05/16 06:57:49 ApplyLocalChangeDelete::ApplyLocalChange() ... Lo
tzik 2013/05/16 11:06:14 Done.
25 public:
26 static void ApplyLocalChange(base::WeakPtr<DriveFileSyncService> sync_service,
27 const FileChange& change,
28 const base::FilePath& local_file_path,
29 const SyncFileMetadata& local_file_metadata,
30 const fileapi::FileSystemURL& url,
31 const SyncStatusCallback& callback);
32 ~ApplyLocalChangeDelegate();
33
34 private:
35 typedef RemoteChangeHandler::RemoteChange RemoteChange;
36
37 ApplyLocalChangeDelegate(
38 base::WeakPtr<DriveFileSyncService> sync_service,
39 const FileChange& change,
40 const base::FilePath& local_file_path,
41 const SyncFileMetadata& local_file_metadata,
42 const fileapi::FileSystemURL& url);
43
44 void Run(const SyncStatusCallback& callback);
45 void DidGetOriginRoot(const SyncStatusCallback& callback,
46 SyncStatusCode status,
47 const std::string& resource_id);
48 void UploadNewFile(const SyncStatusCallback& callback);
49 void DidUploadNewFile(const SyncStatusCallback& callback,
50 google_apis::GDataErrorCode error,
51 const std::string& resource_id,
52 const std::string& md5);
53 void CreateDirectory(const SyncStatusCallback& callback);
54 void DidCreateDirectory(
55 const SyncStatusCallback& callback,
56 google_apis::GDataErrorCode error,
57 const std::string& resource_id);
58 void UploadExistingFile(const SyncStatusCallback& callback);
59 void DidUploadExistingFile(
60 const SyncStatusCallback& callback,
61 google_apis::GDataErrorCode error,
62 const std::string& resource_id,
63 const std::string& md5);
64 void DeleteFile(const SyncStatusCallback& callback);
65 void DeleteDirectory(const SyncStatusCallback& callback);
66 void DidDeleteFile(const SyncStatusCallback& callback,
67 google_apis::GDataErrorCode error);
68 void ResolveToLocal(const SyncStatusCallback& callback);
69 void DidDeleteFileToResolveToLocal(
70 const SyncStatusCallback& callback,
71 google_apis::GDataErrorCode error);
72 void ResolveToRemote(const SyncStatusCallback& callback);
73 void DidResolveToRemote(const SyncStatusCallback& callback,
74 SyncStatusCode status);
75 void DidApplyLocalChange(
76 const SyncStatusCallback& callback,
77 const google_apis::GDataErrorCode error,
78 SyncStatusCode status);
79
80 // Metadata manipulation.
81 void UpdateMetadata(const std::string& resource_id,
82 const std::string& md5,
83 DriveMetadata::ResourceType type,
84 const SyncStatusCallback& callback);
85 void SetToBeFetched(const std::string& resource_id,
86 DriveMetadata::ResourceType type,
87 const SyncStatusCallback& callback);
88 void DeleteMetadata(const SyncStatusCallback& callback);
89 void SetConflict(const std::string& resource_id,
90 const std::string& md5,
91 DriveMetadata::ResourceType type,
92 const SyncStatusCallback& callback);
93
94 void HandleCreationConflict(
95 const std::string& resource_id,
96 DriveMetadata::ResourceType type,
97 const SyncStatusCallback& callback);
98 void HandleConflict(const SyncStatusCallback& callback);
99 void DidGetEntryForConflictResolution(
100 const SyncStatusCallback& callback,
101 google_apis::GDataErrorCode error,
102 scoped_ptr<google_apis::ResourceEntry> entry);
103
104 SyncStatusCode GDataErrorCodeToSyncStatusCodeWrapper(
105 google_apis::GDataErrorCode error);
106
107 DriveMetadataStore* metadata_store();
108 drive::APIUtilInterface* api_util();
109 RemoteChangeHandler* remote_change_handler();
110
111 base::WeakPtr<DriveFileSyncService> sync_service_;
112
113 fileapi::FileSystemURL url_;
114 FileChange local_change_;
115 base::FilePath local_path_;
116 SyncFileMetadata local_metadata_;
117 DriveMetadata drive_metadata_;
118 bool has_drive_metadata_;
119 RemoteChange remote_change_;
120 bool has_remote_change_;
121
122 std::string origin_resource_id_;
123
124 base::WeakPtrFactory<ApplyLocalChangeDelegate> weak_factory_;
125
126 DISALLOW_COPY_AND_ASSIGN(ApplyLocalChangeDelegate);
127 };
128
129 } // namespace drive
130 } // namespace sync_file_system
131
132 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_APPLY_LOCAL_CHANGE_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698