Chromium Code Reviews| 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 #ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "components/keyed_service/core/keyed_service.h" | 10 #include "components/keyed_service/core/keyed_service.h" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 virtual void CloseUI() = 0; | 28 virtual void CloseUI() = 0; |
| 29 protected: | 29 protected: |
| 30 virtual ~LoginUI() {} | 30 virtual ~LoginUI() {} |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 // Interface for obervers of LoginUIService. | 33 // Interface for obervers of LoginUIService. |
| 34 class Observer { | 34 class Observer { |
| 35 public: | 35 public: |
| 36 // Called when a new login UI is shown. | 36 // Called when a new login UI is shown. |
| 37 // |ui| The login UI that was just shown. Will never be null. | 37 // |ui| The login UI that was just shown. Will never be null. |
| 38 virtual void OnLoginUIShown(LoginUI* ui) = 0; | 38 virtual void OnLoginUIShown(LoginUI* ui) {} |
| 39 | 39 |
| 40 // Called when a login UI is closed. | 40 // Called when a login UI is closed. |
| 41 // |ui| The login UI that was just closed; will never be null. | 41 // |ui| The login UI that was just closed; will never be null. |
| 42 virtual void OnLoginUIClosed(LoginUI* ui) = 0; | 42 virtual void OnLoginUIClosed(LoginUI* ui) {} |
| 43 | |
| 44 // Called when a confirmation UI for untrusted signin is shown. | |
| 45 virtual void UntrustedSigninUIShown() {} | |
|
Roger Tawa OOO till Jul 10th
2014/07/28 14:27:50
Is this shown instead of or as well as OnLoginUISh
guohui
2014/08/07 19:53:34
The documentation has been updated to cover all lo
| |
| 43 | 46 |
| 44 protected: | 47 protected: |
| 45 virtual ~Observer() {} | 48 virtual ~Observer() {} |
| 46 }; | 49 }; |
| 47 | 50 |
| 48 explicit LoginUIService(Profile* profile); | 51 explicit LoginUIService(Profile* profile); |
| 49 virtual ~LoginUIService(); | 52 virtual ~LoginUIService(); |
| 50 | 53 |
| 51 // Gets the currently active login UI, or null if no login UI is active. | 54 // Gets the currently active login UI, or null if no login UI is active. |
| 52 LoginUI* current_login_ui() const { | 55 LoginUI* current_login_ui() const { |
| 53 return ui_; | 56 return ui_; |
| 54 } | 57 } |
| 55 | 58 |
| 56 // |observer| The observer to add or remove; cannot be NULL. | 59 // |observer| The observer to add or remove; cannot be NULL. |
| 57 void AddObserver(Observer* observer); | 60 void AddObserver(Observer* observer); |
| 58 void RemoveObserver(Observer* observer); | 61 void RemoveObserver(Observer* observer); |
| 59 | 62 |
| 60 // Sets the currently active login UI. It is illegal to call this if there is | 63 // Sets the currently active login UI. It is illegal to call this if there is |
| 61 // already login UI visible. | 64 // already login UI visible. |
| 62 void SetLoginUI(LoginUI* ui); | 65 void SetLoginUI(LoginUI* ui); |
| 63 | 66 |
| 64 // Called when login UI is closed. If the passed UI is the current login UI, | 67 // Called when login UI is closed. If the passed UI is the current login UI, |
| 65 // sets current_login_ui() to null. | 68 // sets current_login_ui() to null. |
| 66 void LoginUIClosed(LoginUI* ui); | 69 void LoginUIClosed(LoginUI* ui); |
| 67 | 70 |
| 71 // Called when a confirmation UI for untrusted signin is shown. | |
| 72 void UntrustedSigninUIShown(); | |
|
Roger Tawa OOO till Jul 10th
2014/07/28 14:27:50
Rename as well.
guohui
2014/08/07 19:53:34
for consistency i think we should not add On here.
| |
| 73 | |
| 68 // Delegate to an existing login dialog if one exists. | 74 // Delegate to an existing login dialog if one exists. |
| 69 // If not, we make a new popup dialog window, and set it to | 75 // If not, we make a new popup dialog window, and set it to |
| 70 // chrome://signin to ask the user to sign in to chrome. | 76 // chrome://signin to ask the user to sign in to chrome. |
| 71 void ShowLoginPopup(); | 77 void ShowLoginPopup(); |
| 72 | 78 |
| 73 private: | 79 private: |
| 74 // Weak pointer to the currently active login UI, or null if none. | 80 // Weak pointer to the currently active login UI, or null if none. |
| 75 LoginUI* ui_; | 81 LoginUI* ui_; |
| 76 Profile* profile_; | 82 Profile* profile_; |
| 77 | 83 |
| 78 // List of observers. | 84 // List of observers. |
| 79 ObserverList<Observer> observer_list_; | 85 ObserverList<Observer> observer_list_; |
| 80 | 86 |
| 81 DISALLOW_COPY_AND_ASSIGN(LoginUIService); | 87 DISALLOW_COPY_AND_ASSIGN(LoginUIService); |
| 82 }; | 88 }; |
| 83 | 89 |
| 84 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_ | 90 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_ |
| OLD | NEW |