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

Side by Side Diff: chrome/browser/ui/cocoa/login_prompt_cocoa.mm

Issue 1430023002: Enable AutoResize for Constrained Web Dialogs for Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes per erikchen@'s comments. Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/login_prompt_cocoa.h" 5 #import "chrome/browser/ui/cocoa/login_prompt_cocoa.h"
6 6
7 #include "base/mac/bundle_locations.h" 7 #include "base/mac/bundle_locations.h"
8 #include "base/mac/scoped_nsobject.h" 8 #include "base/mac/scoped_nsobject.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // or CancelAuth (say, if the request was cancelled before the UI thread got 70 // or CancelAuth (say, if the request was cancelled before the UI thread got
71 // control). However, that's OK since any UI interaction in those functions 71 // control). However, that's OK since any UI interaction in those functions
72 // will occur via an InvokeLater on the UI thread, which is guaranteed 72 // will occur via an InvokeLater on the UI thread, which is guaranteed
73 // to happen after this is called (since this was InvokeLater'd first). 73 // to happen after this is called (since this was InvokeLater'd first).
74 WebContents* requesting_contents = GetWebContentsForLogin(); 74 WebContents* requesting_contents = GetWebContentsForLogin();
75 DCHECK(requesting_contents); 75 DCHECK(requesting_contents);
76 76
77 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( 77 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet(
78 [[CustomConstrainedWindowSheet alloc] 78 [[CustomConstrainedWindowSheet alloc]
79 initWithCustomWindow:[sheet_controller_ window]]); 79 initWithCustomWindow:[sheet_controller_ window]]);
80 constrained_window_.reset(new ConstrainedWindowMac( 80 constrained_window_.reset(CreateAndShowWebModalDialogMac(
81 this, requesting_contents, sheet)); 81 this, requesting_contents, sheet));
82 82
83 NotifyAuthNeeded(); 83 NotifyAuthNeeded();
84 } 84 }
85 85
86 void CloseDialog() override { 86 void CloseDialog() override {
87 // The hosting dialog may have been freed. 87 // The hosting dialog may have been freed.
88 if (constrained_window_) 88 if (constrained_window_)
89 constrained_window_->CloseWebContentsModalDialog(); 89 constrained_window_->CloseWebContentsModalDialog();
90 } 90 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // Resize the text field. 187 // Resize the text field.
188 CGFloat windowDelta = [GTMUILocalizerAndLayoutTweaker 188 CGFloat windowDelta = [GTMUILocalizerAndLayoutTweaker
189 sizeToFitFixedWidthTextField:explanationField_]; 189 sizeToFitFixedWidthTextField:explanationField_];
190 190
191 NSRect newFrame = [[self window] frame]; 191 NSRect newFrame = [[self window] frame];
192 newFrame.size.height += windowDelta; 192 newFrame.size.height += windowDelta;
193 [[self window] setFrame:newFrame display:NO]; 193 [[self window] setFrame:newFrame display:NO];
194 } 194 }
195 195
196 @end 196 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698