| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 5 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/signin/signin_promo.h" | 9 #include "chrome/browser/signin/signin_promo.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 #if defined(OS_CHROMEOS) | 58 #if defined(OS_CHROMEOS) |
| 59 NOTREACHED(); | 59 NOTREACHED(); |
| 60 #else | 60 #else |
| 61 chrome::ScopedTabbedBrowserDisplayer displayer(profile_); | 61 chrome::ScopedTabbedBrowserDisplayer displayer(profile_); |
| 62 chrome::ShowBrowserSignin( | 62 chrome::ShowBrowserSignin( |
| 63 displayer.browser(), | 63 displayer.browser(), |
| 64 signin_metrics::AccessPoint::ACCESS_POINT_EXTENSIONS); | 64 signin_metrics::AccessPoint::ACCESS_POINT_EXTENSIONS); |
| 65 #endif | 65 #endif |
| 66 } | 66 } |
| 67 | 67 |
| 68 void LoginUIService::SetLastLoginErrorUsername(const base::string16& username) { |
| 69 last_login_error_username_ = username; |
| 70 } |
| 71 |
| 68 void LoginUIService::DisplayLoginResult(Browser* browser, | 72 void LoginUIService::DisplayLoginResult(Browser* browser, |
| 69 const base::string16& message) { | 73 const base::string16& message) { |
| 70 #if defined(OS_CHROMEOS) | 74 #if defined(OS_CHROMEOS) |
| 71 // ChromeOS doesn't have the avatar bubble so it never calls this function. | 75 // ChromeOS doesn't have the avatar bubble so it never calls this function. |
| 72 NOTREACHED(); | 76 NOTREACHED(); |
| 73 #endif | 77 #endif |
| 74 last_login_result_ = message; | 78 last_login_result_ = message; |
| 75 browser->window()->ShowAvatarBubbleFromAvatarButton( | 79 if (switches::IsMaterialDesignUserMenu() && !message.empty()) { |
| 76 message.empty() ? BrowserWindow::AVATAR_BUBBLE_MODE_CONFIRM_SIGNIN | 80 browser->ShowModalSigninErrorWindow(); |
| 77 : BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR, | 81 } else { |
| 78 signin::ManageAccountsParams(), | 82 browser->window()->ShowAvatarBubbleFromAvatarButton( |
| 79 signin_metrics::AccessPoint::ACCESS_POINT_EXTENSIONS); | 83 message.empty() ? BrowserWindow::AVATAR_BUBBLE_MODE_CONFIRM_SIGNIN |
| 84 : BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR, |
| 85 signin::ManageAccountsParams(), |
| 86 signin_metrics::AccessPoint::ACCESS_POINT_EXTENSIONS); |
| 87 } |
| 80 } | 88 } |
| 81 | 89 |
| 82 const base::string16& LoginUIService::GetLastLoginResult() { | 90 const base::string16& LoginUIService::GetLastLoginResult() { |
| 83 return last_login_result_; | 91 return last_login_result_; |
| 84 } | 92 } |
| 93 |
| 94 const base::string16& LoginUIService::GetLastLoginErrorUsername() { |
| 95 return last_login_error_username_; |
| 96 } |
| OLD | NEW |