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

Unified Diff: chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm

Issue 23604046: [rAC, OSX] Add title to OSX rAC dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplify baseline computation. Created 7 years, 3 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/ui/cocoa/autofill/autofill_dialog_cocoa.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm b/chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm
index e883d24df34c0d8e1cd152aee88019b256fb739c..569440a542653c297a0749063ba77e1ca69bb08e 100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm
+++ b/chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm
@@ -266,6 +266,16 @@ void AutofillDialogCocoa::OnConstrainedWindowClosed(
[[mainContainer_ view] setFrame:clientRect];
[[signInContainer_ view] setFrame:clientRect];
+ // Set dialog title.
+ titleTextField_.reset([[NSTextField alloc] initWithFrame:NSZeroRect]);
+ [titleTextField_ setEditable:NO];
+ [titleTextField_ setBordered:NO];
+ [titleTextField_ setDrawsBackground:NO];
+ [titleTextField_ setFont:[NSFont systemFontOfSize:15.0]];
+ [titleTextField_ setStringValue:
+ base::SysUTF16ToNSString(autofillDialog->delegate()->DialogTitle())];
+ [titleTextField_ sizeToFit];
+
NSRect headerRect = clientRect;
headerRect.size.height = kAccountChooserHeight;
headerRect.origin.y = NSMaxY(clientRect);
@@ -300,6 +310,7 @@ void AutofillDialogCocoa::OnConstrainedWindowClosed(
[[FlippedView alloc] initWithFrame:NSZeroRect]);
[flippedContentView setSubviews:
@[accountChooser_,
+ titleTextField_,
[mainContainer_ view],
[signInContainer_ view],
loadingShieldView,
@@ -378,11 +389,21 @@ void AutofillDialogCocoa::OnConstrainedWindowClosed(
clientRect.size.height -= chrome_style::kTitleTopPadding +
chrome_style::kClientBottomPadding;
- NSRect headerRect, mainRect, dummyRect;
+ NSRect headerRect, mainRect, titleRect, dummyRect;
NSDivideRect(clientRect, &headerRect, &mainRect,
kAccountChooserHeight, NSMinYEdge);
NSDivideRect(mainRect, &dummyRect, &mainRect,
autofill::kDetailTopPadding, NSMinYEdge);
+ NSDivideRect(headerRect, &titleRect, &headerRect,
+ NSWidth([titleTextField_ frame]), NSMinXEdge);
+
+ // Align baseline of title with bottom of accountChooser.
+ base::scoped_nsobject<NSLayoutManager> layout_manager(
+ [[NSLayoutManager alloc] init]);
+ NSFont* titleFont = [titleTextField_ font];
+ titleRect.origin.y += NSHeight(titleRect) -
+ [layout_manager defaultBaselineOffsetForFont:titleFont];
+ [titleTextField_ setFrame:titleRect];
[accountChooser_ setFrame:headerRect];
if ([[signInContainer_ view] isHidden]) {
« no previous file with comments | « chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698