| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 } | 249 } |
| 250 tracked_objects::Location unrecoverable_error_location() { | 250 tracked_objects::Location unrecoverable_error_location() { |
| 251 return unrecoverable_error_location_.get() ? | 251 return unrecoverable_error_location_.get() ? |
| 252 *unrecoverable_error_location_.get() : tracked_objects::Location(); | 252 *unrecoverable_error_location_.get() : tracked_objects::Location(); |
| 253 } | 253 } |
| 254 | 254 |
| 255 bool UIShouldDepictAuthInProgress() const { | 255 bool UIShouldDepictAuthInProgress() const { |
| 256 return is_auth_in_progress_; | 256 return is_auth_in_progress_; |
| 257 } | 257 } |
| 258 | 258 |
| 259 bool tried_creating_explicit_passphrase() const { |
| 260 return tried_creating_explicit_passphrase_; |
| 261 } |
| 262 |
| 263 bool tried_setting_explicit_passphrase() const { |
| 264 return tried_setting_explicit_passphrase_; |
| 265 } |
| 266 |
| 259 bool observed_passphrase_required() const { | 267 bool observed_passphrase_required() const { |
| 260 return observed_passphrase_required_; | 268 return observed_passphrase_required_; |
| 261 } | 269 } |
| 262 | 270 |
| 263 bool passphrase_required_for_decryption() const { | 271 bool passphrase_required_for_decryption() const { |
| 264 return passphrase_required_for_decryption_; | 272 return passphrase_required_for_decryption_; |
| 265 } | 273 } |
| 266 | 274 |
| 267 // A timestamp marking the last time the service observed a transition from | 275 // A timestamp marking the last time the service observed a transition from |
| 268 // the SYNCING state to the READY state. Note that this does not reflect the | 276 // the SYNCING state to the READY state. Note that this does not reflect the |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 virtual bool IsUsingSecondaryPassphrase() const; | 365 virtual bool IsUsingSecondaryPassphrase() const; |
| 358 | 366 |
| 359 // Sets the Cryptographer's passphrase, or caches it until that is possible. | 367 // Sets the Cryptographer's passphrase, or caches it until that is possible. |
| 360 // This will check asynchronously whether the passphrase is valid and notify | 368 // This will check asynchronously whether the passphrase is valid and notify |
| 361 // ProfileSyncServiceObservers via the NotificationService when the outcome | 369 // ProfileSyncServiceObservers via the NotificationService when the outcome |
| 362 // is known. | 370 // is known. |
| 363 // |is_explicit| is true if the call is in response to the user explicitly | 371 // |is_explicit| is true if the call is in response to the user explicitly |
| 364 // setting a passphrase as opposed to implicitly (from the users' perspective) | 372 // setting a passphrase as opposed to implicitly (from the users' perspective) |
| 365 // using their Google Account password. An implicit SetPassphrase will *not* | 373 // using their Google Account password. An implicit SetPassphrase will *not* |
| 366 // *not* override an explicit passphrase set previously. | 374 // *not* override an explicit passphrase set previously. |
| 367 virtual void SetPassphrase(const std::string& passphrase, bool is_explicit); | 375 // |is_creation| is true if the call is in response to the user setting |
| 376 // up a new passphrase, and false if it's being set in response to a prompt |
| 377 // for an existing passphrase. |
| 378 virtual void SetPassphrase(const std::string& passphrase, |
| 379 bool is_explicit, |
| 380 bool is_creation); |
| 368 | 381 |
| 369 // Returns whether processing changes is allowed. Check this before doing | 382 // Returns whether processing changes is allowed. Check this before doing |
| 370 // any model-modifying operations. | 383 // any model-modifying operations. |
| 371 bool ShouldPushChanges(); | 384 bool ShouldPushChanges(); |
| 372 | 385 |
| 373 const GURL& sync_service_url() const { return sync_service_url_; } | 386 const GURL& sync_service_url() const { return sync_service_url_; } |
| 374 SigninManager* signin() { return signin_.get(); } | 387 SigninManager* signin() { return signin_.get(); } |
| 375 const std::string& cros_user() const { return cros_user_; } | 388 const std::string& cros_user() const { return cros_user_; } |
| 376 | 389 |
| 377 protected: | 390 protected: |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 // service using this member. Captcha and error state are reflected. | 423 // service using this member. Captcha and error state are reflected. |
| 411 GoogleServiceAuthError last_auth_error_; | 424 GoogleServiceAuthError last_auth_error_; |
| 412 | 425 |
| 413 // Our asynchronous backend to communicate with sync components living on | 426 // Our asynchronous backend to communicate with sync components living on |
| 414 // other threads. | 427 // other threads. |
| 415 scoped_ptr<browser_sync::SyncBackendHost> backend_; | 428 scoped_ptr<browser_sync::SyncBackendHost> backend_; |
| 416 | 429 |
| 417 // Cache of the last name the client attempted to authenticate. | 430 // Cache of the last name the client attempted to authenticate. |
| 418 std::string last_attempted_user_email_; | 431 std::string last_attempted_user_email_; |
| 419 | 432 |
| 433 // Whether the user has tried creating an explicit passphrase on this |
| 434 // machine. |
| 435 bool tried_creating_explicit_passphrase_; |
| 436 |
| 437 // Whether the user has tried setting an explicit passphrase on this |
| 438 // machine. |
| 439 bool tried_setting_explicit_passphrase_; |
| 440 |
| 420 // Whether we have seen a SYNC_PASSPHRASE_REQUIRED since initializing the | 441 // Whether we have seen a SYNC_PASSPHRASE_REQUIRED since initializing the |
| 421 // backend, telling us that it is safe to send a passphrase down ASAP. | 442 // backend, telling us that it is safe to send a passphrase down ASAP. |
| 422 bool observed_passphrase_required_; | 443 bool observed_passphrase_required_; |
| 423 | 444 |
| 424 // Was the last SYNC_PASSPHRASE_REQUIRED notification sent because it | 445 // Was the last SYNC_PASSPHRASE_REQUIRED notification sent because it |
| 425 // was required for decryption? | 446 // was required for decryption? |
| 426 bool passphrase_required_for_decryption_; | 447 bool passphrase_required_for_decryption_; |
| 427 | 448 |
| 428 private: | 449 private: |
| 429 friend class ProfileSyncServiceTest; | 450 friend class ProfileSyncServiceTest; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 | 541 |
| 521 scoped_ptr<TokenMigrator> token_migrator_; | 542 scoped_ptr<TokenMigrator> token_migrator_; |
| 522 | 543 |
| 523 // Sometimes we need to temporarily hold on to a passphrase because we don't | 544 // Sometimes we need to temporarily hold on to a passphrase because we don't |
| 524 // yet have a backend to send it to. This happens during initialization as | 545 // yet have a backend to send it to. This happens during initialization as |
| 525 // we don't StartUp until we have a valid token, which happens after valid | 546 // we don't StartUp until we have a valid token, which happens after valid |
| 526 // credentials were provided. | 547 // credentials were provided. |
| 527 struct CachedPassphrase { | 548 struct CachedPassphrase { |
| 528 std::string value; | 549 std::string value; |
| 529 bool is_explicit; | 550 bool is_explicit; |
| 530 CachedPassphrase() : is_explicit(false) {} | 551 bool is_creation; |
| 552 CachedPassphrase() : is_explicit(false), is_creation(false) {} |
| 531 }; | 553 }; |
| 532 CachedPassphrase cached_passphrase_; | 554 CachedPassphrase cached_passphrase_; |
| 533 | 555 |
| 534 // TODO(tim): Remove this once new 'explicit passphrase' code flushes through | 556 // TODO(tim): Remove this once new 'explicit passphrase' code flushes through |
| 535 // dev channel. See bug 62103. | 557 // dev channel. See bug 62103. |
| 536 // To "migrate" early adopters of password sync on dev channel to the new | 558 // To "migrate" early adopters of password sync on dev channel to the new |
| 537 // model that stores their secondary passphrase preference in the cloud, we | 559 // model that stores their secondary passphrase preference in the cloud, we |
| 538 // need some extra state since this cloud pref will be empty for all of them | 560 // need some extra state since this cloud pref will be empty for all of them |
| 539 // regardless of how they set up sync, and we can't trust | 561 // regardless of how they set up sync, and we can't trust |
| 540 // kSyncUsingSecondaryPassphrase due to bugs in that implementation. | 562 // kSyncUsingSecondaryPassphrase due to bugs in that implementation. |
| 541 bool tried_implicit_gaia_remove_when_bug_62103_fixed_; | 563 bool tried_implicit_gaia_remove_when_bug_62103_fixed_; |
| 542 | 564 |
| 543 // Keep track of where we are in a server clear operation | 565 // Keep track of where we are in a server clear operation |
| 544 ClearServerDataState clear_server_data_state_; | 566 ClearServerDataState clear_server_data_state_; |
| 545 | 567 |
| 546 // Timeout for the clear data command. This timeout is a temporary hack | 568 // Timeout for the clear data command. This timeout is a temporary hack |
| 547 // and is necessary because the nudge sync framework can drop nudges for | 569 // and is necessary because the nudge sync framework can drop nudges for |
| 548 // a wide variety of sync-related conditions (throttling, connections issues, | 570 // a wide variety of sync-related conditions (throttling, connections issues, |
| 549 // syncer paused, etc.). It can only be removed correctly when the framework | 571 // syncer paused, etc.). It can only be removed correctly when the framework |
| 550 // is reworked to allow one-shot commands like clearing server data. | 572 // is reworked to allow one-shot commands like clearing server data. |
| 551 base::OneShotTimer<ProfileSyncService> clear_server_data_timer_; | 573 base::OneShotTimer<ProfileSyncService> clear_server_data_timer_; |
| 552 | 574 |
| 553 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 575 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
| 554 }; | 576 }; |
| 555 | 577 |
| 556 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 578 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| OLD | NEW |