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

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

Issue 23674004: [rAC, OSX] Add overlay shield for interstitials/waits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Allow animated overlays. 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
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..a30a5642dd0e4941b5c16c010e9a6bc56081b24c 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_ getHeightForWidth: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;
+ 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];
+ [[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];
}

Powered by Google App Engine
This is Rietveld 408576698