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