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

Unified Diff: chrome/browser/ui/webui/signin/login_ui_service.cc

Issue 10699013: Add a method to LoginUIService to open the sign in UI in a popup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 months 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/webui/signin/login_ui_service.cc
===================================================================
--- chrome/browser/ui/webui/signin/login_ui_service.cc (revision 144917)
+++ chrome/browser/ui/webui/signin/login_ui_service.cc (working copy)
@@ -5,9 +5,20 @@
#include "chrome/browser/ui/webui/signin/login_ui_service.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/common/url_constants.h"
+#include "chrome/common/chrome_notification_types.h"
+#include "content/public/browser/notification_service.h"
+#include "content/public/browser/notification_source.h"
+#include "content/public/browser/page_navigator.h"
+#include "content/public/common/page_transition_types.h"
+#include "content/public/common/referrer.h"
+#include "webkit/glue/window_open_disposition.h"
+using content::OpenURLParams;
+using content::Referrer;
+
LoginUIService::LoginUIService() : ui_(NULL) {
}
@@ -16,11 +27,15 @@
void LoginUIService::SetLoginUI(LoginUI* ui) {
DCHECK(!current_login_ui() || current_login_ui() == ui);
ui_ = ui;
+ FireLoginUIChanged();
}
void LoginUIService::LoginUIClosed(LoginUI* ui) {
- if (current_login_ui() == ui)
- ui_ = NULL;
+ if (current_login_ui() != ui)
+ return;
+
+ ui_ = NULL;
+ FireLoginUIChanged();
}
void LoginUIService::ShowLoginUI(Browser* browser) {
@@ -33,3 +48,23 @@
// Need to navigate to the settings page and display the UI.
chrome::ShowSettingsSubPage(browser, chrome::kSyncSetupSubPage);
}
+
+void LoginUIService::ShowLoginDialogUI(Browser* browser) {
Andrew T Wilson (Slow) 2012/07/03 17:34:09 This isn't displaying a dialog - it's displaying a
Munjal (Google) 2012/07/03 17:52:17 I changed the name to ShowLoginUIPopup. I think it
Andrew T Wilson (Slow) 2012/07/09 19:52:06 Let's put this in the caller (take it out of this
Munjal (Google) 2012/07/09 21:13:26 Done.
+ if (ui_) {
+ // We already have active login UI - make it visible.
+ ui_->FocusUI();
+ return;
+ }
+
+ OpenURLParams params(
+ GURL(chrome::kChromeUISyncPromoURL), Referrer(), NEW_POPUP,
+ content::PAGE_TRANSITION_START_PAGE, false);
+ browser->OpenURL(params);
+}
+
+void LoginUIService::FireLoginUIChanged() const {
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_LOGIN_UI_CHANGED,
+ content::Source<LoginUIService>(this),
+ content::NotificationService::NoDetails());
Andrew T Wilson (Slow) 2012/07/03 17:34:09 Does it make sense to send out the current login U
Munjal (Google) 2012/07/03 17:52:17 We discussed that remember? In fact, your suggesti
Andrew T Wilson (Slow) 2012/07/09 19:52:06 Yeah, I remember, and I was just reconsidering the
+}

Powered by Google App Engine
This is Rietveld 408576698