Chromium Code Reviews| Index: chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc |
| diff --git a/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc b/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc |
| index ae24ddb6782eedd580719b44c9128267b958af12..4d1ef42bfb7ad51e25861cb84d2db96d4a9c3868 100644 |
| --- a/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc |
| +++ b/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc |
| @@ -20,6 +20,8 @@ |
| #include "ui/views/controls/webview/webview.h" |
| #include "ui/views/widget/widget.h" |
| +namespace { |
| + |
| const int kPasswordCombinedFixedGaiaViewHeight = 440; |
| const int kPasswordCombinedFixedGaiaViewWidth = 360; |
| const int kFixedGaiaViewHeight = 612; |
| @@ -27,6 +29,15 @@ const int kModalDialogWidth = 448; |
| const int kSyncConfirmationDialogHeight = 487; |
| const int kSigninErrorDialogHeight = 164; |
|
Peter Kasting
2016/10/27 22:14:50
These numbers are so horribly magic :( I hope we
msarda
2016/10/28 11:11:09
Acknowledged.
|
| +int GetSyncConfirmationDialogPreferredHeight(Profile* profile) { |
| + // If sync is disabled, then the sync confirmation dialog looks like an error |
| + // dialog and thus it has the same preferred size. |
| + return profile->IsSyncAllowed() ? kSyncConfirmationDialogHeight |
| + : kSigninErrorDialogHeight; |
| +} |
| + |
| +} // namespace |
| + |
| SigninViewControllerDelegateViews::SigninViewControllerDelegateViews( |
| SigninViewController* signin_view_controller, |
| std::unique_ptr<views::WebView> content_view, |
| @@ -144,13 +155,14 @@ SigninViewControllerDelegateViews::CreateSyncConfirmationWebView( |
| views::WebView* web_view = new views::WebView(browser->profile()); |
| web_view->LoadInitialURL(GURL(chrome::kChromeUISyncConfirmationURL)); |
| + int dialog_preferred_height = |
| + GetSyncConfirmationDialogPreferredHeight(browser->profile()); |
| int max_height = browser |
| ->window() |
| ->GetWebContentsModalDialogHost() |
| ->GetMaximumDialogSize().height(); |
| - web_view->SetPreferredSize( |
| - gfx::Size(kModalDialogWidth, |
| - std::min(kSyncConfirmationDialogHeight, max_height))); |
| + web_view->SetPreferredSize(gfx::Size( |
| + kModalDialogWidth, std::min(dialog_preferred_height, max_height))); |
| return std::unique_ptr<views::WebView>(web_view); |
| } |