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_METADATA_DATABASE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_ |
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 CreateCallback; | 117 CreateCallback; |
118 | 118 |
119 // The entry point of the MetadataDatabase for production code. | 119 // The entry point of the MetadataDatabase for production code. |
120 static void Create(base::SequencedTaskRunner* task_runner, | 120 static void Create(base::SequencedTaskRunner* task_runner, |
121 const base::FilePath& database_path, | 121 const base::FilePath& database_path, |
122 const CreateCallback& callback); | 122 const CreateCallback& callback); |
123 ~MetadataDatabase(); | 123 ~MetadataDatabase(); |
124 | 124 |
125 int64 GetLargestChangeID() const; | 125 int64 GetLargestChangeID() const; |
126 | 126 |
| 127 bool HasSyncRoot() const; |
| 128 |
| 129 // Populates empty database with initial data. |
| 130 // Adds a file metadata and a file tracker for |sync_root_folder|, and adds |
| 131 // file metadata and file trackers for each |app_root_folders|. |
| 132 // Newly added tracker for |sync_root_folder| is active and non-dirty. |
| 133 // Newly added trackers for |app_root_folders| are inactive and non-dirty. |
| 134 // Trackers for |app_root_folders| are not yet registered as app-roots, but |
| 135 // are ready to register. |
| 136 void PopulateInitialData( |
| 137 int64 largest_change_id, |
| 138 const google_apis::FileResource& sync_root_folder, |
| 139 const ScopedVector<google_apis::FileResource>& app_root_folders, |
| 140 const SyncStatusCallback& callback); |
| 141 |
127 // Registers existing folder as the app-root for |app_id|. The folder | 142 // Registers existing folder as the app-root for |app_id|. The folder |
128 // must be an inactive folder that does not yet associated to any App. | 143 // must be an inactive folder that does not yet associated to any App. |
129 // This method associates the folder with |app_id| and activates it. | 144 // This method associates the folder with |app_id| and activates it. |
130 void RegisterApp(const std::string& app_id, | 145 void RegisterApp(const std::string& app_id, |
131 const std::string& folder_id, | 146 const std::string& folder_id, |
132 const SyncStatusCallback& callback); | 147 const SyncStatusCallback& callback); |
133 | 148 |
134 // Inactivates the folder associated to the app to disable |app_id|. | 149 // Inactivates the folder associated to the app to disable |app_id|. |
135 // Does nothing if |app_id| is already disabled. | 150 // Does nothing if |app_id| is already disabled. |
136 void DisableApp(const std::string& app_id, | 151 void DisableApp(const std::string& app_id, |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 327 |
313 base::WeakPtrFactory<MetadataDatabase> weak_ptr_factory_; | 328 base::WeakPtrFactory<MetadataDatabase> weak_ptr_factory_; |
314 | 329 |
315 DISALLOW_COPY_AND_ASSIGN(MetadataDatabase); | 330 DISALLOW_COPY_AND_ASSIGN(MetadataDatabase); |
316 }; | 331 }; |
317 | 332 |
318 } // namespace drive_backend | 333 } // namespace drive_backend |
319 } // namespace sync_file_system | 334 } // namespace sync_file_system |
320 | 335 |
321 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_ | 336 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_ |
OLD | NEW |