| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_CHROMEOS_LOGIN_OAUTH_LOGIN_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_OAUTH_LOGIN_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_OAUTH_LOGIN_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_OAUTH_LOGIN_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 11 #include "net/url_request/url_request_context_getter.h" | 9 #include "net/url_request/url_request_context_getter.h" |
| 12 | 10 |
| 13 class Profile; | 11 class Profile; |
| 14 | 12 |
| 15 namespace chromeos { | 13 namespace chromeos { |
| 16 | 14 |
| 17 // This class is responsible for restoring authenticated web sessions out of | 15 // This class is responsible for restoring authenticated web sessions out of |
| 18 // OAuth tokens or vice versa. | 16 // OAuth tokens or vice versa. |
| 19 class OAuthLoginManager { | 17 class OAuthLoginManager { |
| 20 public: | 18 public: |
| 21 enum SessionRestoreState { | 19 enum SessionRestoreState { |
| 22 // Session restore is not started. | 20 // Session restore is not started. |
| 23 SESSION_RESTORE_NOT_STARTED, | 21 SESSION_RESTORE_NOT_STARTED, |
| 24 // Session restore is in progress. We are currently issuing calls to verify | 22 // Session restore is in progress. We are currently issuing calls to verify |
| 25 // stored OAuth tokens and populate cookie jar with GAIA credentials. | 23 // stored OAuth tokens and populate cookie jar with GAIA credentials. |
| 26 SESSION_RESTORE_IN_PROGRESS, | 24 SESSION_RESTORE_IN_PROGRESS, |
| 27 // Session restore is completed. | 25 // Session restore is completed. |
| 28 SESSION_RESTORE_DONE, | 26 SESSION_RESTORE_DONE, |
| 29 }; | 27 }; |
| 30 | 28 |
| 31 class Delegate { | 29 class Delegate { |
| 32 public: | 30 public: |
| 33 virtual ~Delegate() {} | 31 virtual ~Delegate() {} |
| 34 | 32 |
| 33 // Raised when merge session is completed. |
| 34 virtual void OnCompletedMergeSession() = 0; |
| 35 |
| 35 // Raised when cookie jar authentication is successfully completed. | 36 // Raised when cookie jar authentication is successfully completed. |
| 36 virtual void OnCompletedAuthentication(Profile* user_profile) = 0; | 37 virtual void OnCompletedAuthentication(Profile* user_profile) = 0; |
| 37 | 38 |
| 38 // Raised when stored OAuth(1|2) tokens are found and authentication | 39 // Raised when stored OAuth(1|2) tokens are found and authentication |
| 39 // profile is no longer needed. | 40 // profile is no longer needed. |
| 40 virtual void OnFoundStoredTokens() = 0; | 41 virtual void OnFoundStoredTokens() = 0; |
| 41 | 42 |
| 42 // Raised when policy tokens are retrieved. | 43 // Raised when policy tokens are retrieved. |
| 43 virtual void OnRestoredPolicyTokens() {} | 44 virtual void OnRestoredPolicyTokens() {} |
| 44 }; | 45 }; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 scoped_refptr<net::URLRequestContextGetter> auth_request_context_; | 80 scoped_refptr<net::URLRequestContextGetter> auth_request_context_; |
| 80 bool restore_from_auth_cookies_; | 81 bool restore_from_auth_cookies_; |
| 81 SessionRestoreState state_; | 82 SessionRestoreState state_; |
| 82 | 83 |
| 83 DISALLOW_COPY_AND_ASSIGN(OAuthLoginManager); | 84 DISALLOW_COPY_AND_ASSIGN(OAuthLoginManager); |
| 84 }; | 85 }; |
| 85 | 86 |
| 86 } // namespace chromeos | 87 } // namespace chromeos |
| 87 | 88 |
| 88 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_OAUTH_LOGIN_MANAGER_H_ | 89 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_OAUTH_LOGIN_MANAGER_H_ |
| OLD | NEW |