OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/basictypes.h" |
| 10 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 11 |
| 12 class Profile; |
| 13 |
| 14 namespace content { |
| 15 class WebUI; |
| 16 }; |
| 17 |
| 18 // The LoginUIService helps track per-profile information for the login UI - |
| 19 // for example, whether there is login UI currently on-screen. |
| 20 class LoginUIService : public ProfileKeyedService { |
| 21 public: |
| 22 // Creates a LoginUIService associated with the passed |profile|. |profile| |
| 23 // is used to create a new browser in the case that ShowLoginUI() is invoked |
| 24 // when no browser windows are open (e.g. via the Mac menu bar). |
| 25 explicit LoginUIService(Profile* profile); |
| 26 virtual ~LoginUIService(); |
| 27 |
| 28 // Gets the currently active login UI, or null if no login UI is active. |
| 29 content::WebUI* current_login_ui() const { |
| 30 return ui_; |
| 31 } |
| 32 |
| 33 // Sets the currently active login UI. It is illegal to call this if there is |
| 34 // already login UI visible. |
| 35 void SetLoginUI(content::WebUI* ui); |
| 36 |
| 37 // Called when login UI is closed. If the passed UI is the current login UI, |
| 38 // sets current_login_ui() to null. |
| 39 void LoginUIClosed(content::WebUI* ui); |
| 40 |
| 41 // Brings the current login UI for this profile to the foreground (it is an |
| 42 // error to call this if there is no visible login UI. |
| 43 void FocusLoginUI(); |
| 44 |
| 45 // Displays the login dialog to the user. |
| 46 void ShowLoginUI(); |
| 47 |
| 48 private: |
| 49 // Weak pointer to the currently active login UI, or null if none. |
| 50 content::WebUI* ui_; |
| 51 |
| 52 // Weak pointer to the profile this service is associated with. |
| 53 Profile* profile_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(LoginUIService); |
| 56 }; |
| 57 |
| 58 |
| 59 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_ |
OLD | NEW |