Chromium Code Reviews| 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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
| 13 #include "base/time.h" | |
| 13 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
| 14 #include "chrome/browser/sync/internal_api/change_record.h" | 15 #include "chrome/browser/sync/internal_api/change_record.h" |
| 15 #include "chrome/browser/sync/internal_api/configure_reason.h" | 16 #include "chrome/browser/sync/internal_api/configure_reason.h" |
| 16 #include "chrome/browser/sync/protocol/sync_protocol_error.h" | 17 #include "chrome/browser/sync/protocol/sync_protocol_error.h" |
| 17 #include "chrome/browser/sync/syncable/model_type.h" | 18 #include "chrome/browser/sync/syncable/model_type.h" |
| 18 #include "chrome/browser/sync/util/weak_handle.h" | 19 #include "chrome/browser/sync/util/weak_handle.h" |
| 19 #include "chrome/common/net/gaia/google_service_auth_error.h" | 20 #include "chrome/common/net/gaia/google_service_auth_error.h" |
| 20 | 21 |
| 21 class FilePath; | 22 class FilePath; |
| 22 | 23 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 49 // migration or upgrade. | 50 // migration or upgrade. |
| 50 REASON_DECRYPTION = 2, // The cryptographer requires a | 51 REASON_DECRYPTION = 2, // The cryptographer requires a |
| 51 // passphrase for its first attempt at | 52 // passphrase for its first attempt at |
| 52 // decryption. | 53 // decryption. |
| 53 REASON_SET_PASSPHRASE_FAILED = 3, // The cryptographer requires a new | 54 REASON_SET_PASSPHRASE_FAILED = 3, // The cryptographer requires a new |
| 54 // passphrase because its attempt at | 55 // passphrase because its attempt at |
| 55 // decryption with the cached passphrase | 56 // decryption with the cached passphrase |
| 56 // was unsuccessful. | 57 // was unsuccessful. |
| 57 }; | 58 }; |
| 58 | 59 |
| 60 // Possible types of nudge delay for datatypes. | |
| 61 // Note: These are just hints. If a sync happens then all dirty entries | |
| 62 // would be committed as part of the sync. | |
| 63 enum NudgeDelayType { | |
|
tim (not reviewing)
2011/12/09 23:07:22
Instead of 'Type', maybe 'Strategy' or 'Behavior'.
lipalani1
2011/12/15 01:35:16
Done.
| |
| 64 // Sync right away. | |
| 65 IMMEDIATE, | |
| 66 | |
| 67 // Sync this change while syncing another change. | |
| 68 PIGGY_BACK_WITH_ANOTHER_CHANGE, | |
|
tim (not reviewing)
2011/12/09 23:07:22
I thought about this naming for a while since PIGG
lipalani1
2011/12/15 01:35:16
Done.
| |
| 69 | |
| 70 // The datatype does not use one of the predefined wait times but defines its | |
| 71 // own wait time logic for nudge. | |
| 72 CUSTOM, | |
| 73 }; | |
| 74 | |
| 59 // Contains everything needed to talk to and identify a user account. | 75 // Contains everything needed to talk to and identify a user account. |
| 60 struct SyncCredentials { | 76 struct SyncCredentials { |
| 61 std::string email; | 77 std::string email; |
| 62 std::string sync_token; | 78 std::string sync_token; |
| 63 }; | 79 }; |
| 64 | 80 |
| 65 // SyncManager encapsulates syncable::DirectoryManager and serves as | 81 // SyncManager encapsulates syncable::DirectoryManager and serves as |
| 66 // the parent of all other objects in the sync API. If multiple | 82 // the parent of all other objects in the sync API. If multiple |
| 67 // threads interact with the same local sync repository (i.e. the same | 83 // threads interact with the same local sync repository (i.e. the same |
| 68 // sqlite database), they should share a single SyncManager instance. | 84 // sqlite database), they should share a single SyncManager instance. |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 571 bool HasUnsyncedItems() const; | 587 bool HasUnsyncedItems() const; |
| 572 | 588 |
| 573 // Functions used for testing. | 589 // Functions used for testing. |
| 574 | 590 |
| 575 void TriggerOnNotificationStateChangeForTest( | 591 void TriggerOnNotificationStateChangeForTest( |
| 576 bool notifications_enabled); | 592 bool notifications_enabled); |
| 577 | 593 |
| 578 void TriggerOnIncomingNotificationForTest( | 594 void TriggerOnIncomingNotificationForTest( |
| 579 const syncable::ModelTypeBitSet& model_types); | 595 const syncable::ModelTypeBitSet& model_types); |
| 580 | 596 |
| 597 static const int kDefaultNudgeDelayMilliseconds; | |
| 598 static const int kPreferencesNudgeDelayMilliseconds; | |
| 599 static const int kPiggybackNudgeDelay; | |
| 600 | |
| 581 private: | 601 private: |
| 602 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, NudgeDelayTest); | |
| 603 | |
| 604 // For unit tests. | |
| 605 base::TimeDelta GetNudgeDelayTimeDelta(const syncable::ModelType& model_type); | |
| 606 | |
| 582 base::ThreadChecker thread_checker_; | 607 base::ThreadChecker thread_checker_; |
| 583 | 608 |
| 584 // An opaque pointer to the nested private class. | 609 // An opaque pointer to the nested private class. |
| 585 SyncInternal* data_; | 610 SyncInternal* data_; |
| 586 | 611 |
| 587 DISALLOW_COPY_AND_ASSIGN(SyncManager); | 612 DISALLOW_COPY_AND_ASSIGN(SyncManager); |
| 588 }; | 613 }; |
| 589 | 614 |
| 590 bool InitialSyncEndedForTypes(syncable::ModelTypeSet types, UserShare* share); | 615 bool InitialSyncEndedForTypes(syncable::ModelTypeSet types, UserShare* share); |
| 591 | 616 |
| 592 syncable::ModelTypeSet GetTypesWithEmptyProgressMarkerToken( | 617 syncable::ModelTypeSet GetTypesWithEmptyProgressMarkerToken( |
| 593 const syncable::ModelTypeSet types, | 618 const syncable::ModelTypeSet types, |
| 594 sync_api::UserShare* share); | 619 sync_api::UserShare* share); |
| 595 | 620 |
| 596 // Returns the string representation of a PassphraseRequiredReason value. | 621 // Returns the string representation of a PassphraseRequiredReason value. |
| 597 std::string PassphraseRequiredReasonToString(PassphraseRequiredReason reason); | 622 std::string PassphraseRequiredReasonToString(PassphraseRequiredReason reason); |
| 598 | 623 |
| 599 } // namespace sync_api | 624 } // namespace sync_api |
| 600 | 625 |
| 601 #endif // CHROME_BROWSER_SYNC_INTERNAL_API_SYNC_MANAGER_H_ | 626 #endif // CHROME_BROWSER_SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
| OLD | NEW |