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 "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/signin/signin_promo.h" | 8 #include "chrome/browser/signin/signin_promo.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_navigator.h" | 10 #include "chrome/browser/ui/browser_navigator.h" |
| 11 #include "chrome/browser/ui/browser_window.h" |
11 #include "chrome/browser/ui/chrome_pages.h" | 12 #include "chrome/browser/ui/chrome_pages.h" |
12 #include "chrome/browser/ui/host_desktop.h" | 13 #include "chrome/browser/ui/host_desktop.h" |
13 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 14 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
14 #include "chrome/browser/ui/sync/inline_login_dialog.h" | 15 #include "chrome/browser/ui/sync/inline_login_dialog.h" |
15 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 16 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
16 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
| 18 #include "components/signin/core/common/profile_management_switches.h" |
17 | 19 |
18 #if defined(OS_CHROMEOS) | 20 #if defined(OS_CHROMEOS) |
19 #include "chrome/browser/app_mode/app_mode_utils.h" | 21 #include "chrome/browser/app_mode/app_mode_utils.h" |
20 #endif | 22 #endif |
21 | 23 |
22 LoginUIService::LoginUIService(Profile* profile) | 24 LoginUIService::LoginUIService(Profile* profile) |
23 : ui_(NULL), profile_(profile) { | 25 : ui_(NULL), profile_(profile) { |
24 } | 26 } |
25 | 27 |
26 LoginUIService::~LoginUIService() {} | 28 LoginUIService::~LoginUIService() {} |
(...skipping 30 matching lines...) Expand all Loading... |
57 void LoginUIService::ShowLoginPopup() { | 59 void LoginUIService::ShowLoginPopup() { |
58 #if defined(OS_CHROMEOS) | 60 #if defined(OS_CHROMEOS) |
59 if (chrome::IsRunningInForcedAppMode()) | 61 if (chrome::IsRunningInForcedAppMode()) |
60 InlineLoginDialog::Show(profile_); | 62 InlineLoginDialog::Show(profile_); |
61 #else | 63 #else |
62 chrome::ScopedTabbedBrowserDisplayer displayer( | 64 chrome::ScopedTabbedBrowserDisplayer displayer( |
63 profile_, chrome::GetActiveDesktop()); | 65 profile_, chrome::GetActiveDesktop()); |
64 chrome::ShowBrowserSignin(displayer.browser(), signin::SOURCE_APP_LAUNCHER); | 66 chrome::ShowBrowserSignin(displayer.browser(), signin::SOURCE_APP_LAUNCHER); |
65 #endif | 67 #endif |
66 } | 68 } |
| 69 |
| 70 void LoginUIService::DisplayLoginResult(Browser* browser, |
| 71 const base::string16& message) { |
| 72 last_login_result_ = message; |
| 73 if (switches::IsNewAvatarMenu()) { |
| 74 browser->window()->ShowAvatarBubbleFromAvatarButton( |
| 75 message.empty() ? BrowserWindow::AVATAR_BUBBLE_MODE_CONFIRM_SIGNIN : |
| 76 BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR, |
| 77 signin::ManageAccountsParams()); |
| 78 } else { |
| 79 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
| 80 browser->window()->ShowOneClickSigninBubble( |
| 81 BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE, |
| 82 base::string16(), /* no SAML email */ |
| 83 message, |
| 84 // This callback is never invoked. |
| 85 // TODO(rogerta): Separate out the bubble API so we don't have to pass |
| 86 // ignored |email| and |callback| params. |
| 87 BrowserWindow::StartSyncCallback()); |
| 88 #endif |
| 89 } |
| 90 } |
| 91 |
| 92 const base::string16& LoginUIService::GetLastLoginResult() { |
| 93 return last_login_result_; |
| 94 } |
OLD | NEW |