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

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

Issue 1814513002: Fix sizing issues in the tab modal signin flow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests Created 4 years, 8 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 defc7b14ced891038a8302fbd8c366401fb8da15..48c0e83ac9cbf776bb3c582c7aac4a9a7cc9ca33 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,22 +20,23 @@
const int kPasswordCombinedFixedGaiaViewHeight = 440;
const int kPasswordCombinedFixedGaiaViewWidth = 360;
-const int kFixedGaiaViewHeight = 512;
-const int kFixedGaiaViewWidth = 448;
-const int kSyncConfirmationDialogWidth = 448;
+const int kFixedGaiaViewHeight = 612;
+const int kModalDialogWidth = 448;
const int kSyncConfirmationDialogHeight = 351;
SigninViewControllerDelegateViews::SigninViewControllerDelegateViews(
SigninViewController* signin_view_controller,
views::WebView* content_view,
- Browser* browser)
+ Browser* browser,
+ bool wait_for_size)
: SigninViewControllerDelegate(signin_view_controller,
content_view->GetWebContents()),
content_view_(content_view),
- modal_signin_widget_(nullptr) {
- modal_signin_widget_ = constrained_window::ShowWebModalDialogViews(
- this, browser->tab_strip_model()->GetActiveWebContents());
- content_view_->RequestFocus();
+ modal_signin_widget_(nullptr),
+ wait_for_size_(wait_for_size),
+ browser_(browser) {
+ if (!wait_for_size_)
+ DisplayModal();
}
SigninViewControllerDelegateViews::~SigninViewControllerDelegateViews() {}
@@ -74,6 +75,23 @@ void SigninViewControllerDelegateViews::PerformClose() {
modal_signin_widget_->Close();
}
+void SigninViewControllerDelegateViews::ResizeNativeView(int height) {
+ content_view_->SetPreferredSize(gfx::Size(kModalDialogWidth, height));
+ content_view_->Layout();
+
+ if (wait_for_size_) {
+ // The modal wasn't displayed yet so just show it with the already resized
+ // view.
+ DisplayModal();
+ }
+}
+
+void SigninViewControllerDelegateViews::DisplayModal() {
+ modal_signin_widget_ = constrained_window::ShowWebModalDialogViews(
+ this, browser_->tab_strip_model()->GetActiveWebContents());
+ content_view_->RequestFocus();
+}
+
// static
views::WebView* SigninViewControllerDelegateViews::CreateGaiaWebView(
content::WebContentsDelegate* delegate,
@@ -86,7 +104,7 @@ views::WebView* SigninViewControllerDelegateViews::CreateGaiaWebView(
// Adds Gaia signin webview.
const gfx::Size pref_size =
switches::UsePasswordSeparatedSigninFlow()
- ? gfx::Size(kFixedGaiaViewWidth, kFixedGaiaViewHeight)
+ ? gfx::Size(kModalDialogWidth, kFixedGaiaViewHeight)
: gfx::Size(kPasswordCombinedFixedGaiaViewWidth,
kPasswordCombinedFixedGaiaViewHeight);
views::WebView* web_view = new views::WebView(profile);
@@ -110,7 +128,7 @@ SigninViewControllerDelegateViews::CreateSyncConfirmationWebView(
views::WebView* web_view = new views::WebView(profile);
web_view->LoadInitialURL(GURL(chrome::kChromeUISyncConfirmationURL));
web_view->SetPreferredSize(
- gfx::Size(kSyncConfirmationDialogWidth, kSyncConfirmationDialogHeight));
+ gfx::Size(kModalDialogWidth, kSyncConfirmationDialogHeight));
return web_view;
}
@@ -125,7 +143,7 @@ SigninViewControllerDelegate::CreateModalSigninDelegate(
signin_view_controller,
SigninViewControllerDelegateViews::CreateGaiaWebView(
nullptr, mode, browser->profile(), access_point),
- browser);
+ browser, false);
}
SigninViewControllerDelegate*
@@ -136,5 +154,5 @@ SigninViewControllerDelegate::CreateSyncConfirmationDelegate(
signin_view_controller,
SigninViewControllerDelegateViews::CreateSyncConfirmationWebView(
browser->profile()),
- browser);
+ browser, true);
}

Powered by Google App Engine
This is Rietveld 408576698