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

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

Issue 663643002: requestAutocomplete (desktop): don't get stuck in infinite loop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests Created 6 years, 2 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 unified diff | Download patch
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/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 73 }
74 74
75 - (void)loadView { 75 - (void)loadView {
76 webContents_.reset( 76 webContents_.reset(
77 content::WebContents::Create( 77 content::WebContents::Create(
78 content::WebContents::CreateParams(dialog_->delegate()->profile()))); 78 content::WebContents::CreateParams(dialog_->delegate()->profile())));
79 NSView* webContentView = webContents_->GetNativeView(); 79 NSView* webContentView = webContents_->GetNativeView();
80 [self setView:webContentView]; 80 [self setView:webContentView];
81 } 81 }
82 82
83 - (void)loadSignInPage { 83 - (void)loadSignInPage:(const GURL&)url {
84 DCHECK(webContents_.get()); 84 DCHECK(webContents_.get());
85 85
86 // Ensure initial minimum size doesn't cause resize. 86 // Ensure initial minimum size doesn't cause resize.
87 NSSize initialMinSize = [[self view] frame].size; 87 NSSize initialMinSize = [[self view] frame].size;
88 88
89 // Ensure |maxSize_| is bigger than |initialMinSize|. 89 // Ensure |maxSize_| is bigger than |initialMinSize|.
90 maxSize_.height = std::max(maxSize_.height, initialMinSize.height); 90 maxSize_.height = std::max(maxSize_.height, initialMinSize.height);
91 maxSize_.width = std::max(maxSize_.width, initialMinSize.width); 91 maxSize_.width = std::max(maxSize_.width, initialMinSize.width);
92 92
93 signInDelegate_.reset( 93 signInDelegate_.reset(
94 new CocoaSignInDelegate( 94 new CocoaSignInDelegate(
95 dialog_, 95 dialog_,
96 webContents_.get(), 96 webContents_.get(),
97 dialog_->delegate()->GetWebContents(), 97 dialog_->delegate()->GetWebContents(),
98 gfx::Size(NSSizeToCGSize(initialMinSize)), 98 gfx::Size(NSSizeToCGSize(initialMinSize)),
99 gfx::Size(NSSizeToCGSize(maxSize_)), 99 gfx::Size(NSSizeToCGSize(maxSize_)),
100 [self view])); 100 [self view]));
101 webContents_->GetController().LoadURL( 101 webContents_->GetController().LoadURL(url,
102 dialog_->delegate()->SignInUrl(), 102 content::Referrer(),
103 content::Referrer(), 103 ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
104 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, 104 std::string());
105 std::string());
106 } 105 }
107 106
108 - (content::NavigationController*)navigationController { 107 - (content::NavigationController*)navigationController {
109 return &webContents_->GetController(); 108 return &webContents_->GetController();
110 } 109 }
111 110
112 - (content::WebContents*)webContents { 111 - (content::WebContents*)webContents {
113 return webContents_.get(); 112 return webContents_.get();
114 } 113 }
115 114
(...skipping 20 matching lines...) Expand all
136 preferredSize_ = size; 135 preferredSize_ = size;
137 preferredSize_.height += chrome_style::kClientBottomPadding; 136 preferredSize_.height += chrome_style::kClientBottomPadding;
138 137
139 // Always request re-layout if preferredSize changes. 138 // Always request re-layout if preferredSize changes.
140 id delegate = [[[self view] window] windowController]; 139 id delegate = [[[self view] window] windowController];
141 if ([delegate respondsToSelector:@selector(requestRelayout)]) 140 if ([delegate respondsToSelector:@selector(requestRelayout)])
142 [delegate performSelector:@selector(requestRelayout)]; 141 [delegate performSelector:@selector(requestRelayout)];
143 } 142 }
144 143
145 @end 144 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698