| 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_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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 NOT_INITIALIZED, // Initialization hasn't completed, but we've | 371 NOT_INITIALIZED, // Initialization hasn't completed, but we've |
| 372 // constructed a SyncManager. | 372 // constructed a SyncManager. |
| 373 DOWNLOADING_NIGORI, // The SyncManager is initialized, but | 373 DOWNLOADING_NIGORI, // The SyncManager is initialized, but |
| 374 // we're fetching sync encryption information. | 374 // we're fetching sync encryption information. |
| 375 ASSOCIATING_NIGORI, // The SyncManager is initialized, and we | 375 ASSOCIATING_NIGORI, // The SyncManager is initialized, and we |
| 376 // have the sync encryption information, but we | 376 // have the sync encryption information, but we |
| 377 // have to update the local encryption state. | 377 // have to update the local encryption state. |
| 378 INITIALIZED, // Initialization is complete. | 378 INITIALIZED, // Initialization is complete. |
| 379 }; | 379 }; |
| 380 | 380 |
| 381 // Enum used to distinguish which bootstrap encryption token is being updated. | |
| 382 enum BootstrapTokenType { | |
| 383 PASSPHRASE_BOOTSTRAP_TOKEN, | |
| 384 KEYSTORE_BOOTSTRAP_TOKEN | |
| 385 }; | |
| 386 | |
| 387 // Checks if we have received a notice to turn on experimental datatypes | 381 // Checks if we have received a notice to turn on experimental datatypes |
| 388 // (via the nigori node) and informs the frontend if that is the case. | 382 // (via the nigori node) and informs the frontend if that is the case. |
| 389 // Note: it is illegal to call this before the backend is initialized. | 383 // Note: it is illegal to call this before the backend is initialized. |
| 390 void AddExperimentalTypes(); | 384 void AddExperimentalTypes(); |
| 391 | 385 |
| 392 // Downloading of nigori failed and will be retried. | 386 // Downloading of nigori failed and will be retried. |
| 393 void OnNigoriDownloadRetry(); | 387 void OnNigoriDownloadRetry(); |
| 394 | 388 |
| 395 // InitializationComplete passes through the SyncBackendHost to forward | 389 // InitializationComplete passes through the SyncBackendHost to forward |
| 396 // on to |frontend_|, and so that tests can intercept here if they need to | 390 // on to |frontend_|, and so that tests can intercept here if they need to |
| (...skipping 10 matching lines...) Expand all Loading... |
| 407 // eventually retry. FinishingConfigurationOnFrontendLoop(..) will be called | 401 // eventually retry. FinishingConfigurationOnFrontendLoop(..) will be called |
| 408 // on successful completion. | 402 // on successful completion. |
| 409 void RetryConfigurationOnFrontendLoop(const base::Closure& retry_callback); | 403 void RetryConfigurationOnFrontendLoop(const base::Closure& retry_callback); |
| 410 | 404 |
| 411 // Helpers to persist a token that can be used to bootstrap sync encryption | 405 // Helpers to persist a token that can be used to bootstrap sync encryption |
| 412 // across browser restart to avoid requiring the user to re-enter their | 406 // across browser restart to avoid requiring the user to re-enter their |
| 413 // passphrase. |token| must be valid UTF-8 as we use the PrefService for | 407 // passphrase. |token| must be valid UTF-8 as we use the PrefService for |
| 414 // storage. | 408 // storage. |
| 415 void PersistEncryptionBootstrapToken( | 409 void PersistEncryptionBootstrapToken( |
| 416 const std::string& token, | 410 const std::string& token, |
| 417 BootstrapTokenType token_type); | 411 syncer::BootstrapTokenType token_type); |
| 418 | 412 |
| 419 // For convenience, checks if initialization state is INITIALIZED. | 413 // For convenience, checks if initialization state is INITIALIZED. |
| 420 bool initialized() const { return initialization_state_ == INITIALIZED; } | 414 bool initialized() const { return initialization_state_ == INITIALIZED; } |
| 421 | 415 |
| 422 // Let the front end handle the actionable error event. | 416 // Let the front end handle the actionable error event. |
| 423 void HandleActionableErrorEventOnFrontendLoop( | 417 void HandleActionableErrorEventOnFrontendLoop( |
| 424 const syncer::SyncProtocolError& sync_error); | 418 const syncer::SyncProtocolError& sync_error); |
| 425 | 419 |
| 426 // Checks if |passphrase| can be used to decrypt the cryptographer's pending | 420 // Checks if |passphrase| can be used to decrypt the cryptographer's pending |
| 427 // keys that were cached during NotifyPassphraseRequired. Returns true if | 421 // keys that were cached during NotifyPassphraseRequired. Returns true if |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 // it via OnBackendInitialized in the final state of | 535 // it via OnBackendInitialized in the final state of |
| 542 // HandleInitializationCompletedOnFrontendLoop. | 536 // HandleInitializationCompletedOnFrontendLoop. |
| 543 syncer::WeakHandle<syncer::JsBackend> js_backend_; | 537 syncer::WeakHandle<syncer::JsBackend> js_backend_; |
| 544 | 538 |
| 545 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); | 539 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); |
| 546 }; | 540 }; |
| 547 | 541 |
| 548 } // namespace browser_sync | 542 } // namespace browser_sync |
| 549 | 543 |
| 550 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 544 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
| OLD | NEW |