Chromium Code Reviews| 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_PROFILE_SYNC_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 762 | 762 |
| 763 void SetBackupStartDelayForTest(base::TimeDelta delay); | 763 void SetBackupStartDelayForTest(base::TimeDelta delay); |
| 764 | 764 |
| 765 BackendMode backend_mode() const { | 765 BackendMode backend_mode() const { |
| 766 return backend_mode_; | 766 return backend_mode_; |
| 767 } | 767 } |
| 768 | 768 |
| 769 void SetClearingBrowseringDataForTesting( | 769 void SetClearingBrowseringDataForTesting( |
| 770 base::Callback<void(Profile*, base::Time, base::Time)> c); | 770 base::Callback<void(Profile*, base::Time, base::Time)> c); |
| 771 | 771 |
| 772 base::Time GetDeviceBackupTimeForTesting() const; | |
| 773 | |
| 772 protected: | 774 protected: |
| 773 // Helper to configure the priority data types. | 775 // Helper to configure the priority data types. |
| 774 void ConfigurePriorityDataTypes(); | 776 void ConfigurePriorityDataTypes(); |
| 775 | 777 |
| 776 // Helper to install and configure a data type manager. | 778 // Helper to install and configure a data type manager. |
| 777 void ConfigureDataTypeManager(); | 779 void ConfigureDataTypeManager(); |
| 778 | 780 |
| 779 // Shuts down the backend sync components. | 781 // Shuts down the backend sync components. |
| 780 // |option| indicates if syncing is being disabled or not, and whether | 782 // |option| indicates if syncing is being disabled or not, and whether |
| 781 // to claim ownership of sync thread from backend. | 783 // to claim ownership of sync thread from backend. |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 937 | 939 |
| 938 // True if a syncing backend exists. | 940 // True if a syncing backend exists. |
| 939 bool HasSyncingBackend() const; | 941 bool HasSyncingBackend() const; |
| 940 | 942 |
| 941 // Update first sync time stored in preferences | 943 // Update first sync time stored in preferences |
| 942 void UpdateFirstSyncTimePref(); | 944 void UpdateFirstSyncTimePref(); |
| 943 | 945 |
| 944 // Clear browsing data since first sync during rollback. | 946 // Clear browsing data since first sync during rollback. |
| 945 void ClearBrowsingDataSinceFirstSync(); | 947 void ClearBrowsingDataSinceFirstSync(); |
| 946 | 948 |
| 949 // Post background task to check sync backup DB state if needed. | |
| 950 void CheckSyncBackupIfNeeded(); | |
| 951 | |
| 952 // Callback to receive backup DB check result. | |
| 953 void CheckSyncBackupCallback(base::Time backup_time); | |
| 954 | |
| 947 // Factory used to create various dependent objects. | 955 // Factory used to create various dependent objects. |
| 948 scoped_ptr<ProfileSyncComponentsFactory> factory_; | 956 scoped_ptr<ProfileSyncComponentsFactory> factory_; |
| 949 | 957 |
| 950 // The profile whose data we are synchronizing. | 958 // The profile whose data we are synchronizing. |
| 951 Profile* profile_; | 959 Profile* profile_; |
| 952 | 960 |
| 953 // The class that handles getting, setting, and persisting sync | 961 // The class that handles getting, setting, and persisting sync |
| 954 // preferences. | 962 // preferences. |
| 955 sync_driver::SyncPrefs sync_prefs_; | 963 sync_driver::SyncPrefs sync_prefs_; |
| 956 | 964 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1103 | 1111 |
| 1104 // Mode of current backend. | 1112 // Mode of current backend. |
| 1105 BackendMode backend_mode_; | 1113 BackendMode backend_mode_; |
| 1106 | 1114 |
| 1107 // When browser starts, delay sync backup/rollback backend start for this | 1115 // When browser starts, delay sync backup/rollback backend start for this |
| 1108 // time. | 1116 // time. |
| 1109 base::TimeDelta backup_start_delay_; | 1117 base::TimeDelta backup_start_delay_; |
| 1110 | 1118 |
| 1111 base::Callback<void(Profile*, base::Time, base::Time)> clear_browsing_data_; | 1119 base::Callback<void(Profile*, base::Time, base::Time)> clear_browsing_data_; |
| 1112 | 1120 |
| 1121 // Last time when pre-sync data was saved. NULL means backup data state is | |
| 1122 // unknown. If time value is null, backup data doesn't exist. | |
| 1123 scoped_ptr<base::Time> last_backup_time_; | |
|
Nicolas Zea
2014/06/13 22:36:41
Does this need to be in a scoped ptr? Couldn't you
haitaol1
2014/06/13 23:28:25
Using scoped_ptr makes it 3-state, NULL pointer me
| |
| 1124 | |
| 1113 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 1125 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
| 1114 }; | 1126 }; |
| 1115 | 1127 |
| 1116 bool ShouldShowActionOnUI( | 1128 bool ShouldShowActionOnUI( |
| 1117 const syncer::SyncProtocolError& error); | 1129 const syncer::SyncProtocolError& error); |
| 1118 | 1130 |
| 1119 | 1131 |
| 1120 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 1132 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| OLD | NEW |