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 <vector> | 10 #include <vector> |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 | 73 |
74 // Returns true if |origin| is a batch sync origin, i.e. the origin's entire | 74 // Returns true if |origin| is a batch sync origin, i.e. the origin's entire |
75 // file list hasn't been fully fetched and processed yet. | 75 // file list hasn't been fully fetched and processed yet. |
76 bool IsBatchSyncOrigin(const GURL& origin) const; | 76 bool IsBatchSyncOrigin(const GURL& origin) const; |
77 | 77 |
78 // Returns true if |origin| is an incremental sync origin, i.e. the origin's | 78 // Returns true if |origin| is an incremental sync origin, i.e. the origin's |
79 // entire file list has been cached and is ready to apply changes | 79 // entire file list has been cached and is ready to apply changes |
80 // incrementally. | 80 // incrementally. |
81 bool IsIncrementalSyncOrigin(const GURL& origin) const; | 81 bool IsIncrementalSyncOrigin(const GURL& origin) const; |
82 | 82 |
83 // Returns true if |origin| is a disabled sync origin. | |
84 bool IsDisabledSyncOrigin(const GURL& origin) const; | |
tzik
2013/03/14 12:50:54
s/DisabledSyncOrigin/DisabledOrigin/ ?
nhiroki
2013/03/15 12:08:56
I mean to make it consistent with "IsBatchSyncOrig
kinuko
2013/03/16 22:11:03
I think they are for 'batch sync' and 'incremental
| |
85 | |
83 // Marks |origin| as a batch sync origin and associates it with the directory | 86 // Marks |origin| as a batch sync origin and associates it with the directory |
84 // identified by |resource_id|. | 87 // identified by |resource_id|. |
85 // |origin| must not be a batch sync origin nor an incremental sync origin. | 88 // |origin| must not be a batch sync origin nor an incremental sync origin. |
86 void AddBatchSyncOrigin(const GURL& origin, const std::string& resource_id); | 89 void AddBatchSyncOrigin(const GURL& origin, const std::string& resource_id); |
87 | 90 |
88 // Marks |origin| as an incremental sync origin. | 91 // Marks |origin| as an incremental sync origin. |
89 // |origin| must be a batch sync origin. | 92 // |origin| must be a batch sync origin. |
90 void MoveBatchSyncOriginToIncremental(const GURL& origin); | 93 void MoveBatchSyncOriginToIncremental(const GURL& origin); |
91 | 94 |
95 void EnableSyncOrigin(const GURL& origin, | |
tzik
2013/03/14 12:50:54
s/EnableSyncOrigin/EnableOriginSync/,
s/DisableSyn
nhiroki
2013/03/15 12:08:56
Done.
| |
96 const SyncStatusCallback& callback); | |
97 | |
98 void DisableSyncOrigin(const GURL& origin, | |
99 const SyncStatusCallback& callback); | |
100 | |
92 void RemoveOrigin(const GURL& origin, | 101 void RemoveOrigin(const GURL& origin, |
93 const SyncStatusCallback& callback); | 102 const SyncStatusCallback& callback); |
94 | 103 |
95 // Sets the directory identified by |resource_id| as the sync data directory. | 104 // Sets the directory identified by |resource_id| as the sync data directory. |
96 // All data for the Sync FileSystem should be store into the directory. | 105 // All data for the Sync FileSystem should be store into the directory. |
97 // It is invalid to overwrite the directory. | 106 // It is invalid to overwrite the directory. |
98 void SetSyncRootDirectory(const std::string& resource_id); | 107 void SetSyncRootDirectory(const std::string& resource_id); |
99 | 108 |
100 // Returns a set of URLs for files in conflict. | 109 // Returns a set of URLs for files in conflict. |
101 SyncStatusCode GetConflictURLs( | 110 SyncStatusCode GetConflictURLs( |
(...skipping 17 matching lines...) Expand all Loading... | |
119 const ResourceIDMap& batch_sync_origins() const { | 128 const ResourceIDMap& batch_sync_origins() const { |
120 DCHECK(CalledOnValidThread()); | 129 DCHECK(CalledOnValidThread()); |
121 return batch_sync_origins_; | 130 return batch_sync_origins_; |
122 } | 131 } |
123 | 132 |
124 const ResourceIDMap& incremental_sync_origins() const { | 133 const ResourceIDMap& incremental_sync_origins() const { |
125 DCHECK(CalledOnValidThread()); | 134 DCHECK(CalledOnValidThread()); |
126 return incremental_sync_origins_; | 135 return incremental_sync_origins_; |
127 } | 136 } |
128 | 137 |
129 // Returns all origins that are tracked. i.e. Union of batch_sync_origins_ and | 138 // Returns tracked and enabled origins. i.e. Union of batch_sync_origins_ and |
130 // incremental_sync_origins_. | 139 // incremental_sync_origins_. |
131 void GetAllOrigins(std::vector<GURL>* origins); | 140 void GetEnabledOrigins(std::vector<GURL>* origins); |
141 | |
142 // Returns tracked but disabled origins. i.e. disabled_origins_. | |
143 void GetDisabledOrigins(std::vector<GURL>* origins); | |
132 | 144 |
133 private: | 145 private: |
134 friend class DriveMetadataStoreTest; | 146 friend class DriveMetadataStoreTest; |
135 | 147 |
136 void UpdateDBStatus(SyncStatusCode status); | 148 void UpdateDBStatus(SyncStatusCode status); |
137 void UpdateDBStatusAndInvokeCallback(const SyncStatusCallback& callback, | 149 void UpdateDBStatusAndInvokeCallback(const SyncStatusCallback& callback, |
138 SyncStatusCode status); | 150 SyncStatusCode status); |
139 void DidInitialize(const InitializationCallback& callback, | 151 void DidInitialize(const InitializationCallback& callback, |
140 DriveMetadataDBContents* contents, | 152 DriveMetadataDBContents* contents, |
141 SyncStatusCode error); | 153 SyncStatusCode error); |
142 void DidRemoveOrigin(const SyncStatusCallback& callback, | 154 void DidChangeOrigin(const SyncStatusCallback& callback, |
143 SyncStatusCode status); | 155 SyncStatusCode status); |
144 | 156 |
145 // These are only for testing. | 157 // These are only for testing. |
146 void RestoreSyncRootDirectory(const SyncStatusCallback& callback); | 158 void RestoreSyncRootDirectory(const SyncStatusCallback& callback); |
147 void DidRestoreSyncRootDirectory(const SyncStatusCallback& callback, | 159 void DidRestoreSyncRootDirectory(const SyncStatusCallback& callback, |
148 std::string* sync_root_directory_resource_id, | 160 std::string* sync_root_directory_resource_id, |
149 SyncStatusCode status); | 161 SyncStatusCode status); |
150 void RestoreSyncOrigins(const SyncStatusCallback& callback); | 162 void RestoreSyncOrigins(const SyncStatusCallback& callback); |
151 void DidRestoreSyncOrigins(const SyncStatusCallback& callback, | 163 void DidRestoreSyncOrigins(const SyncStatusCallback& callback, |
152 ResourceIDMap* batch_sync_origins, | 164 ResourceIDMap* batch_sync_origins, |
153 ResourceIDMap* incremental_sync_origins, | 165 ResourceIDMap* incremental_sync_origins, |
166 ResourceIDMap* disabled_sync_origins, | |
154 SyncStatusCode status); | 167 SyncStatusCode status); |
155 | 168 |
156 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; | 169 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; |
157 scoped_ptr<DriveMetadataDB> db_; | 170 scoped_ptr<DriveMetadataDB> db_; |
158 SyncStatusCode db_status_; | 171 SyncStatusCode db_status_; |
159 | 172 |
160 int64 largest_changestamp_; | 173 int64 largest_changestamp_; |
161 MetadataMap metadata_map_; | 174 MetadataMap metadata_map_; |
162 | 175 |
163 std::string sync_root_directory_resource_id_; | 176 std::string sync_root_directory_resource_id_; |
164 ResourceIDMap batch_sync_origins_; | 177 ResourceIDMap batch_sync_origins_; |
165 ResourceIDMap incremental_sync_origins_; | 178 ResourceIDMap incremental_sync_origins_; |
179 ResourceIDMap disabled_sync_origins_; | |
166 | 180 |
167 DISALLOW_COPY_AND_ASSIGN(DriveMetadataStore); | 181 DISALLOW_COPY_AND_ASSIGN(DriveMetadataStore); |
168 }; | 182 }; |
169 | 183 |
170 } // namespace sync_file_system | 184 } // namespace sync_file_system |
171 | 185 |
172 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_METADATA_STORE_H_ | 186 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_METADATA_STORE_H_ |
OLD | NEW |