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

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

Issue 1984863002: Clean up LoginUIService. Remove Singleton behavior from PeopleHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync and add datatype push update notifications Created 4 years, 7 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.h
diff --git a/chrome/browser/ui/webui/signin/login_ui_service.h b/chrome/browser/ui/webui/signin/login_ui_service.h
index bc789a38b47482210f7e8565525ba68220a4e9f2..dd0e9543d5da45d8bdd00f977744778d36bb7501 100644
--- a/chrome/browser/ui/webui/signin/login_ui_service.h
+++ b/chrome/browser/ui/webui/signin/login_ui_service.h
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_
#define CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_
+#include <list>
+
#include "base/macros.h"
#include "base/observer_list.h"
#include "base/strings/string16.h"
@@ -24,9 +26,6 @@ class LoginUIService : public KeyedService {
// Invoked when the login UI should be brought to the foreground.
virtual void FocusUI() = 0;
- // Invoked when the login UI should be closed. This can be invoked if the
- // user takes an action that should display new login UI.
- virtual void CloseUI() = 0;
protected:
virtual ~LoginUI() {}
};
@@ -45,22 +44,11 @@ class LoginUIService : public KeyedService {
// Interface for obervers of LoginUIService.
class Observer {
public:
- // Called when a new login UI is shown.
- // |ui| The login UI that was just shown. Will never be null.
- virtual void OnLoginUIShown(LoginUI* ui) {}
-
- // Called when a login UI is closed.
- // |ui| The login UI that was just closed; will never be null.
- virtual void OnLoginUIClosed(LoginUI* ui) {}
-
// Called when the sync confirmation UI is closed. |result| indicates the
// option chosen by the user in the confirmation UI.
virtual void OnSyncConfirmationUIClosed(
SyncConfirmationUIClosedResult result) {}
- // Called when a confirmation UI for untrusted signin is shown.
- virtual void OnUntrustedLoginUIShown() {}
-
protected:
virtual ~Observer() {}
};
@@ -68,30 +56,24 @@ class LoginUIService : public KeyedService {
explicit LoginUIService(Profile* profile);
~LoginUIService() override;
- // Gets the currently active login UI, or null if no login UI is active.
- LoginUI* current_login_ui() const {
- return ui_;
- }
-
// |observer| The observer to add or remove; cannot be NULL.
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
- // Sets the currently active login UI. It is illegal to call this if there is
- // already login UI visible.
+ // Gets the currently active login UI, or null if no login UI is active.
+ LoginUI* current_login_ui() const;
+
+ // Sets the currently active login UI. Callers must call LoginUIClosed when
+ // |ui| is no longer valid.
void SetLoginUI(LoginUI* ui);
- // Called when login UI is closed. If the passed UI is the current login UI,
- // sets current_login_ui() to null.
+ // Called when login UI is closed.
void LoginUIClosed(LoginUI* ui);
// Called when the sync confirmation UI is closed. |result| indicates the
// option chosen by the user in the confirmation UI.
void SyncConfirmationUIClosed(SyncConfirmationUIClosedResult result);
- // Called when a confirmation UI for untrusted signin is shown.
- void UntrustedLoginUIShown();
-
// Delegate to an existing login dialog if one exists.
// If not, we make a new popup dialog window, and set it to
// chrome://signin to ask the user to sign in to chrome.
@@ -104,8 +86,8 @@ class LoginUIService : public KeyedService {
const base::string16& GetLastLoginResult();
private:
- // Weak pointer to the currently active login UI, or null if none.
- LoginUI* ui_;
+ // Weak pointers to the recently opened UIs, with the most recent in front.
+ std::list<LoginUI*> ui_list_;
Profile* profile_;
// List of observers.

Powered by Google App Engine
This is Rietveld 408576698