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 28 matching lines...) Expand all Loading... |
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) {} | 42 virtual void OnLoginUIClosed(LoginUI* ui) {} |
43 | 43 |
44 // Called when the sync confirmation UI is closed. |configure_sync_first| | 44 // Called when the sync confirmation UI is closed. |configure_sync_first| |
45 // is true if the user has requested to configure the sync settings before | 45 // is true if the user has requested to configure the sync settings before |
46 // sync starts. | 46 // sync starts. |
47 virtual void OnSyncConfirmationUIClosed(bool configure_sync_first) {} | 47 virtual void OnSyncConfirmationUIClosed(bool configure_sync_first) {} |
48 | 48 |
| 49 // Called when a confirmation UI for untrusted signin is shown. |
| 50 virtual void OnUntrustedLoginUIShown() {} |
| 51 |
49 protected: | 52 protected: |
50 virtual ~Observer() {} | 53 virtual ~Observer() {} |
51 }; | 54 }; |
52 | 55 |
53 explicit LoginUIService(Profile* profile); | 56 explicit LoginUIService(Profile* profile); |
54 virtual ~LoginUIService(); | 57 virtual ~LoginUIService(); |
55 | 58 |
56 // Gets the currently active login UI, or null if no login UI is active. | 59 // Gets the currently active login UI, or null if no login UI is active. |
57 LoginUI* current_login_ui() const { | 60 LoginUI* current_login_ui() const { |
58 return ui_; | 61 return ui_; |
59 } | 62 } |
60 | 63 |
61 // |observer| The observer to add or remove; cannot be NULL. | 64 // |observer| The observer to add or remove; cannot be NULL. |
62 void AddObserver(Observer* observer); | 65 void AddObserver(Observer* observer); |
63 void RemoveObserver(Observer* observer); | 66 void RemoveObserver(Observer* observer); |
64 | 67 |
65 // Sets the currently active login UI. It is illegal to call this if there is | 68 // Sets the currently active login UI. It is illegal to call this if there is |
66 // already login UI visible. | 69 // already login UI visible. |
67 void SetLoginUI(LoginUI* ui); | 70 void SetLoginUI(LoginUI* ui); |
68 | 71 |
69 // Called when login UI is closed. If the passed UI is the current login UI, | 72 // Called when login UI is closed. If the passed UI is the current login UI, |
70 // sets current_login_ui() to null. | 73 // sets current_login_ui() to null. |
71 void LoginUIClosed(LoginUI* ui); | 74 void LoginUIClosed(LoginUI* ui); |
72 | 75 |
73 // Called when the sync settings confirmation UI is closed. | 76 // Called when the sync settings confirmation UI is closed. |
74 void SyncConfirmationUIClosed(bool configure_sync_first); | 77 void SyncConfirmationUIClosed(bool configure_sync_first); |
75 | 78 |
| 79 // Called when a confirmation UI for untrusted signin is shown. |
| 80 void UntrustedLoginUIShown(); |
| 81 |
76 // Delegate to an existing login dialog if one exists. | 82 // Delegate to an existing login dialog if one exists. |
77 // If not, we make a new popup dialog window, and set it to | 83 // If not, we make a new popup dialog window, and set it to |
78 // chrome://signin to ask the user to sign in to chrome. | 84 // chrome://signin to ask the user to sign in to chrome. |
79 void ShowLoginPopup(); | 85 void ShowLoginPopup(); |
80 | 86 |
81 private: | 87 private: |
82 // Weak pointer to the currently active login UI, or null if none. | 88 // Weak pointer to the currently active login UI, or null if none. |
83 LoginUI* ui_; | 89 LoginUI* ui_; |
84 Profile* profile_; | 90 Profile* profile_; |
85 | 91 |
86 // List of observers. | 92 // List of observers. |
87 ObserverList<Observer> observer_list_; | 93 ObserverList<Observer> observer_list_; |
88 | 94 |
89 DISALLOW_COPY_AND_ASSIGN(LoginUIService); | 95 DISALLOW_COPY_AND_ASSIGN(LoginUIService); |
90 }; | 96 }; |
91 | 97 |
92 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_ | 98 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_ |
OLD | NEW |