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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 browser_sync::ProfileSyncServiceStartBehavior start_behavior); | 277 browser_sync::ProfileSyncServiceStartBehavior start_behavior); |
278 virtual ~ProfileSyncService(); | 278 virtual ~ProfileSyncService(); |
279 | 279 |
280 // Initializes the object. This must be called at most once, and | 280 // Initializes the object. This must be called at most once, and |
281 // immediately after an object of this class is constructed. | 281 // immediately after an object of this class is constructed. |
282 void Initialize(); | 282 void Initialize(); |
283 | 283 |
284 virtual void SetSyncSetupCompleted(); | 284 virtual void SetSyncSetupCompleted(); |
285 | 285 |
286 // ProfileSyncServiceBase implementation. | 286 // ProfileSyncServiceBase implementation. |
287 virtual bool HasSyncSetupCompleted() const OVERRIDE; | 287 virtual bool HasSyncSetupCompleted() const override; |
288 virtual bool SyncActive() const OVERRIDE; | 288 virtual bool SyncActive() const override; |
289 virtual syncer::ModelTypeSet GetActiveDataTypes() const OVERRIDE; | 289 virtual syncer::ModelTypeSet GetActiveDataTypes() const override; |
290 virtual void AddObserver(ProfileSyncServiceBase::Observer* observer) OVERRIDE; | 290 virtual void AddObserver(ProfileSyncServiceBase::Observer* observer) override; |
291 virtual void RemoveObserver( | 291 virtual void RemoveObserver( |
292 ProfileSyncServiceBase::Observer* observer) OVERRIDE; | 292 ProfileSyncServiceBase::Observer* observer) override; |
293 virtual bool HasObserver( | 293 virtual bool HasObserver( |
294 ProfileSyncServiceBase::Observer* observer) const OVERRIDE; | 294 ProfileSyncServiceBase::Observer* observer) const override; |
295 | 295 |
296 void AddProtocolEventObserver(browser_sync::ProtocolEventObserver* observer); | 296 void AddProtocolEventObserver(browser_sync::ProtocolEventObserver* observer); |
297 void RemoveProtocolEventObserver( | 297 void RemoveProtocolEventObserver( |
298 browser_sync::ProtocolEventObserver* observer); | 298 browser_sync::ProtocolEventObserver* observer); |
299 | 299 |
300 void AddTypeDebugInfoObserver(syncer::TypeDebugInfoObserver* observer); | 300 void AddTypeDebugInfoObserver(syncer::TypeDebugInfoObserver* observer); |
301 void RemoveTypeDebugInfoObserver(syncer::TypeDebugInfoObserver* observer); | 301 void RemoveTypeDebugInfoObserver(syncer::TypeDebugInfoObserver* observer); |
302 | 302 |
303 // Add a sync type preference provider. Each provider may only be added once. | 303 // Add a sync type preference provider. Each provider may only be added once. |
304 void AddPreferenceProvider(SyncTypePreferenceProvider* provider); | 304 void AddPreferenceProvider(SyncTypePreferenceProvider* provider); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 | 391 |
392 // Disables sync for the user and prevents it from starting on next restart. | 392 // Disables sync for the user and prevents it from starting on next restart. |
393 virtual void StopSyncingPermanently(); | 393 virtual void StopSyncingPermanently(); |
394 | 394 |
395 // SyncFrontend implementation. | 395 // SyncFrontend implementation. |
396 virtual void OnBackendInitialized( | 396 virtual void OnBackendInitialized( |
397 const syncer::WeakHandle<syncer::JsBackend>& js_backend, | 397 const syncer::WeakHandle<syncer::JsBackend>& js_backend, |
398 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& | 398 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& |
399 debug_info_listener, | 399 debug_info_listener, |
400 const std::string& cache_guid, | 400 const std::string& cache_guid, |
401 bool success) OVERRIDE; | 401 bool success) override; |
402 virtual void OnSyncCycleCompleted() OVERRIDE; | 402 virtual void OnSyncCycleCompleted() override; |
403 virtual void OnProtocolEvent(const syncer::ProtocolEvent& event) OVERRIDE; | 403 virtual void OnProtocolEvent(const syncer::ProtocolEvent& event) override; |
404 virtual void OnDirectoryTypeCommitCounterUpdated( | 404 virtual void OnDirectoryTypeCommitCounterUpdated( |
405 syncer::ModelType type, | 405 syncer::ModelType type, |
406 const syncer::CommitCounters& counters) OVERRIDE; | 406 const syncer::CommitCounters& counters) override; |
407 virtual void OnDirectoryTypeUpdateCounterUpdated( | 407 virtual void OnDirectoryTypeUpdateCounterUpdated( |
408 syncer::ModelType type, | 408 syncer::ModelType type, |
409 const syncer::UpdateCounters& counters) OVERRIDE; | 409 const syncer::UpdateCounters& counters) override; |
410 virtual void OnDirectoryTypeStatusCounterUpdated( | 410 virtual void OnDirectoryTypeStatusCounterUpdated( |
411 syncer::ModelType type, | 411 syncer::ModelType type, |
412 const syncer::StatusCounters& counters) OVERRIDE; | 412 const syncer::StatusCounters& counters) override; |
413 virtual void OnConnectionStatusChange( | 413 virtual void OnConnectionStatusChange( |
414 syncer::ConnectionStatus status) OVERRIDE; | 414 syncer::ConnectionStatus status) override; |
415 virtual void OnPassphraseRequired( | 415 virtual void OnPassphraseRequired( |
416 syncer::PassphraseRequiredReason reason, | 416 syncer::PassphraseRequiredReason reason, |
417 const sync_pb::EncryptedData& pending_keys) OVERRIDE; | 417 const sync_pb::EncryptedData& pending_keys) override; |
418 virtual void OnPassphraseAccepted() OVERRIDE; | 418 virtual void OnPassphraseAccepted() override; |
419 virtual void OnEncryptedTypesChanged( | 419 virtual void OnEncryptedTypesChanged( |
420 syncer::ModelTypeSet encrypted_types, | 420 syncer::ModelTypeSet encrypted_types, |
421 bool encrypt_everything) OVERRIDE; | 421 bool encrypt_everything) override; |
422 virtual void OnEncryptionComplete() OVERRIDE; | 422 virtual void OnEncryptionComplete() override; |
423 virtual void OnMigrationNeededForTypes( | 423 virtual void OnMigrationNeededForTypes( |
424 syncer::ModelTypeSet types) OVERRIDE; | 424 syncer::ModelTypeSet types) override; |
425 virtual void OnExperimentsChanged( | 425 virtual void OnExperimentsChanged( |
426 const syncer::Experiments& experiments) OVERRIDE; | 426 const syncer::Experiments& experiments) override; |
427 virtual void OnActionableError( | 427 virtual void OnActionableError( |
428 const syncer::SyncProtocolError& error) OVERRIDE; | 428 const syncer::SyncProtocolError& error) override; |
429 | 429 |
430 // DataTypeManagerObserver implementation. | 430 // DataTypeManagerObserver implementation. |
431 virtual void OnConfigureDone( | 431 virtual void OnConfigureDone( |
432 const sync_driver::DataTypeManager::ConfigureResult& result) OVERRIDE; | 432 const sync_driver::DataTypeManager::ConfigureResult& result) override; |
433 virtual void OnConfigureStart() OVERRIDE; | 433 virtual void OnConfigureStart() override; |
434 | 434 |
435 // DataTypeEncryptionHandler implementation. | 435 // DataTypeEncryptionHandler implementation. |
436 virtual bool IsPassphraseRequired() const OVERRIDE; | 436 virtual bool IsPassphraseRequired() const override; |
437 virtual syncer::ModelTypeSet GetEncryptedDataTypes() const OVERRIDE; | 437 virtual syncer::ModelTypeSet GetEncryptedDataTypes() const override; |
438 | 438 |
439 // SigninManagerBase::Observer implementation. | 439 // SigninManagerBase::Observer implementation. |
440 virtual void GoogleSigninSucceeded(const std::string& account_id, | 440 virtual void GoogleSigninSucceeded(const std::string& account_id, |
441 const std::string& username, | 441 const std::string& username, |
442 const std::string& password) OVERRIDE; | 442 const std::string& password) override; |
443 virtual void GoogleSignedOut(const std::string& account_id, | 443 virtual void GoogleSignedOut(const std::string& account_id, |
444 const std::string& username) OVERRIDE; | 444 const std::string& username) override; |
445 | 445 |
446 // Called when a user chooses which data types to sync as part of the sync | 446 // Called when a user chooses which data types to sync as part of the sync |
447 // setup wizard. |sync_everything| represents whether they chose the | 447 // setup wizard. |sync_everything| represents whether they chose the |
448 // "keep everything synced" option; if true, |chosen_types| will be ignored | 448 // "keep everything synced" option; if true, |chosen_types| will be ignored |
449 // and all data types will be synced. |sync_everything| means "sync all | 449 // and all data types will be synced. |sync_everything| means "sync all |
450 // current and future data types." | 450 // current and future data types." |
451 virtual void OnUserChoseDatatypes(bool sync_everything, | 451 virtual void OnUserChoseDatatypes(bool sync_everything, |
452 syncer::ModelTypeSet chosen_types); | 452 syncer::ModelTypeSet chosen_types); |
453 | 453 |
454 // Get the sync status code. | 454 // Get the sync status code. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 // assume it's running on the UI thread. | 536 // assume it's running on the UI thread. |
537 static bool IsSyncEnabled(); | 537 static bool IsSyncEnabled(); |
538 | 538 |
539 // Returns whether sync is managed, i.e. controlled by configuration | 539 // Returns whether sync is managed, i.e. controlled by configuration |
540 // management. If so, the user is not allowed to configure sync. | 540 // management. If so, the user is not allowed to configure sync. |
541 virtual bool IsManaged() const; | 541 virtual bool IsManaged() const; |
542 | 542 |
543 // syncer::UnrecoverableErrorHandler implementation. | 543 // syncer::UnrecoverableErrorHandler implementation. |
544 virtual void OnUnrecoverableError( | 544 virtual void OnUnrecoverableError( |
545 const tracked_objects::Location& from_here, | 545 const tracked_objects::Location& from_here, |
546 const std::string& message) OVERRIDE; | 546 const std::string& message) override; |
547 | 547 |
548 // Called to re-enable a type disabled by DisableDatatype(..). Note, this does | 548 // Called to re-enable a type disabled by DisableDatatype(..). Note, this does |
549 // not change the preferred state of a datatype, and is not persisted across | 549 // not change the preferred state of a datatype, and is not persisted across |
550 // restarts. | 550 // restarts. |
551 void ReenableDatatype(syncer::ModelType type); | 551 void ReenableDatatype(syncer::ModelType type); |
552 | 552 |
553 // The functions below (until ActivateDataType()) should only be | 553 // The functions below (until ActivateDataType()) should only be |
554 // called if backend_initialized() is true. | 554 // called if backend_initialized() is true. |
555 | 555 |
556 // TODO(akalin): This is called mostly by ModelAssociators and | 556 // TODO(akalin): This is called mostly by ModelAssociators and |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 // This function is used by about_sync_util.cc to help populate the about:sync | 594 // This function is used by about_sync_util.cc to help populate the about:sync |
595 // page. It returns a ListValue rather than a DictionaryValue in part to make | 595 // page. It returns a ListValue rather than a DictionaryValue in part to make |
596 // it easier to iterate over its elements when constructing that page. | 596 // it easier to iterate over its elements when constructing that page. |
597 base::Value* GetTypeStatusMap() const; | 597 base::Value* GetTypeStatusMap() const; |
598 | 598 |
599 // Overridden by tests. | 599 // Overridden by tests. |
600 // TODO(zea): Remove these and have the dtc's call directly into the SBH. | 600 // TODO(zea): Remove these and have the dtc's call directly into the SBH. |
601 virtual void DeactivateDataType(syncer::ModelType type); | 601 virtual void DeactivateDataType(syncer::ModelType type); |
602 | 602 |
603 // SyncPrefObserver implementation. | 603 // SyncPrefObserver implementation. |
604 virtual void OnSyncManagedPrefChange(bool is_sync_managed) OVERRIDE; | 604 virtual void OnSyncManagedPrefChange(bool is_sync_managed) override; |
605 | 605 |
606 // Changes which data types we're going to be syncing to |preferred_types|. | 606 // Changes which data types we're going to be syncing to |preferred_types|. |
607 // If it is running, the DataTypeManager will be instructed to reconfigure | 607 // If it is running, the DataTypeManager will be instructed to reconfigure |
608 // the sync backend so that exactly these datatypes are actively synced. See | 608 // the sync backend so that exactly these datatypes are actively synced. See |
609 // class comment for more on what it means for a datatype to be Preferred. | 609 // class comment for more on what it means for a datatype to be Preferred. |
610 virtual void ChangePreferredDataTypes( | 610 virtual void ChangePreferredDataTypes( |
611 syncer::ModelTypeSet preferred_types); | 611 syncer::ModelTypeSet preferred_types); |
612 | 612 |
613 // Returns the set of types which are preferred for enabling. This is a | 613 // Returns the set of types which are preferred for enabling. This is a |
614 // superset of the active types (see GetActiveDataTypes()). | 614 // superset of the active types (see GetActiveDataTypes()). |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 // been cleared yet. Virtual for testing purposes. | 723 // been cleared yet. Virtual for testing purposes. |
724 virtual bool waiting_for_auth() const; | 724 virtual bool waiting_for_auth() const; |
725 | 725 |
726 // The set of currently enabled sync experiments. | 726 // The set of currently enabled sync experiments. |
727 const syncer::Experiments& current_experiments() const; | 727 const syncer::Experiments& current_experiments() const; |
728 | 728 |
729 // OAuth2TokenService::Consumer implementation. | 729 // OAuth2TokenService::Consumer implementation. |
730 virtual void OnGetTokenSuccess( | 730 virtual void OnGetTokenSuccess( |
731 const OAuth2TokenService::Request* request, | 731 const OAuth2TokenService::Request* request, |
732 const std::string& access_token, | 732 const std::string& access_token, |
733 const base::Time& expiration_time) OVERRIDE; | 733 const base::Time& expiration_time) override; |
734 virtual void OnGetTokenFailure( | 734 virtual void OnGetTokenFailure( |
735 const OAuth2TokenService::Request* request, | 735 const OAuth2TokenService::Request* request, |
736 const GoogleServiceAuthError& error) OVERRIDE; | 736 const GoogleServiceAuthError& error) override; |
737 | 737 |
738 // OAuth2TokenService::Observer implementation. | 738 // OAuth2TokenService::Observer implementation. |
739 virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE; | 739 virtual void OnRefreshTokenAvailable(const std::string& account_id) override; |
740 virtual void OnRefreshTokenRevoked(const std::string& account_id) OVERRIDE; | 740 virtual void OnRefreshTokenRevoked(const std::string& account_id) override; |
741 virtual void OnRefreshTokensLoaded() OVERRIDE; | 741 virtual void OnRefreshTokensLoaded() override; |
742 | 742 |
743 // KeyedService implementation. This must be called exactly | 743 // KeyedService implementation. This must be called exactly |
744 // once (before this object is destroyed). | 744 // once (before this object is destroyed). |
745 virtual void Shutdown() OVERRIDE; | 745 virtual void Shutdown() override; |
746 | 746 |
747 // Called when a datatype (SyncableService) has a need for sync to start | 747 // Called when a datatype (SyncableService) has a need for sync to start |
748 // ASAP, presumably because a local change event has occurred but we're | 748 // ASAP, presumably because a local change event has occurred but we're |
749 // still in deferred start mode, meaning the SyncableService hasn't been | 749 // still in deferred start mode, meaning the SyncableService hasn't been |
750 // told to MergeDataAndStartSyncing yet. | 750 // told to MergeDataAndStartSyncing yet. |
751 void OnDataTypeRequestsSyncStartup(syncer::ModelType type); | 751 void OnDataTypeRequestsSyncStartup(syncer::ModelType type); |
752 | 752 |
753 // Return sync token status. | 753 // Return sync token status. |
754 SyncTokenStatus GetSyncTokenStatus() const; | 754 SyncTokenStatus GetSyncTokenStatus() const; |
755 | 755 |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1160 BrowsingDataRemover::Observer* browsing_data_remover_observer_; | 1160 BrowsingDataRemover::Observer* browsing_data_remover_observer_; |
1161 | 1161 |
1162 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 1162 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
1163 }; | 1163 }; |
1164 | 1164 |
1165 bool ShouldShowActionOnUI( | 1165 bool ShouldShowActionOnUI( |
1166 const syncer::SyncProtocolError& error); | 1166 const syncer::SyncProtocolError& error); |
1167 | 1167 |
1168 | 1168 |
1169 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 1169 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
OLD | NEW |