| 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/browser/profile_sync_service.h" | 5 #include "components/browser_sync/browser/profile_sync_service.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 ProfileSyncService::~ProfileSyncService() { | 244 ProfileSyncService::~ProfileSyncService() { |
| 245 sync_prefs_.RemoveSyncPrefObserver(this); | 245 sync_prefs_.RemoveSyncPrefObserver(this); |
| 246 // Shutdown() should have been called before destruction. | 246 // Shutdown() should have been called before destruction. |
| 247 CHECK(!backend_initialized_); | 247 CHECK(!backend_initialized_); |
| 248 } | 248 } |
| 249 | 249 |
| 250 bool ProfileSyncService::CanSyncStart() const { | 250 bool ProfileSyncService::CanSyncStart() const { |
| 251 return IsSyncAllowed() && IsSyncRequested() && IsSignedIn(); | 251 return IsSyncAllowed() && IsSyncRequested() && IsSignedIn(); |
| 252 } | 252 } |
| 253 | 253 |
| 254 bool ProfileSyncService::IsOAuthRefreshTokenAvailable() { | |
| 255 if (!oauth2_token_service_) | |
| 256 return false; | |
| 257 | |
| 258 return oauth2_token_service_->RefreshTokenIsAvailable( | |
| 259 signin_->GetAccountIdToUse()); | |
| 260 } | |
| 261 | |
| 262 void ProfileSyncService::Initialize() { | 254 void ProfileSyncService::Initialize() { |
| 263 sync_client_->Initialize(this); | 255 sync_client_->Initialize(this); |
| 264 | 256 |
| 265 startup_controller_.reset(new browser_sync::StartupController( | 257 startup_controller_.reset(new browser_sync::StartupController( |
| 266 start_behavior_, oauth2_token_service_, &sync_prefs_, signin_.get(), | 258 start_behavior_, oauth2_token_service_, &sync_prefs_, signin_.get(), |
| 267 base::Bind(&ProfileSyncService::StartUpSlowBackendComponents, | 259 base::Bind(&ProfileSyncService::StartUpSlowBackendComponents, |
| 268 startup_controller_weak_factory_.GetWeakPtr(), SYNC))); | 260 startup_controller_weak_factory_.GetWeakPtr(), SYNC))); |
| 269 backup_rollback_controller_.reset(new sync_driver::BackupRollbackController( | 261 backup_rollback_controller_.reset(new sync_driver::BackupRollbackController( |
| 270 &sync_prefs_, signin_.get(), | 262 &sync_prefs_, signin_.get(), |
| 271 base::Bind(&ProfileSyncService::StartUpSlowBackendComponents, | 263 base::Bind(&ProfileSyncService::StartUpSlowBackendComponents, |
| (...skipping 2452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2724 } | 2716 } |
| 2725 | 2717 |
| 2726 std::string ProfileSyncService::unrecoverable_error_message() const { | 2718 std::string ProfileSyncService::unrecoverable_error_message() const { |
| 2727 return unrecoverable_error_message_; | 2719 return unrecoverable_error_message_; |
| 2728 } | 2720 } |
| 2729 | 2721 |
| 2730 tracked_objects::Location ProfileSyncService::unrecoverable_error_location() | 2722 tracked_objects::Location ProfileSyncService::unrecoverable_error_location() |
| 2731 const { | 2723 const { |
| 2732 return unrecoverable_error_location_; | 2724 return unrecoverable_error_location_; |
| 2733 } | 2725 } |
| OLD | NEW |