| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_METADATA_STORE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_METADATA_STORE_H_ |
| 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_METADATA_STORE_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_METADATA_STORE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 const SyncStatusCallback& callback); | 66 const SyncStatusCallback& callback); |
| 67 | 67 |
| 68 // Deletes database entry for |url|. Invokes |callback|, upon completion. | 68 // Deletes database entry for |url|. Invokes |callback|, upon completion. |
| 69 void DeleteEntry(const fileapi::FileSystemURL& url, | 69 void DeleteEntry(const fileapi::FileSystemURL& url, |
| 70 const SyncStatusCallback& callback); | 70 const SyncStatusCallback& callback); |
| 71 | 71 |
| 72 // Lookups and reads the database entry for |url|. | 72 // Lookups and reads the database entry for |url|. |
| 73 SyncStatusCode ReadEntry(const fileapi::FileSystemURL& url, | 73 SyncStatusCode ReadEntry(const fileapi::FileSystemURL& url, |
| 74 DriveMetadata* metadata) const; | 74 DriveMetadata* metadata) const; |
| 75 | 75 |
| 76 // Marks |origin| as incremental sync and associates it with the directory |
| 77 // identified by |resource_id|. |
| 78 // |origin| must not already be an incremental sync origin. |
| 79 void AddIncrementalSyncOrigin(const GURL& origin, |
| 80 const std::string& resource_id); |
| 81 |
| 76 // Returns true if |origin| is a batch sync origin, a incremental sync origin | 82 // Returns true if |origin| is a batch sync origin, a incremental sync origin |
| 77 // or a disabled origin. | 83 // or a disabled origin. |
| 78 bool IsKnownOrigin(const GURL& origin) const; | 84 bool IsKnownOrigin(const GURL& origin) const; |
| 79 | 85 |
| 80 // Returns true if |origin| is a batch sync origin, i.e. the origin's entire | 86 // Returns true if |origin| is a batch sync origin, i.e. the origin's entire |
| 81 // file list hasn't been fully fetched and processed yet. | 87 // file list hasn't been fully fetched and processed yet. |
| 82 bool IsBatchSyncOrigin(const GURL& origin) const; | 88 bool IsBatchSyncOrigin(const GURL& origin) const; |
| 83 | 89 |
| 84 // Returns true if |origin| is an incremental sync origin, i.e. the origin's | 90 // Returns true if |origin| is an incremental sync origin, i.e. the origin's |
| 85 // entire file list has been cached and is ready to apply changes | 91 // entire file list has been cached and is ready to apply changes |
| 86 // incrementally. | 92 // incrementally. |
| 87 bool IsIncrementalSyncOrigin(const GURL& origin) const; | 93 bool IsIncrementalSyncOrigin(const GURL& origin) const; |
| 88 | 94 |
| 89 // Returns true if |origin| is a disabled origin. | 95 // Returns true if |origin| is a disabled origin. |
| 90 bool IsOriginDisabled(const GURL& origin) const; | 96 bool IsOriginDisabled(const GURL& origin) const; |
| 91 | 97 |
| 92 // Marks |origin| as a batch sync origin and associates it with the directory | |
| 93 // identified by |resource_id|. | |
| 94 // |origin| must not be a batch sync origin nor an incremental sync origin. | |
| 95 void AddBatchSyncOrigin(const GURL& origin, const std::string& resource_id); | |
| 96 | |
| 97 // Marks |origin| as an incremental sync origin. | |
| 98 // |origin| must be a batch sync origin. | |
| 99 void MoveBatchSyncOriginToIncremental(const GURL& origin); | |
| 100 | |
| 101 void EnableOrigin(const GURL& origin, | 98 void EnableOrigin(const GURL& origin, |
| 102 const SyncStatusCallback& callback); | 99 const SyncStatusCallback& callback); |
| 103 | 100 |
| 104 void DisableOrigin(const GURL& origin, | 101 void DisableOrigin(const GURL& origin, |
| 105 const SyncStatusCallback& callback); | 102 const SyncStatusCallback& callback); |
| 106 | 103 |
| 107 void RemoveOrigin(const GURL& origin, | 104 void RemoveOrigin(const GURL& origin, |
| 108 const SyncStatusCallback& callback); | 105 const SyncStatusCallback& callback); |
| 109 | 106 |
| 110 // Sets the directory identified by |resource_id| as the sync data directory. | 107 // Sets the directory identified by |resource_id| as the sync data directory. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 148 |
| 152 // Maps |resource_id| to corresponding |origin|. | 149 // Maps |resource_id| to corresponding |origin|. |
| 153 // Returns true if the directory indicated by |resource_id| is not an origin | 150 // Returns true if the directory indicated by |resource_id| is not an origin |
| 154 // root directory. | 151 // root directory. |
| 155 bool GetOriginByOriginRootDirectoryId(const std::string& resource_id, | 152 bool GetOriginByOriginRootDirectoryId(const std::string& resource_id, |
| 156 GURL* origin); | 153 GURL* origin); |
| 157 | 154 |
| 158 private: | 155 private: |
| 159 friend class DriveMetadataStoreTest; | 156 friend class DriveMetadataStoreTest; |
| 160 | 157 |
| 158 // Marks |origin| as a batch sync origin and associates it with the directory |
| 159 // identified by |resource_id|. |
| 160 // |origin| must not be a batch sync origin nor an incremental sync origin. |
| 161 void AddBatchSyncOrigin(const GURL& origin, const std::string& resource_id); |
| 162 |
| 163 // Marks |origin| as an incremental sync origin. |
| 164 // |origin| must be a batch sync origin. |
| 165 void MoveBatchSyncOriginToIncremental(const GURL& origin); |
| 166 |
| 161 void UpdateDBStatus(SyncStatusCode status); | 167 void UpdateDBStatus(SyncStatusCode status); |
| 162 void UpdateDBStatusAndInvokeCallback(const SyncStatusCallback& callback, | 168 void UpdateDBStatusAndInvokeCallback(const SyncStatusCallback& callback, |
| 163 SyncStatusCode status); | 169 SyncStatusCode status); |
| 164 void DidInitialize(const InitializationCallback& callback, | 170 void DidInitialize(const InitializationCallback& callback, |
| 165 DriveMetadataDBContents* contents, | 171 DriveMetadataDBContents* contents, |
| 166 SyncStatusCode error); | 172 SyncStatusCode error); |
| 167 void DidUpdateOrigin(const SyncStatusCallback& callback, | 173 void DidUpdateOrigin(const SyncStatusCallback& callback, |
| 168 SyncStatusCode status); | 174 SyncStatusCode status); |
| 169 | 175 |
| 170 // These are only for testing. | 176 // These are only for testing. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 192 ResourceIdByOrigin disabled_origins_; | 198 ResourceIdByOrigin disabled_origins_; |
| 193 | 199 |
| 194 OriginByResourceId origin_by_resource_id_; | 200 OriginByResourceId origin_by_resource_id_; |
| 195 | 201 |
| 196 DISALLOW_COPY_AND_ASSIGN(DriveMetadataStore); | 202 DISALLOW_COPY_AND_ASSIGN(DriveMetadataStore); |
| 197 }; | 203 }; |
| 198 | 204 |
| 199 } // namespace sync_file_system | 205 } // namespace sync_file_system |
| 200 | 206 |
| 201 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_METADATA_STORE_H_ | 207 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_METADATA_STORE_H_ |
| OLD | NEW |