Chromium Code Reviews| 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 f7c9a67a89f56a5eae7e2170dcda4b33d7b774b1..5926f946ae77b2bf9b8462d32dfe5bcaf9c7cfba 100644 |
| --- a/chrome/browser/ui/views/profiles/user_manager_view.cc |
| +++ b/chrome/browser/ui/views/profiles/user_manager_view.cc |
| @@ -22,6 +22,7 @@ |
| #include "chrome/browser/ui/browser_finder.h" |
| #include "chrome/browser/ui/browser_window.h" |
| #include "chrome/browser/ui/user_manager.h" |
| +#include "chrome/common/url_constants.h" |
| #include "chrome/grit/chromium_strings.h" |
| #include "chrome/grit/generated_resources.h" |
| #include "components/guest_view/browser/guest_view_manager.h" |
| @@ -66,7 +67,7 @@ ReauthDelegate::ReauthDelegate(UserManagerView* parent, |
| AddChildView(web_view_); |
| SetLayoutManager(new views::FillLayout()); |
| - web_view->GetWebContents()->SetDelegate(this); |
| + 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 |
| @@ -87,6 +88,10 @@ gfx::Size ReauthDelegate::GetPreferredSize() const { |
| UserManager::kPasswordCombinedReauthDialogHeight); |
| } |
| +void ReauthDelegate::DisplayErrorMessage() { |
| + web_view_->LoadInitialURL(GURL(chrome::kChromeUISigninErrorURL)); |
| +} |
| + |
| bool ReauthDelegate::CanResize() const { |
| return true; |
| } |
| @@ -210,17 +215,14 @@ 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); |
| } |
| // static |
| void UserManager::HideReauthDialog() { |
| // This method should only be called if the user manager is already showing. |
|
sky
2016/09/22 20:32:56
Remove comment for similar reasons about DCHECKs?
|
| - if (!IsShowing()) |
| - return; |
| - |
| - instance_->HideReauthDialog(); |
| + if (instance_ && instance_->GetWidget()->IsVisible()) |
| + instance_->HideReauthDialog(); |
| } |
| // static |
| @@ -230,6 +232,28 @@ void UserManager::AddOnUserManagerShownCallbackForTesting( |
| user_manager_shown_callback_for_testing_ = new base::Closure(callback); |
| } |
| +// static |
| +void UserManager::ShowSigninDialog(content::BrowserContext* browser_context, |
| + const base::FilePath& profile_path) { |
| + if (!IsShowing()) |
| + return; |
| + instance_->SetSigninProfilePath(profile_path); |
| + ShowReauthDialog(browser_context, std::string(), |
| + signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT); |
| +} |
| + |
| +// static |
| +void UserManager::DisplayErrorMessage() { |
| + // This method should only be called if the user manager is already showing. |
| + DCHECK(instance_); |
| + instance_->DisplayErrorMessage(); |
| +} |
| + |
| +// static |
| +base::FilePath UserManager::GetSigninProfilePath() { |
| + return instance_->GetSigninProfilePath(); |
| +} |
| + |
| // UserManagerView ------------------------------------------------------------- |
| UserManagerView::UserManagerView() |
| @@ -408,3 +432,16 @@ void UserManagerView::WindowClosing() { |
| bool UserManagerView::ShouldUseCustomFrame() const { |
| return false; |
| } |
| + |
| +void UserManagerView::DisplayErrorMessage() { |
| + if (delegate_) |
| + delegate_->DisplayErrorMessage(); |
| +} |
| + |
| +void UserManagerView::SetSigninProfilePath(const base::FilePath& profile_path) { |
| + signin_profile_path_ = profile_path; |
| +} |
| + |
| +base::FilePath UserManagerView::GetSigninProfilePath() { |
| + return signin_profile_path_; |
| +} |