|
|
Chromium Code Reviews|
Created:
7 years, 1 month ago by groby-ooo-7-16 Modified:
7 years, 1 month ago Reviewers:
Ilya Sherman CC:
chromium-reviews, benquan, Dane Wallinga, dyu1, estade+watch_chromium.org, rouslan+autofillwatch_chromium.org Base URL:
svn://svn.chromium.org/chrome/trunk/src Visibility:
Public. |
Description[rAC, OSX] Cleanup: Separate out WindowController
Breaking out the window controller into a separate file. (In
anticipation of changes that will have Cocoa dialog code call the
window controller without -performSelector: shenanigans)
R=isherman@chromium.org
BUG=none
TEST=none
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=236383
Patch Set 1 #
Total comments: 8
Patch Set 2 : Review fixes. #Patch Set 3 : Merge to HEAD #
Messages
Total messages: 15 (0 generated)
Oh boy, we're going to have so much fun with merge conflicts! :) LGTM % nits. https://codereview.chromium.org/73293002/diff/1/chrome/browser/ui/cocoa/autof... File chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.h (right): https://codereview.chromium.org/73293002/diff/1/chrome/browser/ui/cocoa/autof... chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.h:1: // Copyright (c) 2013 The Chromium Authors. All rights reserved. ultra nit: Please omit the "(c)" https://codereview.chromium.org/73293002/diff/1/chrome/browser/ui/cocoa/autof... chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.h:74: // A child view request re-layouting. nit: This is currently a sentence fragment; please rephrase. https://codereview.chromium.org/73293002/diff/1/chrome/browser/ui/cocoa/autof... chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.h:84: // User cancels dialog. nit: "cancels" -> "canceled"? https://codereview.chromium.org/73293002/diff/1/chrome/browser/ui/cocoa/autof... chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.h:99: - (BOOL)IsShowingOverlay; nit: Why is the first letter capitalized?
I take it you're working on one or the other? https://codereview.chromium.org/73293002/diff/1/chrome/browser/ui/cocoa/autof... File chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.h (right): https://codereview.chromium.org/73293002/diff/1/chrome/browser/ui/cocoa/autof... chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.h:1: // Copyright (c) 2013 The Chromium Authors. All rights reserved. On 2013/11/14 23:30:04, Ilya Sherman wrote: > ultra nit: Please omit the "(c)" Sure can do - it was a simple copy/pasta :) https://codereview.chromium.org/73293002/diff/1/chrome/browser/ui/cocoa/autof... chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.h:74: // A child view request re-layouting. On 2013/11/14 23:30:04, Ilya Sherman wrote: > nit: This is currently a sentence fragment; please rephrase. Done. https://codereview.chromium.org/73293002/diff/1/chrome/browser/ui/cocoa/autof... chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.h:84: // User cancels dialog. On 2013/11/14 23:30:04, Ilya Sherman wrote: > nit: "cancels" -> "canceled"? Done. https://codereview.chromium.org/73293002/diff/1/chrome/browser/ui/cocoa/autof... chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.h:99: - (BOOL)IsShowingOverlay; On 2013/11/14 23:30:04, Ilya Sherman wrote: > nit: Why is the first letter capitalized? Done.
On 2013/11/14 23:49:43, groby wrote: > I take it you're working on one or the other? Yeah, I'm making some changes to layout in the window controller. The ones I have in flight are small though; I'll hold off on the larger ones until this lands.
On 2013/11/14 23:51:04, Ilya Sherman wrote: > On 2013/11/14 23:49:43, groby wrote: > > I take it you're working on one or the other? > > Yeah, I'm making some changes to layout in the window controller. The ones I > have in flight are small though; I'll hold off on the larger ones until this > lands. Aaand instead I of course chose to work on something that touches this file -- [ https://chromiumcodereview.appspot.com/73723002/ ]. I'm happy to wait for you to land this prior to trying to land that one, though. Should we send this one to the CQ?
On 2013/11/15 06:20:28, Ilya Sherman wrote: > On 2013/11/14 23:51:04, Ilya Sherman wrote: > > On 2013/11/14 23:49:43, groby wrote: > > > I take it you're working on one or the other? > > > > Yeah, I'm making some changes to layout in the window controller. The ones I > > have in flight are small though; I'll hold off on the larger ones until this > > lands. > > Aaand instead I of course chose to work on something that touches this file -- [ > https://chromiumcodereview.appspot.com/73723002/ ]. I'm happy to wait for you > to land this prior to trying to land that one, though. Should we send this one > to the CQ? CQ bit set. Based on current CQ antics, you'll get to land tour stuff early December ;)
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/groby@chromium.org/73293002/60001
Failed to apply patch for
chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.mm:
While running patch -p1 --forward --force --no-backup-if-mismatch;
A
chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.mm
Copied chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm ->
chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.mm
patching file
chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.mm
Hunk #3 FAILED at 34.
Hunk #4 succeeded at 667 (offset 1 line).
1 out of 4 hunks FAILED -- saving rejects to file
chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.mm.rej
Patch: NR
chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm->chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.mm
Index: chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.mm
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm
b/chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.mm
similarity index 73%
copy from chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm
copy to chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.mm
index
082272193c6c7d77aaf24a58495957bd80fced71..8292d2eb912b8367151eaea95387e0bbf6d764cf
100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm
+++ b/chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.mm
@@ -1,27 +1,22 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h"
+#import "chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.h"
-#include "base/bind.h"
-#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_nsobject.h"
-#include "base/message_loop/message_loop.h"
#include "base/strings/sys_string_conversions.h"
#include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
#include "chrome/browser/ui/chrome_style.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_account_chooser.h"
-#import "chrome/browser/ui/cocoa/autofill/autofill_details_container.h"
+#include "chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h"
#include "chrome/browser/ui/cocoa/autofill/autofill_dialog_constants.h"
-#import "chrome/browser/ui/cocoa/autofill/autofill_input_field.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/autofill/autofill_textfield.h"
-#import
"chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sheet.h"
#import
"chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
@@ -29,8 +24,8 @@
#import "ui/base/cocoa/flipped_view.h"
#include "ui/base/cocoa/window_size_constants.h"
#include "ui/base/l10n/l10n_util.h"
-#include "ui/gfx/platform_font.h"
+namespace {
const CGFloat kAccountChooserHeight = 20.0;
const CGFloat kMinimumContentsHeight = 101;
@@ -39,199 +34,7 @@ const CGFloat kDecorationHeight = kAccountChooserHeight +
autofill::kDetailVerticalPadding +
chrome_style::kClientBottomPadding +
chrome_style::kTitleTopPadding;
-
-namespace autofill {
-
-// static
-AutofillDialogView* AutofillDialogView::Create(
- AutofillDialogViewDelegate* delegate) {
- return new AutofillDialogCocoa(delegate);
-}
-
-AutofillDialogCocoa::AutofillDialogCocoa(AutofillDialogViewDelegate* delegate)
- : close_weak_ptr_factory_(this),
- delegate_(delegate) {
-}
-
-AutofillDialogCocoa::~AutofillDialogCocoa() {
- // Cancel potential relayout requests, since the AutofillDialogController
- // is about to go away, but relayout requests assume it will still exist.
- [sheet_delegate_ cancelRelayout];
-}
-
-void AutofillDialogCocoa::Show() {
- // This should only be called once.
- DCHECK(!sheet_delegate_.get());
- sheet_delegate_.reset([[AutofillDialogWindowController alloc]
- initWithWebContents:delegate_->GetWebContents()
- autofillDialog:this]);
- base::scoped_nsobject<CustomConstrainedWindowSheet> sheet(
- [[CustomConstrainedWindowSheet alloc]
- initWithCustomWindow:[sheet_delegate_ window]]);
- constrained_window_.reset(
- new ConstrainedWindowMac(this, delegate_->GetWebContents(), sheet));
- [sheet_delegate_ show];
-}
-
-void AutofillDialogCocoa::Hide() {
- [sheet_delegate_ hide];
-}
-
-void AutofillDialogCocoa::PerformClose() {
- if (!close_weak_ptr_factory_.HasWeakPtrs()) {
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&AutofillDialogCocoa::CloseNow,
- close_weak_ptr_factory_.GetWeakPtr()));
- }
-}
-
-void AutofillDialogCocoa::CloseNow() {
- constrained_window_->CloseWebContentsModalDialog();
-}
-
-void AutofillDialogCocoa::UpdatesStarted() {
-}
-
-void AutofillDialogCocoa::UpdatesFinished() {
-}
-
-void AutofillDialogCocoa::UpdateAccountChooser() {
- [sheet_delegate_ updateAccountChooser];
-}
-
-void AutofillDialogCocoa::UpdateButtonStrip() {
- [sheet_delegate_ updateButtonStrip];
-}
-
-void AutofillDialogCocoa::UpdateOverlay() {
- // TODO(estade): only update the overlay.
- UpdateButtonStrip();
-}
-
-void AutofillDialogCocoa::UpdateDetailArea() {
-}
-
-void AutofillDialogCocoa::UpdateForErrors() {
-}
-
-void AutofillDialogCocoa::UpdateNotificationArea() {
- [sheet_delegate_ updateNotificationArea];
-}
-
-void AutofillDialogCocoa::UpdateSection(DialogSection section) {
- [sheet_delegate_ updateSection:section];
-}
-
-void AutofillDialogCocoa::FillSection(DialogSection section,
- const DetailInput& originating_input) {
- [sheet_delegate_ fillSection:section forInput:originating_input];
-}
-
-void AutofillDialogCocoa::GetUserInput(DialogSection section,
- DetailOutputMap* output) {
- [sheet_delegate_ getInputs:output forSection:section];
-}
-
-string16 AutofillDialogCocoa::GetCvc() {
- return base::SysNSStringToUTF16([sheet_delegate_ getCvc]);
-}
-
-bool AutofillDialogCocoa::HitTestInput(const DetailInput& input,
- const gfx::Point& screen_point) {
- // TODO(dbeam): implement.
- return false;
-}
-
-bool AutofillDialogCocoa::SaveDetailsLocally() {
- return [sheet_delegate_ saveDetailsLocally];
-}
-
-const content::NavigationController* AutofillDialogCocoa::ShowSignIn() {
- return [sheet_delegate_ showSignIn];
-}
-
-void AutofillDialogCocoa::HideSignIn() {
- [sheet_delegate_ hideSignIn];
-}
-
-void AutofillDialogCocoa::ModelChanged() {
- [sheet_delegate_ modelChanged];
-}
-
-void AutofillDialogCocoa::UpdateErrorBubble() {
- [sheet_delegate_ updateErrorBubble];
-}
-
-TestableAutofillDialogView* AutofillDialogCocoa::GetTestableView() {
- return this;
-}
-
-void AutofillDialogCocoa::OnSignInResize(const gfx::Size& pref_size) {
- [sheet_delegate_ onSignInResize:
- NSMakeSize(pref_size.width(), pref_size.height())];
-}
-
-void AutofillDialogCocoa::SubmitForTesting() {
- [sheet_delegate_ accept:nil];
-}
-
-void AutofillDialogCocoa::CancelForTesting() {
- [sheet_delegate_ cancel:nil];
-}
-
-string16 AutofillDialogCocoa::GetTextContentsOfInput(const DetailInput& input)
{
- for (size_t i = SECTION_MIN; i <= SECTION_MAX; ++i) {
- DialogSection section = static_cast<DialogSection>(i);
- DetailOutputMap contents;
- [sheet_delegate_ getInputs:&contents forSection:section];
- DetailOutputMap::const_iterator it = contents.find(&input);
- if (it != contents.end())
- return it->second;
- }
-
- NOTREACHED();
- return string16();
-}
-
-void AutofillDialogCocoa::SetTextContentsOfInput(const DetailInput& input,
- const string16& contents) {
- [sheet_delegate_ setTextContents:base::SysUTF16ToNSString(contents)
- forInput:input];
-}
-
-void AutofillDialogCocoa::SetTextContentsOfSuggestionInput(
- DialogSection section,
- const base::string16& text) {
- [sheet_delegate_ setTextContents:base::SysUTF16ToNSString(text)
- ofSuggestionForSection:section];
-}
-
-void AutofillDialogCocoa::ActivateInput(const DetailInput& input) {
- [sheet_delegate_ activateFieldForInput:input];
-}
-
-gfx::Size AutofillDialogCocoa::GetSize() const {
- return gfx::Size(NSSizeToCGSize([[sheet_delegate_ window] frame].size));
-}
-
-content::WebContents* AutofillDialogCocoa::GetSignInWebContents() {
- return [sheet_delegate_ getSignInWebContents];
-}
-
-
-bool AutofillDialogCocoa::IsShowingOverlay() const {
- return [sheet_delegate_ IsShowingOverlay];
-}
-
-void AutofillDialogCocoa::OnConstrainedWindowClosed(
- ConstrainedWindowMac* window) {
- constrained_window_.reset();
- // |this| belongs to |delegate_|, so no self-destruction here.
- delegate_->ViewClosed();
-}
-
-} // autofill
+} // namespace
#pragma mark "Loading" Shield
@@ -671,7 +474,7 @@ void AutofillDialogCocoa::OnConstrainedWindowClosed(
return [signInContainer_ webContents];
}
-- (BOOL)IsShowingOverlay {
+- (BOOL)isShowingOverlay {
return ![[overlayController_ view] isHidden];
}
Waiting for https://codereview.chromium.org/62873006/ to land....
On 2013/11/16 00:25:13, groby wrote: > Waiting for https://codereview.chromium.org/62873006/ to land.... Wheeeeee!
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/groby@chromium.org/73293002/60001
Failed to apply patch for
chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm:
While running patch -p1 --forward --force --no-backup-if-mismatch;
patching file chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm
Hunk #3 FAILED at 205.
1 out of 3 hunks FAILED -- saving rejects to file
chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm.rej
Patch: chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm
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
082272193c6c7d77aaf24a58495957bd80fced71..6f4f3d7d6bbf7599360919f13821bbf55585e3d9
100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm
+++ b/chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm
@@ -5,40 +5,13 @@
#include "chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h"
#include "base/bind.h"
-#include "base/mac/bundle_locations.h"
-#include "base/mac/foundation_util.h"
#include "base/mac/scoped_nsobject.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/sys_string_conversions.h"
#include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
-#include "chrome/browser/ui/chrome_style.h"
-#import "chrome/browser/ui/cocoa/autofill/autofill_account_chooser.h"
#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_input_field.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/autofill/autofill_textfield.h"
+#import "chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.h"
#import
"chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sheet.h"
-#import
"chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_contents_view.h"
-#include "grit/generated_resources.h"
-#import "ui/base/cocoa/flipped_view.h"
-#include "ui/base/cocoa/window_size_constants.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/gfx/platform_font.h"
-
-const CGFloat kAccountChooserHeight = 20.0;
-const CGFloat kMinimumContentsHeight = 101;
-
-// Height of all decorations & paddings on main dialog together.
-const CGFloat kDecorationHeight = kAccountChooserHeight +
- autofill::kDetailVerticalPadding +
- chrome_style::kClientBottomPadding +
- chrome_style::kTitleTopPadding;
namespace autofill {
@@ -221,7 +194,7 @@ content::WebContents*
AutofillDialogCocoa::GetSignInWebContents() {
bool AutofillDialogCocoa::IsShowingOverlay() const {
- return [sheet_delegate_ IsShowingOverlay];
+ return [sheet_delegate_ isShowingOverlay];
}
void AutofillDialogCocoa::OnConstrainedWindowClosed(
@@ -232,447 +205,3 @@ void AutofillDialogCocoa::OnConstrainedWindowClosed(
}
} // autofill
-
-#pragma mark "Loading" Shield
-
-@interface AutofillOpaqueView : NSView
-@end
-
-@implementation AutofillOpaqueView
-
-- (BOOL)isOpaque {
- return YES;
-}
-
-- (void)drawRect:(NSRect)dirtyRect {
- [[[self window] backgroundColor] setFill];
- [NSBezierPath fillRect:[self bounds]];
-}
-
-@end
-
-
-#pragma mark Field Editor
-
-@interface AutofillDialogFieldEditor : NSTextView
-@end
-
-
-@implementation AutofillDialogFieldEditor
-
-- (void)mouseDown:(NSEvent*)event {
- // Delegate _must_ be notified before mouseDown is complete, since it needs
- // to distinguish between mouseDown for already focused fields, and fields
- // that will receive focus as part of the mouseDown.
- AutofillTextField* textfield =
- base::mac::ObjCCastStrict<AutofillTextField>([self delegate]);
- [textfield onEditorMouseDown:self];
- [super mouseDown:event];
-}
-
-@end
-
-
-#pragma mark Window Controller
-
-@interface AutofillDialogWindowController ()
-
-// Compute maximum allowed height for the dialog.
-- (CGFloat)maxHeight;
-
-// Update size constraints on sign-in container.
-- (void)updateSignInSizeConstraints;
-
-// Notification that the WebContent's view frame has changed.
-- (void)onContentViewFrameDidChange:(NSNotification*)notification;
-
-@end
-
-
-@implementation AutofillDialogWindowController (NSWindowDelegate)
-
-- (id)windowWillReturnFieldEditor:(NSWindow*)window toObject:(id)client {
- AutofillTextField* textfield =
base::mac::ObjCCast<AutofillTextField>(client);
- if (!textfield)
- return nil;
-
- if (!fieldEditor_) {
- fieldEditor_.reset([[AutofillDialogFieldEditor alloc] init]);
- [fieldEditor_ setFieldEditor:YES];
- }
- return fieldEditor_.get();
-}
-
-@end
-
-
-@implementation AutofillDialogWindowController
-
-- (id)initWithWebContents:(content::WebContents*)webContents
- autofillDialog:(autofill::AutofillDialogCocoa*)autofillDialog {
- DCHECK(webContents);
-
- base::scoped_nsobject<ConstrainedWindowCustomWindow> window(
- [[ConstrainedWindowCustomWindow alloc]
- initWithContentRect:ui::kWindowSizeDeterminedLater]);
-
- if ((self = [super initWithWindow:window])) {
- [window setDelegate:self];
- webContents_ = webContents;
- autofillDialog_ = autofillDialog;
-
- mainContainer_.reset([[AutofillMainContainer alloc]
- initWithDelegate:autofillDialog->delegate()]);
- [mainContainer_ setTarget:self];
-
- signInContainer_.reset(
- [[AutofillSignInContainer alloc] initWithDialog:autofillDialog]);
- [[signInContainer_ view] setHidden:YES];
-
- NSRect clientRect = [[mainContainer_ view] frame];
- clientRect.origin = NSMakePoint(chrome_style::kClientBottomPadding,
- chrome_style::kHorizontalPadding);
- [[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);
- accountChooser_.reset([[AutofillAccountChooser alloc]
- initWithFrame:headerRect
- delegate:autofillDialog->delegate()]);
-
- loadingShieldTextField_.reset(
- [[NSTextField alloc] initWithFrame:NSZeroRect]);
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- NSFont* loadingFont = rb.GetFont(
- ui::ResourceBundle::BaseFont).DeriveFont(15).GetNativeFont();
- [loadingShieldTextField_ setFont:loadingFont];
- [loadingShieldTextField_ setEditable:NO];
- [loadingShieldTextField_ setBordered:NO];
- [loadingShieldTextField_ setDrawsBackground:NO];
-
- base::scoped_nsobject<AutofillOpaqueView> loadingShieldView(
- [[AutofillOpaqueView alloc] initWithFrame:NSZeroRect]);
- [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.
- base::scoped_nsobject<NSView> flippedContentView(
- [[FlippedView alloc] initWithFrame:
- [[[self window] contentView] frame]]);
- [flippedContentView setSubviews:
- @[accountChooser_,
- titleTextField_,
- [mainContainer_ view],
- [signInContainer_ view],
- loadingShieldView,
- [overlayController_ view]]];
- [flippedContentView setAutoresizingMask:
- (NSViewWidthSizable | NSViewHeightSizable)];
- [[[self window] contentView] addSubview:flippedContentView];
- [mainContainer_ setAnchorView:[[accountChooser_ subviews]
objectAtIndex:1]];
- }
- return self;
-}
-
-- (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- [super dealloc];
-}
-
-- (CGFloat)maxHeight {
- NSRect dialogFrameRect = [[self window] frame];
- NSRect browserFrameRect =
- [webContents_->GetView()->GetTopLevelNativeWindow() frame];
- dialogFrameRect.size.height =
- NSMaxY(dialogFrameRect) - NSMinY(browserFrameRect);
- dialogFrameRect = [[self window] contentRectForFrameRect:dialogFrameRect];
- return NSHeight(dialogFrameRect);
-}
-
-- (void)updateSignInSizeConstraints {
- // Adjust for the size of all decorations and paddings outside main content.
- CGFloat minHeight = kMinimumContentsHeight - kDecorationHeight;
- CGFloat maxHeight = std::max([self maxHeight] - kDecorationHeight,
minHeight);
- CGFloat width = NSWidth([[[self window] contentView] frame]);
-
- [signInContainer_ constrainSizeToMinimum:NSMakeSize(width, minHeight)
- maximum:NSMakeSize(width, maxHeight)];
-}
-
-- (void)onContentViewFrameDidChange:(NSNotification*)notification {
- [self updateSignInSizeConstraints];
- if ([[signInContainer_ view] isHidden])
- [self requestRelayout];
-}
-
-- (void)cancelRelayout {
- [NSObject cancelPreviā¦
(message too large)
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/groby@chromium.org/73293002/180001
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/groby@chromium.org/73293002/180001
Message was sent while issue was closed.
Change committed as 236383 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
