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

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

Issue 2552473002: Display error message when user try to open a locked supervised user profile when force-sign-in is … (Closed)
Patch Set: refactor Created 4 years 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/user_manager_view.cc
diff --git a/chrome/browser/ui/views/profiles/user_manager_view.cc b/chrome/browser/ui/views/profiles/user_manager_view.cc
index e3cc5d31421c4bb4a10c7d022710bd95fb1e4abe..44d3d108399d7d07bbd1bed765fb8fde72f77ea4 100644
--- a/chrome/browser/ui/views/profiles/user_manager_view.cc
+++ b/chrome/browser/ui/views/profiles/user_manager_view.cc
@@ -60,21 +60,12 @@ bool instance_under_construction_ = false;
ReauthDelegate::ReauthDelegate(UserManagerView* parent,
views::WebView* web_view,
const std::string& email_address,
- signin_metrics::Reason reason)
- : parent_(parent),
- web_view_(web_view),
- email_address_(email_address) {
+ const GURL& url)
+ : parent_(parent), web_view_(web_view), email_address_(email_address) {
AddChildView(web_view_);
SetLayoutManager(new views::FillLayout());
web_view_->GetWebContents()->SetDelegate(this);
-
- // Load the re-auth URL, prepopulated with the user's email address.
- // Add the index of the profile to the URL so that the inline login page
- // knows which profile to load and update the credentials.
- GURL url = signin::GetReauthURLWithEmail(
- signin_metrics::AccessPoint::ACCESS_POINT_USER_MANAGER, reason,
- email_address_);
web_view_->LoadInitialURL(url);
}
@@ -215,14 +206,18 @@ void UserManager::ShowReauthDialog(content::BrowserContext* browser_context,
// This method should only be called if the user manager is already showing.
if (!IsShowing())
return;
- instance_->ShowReauthDialog(browser_context, email, reason);
+ // Load the re-auth URL, prepopulated with the user's email address.
+ // Add the index of the profile to the URL so that the inline login page
+ // knows which profile to load and update the credentials.
+ GURL url = signin::GetReauthURLWithEmail(
+ signin_metrics::AccessPoint::ACCESS_POINT_USER_MANAGER, reason, email);
+ instance_->ShowDialog(browser_context, email, url);
}
// static
-void UserManager::HideReauthDialog() {
- // This method should only be called if the user manager is already showing.
+void UserManager::HideDialog() {
if (instance_ && instance_->GetWidget()->IsVisible())
- instance_->HideReauthDialog();
+ instance_->HideDialog();
}
// static
@@ -238,8 +233,10 @@ void UserManager::ShowSigninDialog(content::BrowserContext* browser_context,
if (!IsShowing())
return;
instance_->SetSigninProfilePath(profile_path);
- ShowReauthDialog(browser_context, std::string(),
- signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT);
+ GURL url = signin::GetPromoURL(
+ signin_metrics::AccessPoint::ACCESS_POINT_USER_MANAGER,
+ signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT, true, true);
+ instance_->ShowDialog(browser_context, std::string(), url);
}
// static
@@ -249,6 +246,13 @@ void UserManager::DisplayErrorMessage() {
instance_->DisplayErrorMessage();
}
+void UserManager::ShowDialogAndDisplayErrorMessage(
+ content::BrowserContext* browser_context) {
+ DCHECK(instance_);
+ instance_->ShowDialog(browser_context, std::string(),
+ GURL(chrome::kChromeUISigninErrorURL));
+}
+
// static
base::FilePath UserManager::GetSigninProfilePath() {
return instance_->GetSigninProfilePath();
@@ -265,7 +269,7 @@ UserManagerView::UserManagerView()
}
UserManagerView::~UserManagerView() {
- HideReauthDialog();
+ HideDialog();
}
// static
@@ -283,22 +287,20 @@ void UserManagerView::OnSystemProfileCreated(
instance_->Init(system_profile, GURL(url));
}
-void UserManagerView::ShowReauthDialog(content::BrowserContext* browser_context,
- const std::string& email,
- signin_metrics::Reason reason) {
- HideReauthDialog();
+void UserManagerView::ShowDialog(content::BrowserContext* browser_context,
+ const std::string& email,
+ const GURL& url) {
+ HideDialog();
// The dialog delegate will be deleted when the widget closes. The created
// WebView's lifetime is managed by the delegate.
- delegate_ = new ReauthDelegate(this,
- new views::WebView(browser_context),
- email,
- reason);
+ delegate_ =
+ new ReauthDelegate(this, new views::WebView(browser_context), email, url);
gfx::NativeView parent = instance_->GetWidget()->GetNativeView();
views::DialogDelegate::CreateDialogWidget(delegate_, nullptr, parent);
delegate_->GetWidget()->Show();
}
-void UserManagerView::HideReauthDialog() {
+void UserManagerView::HideDialog() {
if (delegate_) {
delegate_->CloseReauthDialog();
DCHECK(!delegate_);

Powered by Google App Engine
This is Rietveld 408576698