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_SYNC_FILE_SYSTEM_DRIVE_BACKEND_V1_LOCAL_SYNC_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_V1_LOCAL_SYNC_DELEGATE_H_ |
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_V1_LOCAL_SYNC_DELEGATE_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_V1_LOCAL_SYNC_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_servi
ce.h" | 12 #include "chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_servi
ce.h" |
13 #include "chrome/browser/sync_file_system/file_change.h" | 13 #include "chrome/browser/sync_file_system/file_change.h" |
14 #include "chrome/browser/sync_file_system/sync_callbacks.h" | 14 #include "chrome/browser/sync_file_system/sync_callbacks.h" |
15 #include "chrome/browser/sync_file_system/sync_file_metadata.h" | 15 #include "chrome/browser/sync_file_system/sync_file_metadata.h" |
16 #include "chrome/browser/sync_file_system/sync_file_system.pb.h" | 16 #include "chrome/browser/sync_file_system/sync_file_system.pb.h" |
17 #include "webkit/browser/fileapi/file_system_url.h" | 17 #include "storage/browser/fileapi/file_system_url.h" |
18 | 18 |
19 namespace sync_file_system { | 19 namespace sync_file_system { |
20 | 20 |
21 class ConflictResolutionResolver; | 21 class ConflictResolutionResolver; |
22 class DriveMetadataStore; | 22 class DriveMetadataStore; |
23 | 23 |
24 namespace drive_backend { | 24 namespace drive_backend { |
25 | 25 |
26 class APIUtil; | 26 class APIUtil; |
27 | 27 |
28 // This class handles ApplyLocalChange in LocalChangeProcessor, and its instance | 28 // This class handles ApplyLocalChange in LocalChangeProcessor, and its instance |
29 // represents single ApplyLocalChange operation. | 29 // represents single ApplyLocalChange operation. |
30 // The caller is responsible to own the instance, and can cancel operation by | 30 // The caller is responsible to own the instance, and can cancel operation by |
31 // deleting the instance or |sync_service|. | 31 // deleting the instance or |sync_service|. |
32 class LocalSyncDelegate { | 32 class LocalSyncDelegate { |
33 public: | 33 public: |
34 typedef RemoteChangeHandler::RemoteChange RemoteChange; | 34 typedef RemoteChangeHandler::RemoteChange RemoteChange; |
35 | 35 |
36 LocalSyncDelegate(DriveFileSyncService* sync_service, | 36 LocalSyncDelegate(DriveFileSyncService* sync_service, |
37 const FileChange& change, | 37 const FileChange& change, |
38 const base::FilePath& local_file_path, | 38 const base::FilePath& local_file_path, |
39 const SyncFileMetadata& local_file_metadata, | 39 const SyncFileMetadata& local_file_metadata, |
40 const fileapi::FileSystemURL& url); | 40 const storage::FileSystemURL& url); |
41 ~LocalSyncDelegate(); | 41 ~LocalSyncDelegate(); |
42 | 42 |
43 void Run(const SyncStatusCallback& callback); | 43 void Run(const SyncStatusCallback& callback); |
44 | 44 |
45 private: | 45 private: |
46 void DidGetOriginRoot(const SyncStatusCallback& callback, | 46 void DidGetOriginRoot(const SyncStatusCallback& callback, |
47 SyncStatusCode status, | 47 SyncStatusCode status, |
48 const std::string& resource_id); | 48 const std::string& resource_id); |
49 void UploadNewFile(const SyncStatusCallback& callback); | 49 void UploadNewFile(const SyncStatusCallback& callback); |
50 void DidUploadNewFile(const SyncStatusCallback& callback, | 50 void DidUploadNewFile(const SyncStatusCallback& callback, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 DriveMetadataStore* metadata_store(); | 118 DriveMetadataStore* metadata_store(); |
119 APIUtilInterface* api_util(); | 119 APIUtilInterface* api_util(); |
120 RemoteChangeHandler* remote_change_handler(); | 120 RemoteChangeHandler* remote_change_handler(); |
121 ConflictResolutionResolver* conflict_resolution_resolver(); | 121 ConflictResolutionResolver* conflict_resolution_resolver(); |
122 | 122 |
123 DriveFileSyncService* sync_service_; // Not owned. | 123 DriveFileSyncService* sync_service_; // Not owned. |
124 | 124 |
125 SyncOperationType operation_; | 125 SyncOperationType operation_; |
126 | 126 |
127 fileapi::FileSystemURL url_; | 127 storage::FileSystemURL url_; |
128 FileChange local_change_; | 128 FileChange local_change_; |
129 base::FilePath local_path_; | 129 base::FilePath local_path_; |
130 SyncFileMetadata local_metadata_; | 130 SyncFileMetadata local_metadata_; |
131 DriveMetadata drive_metadata_; | 131 DriveMetadata drive_metadata_; |
132 bool has_drive_metadata_; | 132 bool has_drive_metadata_; |
133 RemoteChange remote_change_; | 133 RemoteChange remote_change_; |
134 bool has_remote_change_; | 134 bool has_remote_change_; |
135 | 135 |
136 std::string origin_resource_id_; | 136 std::string origin_resource_id_; |
137 | 137 |
138 base::WeakPtrFactory<LocalSyncDelegate> weak_factory_; | 138 base::WeakPtrFactory<LocalSyncDelegate> weak_factory_; |
139 | 139 |
140 DISALLOW_COPY_AND_ASSIGN(LocalSyncDelegate); | 140 DISALLOW_COPY_AND_ASSIGN(LocalSyncDelegate); |
141 }; | 141 }; |
142 | 142 |
143 } // namespace drive_backend | 143 } // namespace drive_backend |
144 } // namespace sync_file_system | 144 } // namespace sync_file_system |
145 | 145 |
146 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_V1_LOCAL_SYNC_DELEGATE_
H_ | 146 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_V1_LOCAL_SYNC_DELEGATE_
H_ |
OLD | NEW |