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..fe69a210bf6357a3a4711327d30ae255e14b4ae5 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,30 @@ void AutofillDialogCocoa::OnConstrainedWindowClosed( |
autofillDialog_->PerformClose(); |
} |
+- (void)show { |
+ gfx::Image splashImage = autofillDialog_->delegate()->SplashPageImage(); |
+ if (!splashImage.IsEmpty()) { |
+ autofill::DialogOverlayState state; |
sail
2013/09/04 21:18:52
Is this used anywhere?
groby-ooo-7-16
2013/09/04 22:19:01
#@(*#@. I need an explicit setState for this. Got
|
+ state.image = splashImage; |
+ [overlayController_ updateState]; |
+ [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. |
+ NSView* contentView = [[self window] contentView]; |
+ [contentView setPostsFrameChangedNotifications:YES]; |
sail
2013/09/04 21:18:52
Don't need this since you're observing the window?
groby-ooo-7-16
2013/09/04 22:19:01
Seems that way. Done.
On 2013/09/04 21:18:52, sail
|
+ [[NSNotificationCenter defaultCenter] |
+ addObserver:self |
+ selector:@selector(onContentViewFrameDidChange:) |
+ name:NSWindowDidMoveNotification |
+ object:[self window]]; |
+ |
+ [self requestRelayout]; |
+} |
+ |
- (void)hide { |
autofillDialog_->delegate()->OnCancel(); |
autofillDialog_->PerformClose(); |
@@ -434,6 +469,10 @@ void AutofillDialogCocoa::OnConstrainedWindowClosed( |
} |
} |
+- (void)updateButtonStrip { |
+ [overlayController_ updateState]; |
+} |
+ |
- (void)updateSection:(autofill::DialogSection)section { |
[[mainContainer_ sectionForId:section] update]; |
} |