Chromium Code Reviews| 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 b638d5ee91f83d3e34459b23f1af0727751ec4ff..475b1cd91f877b3730f82bd803da2a8ae274e42d 100644 |
| --- a/chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm |
| +++ b/chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm |
| @@ -17,6 +17,7 @@ |
| #import "chrome/browser/ui/cocoa/autofill/autofill_details_container.h" |
| #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_constants.h" |
| #import "chrome/browser/ui/cocoa/autofill/autofill_main_container.h" |
| +#import "chrome/browser/ui/cocoa/autofill/autofill_overlay_controller.h" |
| #import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h" |
| #import "chrome/browser/ui/cocoa/autofill/autofill_sign_in_container.h" |
| #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sheet.h" |
| @@ -63,6 +64,7 @@ void AutofillDialogCocoa::Show() { |
| initWithCustomWindow:[sheet_delegate_ window]]); |
| constrained_window_.reset( |
| new ConstrainedWindowMac(this, delegate_->GetWebContents(), sheet)); |
| + [sheet_delegate_ show]; |
| } |
| void AutofillDialogCocoa::Hide() { |
| @@ -95,6 +97,7 @@ void AutofillDialogCocoa::UpdateAccountChooser() { |
| } |
| void AutofillDialogCocoa::UpdateButtonStrip() { |
| + [sheet_delegate_ updateButtonStrip]; |
| } |
| void AutofillDialogCocoa::UpdateDetailArea() { |
| @@ -285,6 +288,11 @@ void AutofillDialogCocoa::OnConstrainedWindowClosed( |
| [loadingShieldView setHidden:YES]; |
| [loadingShieldView addSubview:loadingShieldTextField_]; |
| + overlayController_.reset( |
| + [[AutofillOverlayController alloc] initWithDelegate: |
| + autofillDialog->delegate()]); |
| + [[overlayController_ view] setHidden:YES]; |
| + |
| // This needs a flipped content view because otherwise the size |
| // animation looks odd. However, replacing the contentView for constrained |
| // windows does not work - it does custom rendering. |
| @@ -294,7 +302,8 @@ void AutofillDialogCocoa::OnConstrainedWindowClosed( |
| @[accountChooser_, |
| [mainContainer_ view], |
| [signInContainer_ view], |
| - loadingShieldView]]; |
| + loadingShieldView, |
| + [overlayController_ view]]]; |
| [flippedContentView setAutoresizingMask: |
| (NSViewWidthSizable | NSViewHeightSizable)]; |
| [[[self window] contentView] addSubview:flippedContentView]; |
| @@ -306,17 +315,6 @@ void AutofillDialogCocoa::OnConstrainedWindowClosed( |
| contentRect.size.height += NSHeight(headerRect) + |
| chrome_style::kClientBottomPadding + |
| chrome_style::kTitleTopPadding; |
| - [self performLayout]; |
| - |
| - // Resizing the browser causes the ConstrainedWindow to move. |
| - // Observe that to allow resizes based on browser size. |
| - NSView* contentView = [[self window] contentView]; |
| - [contentView setPostsFrameChangedNotifications:YES]; |
| - [[NSNotificationCenter defaultCenter] |
| - addObserver:self |
| - selector:@selector(onContentViewFrameDidChange:) |
| - name:NSWindowDidMoveNotification |
| - object:[self window]]; |
| } |
| return self; |
| } |
| @@ -358,6 +356,16 @@ void AutofillDialogCocoa::OnConstrainedWindowClosed( |
| dialogFrameRect = [[self window] contentRectForFrameRect:dialogFrameRect]; |
| size.height = std::min(NSHeight(dialogFrameRect), size.height); |
| + if (![[overlayController_ view] isHidden]) { |
| + int height = [overlayController_ heightForWidth:size.width]; |
| + // TODO(groby): This currently reserves size on top of the overlay image |
| + // equivalent to the height of the header. Clarify with UX what the final |
| + // padding will be. |
| + if (height != 0) { |
| + size.height = height + headerSize.height + kDetailTopPadding; |
| + } |
| + } |
| + |
| return size; |
| } |
| @@ -393,6 +401,9 @@ void AutofillDialogCocoa::OnConstrainedWindowClosed( |
| [loadingShieldTextField_ setFrame:textFrame]; |
| [[loadingShieldTextField_ superview] setFrame:contentRect]; |
| + [[overlayController_ view] setFrame:contentRect]; |
| + [overlayController_ performLayout]; |
| + |
| NSRect frameRect = [[self window] frameRectForContentRect:contentRect]; |
| [[self window] setFrame:frameRect display:YES]; |
| } |
| @@ -407,6 +418,28 @@ void AutofillDialogCocoa::OnConstrainedWindowClosed( |
| autofillDialog_->PerformClose(); |
| } |
| +- (void)show { |
| + gfx::Image splashImage = autofillDialog_->delegate()->SplashPageImage(); |
| + if (!splashImage.IsEmpty()) { |
| + autofill::DialogOverlayState state; |
| + state.image = splashImage; |
| + [overlayController_ setState:state]; |
| + [overlayController_ beginFadeOut]; |
| + } |
| + |
| + // Resizing the browser causes the ConstrainedWindow to move. |
| + // Observe that to allow resizes based on browser size. |
| + // NOTE: This MUST come last after all initial setup is done, because there |
| + // is an immediate notification post registration. |
| + [[NSNotificationCenter defaultCenter] |
| + addObserver:self |
| + selector:@selector(onContentViewFrameDidChange:) |
| + name:NSWindowDidMoveNotification |
| + object:[self window]]; |
|
sail
2013/09/04 23:08:25
Just to be extra safe, can we add a DCHECK([self w
groby-ooo-7-16
2013/09/05 00:44:20
Done - but it's really belt, suspender & shoelaces
sail
2013/09/05 01:06:32
Oh, you're right. Yea you don't need the DCHECK().
|
| + |
| + [self requestRelayout]; |
| +} |
| + |
| - (void)hide { |
| autofillDialog_->delegate()->OnCancel(); |
| autofillDialog_->PerformClose(); |
| @@ -434,6 +467,10 @@ void AutofillDialogCocoa::OnConstrainedWindowClosed( |
| } |
| } |
| +- (void)updateButtonStrip { |
| + [overlayController_ updateState]; |
| +} |
| + |
| - (void)updateSection:(autofill::DialogSection)section { |
| [[mainContainer_ sectionForId:section] update]; |
| } |