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

Unified Diff: chrome/browser/ui/cocoa/one_click_signin_view_controller.mm

Issue 137563002: OneClickSigninBubbleView: Only show title if no error present. [Mac+Views] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update cc file to compile again after a recent change Created 6 years, 11 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
Index: chrome/browser/ui/cocoa/one_click_signin_view_controller.mm
diff --git a/chrome/browser/ui/cocoa/one_click_signin_view_controller.mm b/chrome/browser/ui/cocoa/one_click_signin_view_controller.mm
index 5e4d9677656be4c8629a1f96ae0a26f03caf024c..923b29580b97bc58837b3b2fc74e5a238790fa54 100644
--- a/chrome/browser/ui/cocoa/one_click_signin_view_controller.mm
+++ b/chrome/browser/ui/cocoa/one_click_signin_view_controller.mm
@@ -21,6 +21,10 @@
namespace {
+// The margin between the top edge of the border and the error message text in
+// the sign-in bubble, in the case of an error.
+const CGFloat kTopErrorMessageMargin = 12;
+
// Shift the origin of |view|'s frame by the given amount in the
// positive y direction (up).
void ShiftOriginY(NSView* view, CGFloat amount) {
@@ -152,6 +156,14 @@ void ShiftOriginY(NSView* view, CGFloat amount) {
}
if (informativePlaceholderTextField_) {
+ if (!isSyncDialog_ && ([errorMessage_ length] != 0)) {
+ // Move up the "Learn more" origin in error case to account for the
+ // smaller bubble.
+ NSRect frame = [informativePlaceholderTextField_ frame];
+ frame = NSOffsetRect(frame, 0, NSHeight([titleTextField_ frame]));
+ [informativePlaceholderTextField_ setFrame:frame];
+ }
+
ShiftOriginY(informativePlaceholderTextField_, totalYOffset);
totalYOffset += [self initializeInformativeTextView];
}
@@ -166,16 +178,30 @@ void ShiftOriginY(NSView* view, CGFloat amount) {
[GTMUILocalizerAndLayoutTweaker
sizeToFitFixedWidthTextField:titleTextField_];
- if (closeButton_)
- ShiftOriginY(closeButton_, totalYOffset);
-
NSSize delta = NSMakeSize(0.0, totalYOffset);
if (isSyncDialog_) {
[messageTextField_ setStringValue:l10n_util::GetNSStringWithFixup(
IDS_ONE_CLICK_SIGNIN_DIALOG_TITLE_NEW)];
} else if ([errorMessage_ length] != 0) {
+ [titleTextField_ setHidden:YES];
[messageTextField_ setStringValue:errorMessage_];
+
+ // Make the bubble less tall, as the title text will be hidden.
+ NSSize size = [[self view] frame].size;
+ size.height = size.height - NSHeight([titleTextField_ frame]);
+ [[self view] setFrameSize:size];
+
+ // Shift the message text up to where the title text used to be.
+ NSPoint origin = [titleTextField_ frame].origin;
+ [messageTextField_ setFrameOrigin:origin];
+ ShiftOriginY(messageTextField_, -kTopErrorMessageMargin);
+
+ // Use "OK" instead of "OK, got it" in the error case, and size the button
+ // accordingly.
+ [closeButton_ setTitle:l10n_util::GetNSStringWithFixup(
+ IDS_OK)];
+ [GTMUILocalizerAndLayoutTweaker sizeToFitView:[closeButton_ superview]];
}
// Resize bubble and window to hold the controls.
« no previous file with comments | « chrome/app/nibs/OneClickSigninBubble.xib ('k') | chrome/browser/ui/views/sync/one_click_signin_bubble_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698