OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <map> | 9 #include <map> |
10 | 10 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 const browser_sync::SyncBackendHost::StatusSummary& summary); | 198 const browser_sync::SyncBackendHost::StatusSummary& summary); |
199 | 199 |
200 // Returns true if the SyncBackendHost has told us it's ready to accept | 200 // Returns true if the SyncBackendHost has told us it's ready to accept |
201 // changes. | 201 // changes. |
202 // TODO(timsteele): What happens if the bookmark model is loaded, a change | 202 // TODO(timsteele): What happens if the bookmark model is loaded, a change |
203 // takes place, and the backend isn't initialized yet? | 203 // takes place, and the backend isn't initialized yet? |
204 bool sync_initialized() const { return backend_initialized_; } | 204 bool sync_initialized() const { return backend_initialized_; } |
205 bool unrecoverable_error_detected() const { | 205 bool unrecoverable_error_detected() const { |
206 return unrecoverable_error_detected_; | 206 return unrecoverable_error_detected_; |
207 } | 207 } |
| 208 const std::string& unrecoverable_error_message() { |
| 209 return unrecoverable_error_message_; |
| 210 } |
| 211 tracked_objects::Location unrecoverable_error_location() { |
| 212 return unrecoverable_error_location_.get() ? |
| 213 *unrecoverable_error_location_.get() : tracked_objects::Location(); |
| 214 } |
208 | 215 |
209 bool UIShouldDepictAuthInProgress() const { | 216 bool UIShouldDepictAuthInProgress() const { |
210 return is_auth_in_progress_; | 217 return is_auth_in_progress_; |
211 } | 218 } |
212 | 219 |
213 // A timestamp marking the last time the service observed a transition from | 220 // A timestamp marking the last time the service observed a transition from |
214 // the SYNCING state to the READY state. Note that this does not reflect the | 221 // the SYNCING state to the READY state. Note that this does not reflect the |
215 // last time we polled the server to see if there were any changes; the | 222 // last time we polled the server to see if there were any changes; the |
216 // timestamp is only snapped when syncing takes place and we download or | 223 // timestamp is only snapped when syncing takes place and we download or |
217 // upload some bookmark entity. | 224 // upload some bookmark entity. |
(...skipping 21 matching lines...) Expand all Loading... |
239 | 246 |
240 // Record stats on various events. | 247 // Record stats on various events. |
241 static void SyncEvent(SyncEventCodes code); | 248 static void SyncEvent(SyncEventCodes code); |
242 | 249 |
243 // Returns whether sync is enabled. Sync can be enabled/disabled both | 250 // Returns whether sync is enabled. Sync can be enabled/disabled both |
244 // at compile time (e.g., on a per-OS basis) or at run time (e.g., | 251 // at compile time (e.g., on a per-OS basis) or at run time (e.g., |
245 // command-line switches). | 252 // command-line switches). |
246 static bool IsSyncEnabled(); | 253 static bool IsSyncEnabled(); |
247 | 254 |
248 // UnrecoverableErrorHandler implementation. | 255 // UnrecoverableErrorHandler implementation. |
249 virtual void OnUnrecoverableError(); | 256 virtual void OnUnrecoverableError( |
| 257 const tracked_objects::Location& from_here, |
| 258 const std::string& message); |
250 | 259 |
251 browser_sync::SyncBackendHost* backend() { return backend_.get(); } | 260 browser_sync::SyncBackendHost* backend() { return backend_.get(); } |
252 | 261 |
253 virtual void ActivateDataType( | 262 virtual void ActivateDataType( |
254 browser_sync::DataTypeController* data_type_controller, | 263 browser_sync::DataTypeController* data_type_controller, |
255 browser_sync::ChangeProcessor* change_processor); | 264 browser_sync::ChangeProcessor* change_processor); |
256 virtual void DeactivateDataType( | 265 virtual void DeactivateDataType( |
257 browser_sync::DataTypeController* data_type_controller, | 266 browser_sync::DataTypeController* data_type_controller, |
258 browser_sync::ChangeProcessor* change_processor); | 267 browser_sync::ChangeProcessor* change_processor); |
259 | 268 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 // As its name suggests, this should NOT be used for anything other than UI. | 408 // As its name suggests, this should NOT be used for anything other than UI. |
400 bool is_auth_in_progress_; | 409 bool is_auth_in_progress_; |
401 | 410 |
402 SyncSetupWizard wizard_; | 411 SyncSetupWizard wizard_; |
403 | 412 |
404 // True if an unrecoverable error (e.g. violation of an assumed invariant) | 413 // True if an unrecoverable error (e.g. violation of an assumed invariant) |
405 // occurred during syncer operation. This value should be checked before | 414 // occurred during syncer operation. This value should be checked before |
406 // doing any work that might corrupt things further. | 415 // doing any work that might corrupt things further. |
407 bool unrecoverable_error_detected_; | 416 bool unrecoverable_error_detected_; |
408 | 417 |
| 418 // A message sent when an unrecoverable error occurred. |
| 419 std::string unrecoverable_error_message_; |
| 420 scoped_ptr<tracked_objects::Location> unrecoverable_error_location_; |
| 421 |
409 // Which peer-to-peer notification method to use. | 422 // Which peer-to-peer notification method to use. |
410 browser_sync::NotificationMethod notification_method_; | 423 browser_sync::NotificationMethod notification_method_; |
411 | 424 |
412 // Manages the start and stop of the various data types. | 425 // Manages the start and stop of the various data types. |
413 scoped_ptr<browser_sync::DataTypeManager> data_type_manager_; | 426 scoped_ptr<browser_sync::DataTypeManager> data_type_manager_; |
414 | 427 |
415 ObserverList<Observer> observers_; | 428 ObserverList<Observer> observers_; |
416 | 429 |
417 NotificationRegistrar registrar_; | 430 NotificationRegistrar registrar_; |
418 | 431 |
419 ScopedRunnableMethodFactory<ProfileSyncService> | 432 ScopedRunnableMethodFactory<ProfileSyncService> |
420 scoped_runnable_method_factory_; | 433 scoped_runnable_method_factory_; |
421 | 434 |
422 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 435 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
423 }; | 436 }; |
424 | 437 |
425 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 438 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
OLD | NEW |