| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_dialog_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" | 10 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 198 } |
| 199 | 199 |
| 200 - (void)requestRelayout { | 200 - (void)requestRelayout { |
| 201 [self cancelRelayout]; | 201 [self cancelRelayout]; |
| 202 [self performSelector:@selector(performLayout) withObject:nil afterDelay:0.0]; | 202 [self performSelector:@selector(performLayout) withObject:nil afterDelay:0.0]; |
| 203 } | 203 } |
| 204 | 204 |
| 205 - (NSSize)preferredSize { | 205 - (NSSize)preferredSize { |
| 206 NSSize size; | 206 NSSize size; |
| 207 | 207 |
| 208 // Overall size is determined by either main container or sign in view. | 208 if (![[overlayController_ view] isHidden]) { |
| 209 if ([[signInContainer_ view] isHidden]) | 209 size.height = [overlayController_ heightForWidth:size.width]; |
| 210 size = [mainContainer_ preferredSize]; | 210 } else { |
| 211 else | 211 // Overall size is determined by either main container or sign in view. |
| 212 size = [signInContainer_ preferredSize]; | 212 if ([[signInContainer_ view] isHidden]) |
| 213 size = [mainContainer_ preferredSize]; |
| 214 else |
| 215 size = [signInContainer_ preferredSize]; |
| 213 | 216 |
| 214 // Always make room for the header. | 217 // Always make room for the header. |
| 215 size.height += kDecorationHeight; | 218 size.height += kDecorationHeight; |
| 216 | |
| 217 if (![[overlayController_ view] isHidden]) { | |
| 218 CGFloat height = [overlayController_ heightForWidth:size.width]; | |
| 219 if (height != 0.0) | |
| 220 size.height = height; | |
| 221 } | 219 } |
| 222 | 220 |
| 223 // Show as much of the main view as is possible without going past the | 221 // Show as much of the main view as is possible without going past the |
| 224 // bottom of the browser window. | 222 // bottom of the browser window. |
| 225 size.height = std::min(size.height, [self maxHeight]); | 223 size.height = std::min(size.height, [self maxHeight]); |
| 226 | 224 |
| 227 return size; | 225 return size; |
| 228 } | 226 } |
| 229 | 227 |
| 230 - (void)performLayout { | 228 - (void)performLayout { |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 | 415 |
| 418 - (content::WebContents*)getSignInWebContents { | 416 - (content::WebContents*)getSignInWebContents { |
| 419 return [signInContainer_ webContents]; | 417 return [signInContainer_ webContents]; |
| 420 } | 418 } |
| 421 | 419 |
| 422 - (BOOL)isShowingOverlay { | 420 - (BOOL)isShowingOverlay { |
| 423 return ![[overlayController_ view] isHidden]; | 421 return ![[overlayController_ view] isHidden]; |
| 424 } | 422 } |
| 425 | 423 |
| 426 @end | 424 @end |
| OLD | NEW |