| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // The signin manager encapsulates some functionality tracking | 5 // The signin manager encapsulates some functionality tracking |
| 6 // which user is signed in. When a user is signed in, a ClientLogin | 6 // which user is signed in. When a user is signed in, a ClientLogin |
| 7 // request is run on their behalf. Auth tokens are fetched from Google | 7 // request is run on their behalf. Auth tokens are fetched from Google |
| 8 // and the results are stored in the TokenService. | 8 // and the results are stored in the TokenService. |
| 9 | 9 |
| 10 #ifndef CHROME_BROWSER_SYNC_SIGNIN_MANAGER_H_ | 10 #ifndef CHROME_BROWSER_SYNC_SIGNIN_MANAGER_H_ |
| 11 #define CHROME_BROWSER_SYNC_SIGNIN_MANAGER_H_ | 11 #define CHROME_BROWSER_SYNC_SIGNIN_MANAGER_H_ |
| 12 #pragma once | 12 #pragma once |
| 13 | 13 |
| 14 #include <string> | 14 #include <string> |
| 15 | 15 |
| 16 #include "base/compiler_specific.h" |
| 16 #include "base/logging.h" | 17 #include "base/logging.h" |
| 17 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 18 #include "chrome/browser/net/gaia/gaia_oauth_fetcher.h" | 19 #include "chrome/browser/net/gaia/gaia_oauth_fetcher.h" |
| 19 #include "chrome/common/net/gaia/gaia_auth_consumer.h" | 20 #include "chrome/common/net/gaia/gaia_auth_consumer.h" |
| 20 #include "chrome/common/net/gaia/google_service_auth_error.h" | 21 #include "chrome/common/net/gaia/google_service_auth_error.h" |
| 21 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
| 22 #include "content/public/browser/notification_registrar.h" | 23 #include "content/public/browser/notification_registrar.h" |
| 23 | 24 |
| 24 class GaiaAuthFetcher; | 25 class GaiaAuthFetcher; |
| 25 class Profile; | 26 class Profile; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // associated with the user, and canceling all auth in progress. | 82 // associated with the user, and canceling all auth in progress. |
| 82 void SignOut(); | 83 void SignOut(); |
| 83 | 84 |
| 84 // Called when a new request to re-authenticate a user is in progress. | 85 // Called when a new request to re-authenticate a user is in progress. |
| 85 // Will clear in memory data but leaves the db as such so when the browser | 86 // Will clear in memory data but leaves the db as such so when the browser |
| 86 // restarts we can use the old token(which might throw a password error). | 87 // restarts we can use the old token(which might throw a password error). |
| 87 void ClearInMemoryData(); | 88 void ClearInMemoryData(); |
| 88 | 89 |
| 89 // GaiaAuthConsumer | 90 // GaiaAuthConsumer |
| 90 virtual void OnClientLoginSuccess(const ClientLoginResult& result) OVERRIDE; | 91 virtual void OnClientLoginSuccess(const ClientLoginResult& result) OVERRIDE; |
| 91 virtual void OnClientLoginFailure(const GoogleServiceAuthError& error) | 92 virtual void OnClientLoginFailure( |
| 92 OVERRIDE; | 93 const GoogleServiceAuthError& error) OVERRIDE; |
| 93 virtual void OnGetUserInfoSuccess(const std::string& key, | 94 virtual void OnGetUserInfoSuccess(const std::string& key, |
| 94 const std::string& value) OVERRIDE; | 95 const std::string& value) OVERRIDE; |
| 95 virtual void OnGetUserInfoKeyNotFound(const std::string& key) OVERRIDE; | 96 virtual void OnGetUserInfoKeyNotFound(const std::string& key) OVERRIDE; |
| 96 virtual void OnGetUserInfoFailure(const GoogleServiceAuthError& error) | 97 virtual void OnGetUserInfoFailure( |
| 97 OVERRIDE; | 98 const GoogleServiceAuthError& error) OVERRIDE; |
| 98 virtual void OnTokenAuthFailure(const GoogleServiceAuthError& error) | 99 virtual void OnTokenAuthFailure(const GoogleServiceAuthError& error) OVERRIDE; |
| 99 OVERRIDE; | |
| 100 | 100 |
| 101 // GaiaOAuthConsumer | 101 // GaiaOAuthConsumer |
| 102 virtual void OnOAuthGetAccessTokenSuccess(const std::string& token, | 102 virtual void OnOAuthGetAccessTokenSuccess(const std::string& token, |
| 103 const std::string& secret) OVERRIDE; | 103 const std::string& secret) OVERRIDE; |
| 104 virtual void OnOAuthGetAccessTokenFailure( | 104 virtual void OnOAuthGetAccessTokenFailure( |
| 105 const GoogleServiceAuthError& error) OVERRIDE; | 105 const GoogleServiceAuthError& error) OVERRIDE; |
| 106 virtual void OnOAuthWrapBridgeSuccess(const std::string& service_name, | 106 virtual void OnOAuthWrapBridgeSuccess(const std::string& service_name, |
| 107 const std::string& token, | 107 const std::string& token, |
| 108 const std::string& expires_in) | 108 const std::string& expires_in) OVERRIDE; |
| 109 OVERRIDE; | 109 virtual void OnOAuthWrapBridgeFailure( |
| 110 virtual void OnOAuthWrapBridgeFailure(const std::string& service_name, | 110 const std::string& service_name, |
| 111 const GoogleServiceAuthError& error); | 111 const GoogleServiceAuthError& error) OVERRIDE; |
| 112 virtual void OnUserInfoSuccess(const std::string& email) OVERRIDE; | 112 virtual void OnUserInfoSuccess(const std::string& email) OVERRIDE; |
| 113 virtual void OnUserInfoFailure(const GoogleServiceAuthError& error) OVERRIDE; | 113 virtual void OnUserInfoFailure(const GoogleServiceAuthError& error) OVERRIDE; |
| 114 | 114 |
| 115 // content::NotificationObserver | 115 // content::NotificationObserver |
| 116 virtual void Observe(int type, | 116 virtual void Observe(int type, |
| 117 const content::NotificationSource& source, | 117 const content::NotificationSource& source, |
| 118 const content::NotificationDetails& details) OVERRIDE; | 118 const content::NotificationDetails& details) OVERRIDE; |
| 119 | 119 |
| 120 private: | 120 private: |
| 121 void PrepareForSignin(); | 121 void PrepareForSignin(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 144 // Actual OAuth login handler. | 144 // Actual OAuth login handler. |
| 145 scoped_ptr<GaiaOAuthFetcher> oauth_login_; | 145 scoped_ptr<GaiaOAuthFetcher> oauth_login_; |
| 146 | 146 |
| 147 // Register for notifications from the TokenService. | 147 // Register for notifications from the TokenService. |
| 148 content::NotificationRegistrar registrar_; | 148 content::NotificationRegistrar registrar_; |
| 149 | 149 |
| 150 DISALLOW_COPY_AND_ASSIGN(SigninManager); | 150 DISALLOW_COPY_AND_ASSIGN(SigninManager); |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 #endif // CHROME_BROWSER_SYNC_SIGNIN_MANAGER_H_ | 153 #endif // CHROME_BROWSER_SYNC_SIGNIN_MANAGER_H_ |
| OLD | NEW |