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

Unified Diff: chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm

Issue 2267013002: [MD User Menu] New way to handle supervised user auth error (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comments Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/sync_ui_util.cc ('k') | chrome/browser/ui/views/profiles/profile_chooser_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
diff --git a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
index 328a875de2aaf489e73b14c1d5577de94c879db3..343df2539b5f6273754b6d40dc09f83ff3683d1e 100644
--- a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
+++ b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
@@ -963,9 +963,6 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
// Builds a header for signin and sync error surfacing on the user menu.
- (NSView*)buildSyncErrorViewIfNeeded;
-- (NSView*)buildSyncErrorViewWithContent:(int)contentStringId
- buttonStringId:(int)buttonStringId
- buttonAction:(SEL)buttonAction;
// Builds a tutorial card to introduce an upgrade user to the new avatar menu if
// needed. |tutorial_shown| indicates if the tutorial has already been shown in
@@ -1868,6 +1865,9 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
case sync_ui_util::UNRECOVERABLE_ERROR:
buttonAction = @selector(showSignoutSigninView:);
break;
+ case sync_ui_util::SUPERVISED_USER_AUTH_ERROR:
+ buttonAction = nil;
+ break;
case sync_ui_util::AUTH_ERROR:
buttonAction = @selector(showAccountReauthenticationView:);
break;
@@ -1882,32 +1882,30 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
default:
NOTREACHED();
}
- return [self buildSyncErrorViewWithContent:contentStringId
- buttonStringId:buttonStringId
- buttonAction:buttonAction];
-}
-- (NSView*)buildSyncErrorViewWithContent:(int)contentStringId
- buttonStringId:(int)buttonStringId
- buttonAction:(SEL)buttonAction {
base::scoped_nsobject<NSView> container(
[[NSView alloc] initWithFrame:NSMakeRect(0, 0, GetFixedMenuWidth(), 0)]);
CGFloat iconSize = 20.0;
CGFloat xOffset = kHorizontalSpacing + iconSize + 12.0;
CGFloat availableWidth = GetFixedMenuWidth() - xOffset - kHorizontalSpacing;
- CGFloat yOffset = 20.0;
+ CGFloat yOffset = 16.0;
// Adds an action button for resolving the error at the bottom.
- base::scoped_nsobject<NSButton> resolveErrorButton(
- [[BlueLabelButton alloc] initWithFrame:NSZeroRect]);
- [resolveErrorButton setTitle:l10n_util::GetNSString(buttonStringId)];
- [resolveErrorButton setTarget:self];
- [resolveErrorButton setAction:buttonAction];
- [resolveErrorButton setAlignment:NSCenterTextAlignment];
- [resolveErrorButton sizeToFit];
- [resolveErrorButton setFrameOrigin:NSMakePoint(xOffset, yOffset)];
- [container addSubview:resolveErrorButton];
- yOffset = NSMaxY([resolveErrorButton frame]) + kVerticalSpacing;
+ if (buttonStringId) {
+ // If the button string is specified, then the button action needs to be
+ // already initialized for the button to be constructed.
+ DCHECK(buttonAction);
+ base::scoped_nsobject<NSButton> resolveErrorButton(
+ [[BlueLabelButton alloc] initWithFrame:NSZeroRect]);
+ [resolveErrorButton setTitle:l10n_util::GetNSString(buttonStringId)];
+ [resolveErrorButton setTarget:self];
+ [resolveErrorButton setAction:buttonAction];
+ [resolveErrorButton setAlignment:NSCenterTextAlignment];
+ [resolveErrorButton sizeToFit];
+ [resolveErrorButton setFrameOrigin:NSMakePoint(xOffset, yOffset + 4.0)];
+ [container addSubview:resolveErrorButton];
+ yOffset = NSMaxY([resolveErrorButton frame]) + kVerticalSpacing;
+ }
// Adds the error message content.
NSTextField* contentLabel =
« no previous file with comments | « chrome/browser/sync/sync_ui_util.cc ('k') | chrome/browser/ui/views/profiles/profile_chooser_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698