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

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

Issue 10192005: Refactor LoginUIService to not rely on WebUI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 d0d242af248d6a24d12ed0064f67069d3d5e5942..9864b4e13c7c77ec9316c398449fe04d5b95f543 100644
--- a/chrome/browser/ui/webui/signin/login_ui_service.h
+++ b/chrome/browser/ui/webui/signin/login_ui_service.h
@@ -11,14 +11,24 @@
class Profile;
-namespace content {
-class WebUI;
-};
-
// The LoginUIService helps track per-profile information for the login UI -
// for example, whether there is login UI currently on-screen.
class LoginUIService : public ProfileKeyedService {
public:
+ // Various UI components implement this API to allow LoginUIService to
+ // manipulate their associated login UI.
+ class LoginUI {
+ public:
+ // 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() {}
+ };
+
// Creates a LoginUIService associated with the passed |profile|. |profile|
// is used to create a new browser in the case that ShowLoginUI() is invoked
// when no browser windows are open (e.g. via the Mac menu bar).
@@ -26,33 +36,26 @@ class LoginUIService : public ProfileKeyedService {
virtual ~LoginUIService();
// Gets the currently active login UI, or null if no login UI is active.
- content::WebUI* current_login_ui() const {
+ LoginUI* current_login_ui() const {
return ui_;
}
// Sets the currently active login UI. It is illegal to call this if there is
// already login UI visible.
- void SetLoginUI(content::WebUI* ui);
+ 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.
- void LoginUIClosed(content::WebUI* ui);
-
- // Brings the current login UI for this profile to the foreground (it is an
- // error to call this if there is no visible login UI.
- void FocusLoginUI();
+ void LoginUIClosed(LoginUI* ui);
- // Displays the login dialog if the user is not yet logged in, otherwise
- // displays the sync setup dialog. If |force_login| is true, then the login
- // UI is displayed even if the user is already logged in (useful if we need
- // to gather GAIA credentials for oauth tokens). Virtual for mocking purposes.
- // TODO(atwilson): Refactor this API to make the behavior more clear and use
- // an enum instead of a boolean (http://crbug.com/118795).
- virtual void ShowLoginUI(bool force_login);
+ // Brings the login UI to the foreground, or if there is no login UI,
+ // navigates to the login UI page in a new browser tab.
+ // Virtual for mocking purposes.
+ virtual void ShowLoginUI();
private:
// Weak pointer to the currently active login UI, or null if none.
- content::WebUI* ui_;
+ LoginUI* ui_;
// Weak pointer to the profile this service is associated with.
Profile* profile_;

Powered by Google App Engine
This is Rietveld 408576698