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