| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 // Called to perform migration of |types|. | 94 // Called to perform migration of |types|. |
| 95 virtual void OnMigrationNeededForTypes( | 95 virtual void OnMigrationNeededForTypes( |
| 96 const syncable::ModelTypeSet& types) = 0; | 96 const syncable::ModelTypeSet& types) = 0; |
| 97 | 97 |
| 98 // Inform the Frontend that new datatypes are available for registration. | 98 // Inform the Frontend that new datatypes are available for registration. |
| 99 virtual void OnDataTypesChanged(const syncable::ModelTypeSet& to_add) = 0; | 99 virtual void OnDataTypesChanged(const syncable::ModelTypeSet& to_add) = 0; |
| 100 | 100 |
| 101 // Called when the sync cycle returns there is an user actionable error. | 101 // Called when the sync cycle returns there is an user actionable error. |
| 102 virtual void OnActionableError( | 102 virtual void OnActionableError( |
| 103 const browser_sync::SyncProtocolError& error) = 0; | 103 const browser_sync::SyncOperationResult& result) = 0; |
| 104 | 104 |
| 105 protected: | 105 protected: |
| 106 // Don't delete through SyncFrontend interface. | 106 // Don't delete through SyncFrontend interface. |
| 107 virtual ~SyncFrontend() { | 107 virtual ~SyncFrontend() { |
| 108 } | 108 } |
| 109 private: | 109 private: |
| 110 DISALLOW_COPY_AND_ASSIGN(SyncFrontend); | 110 DISALLOW_COPY_AND_ASSIGN(SyncFrontend); |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 // A UI-thread safe API into the sync backend that "hosts" the top-level | 113 // A UI-thread safe API into the sync backend that "hosts" the top-level |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 sync_api::PassphraseRequiredReason reason) OVERRIDE; | 269 sync_api::PassphraseRequiredReason reason) OVERRIDE; |
| 270 virtual void OnPassphraseAccepted( | 270 virtual void OnPassphraseAccepted( |
| 271 const std::string& bootstrap_token) OVERRIDE; | 271 const std::string& bootstrap_token) OVERRIDE; |
| 272 virtual void OnStopSyncingPermanently() OVERRIDE; | 272 virtual void OnStopSyncingPermanently() OVERRIDE; |
| 273 virtual void OnUpdatedToken(const std::string& token) OVERRIDE; | 273 virtual void OnUpdatedToken(const std::string& token) OVERRIDE; |
| 274 virtual void OnClearServerDataFailed() OVERRIDE; | 274 virtual void OnClearServerDataFailed() OVERRIDE; |
| 275 virtual void OnClearServerDataSucceeded() OVERRIDE; | 275 virtual void OnClearServerDataSucceeded() OVERRIDE; |
| 276 virtual void OnEncryptionComplete( | 276 virtual void OnEncryptionComplete( |
| 277 const syncable::ModelTypeSet& encrypted_types); | 277 const syncable::ModelTypeSet& encrypted_types); |
| 278 virtual void OnActionableError( | 278 virtual void OnActionableError( |
| 279 const browser_sync::SyncProtocolError& sync_error); | 279 const browser_sync::SyncOperationResult& sync_error); |
| 280 | 280 |
| 281 struct DoInitializeOptions { | 281 struct DoInitializeOptions { |
| 282 DoInitializeOptions( | 282 DoInitializeOptions( |
| 283 MessageLoop* sync_loop, | 283 MessageLoop* sync_loop, |
| 284 SyncBackendRegistrar* registrar, | 284 SyncBackendRegistrar* registrar, |
| 285 const WeakHandle<JsEventHandler>& event_handler, | 285 const WeakHandle<JsEventHandler>& event_handler, |
| 286 const GURL& service_url, | 286 const GURL& service_url, |
| 287 const scoped_refptr<net::URLRequestContextGetter>& | 287 const scoped_refptr<net::URLRequestContextGetter>& |
| 288 request_context_getter, | 288 request_context_getter, |
| 289 const sync_api::SyncCredentials& credentials, | 289 const sync_api::SyncCredentials& credentials, |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 // Invoked periodically to tell the syncapi to persist its state | 400 // Invoked periodically to tell the syncapi to persist its state |
| 401 // by writing to disk. | 401 // by writing to disk. |
| 402 // This is called from the thread we were created on (which is the | 402 // This is called from the thread we were created on (which is the |
| 403 // SyncBackendHost |sync_thread_|), using a repeating timer that is kicked | 403 // SyncBackendHost |sync_thread_|), using a repeating timer that is kicked |
| 404 // off as soon as the SyncManager tells us it completed | 404 // off as soon as the SyncManager tells us it completed |
| 405 // initialization. | 405 // initialization. |
| 406 void SaveChanges(); | 406 void SaveChanges(); |
| 407 | 407 |
| 408 // Let the front end handle the actionable error event. | 408 // Let the front end handle the actionable error event. |
| 409 void HandleActionableErrorEventOnFrontendLoop( | 409 void HandleActionableErrorEventOnFrontendLoop( |
| 410 const browser_sync::SyncProtocolError& sync_error); | 410 const browser_sync::SyncOperationResult& sync_error); |
| 411 | 411 |
| 412 // Dispatched to from OnAuthError to handle updating frontend UI | 412 // Dispatched to from OnAuthError to handle updating frontend UI |
| 413 // components. | 413 // components. |
| 414 void HandleAuthErrorEventOnFrontendLoop( | 414 void HandleAuthErrorEventOnFrontendLoop( |
| 415 const GoogleServiceAuthError& new_auth_error); | 415 const GoogleServiceAuthError& new_auth_error); |
| 416 | 416 |
| 417 // Invoked when a passphrase is required to decrypt a set of Nigori keys, | 417 // Invoked when a passphrase is required to decrypt a set of Nigori keys, |
| 418 // or for encrypting. |reason| denotes why the passhrase was required. | 418 // or for encrypting. |reason| denotes why the passhrase was required. |
| 419 void NotifyPassphraseRequired(sync_api::PassphraseRequiredReason reason); | 419 void NotifyPassphraseRequired(sync_api::PassphraseRequiredReason reason); |
| 420 | 420 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 | 551 |
| 552 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. | 552 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. |
| 553 scoped_ptr<sessions::SyncSessionSnapshot> last_snapshot_; | 553 scoped_ptr<sessions::SyncSessionSnapshot> last_snapshot_; |
| 554 | 554 |
| 555 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); | 555 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); |
| 556 }; | 556 }; |
| 557 | 557 |
| 558 } // namespace browser_sync | 558 } // namespace browser_sync |
| 559 | 559 |
| 560 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 560 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
| OLD | NEW |