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

Side by Side Diff: chrome/browser/ui/cocoa/autofill/autofill_sign_in_container.mm

Issue 97993006: [rAC, OSX] Force better initial size for sign-in (2nd try) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/autofill/autofill_sign_in_container.h" 5 #import "chrome/browser/ui/cocoa/autofill/autofill_sign_in_container.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 19 matching lines...) Expand all
30 webContents_.reset( 30 webContents_.reset(
31 content::WebContents::Create( 31 content::WebContents::Create(
32 content::WebContents::CreateParams(dialog_->delegate()->profile()))); 32 content::WebContents::CreateParams(dialog_->delegate()->profile())));
33 NSView* webContentView = webContents_->GetView()->GetNativeView(); 33 NSView* webContentView = webContents_->GetView()->GetNativeView();
34 [self setView:webContentView]; 34 [self setView:webContentView];
35 } 35 }
36 36
37 - (void)loadSignInPage { 37 - (void)loadSignInPage {
38 DCHECK(webContents_.get()); 38 DCHECK(webContents_.get());
39 39
40 // Prevent accidentaly empty |maxSize_|. 40 // Ensure initial minimum size doesn't cause resize.
41 if (NSEqualSizes(NSMakeSize(0, 0), maxSize_)) { 41 NSSize initialMinSize = [[self view] frame].size;
42 maxSize_ = [[[self view] window] frame].size; 42
43 maxSize_.height -= chrome_style::kClientBottomPadding; 43 // Ensure |maxSize_| is bigger than |initialMinSize|.
44 } 44 maxSize_.height = std::max(maxSize_.height, initialMinSize.height);
45 maxSize_.width = std::max(maxSize_.width, initialMinSize.width);
45 46
46 signInDelegate_.reset( 47 signInDelegate_.reset(
47 new autofill::AutofillDialogSignInDelegate( 48 new autofill::AutofillDialogSignInDelegate(
48 dialog_, webContents_.get(), 49 dialog_, webContents_.get(),
49 dialog_->delegate()->GetWebContents()->GetDelegate(), 50 dialog_->delegate()->GetWebContents()->GetDelegate(),
50 gfx::Size(NSSizeToCGSize(minSize_)), 51 gfx::Size(NSSizeToCGSize(initialMinSize)),
51 gfx::Size(NSSizeToCGSize(maxSize_)))); 52 gfx::Size(NSSizeToCGSize(maxSize_))));
52 webContents_->GetController().LoadURL( 53 webContents_->GetController().LoadURL(
53 dialog_->delegate()->SignInUrl(), 54 dialog_->delegate()->SignInUrl(),
54 content::Referrer(), 55 content::Referrer(),
55 content::PAGE_TRANSITION_AUTO_TOPLEVEL, 56 content::PAGE_TRANSITION_AUTO_TOPLEVEL,
56 std::string()); 57 std::string());
57 } 58 }
58 59
59 - (content::NavigationController*)navigationController { 60 - (content::NavigationController*)navigationController {
60 return &webContents_->GetController(); 61 return &webContents_->GetController();
(...skipping 26 matching lines...) Expand all
87 preferredSize_ = size; 88 preferredSize_ = size;
88 preferredSize_.height += chrome_style::kClientBottomPadding; 89 preferredSize_.height += chrome_style::kClientBottomPadding;
89 90
90 // Always request re-layout if preferredSize changes. 91 // Always request re-layout if preferredSize changes.
91 id delegate = [[[self view] window] windowController]; 92 id delegate = [[[self view] window] windowController];
92 if ([delegate respondsToSelector:@selector(requestRelayout)]) 93 if ([delegate respondsToSelector:@selector(requestRelayout)])
93 [delegate performSelector:@selector(requestRelayout)]; 94 [delegate performSelector:@selector(requestRelayout)];
94 } 95 }
95 96
96 @end 97 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698