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

Unified Diff: chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc

Issue 2450843002: Indicate that sync was disabled by administrator. (Closed)
Patch Set: Address code review. Created 4 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 side-by-side diff with in-line comments
Download patch
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);
}

Powered by Google App Engine
This is Rietveld 408576698