Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ui/avatar_button_error_controller.h" | 5 #include "chrome/browser/ui/avatar_button_error_controller.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profiles_state.h" | 7 #include "chrome/browser/profiles/profiles_state.h" |
| 8 #include "chrome/browser/sync/profile_sync_service_factory.h" | 8 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 9 #include "components/browser_sync/profile_sync_service.h" | 9 #include "components/browser_sync/profile_sync_service.h" |
| 10 #include "components/signin/core/browser/signin_error_controller.h" | 10 #include "components/signin/core/browser/signin_error_controller.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 bool AvatarButtonErrorController::SyncErrorObserver::HasSyncError() { | 87 bool AvatarButtonErrorController::SyncErrorObserver::HasSyncError() { |
| 88 browser_sync::ProfileSyncService* sync_service = | 88 browser_sync::ProfileSyncService* sync_service = |
| 89 ProfileSyncServiceFactory::GetForProfile(profile_); | 89 ProfileSyncServiceFactory::GetForProfile(profile_); |
| 90 if (sync_service) { | 90 if (sync_service) { |
| 91 SyncErrorController* sync_error_controller = | 91 SyncErrorController* sync_error_controller = |
| 92 sync_service->sync_error_controller(); | 92 sync_service->sync_error_controller(); |
| 93 browser_sync::ProfileSyncService::Status status; | 93 browser_sync::ProfileSyncService::Status status; |
| 94 sync_service->QueryDetailedSyncStatus(&status); | 94 sync_service->QueryDetailedSyncStatus(&status); |
| 95 return sync_service->HasUnrecoverableError() || | 95 return sync_service->HasUnrecoverableError() || |
| 96 status.sync_protocol_error.action == syncer::UPGRADE_CLIENT || | 96 status.sync_protocol_error.action == syncer::UPGRADE_CLIENT || |
| 97 (sync_error_controller && sync_error_controller->HasError()); | 97 (sync_error_controller && sync_error_controller->HasError()) || |
| 98 (!sync_service->IsFirstSetupComplete() && | |
|
skym
2017/06/01 19:48:44
I've seen these two booleans checked before in thi
Patrick Noland
2017/06/07 19:07:23
Done.
| |
| 99 sync_service->IsSyncRequested()); | |
| 98 } | 100 } |
| 99 return false; | 101 return false; |
| 100 } | 102 } |
| 101 | 103 |
| 102 SyncErrorController* AvatarButtonErrorController::SyncErrorObserver:: | 104 SyncErrorController* AvatarButtonErrorController::SyncErrorObserver:: |
| 103 GetSyncErrorControllerIfNeeded() { | 105 GetSyncErrorControllerIfNeeded() { |
| 104 browser_sync::ProfileSyncService* sync_service = | 106 browser_sync::ProfileSyncService* sync_service = |
| 105 ProfileSyncServiceFactory::GetForProfile(profile_); | 107 ProfileSyncServiceFactory::GetForProfile(profile_); |
| 106 return sync_service ? sync_service->sync_error_controller() : nullptr; | 108 return sync_service ? sync_service->sync_error_controller() : nullptr; |
| 107 } | 109 } |
| OLD | NEW |