| 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/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_finder.h" |
| 9 #include "chrome/browser/ui/browser_navigator.h" | 10 #include "chrome/browser/ui/browser_navigator.h" |
| 10 #include "chrome/browser/ui/chrome_pages.h" | 11 #include "chrome/browser/ui/chrome_pages.h" |
| 11 #include "chrome/browser/ui/host_desktop.h" | 12 #include "chrome/browser/ui/host_desktop.h" |
| 12 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 13 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 13 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" | 14 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" |
| 14 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
| 15 | 16 |
| 16 LoginUIService::LoginUIService(Profile* profile) | 17 LoginUIService::LoginUIService(Profile* profile) |
| 17 : ui_(NULL), profile_(profile) { | 18 : ui_(NULL), profile_(profile) { |
| 18 } | 19 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 35 | 36 |
| 36 void LoginUIService::LoginUIClosed(LoginUI* ui) { | 37 void LoginUIService::LoginUIClosed(LoginUI* ui) { |
| 37 if (current_login_ui() != ui) | 38 if (current_login_ui() != ui) |
| 38 return; | 39 return; |
| 39 | 40 |
| 40 ui_ = NULL; | 41 ui_ = NULL; |
| 41 FOR_EACH_OBSERVER(Observer, observer_list_, OnLoginUIClosed(ui)); | 42 FOR_EACH_OBSERVER(Observer, observer_list_, OnLoginUIClosed(ui)); |
| 42 } | 43 } |
| 43 | 44 |
| 44 void LoginUIService::ShowLoginPopup() { | 45 void LoginUIService::ShowLoginPopup() { |
| 45 if (current_login_ui()) { | 46 Browser* browser = FindOrCreateTabbedBrowser(profile_, |
| 46 current_login_ui()->FocusUI(); | 47 chrome::GetActiveDesktop()); |
| 47 return; | 48 chrome::ShowBrowserSignin(browser, SyncPromoUI::SOURCE_APP_LAUNCHER); |
| 48 } | |
| 49 | |
| 50 Browser* browser = | |
| 51 new Browser(Browser::CreateParams(Browser::TYPE_POPUP, profile_, | |
| 52 chrome::GetActiveDesktop())); | |
| 53 // TODO(munjal): Change the source from SOURCE_NTP_LINK to something else | |
| 54 // once we have added a new source for extension API. | |
| 55 GURL signin_url(SyncPromoUI::GetSyncPromoURL(GURL(), | |
| 56 SyncPromoUI::SOURCE_NTP_LINK, | |
| 57 true)); | |
| 58 chrome::NavigateParams params(browser, | |
| 59 signin_url, | |
| 60 content::PAGE_TRANSITION_AUTO_TOPLEVEL); | |
| 61 params.disposition = CURRENT_TAB; | |
| 62 params.window_action = chrome::NavigateParams::SHOW_WINDOW; | |
| 63 chrome::Navigate(¶ms); | |
| 64 } | 49 } |
| OLD | NEW |