1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "chrome/browser/sync/sync_error_controller.h" 6 7 #include "chrome/browser/sync/profile_sync_service.h" 8 #include "chrome/browser/sync/profile_sync_service_factory.h" 9 SyncErrorController(ProfileSyncService * service)10SyncErrorController::SyncErrorController(ProfileSyncService* service) 11 : service_(service) { 12 DCHECK(service_); 13 } 14 ~SyncErrorController()15SyncErrorController::~SyncErrorController() { 16 } 17 HasError()18bool SyncErrorController::HasError() { 19 return service_->HasSyncSetupCompleted() && 20 service_->IsPassphraseRequired() && 21 service_->IsPassphraseRequiredForDecryption(); 22 } 23 AddObserver(Observer * observer)24void SyncErrorController::AddObserver(Observer* observer) { 25 observer_list_.AddObserver(observer); 26 } 27 RemoveObserver(Observer * observer)28void SyncErrorController::RemoveObserver(Observer* observer) { 29 observer_list_.RemoveObserver(observer); 30 } 31 OnStateChanged()32void SyncErrorController::OnStateChanged() { 33 FOR_EACH_OBSERVER(Observer, 34 observer_list_, 35 OnErrorChanged()); 36 } 37