| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/sync/sync_error_controller.h" | 5 #include "components/sync_driver/sync_error_controller.h" |
| 6 | 6 |
| 7 #include "chrome/browser/sync/profile_sync_service.h" | 7 #include "components/sync_driver/sync_service.h" |
| 8 #include "chrome/browser/sync/profile_sync_service_factory.h" | |
| 9 | 8 |
| 10 SyncErrorController::SyncErrorController(ProfileSyncService* service) | 9 SyncErrorController::SyncErrorController(sync_driver::SyncService* service) |
| 11 : service_(service) { | 10 : service_(service) { |
| 12 DCHECK(service_); | 11 DCHECK(service_); |
| 13 } | 12 } |
| 14 | 13 |
| 15 SyncErrorController::~SyncErrorController() { | 14 SyncErrorController::~SyncErrorController() { |
| 16 } | 15 } |
| 17 | 16 |
| 18 bool SyncErrorController::HasError() { | 17 bool SyncErrorController::HasError() { |
| 19 return service_->HasSyncSetupCompleted() && | 18 return service_->HasSyncSetupCompleted() && |
| 20 service_->IsPassphraseRequired() && | 19 service_->IsPassphraseRequired() && |
| 21 service_->IsPassphraseRequiredForDecryption(); | 20 service_->IsPassphraseRequiredForDecryption(); |
| 22 } | 21 } |
| 23 | 22 |
| 24 void SyncErrorController::AddObserver(Observer* observer) { | 23 void SyncErrorController::AddObserver(Observer* observer) { |
| 25 observer_list_.AddObserver(observer); | 24 observer_list_.AddObserver(observer); |
| 26 } | 25 } |
| 27 | 26 |
| 28 void SyncErrorController::RemoveObserver(Observer* observer) { | 27 void SyncErrorController::RemoveObserver(Observer* observer) { |
| 29 observer_list_.RemoveObserver(observer); | 28 observer_list_.RemoveObserver(observer); |
| 30 } | 29 } |
| 31 | 30 |
| 32 void SyncErrorController::OnStateChanged() { | 31 void SyncErrorController::OnStateChanged() { |
| 33 FOR_EACH_OBSERVER(Observer, | 32 FOR_EACH_OBSERVER(Observer, |
| 34 observer_list_, | 33 observer_list_, |
| 35 OnErrorChanged()); | 34 OnErrorChanged()); |
| 36 } | 35 } |
| OLD | NEW |