Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: chrome/browser/sync/profile_sync_service.h

Issue 408003002: [Sync] Fix namespace for sync_driver component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile and chrome/ usage Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 class ProfileSyncComponentsFactory; 55 class ProfileSyncComponentsFactory;
56 class SupervisedUserSigninManagerWrapper; 56 class SupervisedUserSigninManagerWrapper;
57 class SyncErrorController; 57 class SyncErrorController;
58 58
59 namespace base { 59 namespace base {
60 class CommandLine; 60 class CommandLine;
61 }; 61 };
62 62
63 namespace browser_sync { 63 namespace browser_sync {
64 class BackendMigrator; 64 class BackendMigrator;
65 class ChangeProcessor;
66 class DataTypeManager;
67 class DeviceInfo; 65 class DeviceInfo;
68 class FaviconCache; 66 class FaviconCache;
69 class JsController; 67 class JsController;
70 class OpenTabsUIDelegate; 68 class OpenTabsUIDelegate;
71 69
72 namespace sessions { 70 namespace sessions {
73 class SyncSessionSnapshot; 71 class SyncSessionSnapshot;
74 } // namespace sessions 72 } // namespace sessions
75 } // namespace browser_sync 73 } // namespace browser_sync
76 74
75 namespace sync_driver {
76 class ChangeProcessor;
77 class DataTypeManager;
78 }
maxbogue 2014/07/21 22:14:21 // namespace sync_driver
Nicolas Zea 2014/07/21 22:23:31 Done.
79
77 namespace syncer { 80 namespace syncer {
78 class BaseTransaction; 81 class BaseTransaction;
79 class NetworkResources; 82 class NetworkResources;
80 struct CommitCounters; 83 struct CommitCounters;
81 struct StatusCounters; 84 struct StatusCounters;
82 struct SyncCredentials; 85 struct SyncCredentials;
83 struct UpdateCounters; 86 struct UpdateCounters;
84 struct UserShare; 87 struct UserShare;
85 } // namespace syncer 88 } // namespace syncer
86 89
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // SetSetupInProgress(false) should be called when configuration is complete. 170 // SetSetupInProgress(false) should be called when configuration is complete.
168 // When SetSyncSetupCompleted() == false, but SetSetupInProgress(true) has 171 // When SetSyncSetupCompleted() == false, but SetSetupInProgress(true) has
169 // been called, then the sync engine knows not to download any user data. 172 // been called, then the sync engine knows not to download any user data.
170 // 173 //
171 // When initial sync is complete, the UI code should call 174 // When initial sync is complete, the UI code should call
172 // SetSyncSetupCompleted() followed by SetSetupInProgress(false) - this will 175 // SetSyncSetupCompleted() followed by SetSetupInProgress(false) - this will
173 // tell the sync engine that setup is completed and it can begin downloading 176 // tell the sync engine that setup is completed and it can begin downloading
174 // data from the sync server. 177 // data from the sync server.
175 // 178 //
176 class ProfileSyncService : public ProfileSyncServiceBase, 179 class ProfileSyncService : public ProfileSyncServiceBase,
177 public browser_sync::SyncFrontend, 180 public sync_driver::SyncFrontend,
178 public sync_driver::SyncPrefObserver, 181 public sync_driver::SyncPrefObserver,
179 public browser_sync::DataTypeManagerObserver, 182 public sync_driver::DataTypeManagerObserver,
180 public syncer::UnrecoverableErrorHandler, 183 public syncer::UnrecoverableErrorHandler,
181 public KeyedService, 184 public KeyedService,
182 public browser_sync::DataTypeEncryptionHandler, 185 public sync_driver::DataTypeEncryptionHandler,
183 public OAuth2TokenService::Consumer, 186 public OAuth2TokenService::Consumer,
184 public OAuth2TokenService::Observer, 187 public OAuth2TokenService::Observer,
185 public SessionsSyncManager::SyncInternalApiDelegate, 188 public SessionsSyncManager::SyncInternalApiDelegate,
186 public SigninManagerBase::Observer { 189 public SigninManagerBase::Observer {
187 public: 190 public:
188 typedef browser_sync::SyncBackendHost::Status Status; 191 typedef browser_sync::SyncBackendHost::Status Status;
189 192
190 // Status of sync server connection, sync token and token request. 193 // Status of sync server connection, sync token and token request.
191 struct SyncTokenStatus { 194 struct SyncTokenStatus {
192 SyncTokenStatus(); 195 SyncTokenStatus();
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 323
321 // Return whether OAuth2 refresh token is loaded and available for the backend 324 // Return whether OAuth2 refresh token is loaded and available for the backend
322 // to start up. Virtual to enable mocking in tests. 325 // to start up. Virtual to enable mocking in tests.
323 virtual bool IsOAuthRefreshTokenAvailable(); 326 virtual bool IsOAuthRefreshTokenAvailable();
324 327
325 // Registers a data type controller with the sync service. This 328 // Registers a data type controller with the sync service. This
326 // makes the data type controller available for use, it does not 329 // makes the data type controller available for use, it does not
327 // enable or activate the synchronization of the data type (see 330 // enable or activate the synchronization of the data type (see
328 // ActivateDataType). Takes ownership of the pointer. 331 // ActivateDataType). Takes ownership of the pointer.
329 void RegisterDataTypeController( 332 void RegisterDataTypeController(
330 browser_sync::DataTypeController* data_type_controller); 333 sync_driver::DataTypeController* data_type_controller);
331 334
332 // Registers a type whose sync storage will not be managed by the 335 // Registers a type whose sync storage will not be managed by the
333 // ProfileSyncService. It declares that this sync type may be activated at 336 // ProfileSyncService. It declares that this sync type may be activated at
334 // some point in the future. This function call does not enable or activate 337 // some point in the future. This function call does not enable or activate
335 // the syncing of this type 338 // the syncing of this type
336 void RegisterNonBlockingType(syncer::ModelType type); 339 void RegisterNonBlockingType(syncer::ModelType type);
337 340
338 // Called by a component that supports non-blocking sync when it is ready to 341 // Called by a component that supports non-blocking sync when it is ready to
339 // initialize its connection to the sync backend. 342 // initialize its connection to the sync backend.
340 // 343 //
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 virtual void AddObserverForDeviceInfoChange( 385 virtual void AddObserverForDeviceInfoChange(
383 browser_sync::SyncedDeviceTracker::Observer* observer); 386 browser_sync::SyncedDeviceTracker::Observer* observer);
384 387
385 // Removes the observer from device info notification. 388 // Removes the observer from device info notification.
386 virtual void RemoveObserverForDeviceInfoChange( 389 virtual void RemoveObserverForDeviceInfoChange(
387 browser_sync::SyncedDeviceTracker::Observer* observer); 390 browser_sync::SyncedDeviceTracker::Observer* observer);
388 391
389 // Fills state_map with a map of current data types that are possible to 392 // Fills state_map with a map of current data types that are possible to
390 // sync, as well as their states. 393 // sync, as well as their states.
391 void GetDataTypeControllerStates( 394 void GetDataTypeControllerStates(
392 browser_sync::DataTypeController::StateMap* state_map) const; 395 sync_driver::DataTypeController::StateMap* state_map) const;
393 396
394 // Disables sync for user. Use ShowLoginDialog to enable. 397 // Disables sync for user. Use ShowLoginDialog to enable.
395 virtual void DisableForUser(); 398 virtual void DisableForUser();
396 399
397 // Disables sync for the user and prevents it from starting on next restart. 400 // Disables sync for the user and prevents it from starting on next restart.
398 virtual void StopSyncingPermanently(); 401 virtual void StopSyncingPermanently();
399 402
400 // SyncFrontend implementation. 403 // SyncFrontend implementation.
401 virtual void OnBackendInitialized( 404 virtual void OnBackendInitialized(
402 const syncer::WeakHandle<syncer::JsBackend>& js_backend, 405 const syncer::WeakHandle<syncer::JsBackend>& js_backend,
(...skipping 24 matching lines...) Expand all
427 virtual void OnEncryptionComplete() OVERRIDE; 430 virtual void OnEncryptionComplete() OVERRIDE;
428 virtual void OnMigrationNeededForTypes( 431 virtual void OnMigrationNeededForTypes(
429 syncer::ModelTypeSet types) OVERRIDE; 432 syncer::ModelTypeSet types) OVERRIDE;
430 virtual void OnExperimentsChanged( 433 virtual void OnExperimentsChanged(
431 const syncer::Experiments& experiments) OVERRIDE; 434 const syncer::Experiments& experiments) OVERRIDE;
432 virtual void OnActionableError( 435 virtual void OnActionableError(
433 const syncer::SyncProtocolError& error) OVERRIDE; 436 const syncer::SyncProtocolError& error) OVERRIDE;
434 437
435 // DataTypeManagerObserver implementation. 438 // DataTypeManagerObserver implementation.
436 virtual void OnConfigureDone( 439 virtual void OnConfigureDone(
437 const browser_sync::DataTypeManager::ConfigureResult& result) OVERRIDE; 440 const sync_driver::DataTypeManager::ConfigureResult& result) OVERRIDE;
438 virtual void OnConfigureRetry() OVERRIDE; 441 virtual void OnConfigureRetry() OVERRIDE;
439 virtual void OnConfigureStart() OVERRIDE; 442 virtual void OnConfigureStart() OVERRIDE;
440 443
441 // DataTypeEncryptionHandler implementation. 444 // DataTypeEncryptionHandler implementation.
442 virtual bool IsPassphraseRequired() const OVERRIDE; 445 virtual bool IsPassphraseRequired() const OVERRIDE;
443 virtual syncer::ModelTypeSet GetEncryptedDataTypes() const OVERRIDE; 446 virtual syncer::ModelTypeSet GetEncryptedDataTypes() const OVERRIDE;
444 447
445 // SigninManagerBase::Observer implementation. 448 // SigninManagerBase::Observer implementation.
446 virtual void GoogleSigninSucceeded(const std::string& username, 449 virtual void GoogleSigninSucceeded(const std::string& username,
447 const std::string& password) OVERRIDE; 450 const std::string& password) OVERRIDE;
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 711
709 // Marks all currently registered types as "acknowledged" so we won't prompt 712 // Marks all currently registered types as "acknowledged" so we won't prompt
710 // the user about them any more. 713 // the user about them any more.
711 void AcknowledgeSyncedTypes(); 714 void AcknowledgeSyncedTypes();
712 715
713 SyncErrorController* sync_error_controller() { 716 SyncErrorController* sync_error_controller() {
714 return sync_error_controller_.get(); 717 return sync_error_controller_.get();
715 } 718 }
716 719
717 // TODO(sync): This is only used in tests. Can we remove it? 720 // TODO(sync): This is only used in tests. Can we remove it?
718 const browser_sync::FailedDataTypesHandler& failed_data_types_handler() const; 721 const sync_driver::FailedDataTypesHandler& failed_data_types_handler() const;
719 722
720 browser_sync::DataTypeManager::ConfigureStatus configure_status() { 723 sync_driver::DataTypeManager::ConfigureStatus configure_status() {
721 return configure_status_; 724 return configure_status_;
722 } 725 }
723 726
724 // If true, the ProfileSyncService has detected that a new GAIA signin has 727 // If true, the ProfileSyncService has detected that a new GAIA signin has
725 // succeeded, and is waiting for initialization to complete. This is used by 728 // succeeded, and is waiting for initialization to complete. This is used by
726 // the UI to differentiate between a new auth error (encountered as part of 729 // the UI to differentiate between a new auth error (encountered as part of
727 // the initialization process) and a pre-existing auth error that just hasn't 730 // the initialization process) and a pre-existing auth error that just hasn't
728 // been cleared yet. Virtual for testing purposes. 731 // been cleared yet. Virtual for testing purposes.
729 virtual bool waiting_for_auth() const; 732 virtual bool waiting_for_auth() const;
730 733
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 // Shuts down the backend sync components. 796 // Shuts down the backend sync components.
794 // |option| indicates if syncing is being disabled or not, and whether 797 // |option| indicates if syncing is being disabled or not, and whether
795 // to claim ownership of sync thread from backend. 798 // to claim ownership of sync thread from backend.
796 void ShutdownImpl(browser_sync::SyncBackendHost::ShutdownOption option); 799 void ShutdownImpl(browser_sync::SyncBackendHost::ShutdownOption option);
797 800
798 // Return SyncCredentials from the OAuth2TokenService. 801 // Return SyncCredentials from the OAuth2TokenService.
799 syncer::SyncCredentials GetCredentials(); 802 syncer::SyncCredentials GetCredentials();
800 803
801 virtual syncer::WeakHandle<syncer::JsEventHandler> GetJsEventHandler(); 804 virtual syncer::WeakHandle<syncer::JsEventHandler> GetJsEventHandler();
802 805
803 const browser_sync::DataTypeController::TypeMap& 806 const sync_driver::DataTypeController::TypeMap&
804 directory_data_type_controllers() { 807 directory_data_type_controllers() {
805 return directory_data_type_controllers_; 808 return directory_data_type_controllers_;
806 } 809 }
807 810
808 // Helper method for managing encryption UI. 811 // Helper method for managing encryption UI.
809 bool IsEncryptedDatatypeEnabled() const; 812 bool IsEncryptedDatatypeEnabled() const;
810 813
811 // Helper for OnUnrecoverableError. 814 // Helper for OnUnrecoverableError.
812 // TODO(tim): Use an enum for |delete_sync_database| here, in ShutdownImpl, 815 // TODO(tim): Use an enum for |delete_sync_database| here, in ShutdownImpl,
813 // and in SyncBackendHost::Shutdown. 816 // and in SyncBackendHost::Shutdown.
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 // The time that OnConfigureStart is called. This member is zero if 988 // The time that OnConfigureStart is called. This member is zero if
986 // OnConfigureStart has not yet been called, and is reset to zero once 989 // OnConfigureStart has not yet been called, and is reset to zero once
987 // OnConfigureDone is called. 990 // OnConfigureDone is called.
988 base::Time sync_configure_start_time_; 991 base::Time sync_configure_start_time_;
989 992
990 // Indicates if this is the first time sync is being configured. This value 993 // Indicates if this is the first time sync is being configured. This value
991 // is equal to !HasSyncSetupCompleted() at the time of OnBackendInitialized(). 994 // is equal to !HasSyncSetupCompleted() at the time of OnBackendInitialized().
992 bool is_first_time_sync_configure_; 995 bool is_first_time_sync_configure_;
993 996
994 // List of available data type controllers for directory types. 997 // List of available data type controllers for directory types.
995 browser_sync::DataTypeController::TypeMap directory_data_type_controllers_; 998 sync_driver::DataTypeController::TypeMap directory_data_type_controllers_;
996 999
997 // Whether the SyncBackendHost has been initialized. 1000 // Whether the SyncBackendHost has been initialized.
998 bool backend_initialized_; 1001 bool backend_initialized_;
999 1002
1000 // Set when sync receives DISABLED_BY_ADMIN error from server. Prevents 1003 // Set when sync receives DISABLED_BY_ADMIN error from server. Prevents
1001 // ProfileSyncService from starting backend till browser restarted or user 1004 // ProfileSyncService from starting backend till browser restarted or user
1002 // signed out. 1005 // signed out.
1003 bool sync_disabled_by_admin_; 1006 bool sync_disabled_by_admin_;
1004 1007
1005 // Set to true if a signin has completed but we're still waiting for the 1008 // Set to true if a signin has completed but we're still waiting for the
1006 // backend to refresh its credentials. 1009 // backend to refresh its credentials.
1007 bool is_auth_in_progress_; 1010 bool is_auth_in_progress_;
1008 1011
1009 // Encapsulates user signin - used to set/get the user's authenticated 1012 // Encapsulates user signin - used to set/get the user's authenticated
1010 // email address. 1013 // email address.
1011 const scoped_ptr<SupervisedUserSigninManagerWrapper> signin_; 1014 const scoped_ptr<SupervisedUserSigninManagerWrapper> signin_;
1012 1015
1013 // Information describing an unrecoverable error. 1016 // Information describing an unrecoverable error.
1014 UnrecoverableErrorReason unrecoverable_error_reason_; 1017 UnrecoverableErrorReason unrecoverable_error_reason_;
1015 std::string unrecoverable_error_message_; 1018 std::string unrecoverable_error_message_;
1016 tracked_objects::Location unrecoverable_error_location_; 1019 tracked_objects::Location unrecoverable_error_location_;
1017 1020
1018 // Manages the start and stop of the directory data types. 1021 // Manages the start and stop of the directory data types.
1019 scoped_ptr<browser_sync::DataTypeManager> directory_data_type_manager_; 1022 scoped_ptr<sync_driver::DataTypeManager> directory_data_type_manager_;
1020 1023
1021 // Manager for the non-blocking data types. 1024 // Manager for the non-blocking data types.
1022 browser_sync::NonBlockingDataTypeManager non_blocking_data_type_manager_; 1025 sync_driver::NonBlockingDataTypeManager non_blocking_data_type_manager_;
1023 1026
1024 ObserverList<ProfileSyncServiceBase::Observer> observers_; 1027 ObserverList<ProfileSyncServiceBase::Observer> observers_;
1025 ObserverList<browser_sync::ProtocolEventObserver> protocol_event_observers_; 1028 ObserverList<browser_sync::ProtocolEventObserver> protocol_event_observers_;
1026 ObserverList<syncer::TypeDebugInfoObserver> type_debug_info_observers_; 1029 ObserverList<syncer::TypeDebugInfoObserver> type_debug_info_observers_;
1027 1030
1028 syncer::SyncJsController sync_js_controller_; 1031 syncer::SyncJsController sync_js_controller_;
1029 1032
1030 // This allows us to gracefully handle an ABORTED return code from the 1033 // This allows us to gracefully handle an ABORTED return code from the
1031 // DataTypeManager in the event that the server informed us to cease and 1034 // DataTypeManager in the event that the server informed us to cease and
1032 // desist syncing immediately. 1035 // desist syncing immediately.
(...skipping 21 matching lines...) Expand all
1054 1057
1055 // This is the last |SyncProtocolError| we received from the server that had 1058 // This is the last |SyncProtocolError| we received from the server that had
1056 // an action set on it. 1059 // an action set on it.
1057 syncer::SyncProtocolError last_actionable_error_; 1060 syncer::SyncProtocolError last_actionable_error_;
1058 1061
1059 // Exposes sync errors to the UI. 1062 // Exposes sync errors to the UI.
1060 scoped_ptr<SyncErrorController> sync_error_controller_; 1063 scoped_ptr<SyncErrorController> sync_error_controller_;
1061 1064
1062 // Tracks the set of failed data types (those that encounter an error 1065 // Tracks the set of failed data types (those that encounter an error
1063 // or must delay loading for some reason). 1066 // or must delay loading for some reason).
1064 browser_sync::FailedDataTypesHandler failed_data_types_handler_; 1067 sync_driver::FailedDataTypesHandler failed_data_types_handler_;
1065 1068
1066 browser_sync::DataTypeManager::ConfigureStatus configure_status_; 1069 sync_driver::DataTypeManager::ConfigureStatus configure_status_;
1067 1070
1068 // The set of currently enabled sync experiments. 1071 // The set of currently enabled sync experiments.
1069 syncer::Experiments current_experiments_; 1072 syncer::Experiments current_experiments_;
1070 1073
1071 // Sync's internal debug info listener. Used to record datatype configuration 1074 // Sync's internal debug info listener. Used to record datatype configuration
1072 // and association information. 1075 // and association information.
1073 syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_; 1076 syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_;
1074 1077
1075 // A thread where all the sync operations happen. 1078 // A thread where all the sync operations happen.
1076 // OWNERSHIP Notes: 1079 // OWNERSHIP Notes:
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 scoped_ptr<base::Time> last_backup_time_; 1139 scoped_ptr<base::Time> last_backup_time_;
1137 1140
1138 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); 1141 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService);
1139 }; 1142 };
1140 1143
1141 bool ShouldShowActionOnUI( 1144 bool ShouldShowActionOnUI(
1142 const syncer::SyncProtocolError& error); 1145 const syncer::SyncProtocolError& error);
1143 1146
1144 1147
1145 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 1148 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698