| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_GLUE_SYNC_BACKEND_HOST_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // using their Google Account password. An implicit SetPassphrase will *not* | 176 // using their Google Account password. An implicit SetPassphrase will *not* |
| 177 // *not* override an explicit passphrase set previously. | 177 // *not* override an explicit passphrase set previously. |
| 178 void SetPassphrase(const std::string& passphrase, bool is_explicit); | 178 void SetPassphrase(const std::string& passphrase, bool is_explicit); |
| 179 | 179 |
| 180 // Called on |frontend_loop_| to kick off shutdown procedure. After this, | 180 // Called on |frontend_loop_| to kick off shutdown procedure. After this, |
| 181 // no further sync activity will occur with the sync server and no further | 181 // no further sync activity will occur with the sync server and no further |
| 182 // change applications will occur from changes already downloaded. | 182 // change applications will occur from changes already downloaded. |
| 183 virtual void StopSyncingForShutdown(); | 183 virtual void StopSyncingForShutdown(); |
| 184 | 184 |
| 185 // Called on |frontend_loop_| to kick off shutdown. | 185 // Called on |frontend_loop_| to kick off shutdown. |
| 186 // |sync_disabled| indicates if syncing is being disabled or not. | 186 // |delete_stale_data| indicates whether or not we should delete the local |
| 187 // See the implementation and Core::DoShutdown for details. | 187 // sync database. |
| 188 // Must be called *after* StopSyncingForShutdown. | 188 // See the implementation and Core::DoShutdown for details. Must be called |
| 189 void Shutdown(bool sync_disabled); | 189 // *after* StopSyncingForShutdown. |
| 190 void Shutdown(bool delete_stale_data); |
| 190 | 191 |
| 191 // Changes the set of data types that are currently being synced. | 192 // Changes the set of data types that are currently being synced. |
| 192 // The ready_task will be run when all of the requested data types | 193 // The ready_task will be run when all of the requested data types |
| 193 // are up-to-date and ready for activation. The task will be | 194 // are up-to-date and ready for activation. The task will be |
| 194 // cancelled upon shutdown. | 195 // cancelled upon shutdown. |
| 195 virtual void ConfigureDataTypes( | 196 virtual void ConfigureDataTypes( |
| 196 const syncable::ModelTypeSet& types_to_add, | 197 const syncable::ModelTypeSet& types_to_add, |
| 197 const syncable::ModelTypeSet& types_to_remove, | 198 const syncable::ModelTypeSet& types_to_remove, |
| 198 sync_api::ConfigureReason reason, | 199 sync_api::ConfigureReason reason, |
| 199 base::Callback<void(bool)> ready_task, | 200 base::Callback<void(bool)> ready_task, |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 // 1) From |sync_thread_|, invoke the syncapi Shutdown call to do | 382 // 1) From |sync_thread_|, invoke the syncapi Shutdown call to do |
| 382 // a final SaveChanges, and close sqlite handles. | 383 // a final SaveChanges, and close sqlite handles. |
| 383 // 2) Then, from |frontend_loop_|, halt the sync_thread_ (which is | 384 // 2) Then, from |frontend_loop_|, halt the sync_thread_ (which is |
| 384 // a blocking call). This causes syncapi thread-exit handlers | 385 // a blocking call). This causes syncapi thread-exit handlers |
| 385 // to run and make use of cached pointers to various components | 386 // to run and make use of cached pointers to various components |
| 386 // owned implicitly by us. | 387 // owned implicitly by us. |
| 387 // 3) Destroy this Core. That will delete syncapi components in a | 388 // 3) Destroy this Core. That will delete syncapi components in a |
| 388 // safe order because the thread that was using them has exited | 389 // safe order because the thread that was using them has exited |
| 389 // (in step 2). | 390 // (in step 2). |
| 390 void DoStopSyncManagerForShutdown(const base::Closure& closure); | 391 void DoStopSyncManagerForShutdown(const base::Closure& closure); |
| 391 void DoShutdown(bool stopping_sync); | 392 void DoShutdown(bool delete_stale_data); |
| 392 | 393 |
| 393 virtual void DoRequestConfig( | 394 virtual void DoRequestConfig( |
| 394 const syncable::ModelTypeBitSet& types_to_config, | 395 const syncable::ModelTypeBitSet& types_to_config, |
| 395 sync_api::ConfigureReason reason); | 396 sync_api::ConfigureReason reason); |
| 396 | 397 |
| 397 // Start the configuration mode. |callback| is called on the sync | 398 // Start the configuration mode. |callback| is called on the sync |
| 398 // thread. | 399 // thread. |
| 399 virtual void DoStartConfiguration(const base::Closure& callback); | 400 virtual void DoStartConfiguration(const base::Closure& callback); |
| 400 | 401 |
| 401 // Set the base request context to use when making HTTP calls. | 402 // Set the base request context to use when making HTTP calls. |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 | 599 |
| 599 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. | 600 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. |
| 600 scoped_ptr<sessions::SyncSessionSnapshot> last_snapshot_; | 601 scoped_ptr<sessions::SyncSessionSnapshot> last_snapshot_; |
| 601 | 602 |
| 602 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); | 603 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); |
| 603 }; | 604 }; |
| 604 | 605 |
| 605 } // namespace browser_sync | 606 } // namespace browser_sync |
| 606 | 607 |
| 607 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 608 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
| OLD | NEW |