| 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 |
| 59 // Contains everything needed to talk to and identify a user account. | 61 // Contains everything needed to talk to and identify a user account. |
| 60 struct SyncCredentials { | 62 struct SyncCredentials { |
| 61 std::string email; | 63 std::string email; |
| 62 std::string sync_token; | 64 std::string sync_token; |
| 63 }; | 65 }; |
| 64 | 66 |
| 65 // SyncManager encapsulates syncable::DirectoryManager and serves as | 67 // SyncManager encapsulates syncable::DirectoryManager and serves as |
| 66 // the parent of all other objects in the sync API. If multiple | 68 // 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 | 69 // threads interact with the same local sync repository (i.e. the same |
| 68 // sqlite database), they should share a single SyncManager instance. | 70 // sqlite database), they should share a single SyncManager instance. |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 bool HasUnsyncedItems() const; | 575 bool HasUnsyncedItems() const; |
| 574 | 576 |
| 575 // Functions used for testing. | 577 // Functions used for testing. |
| 576 | 578 |
| 577 void TriggerOnNotificationStateChangeForTest( | 579 void TriggerOnNotificationStateChangeForTest( |
| 578 bool notifications_enabled); | 580 bool notifications_enabled); |
| 579 | 581 |
| 580 void TriggerOnIncomingNotificationForTest( | 582 void TriggerOnIncomingNotificationForTest( |
| 581 syncable::ModelTypeSet model_types); | 583 syncable::ModelTypeSet model_types); |
| 582 | 584 |
| 585 static const int kDefaultNudgeDelayMilliseconds; |
| 586 static const int kPreferencesNudgeDelayMilliseconds; |
| 587 static const int kPiggybackNudgeDelay; |
| 588 |
| 583 private: | 589 private: |
| 590 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, NudgeDelayTest); |
| 591 |
| 592 // For unit tests. |
| 593 base::TimeDelta GetNudgeDelayTimeDelta(const syncable::ModelType& model_type); |
| 594 |
| 584 base::ThreadChecker thread_checker_; | 595 base::ThreadChecker thread_checker_; |
| 585 | 596 |
| 586 // Internal callback of RefreshNigori. | 597 // Internal callback of RefreshNigori. |
| 587 void DoneRefreshNigori(const base::Closure& done_callback, | 598 void DoneRefreshNigori(const base::Closure& done_callback, |
| 588 bool is_ready); | 599 bool is_ready); |
| 589 | 600 |
| 590 // An opaque pointer to the nested private class. | 601 // An opaque pointer to the nested private class. |
| 591 SyncInternal* data_; | 602 SyncInternal* data_; |
| 592 | 603 |
| 593 DISALLOW_COPY_AND_ASSIGN(SyncManager); | 604 DISALLOW_COPY_AND_ASSIGN(SyncManager); |
| 594 }; | 605 }; |
| 595 | 606 |
| 596 bool InitialSyncEndedForTypes(syncable::ModelTypeSet types, UserShare* share); | 607 bool InitialSyncEndedForTypes(syncable::ModelTypeSet types, UserShare* share); |
| 597 | 608 |
| 598 syncable::ModelTypeSet GetTypesWithEmptyProgressMarkerToken( | 609 syncable::ModelTypeSet GetTypesWithEmptyProgressMarkerToken( |
| 599 syncable::ModelTypeSet types, | 610 syncable::ModelTypeSet types, |
| 600 sync_api::UserShare* share); | 611 sync_api::UserShare* share); |
| 601 | 612 |
| 602 // Returns the string representation of a PassphraseRequiredReason value. | 613 // Returns the string representation of a PassphraseRequiredReason value. |
| 603 std::string PassphraseRequiredReasonToString(PassphraseRequiredReason reason); | 614 std::string PassphraseRequiredReasonToString(PassphraseRequiredReason reason); |
| 604 | 615 |
| 605 } // namespace sync_api | 616 } // namespace sync_api |
| 606 | 617 |
| 607 #endif // CHROME_BROWSER_SYNC_INTERNAL_API_SYNC_MANAGER_H_ | 618 #endif // CHROME_BROWSER_SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
| OLD | NEW |