Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Side by Side Diff: chrome/browser/ui/avatar_button_error_controller.cc

Issue 2708073002: Removing pre-material design menu setting. (Closed)
Patch Set: Removing header Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "components/signin/core/common/profile_management_switches.h"
12 11
13 using syncer::SyncErrorController; 12 using syncer::SyncErrorController;
14 13
15 AvatarButtonErrorController::AvatarButtonErrorController( 14 AvatarButtonErrorController::AvatarButtonErrorController(
16 AvatarButtonErrorControllerDelegate* delegate, 15 AvatarButtonErrorControllerDelegate* delegate,
17 Profile* profile) 16 Profile* profile)
18 : delegate_(delegate), 17 : delegate_(delegate),
19 avatar_signin_error_controller_(profile, this), 18 avatar_signin_error_controller_(profile, this),
20 avatar_sync_error_controller_(profile, this), 19 avatar_sync_error_controller_(profile, this),
21 has_signin_error_(avatar_signin_error_controller_.HasSigninError()), 20 has_signin_error_(avatar_signin_error_controller_.HasSigninError()),
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 sync_error_controller->RemoveObserver(this); 80 sync_error_controller->RemoveObserver(this);
82 } 81 }
83 82
84 void AvatarButtonErrorController::SyncErrorObserver::OnErrorChanged() { 83 void AvatarButtonErrorController::SyncErrorObserver::OnErrorChanged() {
85 avatar_button_error_controller_->UpdateSyncError(HasSyncError()); 84 avatar_button_error_controller_->UpdateSyncError(HasSyncError());
86 } 85 }
87 86
88 bool AvatarButtonErrorController::SyncErrorObserver::HasSyncError() { 87 bool AvatarButtonErrorController::SyncErrorObserver::HasSyncError() {
89 browser_sync::ProfileSyncService* sync_service = 88 browser_sync::ProfileSyncService* sync_service =
90 ProfileSyncServiceFactory::GetForProfile(profile_); 89 ProfileSyncServiceFactory::GetForProfile(profile_);
91 if (switches::IsMaterialDesignUserMenu() && sync_service) { 90 if (sync_service) {
92 SyncErrorController* sync_error_controller = 91 SyncErrorController* sync_error_controller =
93 sync_service->sync_error_controller(); 92 sync_service->sync_error_controller();
94 browser_sync::ProfileSyncService::Status status; 93 browser_sync::ProfileSyncService::Status status;
95 sync_service->QueryDetailedSyncStatus(&status); 94 sync_service->QueryDetailedSyncStatus(&status);
96 return sync_service->HasUnrecoverableError() || 95 return sync_service->HasUnrecoverableError() ||
97 status.sync_protocol_error.action == syncer::UPGRADE_CLIENT || 96 status.sync_protocol_error.action == syncer::UPGRADE_CLIENT ||
98 (sync_error_controller && sync_error_controller->HasError()); 97 (sync_error_controller && sync_error_controller->HasError());
99 } 98 }
100 return false; 99 return false;
101 } 100 }
102 101
103 SyncErrorController* AvatarButtonErrorController::SyncErrorObserver:: 102 SyncErrorController* AvatarButtonErrorController::SyncErrorObserver::
104 GetSyncErrorControllerIfNeeded() { 103 GetSyncErrorControllerIfNeeded() {
105 if (!switches::IsMaterialDesignUserMenu())
106 return nullptr;
107 browser_sync::ProfileSyncService* sync_service = 104 browser_sync::ProfileSyncService* sync_service =
108 ProfileSyncServiceFactory::GetForProfile(profile_); 105 ProfileSyncServiceFactory::GetForProfile(profile_);
109 return sync_service ? sync_service->sync_error_controller() : nullptr; 106 return sync_service ? sync_service->sync_error_controller() : nullptr;
110 } 107 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_global_error_unittest.cc ('k') | chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698