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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 bool HasUnsyncedItems() const; | 573 bool HasUnsyncedItems() const; |
572 | 574 |
573 // Functions used for testing. | 575 // Functions used for testing. |
574 | 576 |
575 void TriggerOnNotificationStateChangeForTest( | 577 void TriggerOnNotificationStateChangeForTest( |
576 bool notifications_enabled); | 578 bool notifications_enabled); |
577 | 579 |
578 void TriggerOnIncomingNotificationForTest( | 580 void TriggerOnIncomingNotificationForTest( |
579 syncable::ModelTypeSet model_types); | 581 syncable::ModelTypeSet model_types); |
580 | 582 |
| 583 static const int kDefaultNudgeDelayMilliseconds; |
| 584 static const int kPreferencesNudgeDelayMilliseconds; |
| 585 static const int kPiggybackNudgeDelay; |
| 586 |
581 private: | 587 private: |
| 588 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, NudgeDelayTest); |
| 589 |
| 590 // For unit tests. |
| 591 base::TimeDelta GetNudgeDelayTimeDelta(const syncable::ModelType& model_type); |
| 592 |
582 base::ThreadChecker thread_checker_; | 593 base::ThreadChecker thread_checker_; |
583 | 594 |
584 // An opaque pointer to the nested private class. | 595 // An opaque pointer to the nested private class. |
585 SyncInternal* data_; | 596 SyncInternal* data_; |
586 | 597 |
587 DISALLOW_COPY_AND_ASSIGN(SyncManager); | 598 DISALLOW_COPY_AND_ASSIGN(SyncManager); |
588 }; | 599 }; |
589 | 600 |
590 bool InitialSyncEndedForTypes(syncable::ModelTypeSet types, UserShare* share); | 601 bool InitialSyncEndedForTypes(syncable::ModelTypeSet types, UserShare* share); |
591 | 602 |
592 syncable::ModelTypeSet GetTypesWithEmptyProgressMarkerToken( | 603 syncable::ModelTypeSet GetTypesWithEmptyProgressMarkerToken( |
593 syncable::ModelTypeSet types, | 604 syncable::ModelTypeSet types, |
594 sync_api::UserShare* share); | 605 sync_api::UserShare* share); |
595 | 606 |
596 // Returns the string representation of a PassphraseRequiredReason value. | 607 // Returns the string representation of a PassphraseRequiredReason value. |
597 std::string PassphraseRequiredReasonToString(PassphraseRequiredReason reason); | 608 std::string PassphraseRequiredReasonToString(PassphraseRequiredReason reason); |
598 | 609 |
599 } // namespace sync_api | 610 } // namespace sync_api |
600 | 611 |
601 #endif // CHROME_BROWSER_SYNC_INTERNAL_API_SYNC_MANAGER_H_ | 612 #endif // CHROME_BROWSER_SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
OLD | NEW |