| 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_INTERNAL_API_SYNC_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
| 6 #define CHROME_BROWSER_SYNC_INTERNAL_API_SYNC_MANAGER_H_ | 6 #define CHROME_BROWSER_SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 // Count of empty and non empty getupdates; | 152 // Count of empty and non empty getupdates; |
| 153 int nonempty_get_updates; | 153 int nonempty_get_updates; |
| 154 int empty_get_updates; | 154 int empty_get_updates; |
| 155 | 155 |
| 156 // Count of useless and useful syncs we perform. | 156 // Count of useless and useful syncs we perform. |
| 157 int useless_sync_cycles; | 157 int useless_sync_cycles; |
| 158 int useful_sync_cycles; | 158 int useful_sync_cycles; |
| 159 | 159 |
| 160 // Encryption related. | 160 // Encryption related. |
| 161 syncable::ModelTypeSet encrypted_types; | 161 syncable::ModelEnumSet encrypted_types; |
| 162 bool cryptographer_ready; | 162 bool cryptographer_ready; |
| 163 bool crypto_has_pending_keys; | 163 bool crypto_has_pending_keys; |
| 164 | 164 |
| 165 // The unique identifer for this client. | 165 // The unique identifer for this client. |
| 166 std::string unique_id; | 166 std::string unique_id; |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 // An interface the embedding application implements to be notified | 169 // An interface the embedding application implements to be notified |
| 170 // on change events. Note that these methods may be called on *any* | 170 // on change events. Note that these methods may be called on *any* |
| 171 // thread. | 171 // thread. |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 // |encrypted_types| will always be a superset of | 383 // |encrypted_types| will always be a superset of |
| 384 // Cryptographer::SensitiveTypes(). If |encrypt_everything| is | 384 // Cryptographer::SensitiveTypes(). If |encrypt_everything| is |
| 385 // true, |encrypted_types| will be the set of all known types. | 385 // true, |encrypted_types| will be the set of all known types. |
| 386 // | 386 // |
| 387 // Until this function is called, observers can assume that the | 387 // Until this function is called, observers can assume that the |
| 388 // set of encrypted types is Cryptographer::SensitiveTypes() and | 388 // set of encrypted types is Cryptographer::SensitiveTypes() and |
| 389 // that the encrypt everything flag is false. | 389 // that the encrypt everything flag is false. |
| 390 // | 390 // |
| 391 // Called from within a transaction. | 391 // Called from within a transaction. |
| 392 virtual void OnEncryptedTypesChanged( | 392 virtual void OnEncryptedTypesChanged( |
| 393 const syncable::ModelTypeSet& encrypted_types, | 393 syncable::ModelEnumSet encrypted_types, |
| 394 bool encrypt_everything) = 0; | 394 bool encrypt_everything) = 0; |
| 395 | 395 |
| 396 // Called after we finish encrypting the current set of encrypted | 396 // Called after we finish encrypting the current set of encrypted |
| 397 // types. | 397 // types. |
| 398 // | 398 // |
| 399 // Called from within a transaction. | 399 // Called from within a transaction. |
| 400 virtual void OnEncryptionComplete() = 0; | 400 virtual void OnEncryptionComplete() = 0; |
| 401 | 401 |
| 402 virtual void OnActionableError( | 402 virtual void OnActionableError( |
| 403 const browser_sync::SyncProtocolError& sync_protocol_error) = 0; | 403 const browser_sync::SyncProtocolError& sync_protocol_error) = 0; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 // OnPassphraseRequired(), but otherwise it will trigger | 552 // OnPassphraseRequired(), but otherwise it will trigger |
| 553 // OnEncryptionComplete(). | 553 // OnEncryptionComplete(). |
| 554 void EnableEncryptEverything(); | 554 void EnableEncryptEverything(); |
| 555 | 555 |
| 556 // Returns true if we are currently encrypting all sync data. May | 556 // Returns true if we are currently encrypting all sync data. May |
| 557 // be called on any thread. | 557 // be called on any thread. |
| 558 bool EncryptEverythingEnabledForTest() const; | 558 bool EncryptEverythingEnabledForTest() const; |
| 559 | 559 |
| 560 // Gets the set of encrypted types from the cryptographer | 560 // Gets the set of encrypted types from the cryptographer |
| 561 // Note: opens a transaction. May be called from any thread. | 561 // Note: opens a transaction. May be called from any thread. |
| 562 syncable::ModelTypeSet GetEncryptedDataTypesForTest() const; | 562 syncable::ModelEnumSet GetEncryptedDataTypesForTest() const; |
| 563 | 563 |
| 564 // Reads the nigori node to determine if any experimental types should be | 564 // Reads the nigori node to determine if any experimental types should be |
| 565 // enabled. | 565 // enabled. |
| 566 // Note: opens a transaction. May be called on any thread. | 566 // Note: opens a transaction. May be called on any thread. |
| 567 bool ReceivedExperimentalTypes(syncable::ModelTypeSet* to_add) const; | 567 bool ReceivedExperimentalTypes(syncable::ModelEnumSet* to_add) const; |
| 568 | 568 |
| 569 // Uses a read-only transaction to determine if the directory being synced has | 569 // Uses a read-only transaction to determine if the directory being synced has |
| 570 // any remaining unsynced items. May be called on any thread. | 570 // any remaining unsynced items. May be called on any thread. |
| 571 bool HasUnsyncedItems() const; | 571 bool HasUnsyncedItems() const; |
| 572 | 572 |
| 573 // Functions used for testing. | 573 // Functions used for testing. |
| 574 | 574 |
| 575 void TriggerOnNotificationStateChangeForTest( | 575 void TriggerOnNotificationStateChangeForTest( |
| 576 bool notifications_enabled); | 576 bool notifications_enabled); |
| 577 | 577 |
| 578 void TriggerOnIncomingNotificationForTest( | 578 void TriggerOnIncomingNotificationForTest( |
| 579 syncable::ModelEnumSet model_types); | 579 syncable::ModelEnumSet model_types); |
| 580 | 580 |
| 581 private: | 581 private: |
| 582 base::ThreadChecker thread_checker_; | 582 base::ThreadChecker thread_checker_; |
| 583 | 583 |
| 584 // An opaque pointer to the nested private class. | 584 // An opaque pointer to the nested private class. |
| 585 SyncInternal* data_; | 585 SyncInternal* data_; |
| 586 | 586 |
| 587 DISALLOW_COPY_AND_ASSIGN(SyncManager); | 587 DISALLOW_COPY_AND_ASSIGN(SyncManager); |
| 588 }; | 588 }; |
| 589 | 589 |
| 590 bool InitialSyncEndedForTypes(syncable::ModelTypeSet types, UserShare* share); | 590 bool InitialSyncEndedForTypes(syncable::ModelEnumSet types, UserShare* share); |
| 591 | 591 |
| 592 syncable::ModelTypeSet GetTypesWithEmptyProgressMarkerToken( | 592 syncable::ModelEnumSet GetTypesWithEmptyProgressMarkerToken( |
| 593 const syncable::ModelTypeSet types, | 593 syncable::ModelEnumSet types, |
| 594 sync_api::UserShare* share); | 594 sync_api::UserShare* share); |
| 595 | 595 |
| 596 // Returns the string representation of a PassphraseRequiredReason value. | 596 // Returns the string representation of a PassphraseRequiredReason value. |
| 597 std::string PassphraseRequiredReasonToString(PassphraseRequiredReason reason); | 597 std::string PassphraseRequiredReasonToString(PassphraseRequiredReason reason); |
| 598 | 598 |
| 599 } // namespace sync_api | 599 } // namespace sync_api |
| 600 | 600 |
| 601 #endif // CHROME_BROWSER_SYNC_INTERNAL_API_SYNC_MANAGER_H_ | 601 #endif // CHROME_BROWSER_SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
| OLD | NEW |