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

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

Issue 2619963003: Change the views sign-in dialog to be tab modal. (Closed)
Patch Set: Fix field order Created 3 years, 11 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
« no previous file with comments | « chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9a650bf4c4adb8718645cd30d06435887fadf8f5..83f947ef4e68a24612efaa5dfcb870cea679a72c 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
@@ -42,17 +42,21 @@ SigninViewControllerDelegateViews::SigninViewControllerDelegateViews(
SigninViewController* signin_view_controller,
std::unique_ptr<views::WebView> content_view,
Browser* browser,
+ ui::ModalType dialog_modal_type,
bool wait_for_size)
: SigninViewControllerDelegate(signin_view_controller,
content_view->GetWebContents()),
content_view_(content_view.release()),
modal_signin_widget_(nullptr),
+ dialog_modal_type_(dialog_modal_type),
wait_for_size_(wait_for_size),
browser_(browser) {
DCHECK(browser_);
DCHECK(browser_->tab_strip_model()->GetActiveWebContents())
<< "A tab must be active to present the sign-in modal dialog.";
-
+ DCHECK(dialog_modal_type == ui::MODAL_TYPE_CHILD ||
+ dialog_modal_type == ui::MODAL_TYPE_WINDOW)
+ << "Unsupported dialog modal type " << dialog_modal_type;
if (!wait_for_size_)
DisplayModal();
}
@@ -78,7 +82,7 @@ void SigninViewControllerDelegateViews::DeleteDelegate() {
}
ui::ModalType SigninViewControllerDelegateViews::GetModalType() const {
- return ui::MODAL_TYPE_WINDOW;
+ return dialog_modal_type_;
}
bool SigninViewControllerDelegateViews::ShouldShowCloseButton() const {
@@ -121,9 +125,20 @@ void SigninViewControllerDelegateViews::DisplayModal() {
return;
gfx::NativeWindow window = host_web_contents->GetTopLevelNativeWindow();
- modal_signin_widget_ =
- constrained_window::CreateBrowserModalDialogViews(this, window);
- modal_signin_widget_->Show();
+ switch (dialog_modal_type_) {
+ case ui::MODAL_TYPE_WINDOW:
+ modal_signin_widget_ =
+ constrained_window::CreateBrowserModalDialogViews(this, window);
+ modal_signin_widget_->Show();
+ break;
+ case ui::MODAL_TYPE_CHILD:
+ modal_signin_widget_ = constrained_window::ShowWebModalDialogViews(
+ this, browser_->tab_strip_model()->GetActiveWebContents());
+ break;
+ default:
+ NOTREACHED() << "Unsupported dialog modal type " << dialog_modal_type_;
+ }
+ content_view_->RequestFocus();
}
// static
@@ -206,7 +221,7 @@ SigninViewControllerDelegate::CreateModalSigninDelegate(
signin_view_controller,
SigninViewControllerDelegateViews::CreateGaiaWebView(
nullptr, mode, browser, access_point),
- browser, false);
+ browser, ui::MODAL_TYPE_CHILD, false);
}
SigninViewControllerDelegate*
@@ -216,7 +231,7 @@ SigninViewControllerDelegate::CreateSyncConfirmationDelegate(
return new SigninViewControllerDelegateViews(
signin_view_controller,
SigninViewControllerDelegateViews::CreateSyncConfirmationWebView(browser),
- browser, true);
+ browser, ui::MODAL_TYPE_WINDOW, true);
}
SigninViewControllerDelegate*
@@ -226,5 +241,5 @@ SigninViewControllerDelegate::CreateSigninErrorDelegate(
return new SigninViewControllerDelegateViews(
signin_view_controller,
SigninViewControllerDelegateViews::CreateSigninErrorWebView(browser),
- browser, true);
+ browser, ui::MODAL_TYPE_WINDOW, true);
}
« no previous file with comments | « chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698