| 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 #include "components/browser_sync/profile_sync_service.h" | 5 #include "components/browser_sync/profile_sync_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cstddef> | 9 #include <cstddef> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "components/history/core/browser/typed_url_data_type_controller.h" | 30 #include "components/history/core/browser/typed_url_data_type_controller.h" |
| 31 #include "components/invalidation/impl/invalidation_prefs.h" | 31 #include "components/invalidation/impl/invalidation_prefs.h" |
| 32 #include "components/invalidation/public/invalidation_service.h" | 32 #include "components/invalidation/public/invalidation_service.h" |
| 33 #include "components/pref_registry/pref_registry_syncable.h" | 33 #include "components/pref_registry/pref_registry_syncable.h" |
| 34 #include "components/prefs/json_pref_store.h" | 34 #include "components/prefs/json_pref_store.h" |
| 35 #include "components/reading_list/features/reading_list_enable_flags.h" | 35 #include "components/reading_list/features/reading_list_enable_flags.h" |
| 36 #include "components/signin/core/browser/about_signin_internals.h" | 36 #include "components/signin/core/browser/about_signin_internals.h" |
| 37 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 37 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 38 #include "components/signin/core/browser/signin_manager.h" | 38 #include "components/signin/core/browser/signin_manager.h" |
| 39 #include "components/signin/core/browser/signin_metrics.h" | 39 #include "components/signin/core/browser/signin_metrics.h" |
| 40 #include "components/signin/core/common/profile_management_switches.h" |
| 40 #include "components/strings/grit/components_strings.h" | 41 #include "components/strings/grit/components_strings.h" |
| 41 #include "components/sync/base/bind_to_task_runner.h" | 42 #include "components/sync/base/bind_to_task_runner.h" |
| 42 #include "components/sync/base/cryptographer.h" | 43 #include "components/sync/base/cryptographer.h" |
| 43 #include "components/sync/base/passphrase_type.h" | 44 #include "components/sync/base/passphrase_type.h" |
| 44 #include "components/sync/base/pref_names.h" | 45 #include "components/sync/base/pref_names.h" |
| 45 #include "components/sync/base/report_unrecoverable_error.h" | 46 #include "components/sync/base/report_unrecoverable_error.h" |
| 46 #include "components/sync/base/stop_source.h" | 47 #include "components/sync/base/stop_source.h" |
| 47 #include "components/sync/base/system_encryptor.h" | 48 #include "components/sync/base/system_encryptor.h" |
| 48 #include "components/sync/device_info/device_info.h" | 49 #include "components/sync/device_info/device_info.h" |
| 49 #include "components/sync/device_info/device_info_sync_bridge.h" | 50 #include "components/sync/device_info/device_info_sync_bridge.h" |
| (...skipping 1905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1955 // engine starts up. | 1956 // engine starts up. |
| 1956 crypto_->ConsumeCachedPassphraseIfPossible(); | 1957 crypto_->ConsumeCachedPassphraseIfPossible(); |
| 1957 } | 1958 } |
| 1958 #if defined(OS_CHROMEOS) | 1959 #if defined(OS_CHROMEOS) |
| 1959 RefreshSpareBootstrapToken(password); | 1960 RefreshSpareBootstrapToken(password); |
| 1960 #endif | 1961 #endif |
| 1961 if (!IsEngineInitialized() || GetAuthError().state() != AuthError::NONE) { | 1962 if (!IsEngineInitialized() || GetAuthError().state() != AuthError::NONE) { |
| 1962 // Track the fact that we're still waiting for auth to complete. | 1963 // Track the fact that we're still waiting for auth to complete. |
| 1963 is_auth_in_progress_ = true; | 1964 is_auth_in_progress_ = true; |
| 1964 } | 1965 } |
| 1966 |
| 1967 if (switches::IsAccountConsistencyDiceEnabled() && |
| 1968 oauth2_token_service_->RefreshTokenIsAvailable(account_id)) { |
| 1969 // When Dice is enabled, the refresh token may be available before the user |
| 1970 // enables sync. Start sync if the refresh token is already available in the |
| 1971 // token service when the authenticated account is set. |
| 1972 OnRefreshTokenAvailable(account_id); |
| 1973 } |
| 1965 } | 1974 } |
| 1966 | 1975 |
| 1967 void ProfileSyncService::GoogleSignedOut(const std::string& account_id, | 1976 void ProfileSyncService::GoogleSignedOut(const std::string& account_id, |
| 1968 const std::string& username) { | 1977 const std::string& username) { |
| 1969 DCHECK(thread_checker_.CalledOnValidThread()); | 1978 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1970 sync_disabled_by_admin_ = false; | 1979 sync_disabled_by_admin_ = false; |
| 1971 UMA_HISTOGRAM_ENUMERATION("Sync.StopSource", syncer::SIGN_OUT, | 1980 UMA_HISTOGRAM_ENUMERATION("Sync.StopSource", syncer::SIGN_OUT, |
| 1972 syncer::STOP_SOURCE_LIMIT); | 1981 syncer::STOP_SOURCE_LIMIT); |
| 1973 RequestStop(CLEAR_DATA); | 1982 RequestStop(CLEAR_DATA); |
| 1974 } | 1983 } |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2429 return; | 2438 return; |
| 2430 | 2439 |
| 2431 DCHECK(startup_controller_->IsSetupInProgress()); | 2440 DCHECK(startup_controller_->IsSetupInProgress()); |
| 2432 startup_controller_->SetSetupInProgress(false); | 2441 startup_controller_->SetSetupInProgress(false); |
| 2433 | 2442 |
| 2434 if (IsEngineInitialized()) | 2443 if (IsEngineInitialized()) |
| 2435 ReconfigureDatatypeManager(); | 2444 ReconfigureDatatypeManager(); |
| 2436 NotifyObservers(); | 2445 NotifyObservers(); |
| 2437 } | 2446 } |
| 2438 } // namespace browser_sync | 2447 } // namespace browser_sync |
| OLD | NEW |