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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 | 1106 |
1107 // ProfileSyncService needs to hold reference to access_token_request_ for | 1107 // ProfileSyncService needs to hold reference to access_token_request_ for |
1108 // the duration of request in order to receive callbacks. | 1108 // the duration of request in order to receive callbacks. |
1109 scoped_ptr<OAuth2TokenService::Request> access_token_request_; | 1109 scoped_ptr<OAuth2TokenService::Request> access_token_request_; |
1110 | 1110 |
1111 // If RequestAccessToken fails with transient error then retry requesting | 1111 // If RequestAccessToken fails with transient error then retry requesting |
1112 // access token with exponential backoff. | 1112 // access token with exponential backoff. |
1113 base::OneShotTimer<ProfileSyncService> request_access_token_retry_timer_; | 1113 base::OneShotTimer<ProfileSyncService> request_access_token_retry_timer_; |
1114 net::BackoffEntry request_access_token_backoff_; | 1114 net::BackoffEntry request_access_token_backoff_; |
1115 | 1115 |
1116 base::WeakPtrFactory<ProfileSyncService> weak_factory_; | |
1117 | |
1118 // We don't use |weak_factory_| for the StartupController because the weak | |
1119 // ptrs should be bound to the lifetime of ProfileSyncService and not to the | |
1120 // [Initialize -> sync disabled/shutdown] lifetime. We don't pass | |
1121 // StartupController an Unretained reference to future-proof against | |
1122 // the controller impl changing to post tasks. Therefore, we have a separate | |
1123 // factory. | |
1124 base::WeakPtrFactory<ProfileSyncService> startup_controller_weak_factory_; | |
1125 | |
1126 // States related to sync token and connection. | 1116 // States related to sync token and connection. |
1127 base::Time connection_status_update_time_; | 1117 base::Time connection_status_update_time_; |
1128 syncer::ConnectionStatus connection_status_; | 1118 syncer::ConnectionStatus connection_status_; |
1129 base::Time token_request_time_; | 1119 base::Time token_request_time_; |
1130 base::Time token_receive_time_; | 1120 base::Time token_receive_time_; |
1131 GoogleServiceAuthError last_get_token_error_; | 1121 GoogleServiceAuthError last_get_token_error_; |
1132 base::Time next_token_request_time_; | 1122 base::Time next_token_request_time_; |
1133 | 1123 |
1134 scoped_ptr<sync_driver::LocalDeviceInfoProvider> local_device_; | 1124 scoped_ptr<sync_driver::LocalDeviceInfoProvider> local_device_; |
1135 | 1125 |
1136 // Locally owned SyncableService implementations. | 1126 // Locally owned SyncableService implementations. |
1137 scoped_ptr<browser_sync::SessionsSyncManager> sessions_sync_manager_; | 1127 scoped_ptr<browser_sync::SessionsSyncManager> sessions_sync_manager_; |
1138 scoped_ptr<sync_driver::DeviceInfoSyncService> device_info_sync_service_; | 1128 scoped_ptr<sync_driver::DeviceInfoSyncService> device_info_sync_service_; |
1139 | 1129 |
1140 scoped_ptr<syncer::NetworkResources> network_resources_; | 1130 scoped_ptr<syncer::NetworkResources> network_resources_; |
1141 | 1131 |
1142 browser_sync::StartupController startup_controller_; | 1132 scoped_ptr<browser_sync::StartupController> startup_controller_; |
1143 | 1133 |
1144 browser_sync::BackupRollbackController backup_rollback_controller_; | 1134 scoped_ptr<browser_sync::BackupRollbackController> |
| 1135 backup_rollback_controller_; |
1145 | 1136 |
1146 // Mode of current backend. | 1137 // Mode of current backend. |
1147 BackendMode backend_mode_; | 1138 BackendMode backend_mode_; |
1148 | 1139 |
1149 // Whether backup is needed before sync starts. | 1140 // Whether backup is needed before sync starts. |
1150 bool need_backup_; | 1141 bool need_backup_; |
1151 | 1142 |
1152 // Whether backup is finished. | 1143 // Whether backup is finished. |
1153 bool backup_finished_; | 1144 bool backup_finished_; |
1154 | 1145 |
1155 base::Time backup_start_time_; | 1146 base::Time backup_start_time_; |
1156 | 1147 |
1157 base::Callback< | 1148 base::Callback< |
1158 void(BrowsingDataRemover::Observer*, Profile*, base::Time, base::Time)> | 1149 void(BrowsingDataRemover::Observer*, Profile*, base::Time, base::Time)> |
1159 clear_browsing_data_; | 1150 clear_browsing_data_; |
1160 | 1151 |
1161 // Last time when pre-sync data was saved. NULL pointer means backup data | 1152 // Last time when pre-sync data was saved. NULL pointer means backup data |
1162 // state is unknown. If time value is null, backup data doesn't exist. | 1153 // state is unknown. If time value is null, backup data doesn't exist. |
1163 scoped_ptr<base::Time> last_backup_time_; | 1154 scoped_ptr<base::Time> last_backup_time_; |
1164 | 1155 |
1165 BrowsingDataRemover::Observer* browsing_data_remover_observer_; | 1156 BrowsingDataRemover::Observer* browsing_data_remover_observer_; |
1166 | 1157 |
1167 // The full path to the sync data directory. | 1158 // The full path to the sync data directory. |
1168 base::FilePath directory_path_; | 1159 base::FilePath directory_path_; |
1169 | 1160 |
| 1161 base::WeakPtrFactory<ProfileSyncService> weak_factory_; |
| 1162 |
| 1163 // We don't use |weak_factory_| for the StartupController because the weak |
| 1164 // ptrs should be bound to the lifetime of ProfileSyncService and not to the |
| 1165 // [Initialize -> sync disabled/shutdown] lifetime. We don't pass |
| 1166 // StartupController an Unretained reference to future-proof against |
| 1167 // the controller impl changing to post tasks. Therefore, we have a separate |
| 1168 // factory. |
| 1169 base::WeakPtrFactory<ProfileSyncService> startup_controller_weak_factory_; |
| 1170 |
1170 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 1171 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
1171 }; | 1172 }; |
1172 | 1173 |
1173 bool ShouldShowActionOnUI( | 1174 bool ShouldShowActionOnUI( |
1174 const syncer::SyncProtocolError& error); | 1175 const syncer::SyncProtocolError& error); |
1175 | 1176 |
1176 | 1177 |
1177 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 1178 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
OLD | NEW |