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 const syncable::ModelTypeSet& enncrypted_types, | 215 syncable::ModelEnumSet 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 const syncable::ModelTypeSet& types) OVERRIDE; | 219 syncable::ModelEnumSet types) OVERRIDE; |
220 virtual void OnDataTypesChanged( | 220 virtual void OnDataTypesChanged( |
221 const syncable::ModelTypeSet& to_add) OVERRIDE; | 221 syncable::ModelEnumSet 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 const syncable::ModelTypeSet& chosen_types); | 245 syncable::ModelEnumSet 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 const syncable::ModelTypeSet& preferred_types); | 413 syncable::ModelEnumSet 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 void GetPreferredDataTypes( | 418 virtual syncable::ModelEnumSet GetPreferredDataTypes() const; |
419 syncable::ModelTypeSet* preferred_types) const; | |
420 | 419 |
421 // 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 |
422 // should be advertised to the user). These will typically only change | 421 // should be advertised to the user). These will typically only change |
423 // 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 |
424 // for a datatype to be Registered. | 423 // for a datatype to be Registered. |
425 virtual void GetRegisteredDataTypes( | 424 virtual syncable::ModelEnumSet GetRegisteredDataTypes() const; |
426 syncable::ModelTypeSet* registered_types) const; | |
427 | 425 |
428 // Checks whether the Cryptographer is ready to encrypt and decrypt updates | 426 // Checks whether the Cryptographer is ready to encrypt and decrypt updates |
429 // for sensitive data types. Caller must be holding a | 427 // for sensitive data types. Caller must be holding a |
430 // syncapi::BaseTransaction to ensure thread safety. | 428 // syncapi::BaseTransaction to ensure thread safety. |
431 virtual bool IsCryptographerReady( | 429 virtual bool IsCryptographerReady( |
432 const sync_api::BaseTransaction* trans) const; | 430 const sync_api::BaseTransaction* trans) const; |
433 | 431 |
434 // 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 |
435 // to call this method before the backend is initialized. | 433 // to call this method before the backend is initialized. |
436 virtual bool IsUsingSecondaryPassphrase() const; | 434 virtual bool IsUsingSecondaryPassphrase() const; |
(...skipping 14 matching lines...) Expand all Loading... |
451 virtual void EnableEncryptEverything(); | 449 virtual void EnableEncryptEverything(); |
452 | 450 |
453 // 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: |
454 // 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 |
455 // 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, |
456 // encryption_pending() must be checked. | 454 // encryption_pending() must be checked. |
457 virtual bool EncryptEverythingEnabled() const; | 455 virtual bool EncryptEverythingEnabled() const; |
458 | 456 |
459 // Fills |encrypted_types| with the set of currently encrypted types. Does | 457 // Fills |encrypted_types| with the set of currently encrypted types. Does |
460 // not account for types pending encryption. | 458 // not account for types pending encryption. |
461 virtual void GetEncryptedDataTypes( | 459 virtual syncable::ModelEnumSet GetEncryptedDataTypes() const; |
462 syncable::ModelTypeSet* encrypted_types) const; | |
463 | 460 |
464 // 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. |
465 virtual bool encryption_pending() const; | 462 virtual bool encryption_pending() const; |
466 | 463 |
467 // Returns whether processing changes is allowed. Check this before doing | 464 // Returns whether processing changes is allowed. Check this before doing |
468 // any model-modifying operations. | 465 // any model-modifying operations. |
469 bool ShouldPushChanges(); | 466 bool ShouldPushChanges(); |
470 | 467 |
471 const GURL& sync_service_url() const { return sync_service_url_; } | 468 const GURL& sync_service_url() const { return sync_service_url_; } |
472 SigninManager* signin() { return signin_.get(); } | 469 SigninManager* signin() { return signin_.get(); } |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 | 669 |
673 // 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 |
674 // 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 |
675 // a wide variety of sync-related conditions (throttling, connections issues, | 672 // a wide variety of sync-related conditions (throttling, connections issues, |
676 // 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 |
677 // is reworked to allow one-shot commands like clearing server data. | 674 // is reworked to allow one-shot commands like clearing server data. |
678 base::OneShotTimer<ProfileSyncService> clear_server_data_timer_; | 675 base::OneShotTimer<ProfileSyncService> clear_server_data_timer_; |
679 | 676 |
680 // The current set of encrypted types. Always a superset of | 677 // The current set of encrypted types. Always a superset of |
681 // Cryptographer::SensitiveTypes(). | 678 // Cryptographer::SensitiveTypes(). |
682 syncable::ModelTypeSet encrypted_types_; | 679 syncable::ModelEnumSet encrypted_types_; |
683 | 680 |
684 // Whether we want to encrypt everything. | 681 // Whether we want to encrypt everything. |
685 bool encrypt_everything_; | 682 bool encrypt_everything_; |
686 | 683 |
687 // 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 |
688 // 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 |
689 // if they e.g. don't remember their explicit passphrase. | 686 // if they e.g. don't remember their explicit passphrase. |
690 bool encryption_pending_; | 687 bool encryption_pending_; |
691 | 688 |
692 // 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... |
708 FailedDatatypesHandler failed_datatypes_handler_; | 705 FailedDatatypesHandler failed_datatypes_handler_; |
709 | 706 |
710 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 707 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
711 }; | 708 }; |
712 | 709 |
713 bool ShouldShowActionOnUI( | 710 bool ShouldShowActionOnUI( |
714 const browser_sync::SyncProtocolError& error); | 711 const browser_sync::SyncProtocolError& error); |
715 | 712 |
716 | 713 |
717 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 714 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
OLD | NEW |