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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 SyncErrorController* sync_error_controller = GetSyncErrorControllerIfNeeded(); | 77 SyncErrorController* sync_error_controller = GetSyncErrorControllerIfNeeded(); |
78 if (sync_error_controller) | 78 if (sync_error_controller) |
79 sync_error_controller->RemoveObserver(this); | 79 sync_error_controller->RemoveObserver(this); |
80 } | 80 } |
81 | 81 |
82 void AvatarButtonErrorController::SyncErrorObserver::OnErrorChanged() { | 82 void AvatarButtonErrorController::SyncErrorObserver::OnErrorChanged() { |
83 avatar_button_error_controller_->UpdateSyncError(HasSyncError()); | 83 avatar_button_error_controller_->UpdateSyncError(HasSyncError()); |
84 } | 84 } |
85 | 85 |
86 bool AvatarButtonErrorController::SyncErrorObserver::HasSyncError() { | 86 bool AvatarButtonErrorController::SyncErrorObserver::HasSyncError() { |
87 ProfileSyncService* sync_service = | 87 browser_sync::ProfileSyncService* sync_service = |
88 ProfileSyncServiceFactory::GetForProfile(profile_); | 88 ProfileSyncServiceFactory::GetForProfile(profile_); |
89 if (switches::IsMaterialDesignUserMenu() && sync_service) { | 89 if (switches::IsMaterialDesignUserMenu() && sync_service) { |
90 SyncErrorController* sync_error_controller = | 90 SyncErrorController* sync_error_controller = |
91 sync_service->sync_error_controller(); | 91 sync_service->sync_error_controller(); |
92 ProfileSyncService::Status status; | 92 browser_sync::ProfileSyncService::Status status; |
93 sync_service->QueryDetailedSyncStatus(&status); | 93 sync_service->QueryDetailedSyncStatus(&status); |
94 return sync_service->HasUnrecoverableError() || | 94 return sync_service->HasUnrecoverableError() || |
95 status.sync_protocol_error.action == syncer::UPGRADE_CLIENT || | 95 status.sync_protocol_error.action == syncer::UPGRADE_CLIENT || |
96 (sync_error_controller && sync_error_controller->HasError()); | 96 (sync_error_controller && sync_error_controller->HasError()); |
97 } | 97 } |
98 return false; | 98 return false; |
99 } | 99 } |
100 | 100 |
101 SyncErrorController* AvatarButtonErrorController::SyncErrorObserver:: | 101 SyncErrorController* AvatarButtonErrorController::SyncErrorObserver:: |
102 GetSyncErrorControllerIfNeeded() { | 102 GetSyncErrorControllerIfNeeded() { |
103 if (!switches::IsMaterialDesignUserMenu()) | 103 if (!switches::IsMaterialDesignUserMenu()) |
104 return nullptr; | 104 return nullptr; |
105 ProfileSyncService* sync_service = | 105 browser_sync::ProfileSyncService* sync_service = |
106 ProfileSyncServiceFactory::GetForProfile(profile_); | 106 ProfileSyncServiceFactory::GetForProfile(profile_); |
107 return sync_service ? sync_service->sync_error_controller() : nullptr; | 107 return sync_service ? sync_service->sync_error_controller() : nullptr; |
108 } | 108 } |
OLD | NEW |