| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_INLINE_LOGIN_HANDLER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_IMPL_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_IMPL_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // to create a new profile instead. | 144 // to create a new profile instead. |
| 145 CREATE_NEW_USER, | 145 CREATE_NEW_USER, |
| 146 | 146 |
| 147 // The user chose to sign in and enable sync in the current profile. | 147 // The user chose to sign in and enable sync in the current profile. |
| 148 START_SYNC, | 148 START_SYNC, |
| 149 | 149 |
| 150 // The user chose abort sign in. | 150 // The user chose abort sign in. |
| 151 CLOSE | 151 CLOSE |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 InlineSigninHelper( | 154 InlineSigninHelper(base::WeakPtr<InlineLoginHandlerImpl> handler, |
| 155 base::WeakPtr<InlineLoginHandlerImpl> handler, | 155 net::URLRequestContextGetter* getter, |
| 156 net::URLRequestContextGetter* getter, | 156 Profile* profile, |
| 157 Profile* profile, | 157 Profile::CreateStatus create_status, |
| 158 const GURL& current_url, | 158 const GURL& current_url, |
| 159 const std::string& email, | 159 const std::string& email, |
| 160 const std::string& gaia_id, | 160 const std::string& gaia_id, |
| 161 const std::string& password, | 161 const std::string& password, |
| 162 const std::string& session_index, | 162 const std::string& session_index, |
| 163 const std::string& auth_code, | 163 const std::string& auth_code, |
| 164 const std::string& signin_scoped_device_id, | 164 const std::string& signin_scoped_device_id, |
| 165 bool choose_what_to_sync, | 165 bool choose_what_to_sync, |
| 166 bool confirm_untrusted_signin); | 166 bool confirm_untrusted_signin); |
| 167 ~InlineSigninHelper() override; | 167 ~InlineSigninHelper() override; |
| 168 | 168 |
| 169 private: | 169 private: |
| 170 // Handles cross account sign in error. If the supplied |email| does not match | 170 // Handles cross account sign in error. If the supplied |email| does not match |
| 171 // the last signed in email of the current profile, then Chrome will show a | 171 // the last signed in email of the current profile, then Chrome will show a |
| 172 // confirmation dialog before starting sync. It returns true if there is a | 172 // confirmation dialog before starting sync. It returns true if there is a |
| 173 // cross account error, and false otherwise. | 173 // cross account error, and false otherwise. |
| 174 bool HandleCrossAccountError( | 174 bool HandleCrossAccountError( |
| 175 const std::string& refresh_token, | 175 const std::string& refresh_token, |
| 176 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required, | 176 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required, |
| 177 OneClickSigninSyncStarter::StartSyncMode start_mode); | 177 OneClickSigninSyncStarter::StartSyncMode start_mode); |
| 178 | 178 |
| 179 // Callback used with ConfirmEmailDialogDelegate. | 179 // Callback used with ConfirmEmailDialogDelegate. |
| 180 void ConfirmEmailAction( | 180 void ConfirmEmailAction( |
| 181 content::WebContents* web_contents, | 181 content::WebContents* web_contents, |
| 182 const std::string& refresh_token, | 182 const std::string& refresh_token, |
| 183 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required, | 183 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required, |
| 184 OneClickSigninSyncStarter::StartSyncMode start_mode, | 184 OneClickSigninSyncStarter::StartSyncMode start_mode, |
| 185 Action action); | 185 Action action); |
| 186 | 186 |
| 187 // Overridden from GaiaAuthConsumer. | 187 // Overridden from GaiaAuthConsumer. |
| 188 void OnClientOAuthSuccess(const ClientOAuthResult& result) override; | 188 void OnClientOAuthSuccess(const ClientOAuthResult& result) override; |
| 189 void OnClientOAuthFailure(const GoogleServiceAuthError& error) | 189 void OnClientOAuthFailure(const GoogleServiceAuthError& error) |
| 190 override; | 190 override; |
| 191 | 191 |
| 192 void OnClientOAuthSuccessAndBrowserOpened(const ClientOAuthResult& result, |
| 193 Profile* profile, |
| 194 Profile::CreateStatus status); |
| 195 |
| 192 // Creates the sync starter. Virtual for tests. Call to exchange oauth code | 196 // Creates the sync starter. Virtual for tests. Call to exchange oauth code |
| 193 // for tokens. | 197 // for tokens. |
| 194 virtual void CreateSyncStarter( | 198 virtual void CreateSyncStarter( |
| 195 Browser* browser, | 199 Browser* browser, |
| 196 content::WebContents* contents, | 200 content::WebContents* contents, |
| 197 const GURL& current_url, | 201 const GURL& current_url, |
| 198 const GURL& continue_url, | 202 const GURL& continue_url, |
| 199 const std::string& refresh_token, | 203 const std::string& refresh_token, |
| 200 OneClickSigninSyncStarter::StartSyncMode start_mode, | 204 OneClickSigninSyncStarter::StartSyncMode start_mode, |
| 201 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required); | 205 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required); |
| 202 | 206 |
| 203 GaiaAuthFetcher gaia_auth_fetcher_; | 207 GaiaAuthFetcher gaia_auth_fetcher_; |
| 204 base::WeakPtr<InlineLoginHandlerImpl> handler_; | 208 base::WeakPtr<InlineLoginHandlerImpl> handler_; |
| 205 Profile* profile_; | 209 Profile* profile_; |
| 210 Profile::CreateStatus create_status_; |
| 206 GURL current_url_; | 211 GURL current_url_; |
| 207 std::string email_; | 212 std::string email_; |
| 208 std::string gaia_id_; | 213 std::string gaia_id_; |
| 209 std::string password_; | 214 std::string password_; |
| 210 std::string session_index_; | 215 std::string session_index_; |
| 211 std::string auth_code_; | 216 std::string auth_code_; |
| 212 bool choose_what_to_sync_; | 217 bool choose_what_to_sync_; |
| 213 bool confirm_untrusted_signin_; | 218 bool confirm_untrusted_signin_; |
| 214 | 219 |
| 215 DISALLOW_COPY_AND_ASSIGN(InlineSigninHelper); | 220 DISALLOW_COPY_AND_ASSIGN(InlineSigninHelper); |
| 216 }; | 221 }; |
| 217 | 222 |
| 218 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_IMPL_H_ | 223 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_IMPL_H_ |
| OLD | NEW |