OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <string> | 10 #include <string> |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 bool success) OVERRIDE; | 205 bool success) OVERRIDE; |
206 virtual void OnSyncCycleCompleted() OVERRIDE; | 206 virtual void OnSyncCycleCompleted() OVERRIDE; |
207 virtual void OnAuthError() OVERRIDE; | 207 virtual void OnAuthError() OVERRIDE; |
208 virtual void OnStopSyncingPermanently() OVERRIDE; | 208 virtual void OnStopSyncingPermanently() OVERRIDE; |
209 virtual void OnClearServerDataFailed() OVERRIDE; | 209 virtual void OnClearServerDataFailed() OVERRIDE; |
210 virtual void OnClearServerDataSucceeded() OVERRIDE; | 210 virtual void OnClearServerDataSucceeded() OVERRIDE; |
211 virtual void OnPassphraseRequired( | 211 virtual void OnPassphraseRequired( |
212 sync_api::PassphraseRequiredReason reason) OVERRIDE; | 212 sync_api::PassphraseRequiredReason reason) OVERRIDE; |
213 virtual void OnPassphraseAccepted() OVERRIDE; | 213 virtual void OnPassphraseAccepted() OVERRIDE; |
214 virtual void OnEncryptedTypesChanged( | 214 virtual void OnEncryptedTypesChanged( |
215 syncable::ModelEnumSet encrypted_types, | 215 syncable::ModelTypeSet encrypted_types, |
216 bool encrypt_everything) OVERRIDE; | 216 bool encrypt_everything) OVERRIDE; |
217 virtual void OnEncryptionComplete() OVERRIDE; | 217 virtual void OnEncryptionComplete() OVERRIDE; |
218 virtual void OnMigrationNeededForTypes( | 218 virtual void OnMigrationNeededForTypes( |
219 syncable::ModelEnumSet types) OVERRIDE; | 219 syncable::ModelTypeSet types) OVERRIDE; |
220 virtual void OnDataTypesChanged( | 220 virtual void OnDataTypesChanged( |
221 syncable::ModelEnumSet to_add) OVERRIDE; | 221 syncable::ModelTypeSet to_add) OVERRIDE; |
222 virtual void OnActionableError( | 222 virtual void OnActionableError( |
223 const browser_sync::SyncProtocolError& error) OVERRIDE; | 223 const browser_sync::SyncProtocolError& error) OVERRIDE; |
224 | 224 |
225 void OnClearServerDataTimeout(); | 225 void OnClearServerDataTimeout(); |
226 | 226 |
227 // Called when a user enters credentials through UI. | 227 // Called when a user enters credentials through UI. |
228 virtual void OnUserSubmittedAuth(const std::string& username, | 228 virtual void OnUserSubmittedAuth(const std::string& username, |
229 const std::string& password, | 229 const std::string& password, |
230 const std::string& captcha, | 230 const std::string& captcha, |
231 const std::string& access_code); | 231 const std::string& access_code); |
232 | 232 |
233 // Called when a user enters credentials through UI. | 233 // Called when a user enters credentials through UI. |
234 virtual void OnUserSubmittedOAuth(const std::string& oauth1_request_token); | 234 virtual void OnUserSubmittedOAuth(const std::string& oauth1_request_token); |
235 | 235 |
236 // Update the last auth error and notify observers of error state. | 236 // Update the last auth error and notify observers of error state. |
237 void UpdateAuthErrorState(const GoogleServiceAuthError& error); | 237 void UpdateAuthErrorState(const GoogleServiceAuthError& error); |
238 | 238 |
239 // Called when a user chooses which data types to sync as part of the sync | 239 // Called when a user chooses which data types to sync as part of the sync |
240 // setup wizard. |sync_everything| represents whether they chose the | 240 // setup wizard. |sync_everything| represents whether they chose the |
241 // "keep everything synced" option; if true, |chosen_types| will be ignored | 241 // "keep everything synced" option; if true, |chosen_types| will be ignored |
242 // and all data types will be synced. |sync_everything| means "sync all | 242 // and all data types will be synced. |sync_everything| means "sync all |
243 // current and future data types." | 243 // current and future data types." |
244 virtual void OnUserChoseDatatypes(bool sync_everything, | 244 virtual void OnUserChoseDatatypes(bool sync_everything, |
245 syncable::ModelEnumSet chosen_types); | 245 syncable::ModelTypeSet chosen_types); |
246 | 246 |
247 // Called when a user cancels any setup dialog (login, etc). | 247 // Called when a user cancels any setup dialog (login, etc). |
248 virtual void OnUserCancelledDialog(); | 248 virtual void OnUserCancelledDialog(); |
249 | 249 |
250 // Get various information for displaying in the user interface. | 250 // Get various information for displaying in the user interface. |
251 browser_sync::SyncBackendHost::StatusSummary QuerySyncStatusSummary(); | 251 browser_sync::SyncBackendHost::StatusSummary QuerySyncStatusSummary(); |
252 virtual browser_sync::SyncBackendHost::Status QueryDetailedSyncStatus(); | 252 virtual browser_sync::SyncBackendHost::Status QueryDetailedSyncStatus(); |
253 | 253 |
254 virtual const GoogleServiceAuthError& GetAuthError() const; | 254 virtual const GoogleServiceAuthError& GetAuthError() const; |
255 | 255 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 // content::NotificationObserver implementation. | 403 // content::NotificationObserver implementation. |
404 virtual void Observe(int type, | 404 virtual void Observe(int type, |
405 const content::NotificationSource& source, | 405 const content::NotificationSource& source, |
406 const content::NotificationDetails& details) OVERRIDE; | 406 const content::NotificationDetails& details) OVERRIDE; |
407 | 407 |
408 // Changes which data types we're going to be syncing to |preferred_types|. | 408 // Changes which data types we're going to be syncing to |preferred_types|. |
409 // If it is running, the DataTypeManager will be instructed to reconfigure | 409 // If it is running, the DataTypeManager will be instructed to reconfigure |
410 // the sync backend so that exactly these datatypes are actively synced. See | 410 // the sync backend so that exactly these datatypes are actively synced. See |
411 // class comment for more on what it means for a datatype to be Preferred. | 411 // class comment for more on what it means for a datatype to be Preferred. |
412 virtual void ChangePreferredDataTypes( | 412 virtual void ChangePreferredDataTypes( |
413 syncable::ModelEnumSet preferred_types); | 413 syncable::ModelTypeSet preferred_types); |
414 | 414 |
415 // Get the set of currently enabled data types (as chosen or configured by | 415 // Get the set of currently enabled data types (as chosen or configured by |
416 // the user). See class comment for more on what it means for a datatype | 416 // the user). See class comment for more on what it means for a datatype |
417 // to be Preferred. | 417 // to be Preferred. |
418 virtual syncable::ModelEnumSet GetPreferredDataTypes() const; | 418 virtual syncable::ModelTypeSet GetPreferredDataTypes() const; |
419 | 419 |
420 // Gets the set of all data types that could be allowed (the set that | 420 // Gets the set of all data types that could be allowed (the set that |
421 // should be advertised to the user). These will typically only change | 421 // should be advertised to the user). These will typically only change |
422 // via a command-line option. See class comment for more on what it means | 422 // via a command-line option. See class comment for more on what it means |
423 // for a datatype to be Registered. | 423 // for a datatype to be Registered. |
424 virtual syncable::ModelEnumSet GetRegisteredDataTypes() const; | 424 virtual syncable::ModelTypeSet GetRegisteredDataTypes() const; |
425 | 425 |
426 // Checks whether the Cryptographer is ready to encrypt and decrypt updates | 426 // Checks whether the Cryptographer is ready to encrypt and decrypt updates |
427 // for sensitive data types. Caller must be holding a | 427 // for sensitive data types. Caller must be holding a |
428 // syncapi::BaseTransaction to ensure thread safety. | 428 // syncapi::BaseTransaction to ensure thread safety. |
429 virtual bool IsCryptographerReady( | 429 virtual bool IsCryptographerReady( |
430 const sync_api::BaseTransaction* trans) const; | 430 const sync_api::BaseTransaction* trans) const; |
431 | 431 |
432 // Returns true if a secondary passphrase is being used. It is not legal | 432 // Returns true if a secondary passphrase is being used. It is not legal |
433 // to call this method before the backend is initialized. | 433 // to call this method before the backend is initialized. |
434 virtual bool IsUsingSecondaryPassphrase() const; | 434 virtual bool IsUsingSecondaryPassphrase() const; |
(...skipping 14 matching lines...) Expand all Loading... |
449 virtual void EnableEncryptEverything(); | 449 virtual void EnableEncryptEverything(); |
450 | 450 |
451 // Returns true if we are currently set to encrypt all the sync data. Note: | 451 // Returns true if we are currently set to encrypt all the sync data. Note: |
452 // this is based on the cryptographer's settings, so if the user has recently | 452 // this is based on the cryptographer's settings, so if the user has recently |
453 // requested encryption to be turned on, this may not be true yet. For that, | 453 // requested encryption to be turned on, this may not be true yet. For that, |
454 // encryption_pending() must be checked. | 454 // encryption_pending() must be checked. |
455 virtual bool EncryptEverythingEnabled() const; | 455 virtual bool EncryptEverythingEnabled() const; |
456 | 456 |
457 // Fills |encrypted_types| with the set of currently encrypted types. Does | 457 // Fills |encrypted_types| with the set of currently encrypted types. Does |
458 // not account for types pending encryption. | 458 // not account for types pending encryption. |
459 virtual syncable::ModelEnumSet GetEncryptedDataTypes() const; | 459 virtual syncable::ModelTypeSet GetEncryptedDataTypes() const; |
460 | 460 |
461 // Returns true if the syncer is waiting for new datatypes to be encrypted. | 461 // Returns true if the syncer is waiting for new datatypes to be encrypted. |
462 virtual bool encryption_pending() const; | 462 virtual bool encryption_pending() const; |
463 | 463 |
464 // Returns whether processing changes is allowed. Check this before doing | 464 // Returns whether processing changes is allowed. Check this before doing |
465 // any model-modifying operations. | 465 // any model-modifying operations. |
466 bool ShouldPushChanges(); | 466 bool ShouldPushChanges(); |
467 | 467 |
468 const GURL& sync_service_url() const { return sync_service_url_; } | 468 const GURL& sync_service_url() const { return sync_service_url_; } |
469 SigninManager* signin() { return signin_.get(); } | 469 SigninManager* signin() { return signin_.get(); } |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 | 669 |
670 // Timeout for the clear data command. This timeout is a temporary hack | 670 // Timeout for the clear data command. This timeout is a temporary hack |
671 // and is necessary because the nudge sync framework can drop nudges for | 671 // and is necessary because the nudge sync framework can drop nudges for |
672 // a wide variety of sync-related conditions (throttling, connections issues, | 672 // a wide variety of sync-related conditions (throttling, connections issues, |
673 // syncer paused, etc.). It can only be removed correctly when the framework | 673 // syncer paused, etc.). It can only be removed correctly when the framework |
674 // is reworked to allow one-shot commands like clearing server data. | 674 // is reworked to allow one-shot commands like clearing server data. |
675 base::OneShotTimer<ProfileSyncService> clear_server_data_timer_; | 675 base::OneShotTimer<ProfileSyncService> clear_server_data_timer_; |
676 | 676 |
677 // The current set of encrypted types. Always a superset of | 677 // The current set of encrypted types. Always a superset of |
678 // Cryptographer::SensitiveTypes(). | 678 // Cryptographer::SensitiveTypes(). |
679 syncable::ModelEnumSet encrypted_types_; | 679 syncable::ModelTypeSet encrypted_types_; |
680 | 680 |
681 // Whether we want to encrypt everything. | 681 // Whether we want to encrypt everything. |
682 bool encrypt_everything_; | 682 bool encrypt_everything_; |
683 | 683 |
684 // Whether we're waiting for an attempt to encryption all sync data to | 684 // Whether we're waiting for an attempt to encryption all sync data to |
685 // complete. We track this at this layer in order to allow the user to cancel | 685 // complete. We track this at this layer in order to allow the user to cancel |
686 // if they e.g. don't remember their explicit passphrase. | 686 // if they e.g. don't remember their explicit passphrase. |
687 bool encryption_pending_; | 687 bool encryption_pending_; |
688 | 688 |
689 // If true, we want to automatically start sync signin whenever we have | 689 // If true, we want to automatically start sync signin whenever we have |
(...skipping 15 matching lines...) Expand all Loading... |
705 FailedDatatypesHandler failed_datatypes_handler_; | 705 FailedDatatypesHandler failed_datatypes_handler_; |
706 | 706 |
707 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 707 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
708 }; | 708 }; |
709 | 709 |
710 bool ShouldShowActionOnUI( | 710 bool ShouldShowActionOnUI( |
711 const browser_sync::SyncProtocolError& error); | 711 const browser_sync::SyncProtocolError& error); |
712 | 712 |
713 | 713 |
714 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 714 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
OLD | NEW |