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 #include "chrome/browser/chromeos/login/oauth1_login_manager.h" | 5 #include "chrome/browser/chromeos/login/oauth1_login_manager.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/chromeos/login/user_manager.h" | 9 #include "chrome/browser/chromeos/login/user_manager.h" |
10 #include "chrome/browser/policy/browser_policy_connector.h" | 10 #include "chrome/browser/policy/browser_policy_connector.h" |
Joao da Silva
2013/01/17 09:38:05
Not used anymore
Mattias Nissler (ping if slow)
2013/01/22 10:31:39
Done.
| |
11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/signin/token_service.h" | 13 #include "chrome/browser/signin/token_service.h" |
14 #include "chrome/browser/signin/token_service_factory.h" | 14 #include "chrome/browser/signin/token_service_factory.h" |
15 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
18 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
19 #include "google_apis/gaia/gaia_auth_fetcher.h" | 19 #include "google_apis/gaia/gaia_auth_fetcher.h" |
20 #include "google_apis/gaia/gaia_constants.h" | 20 #include "google_apis/gaia/gaia_constants.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 StoreOAuth1Tokens(); | 133 StoreOAuth1Tokens(); |
134 // Verify OAuth1 token by doing OAuthLogin and fetching credentials. If we | 134 // Verify OAuth1 token by doing OAuthLogin and fetching credentials. If we |
135 // have just transfered auth cookies out of authenticated cookie jar, there | 135 // have just transfered auth cookies out of authenticated cookie jar, there |
136 // is no need to try to mint them from OAuth token again. | 136 // is no need to try to mint them from OAuth token again. |
137 VerifyOAuth1AccessToken(); | 137 VerifyOAuth1AccessToken(); |
138 } | 138 } |
139 | 139 |
140 void OAuth1LoginManager::OnOAuth1AccessTokenFetchFailed() { | 140 void OAuth1LoginManager::OnOAuth1AccessTokenFetchFailed() { |
141 LOG(ERROR) << "OAuth1 access token fetch failed!"; | 141 LOG(ERROR) << "OAuth1 access token fetch failed!"; |
142 state_ = OAuthLoginManager::SESSION_RESTORE_DONE; | 142 state_ = OAuthLoginManager::SESSION_RESTORE_DONE; |
143 g_browser_process->browser_policy_connector()->RegisterForUserPolicy( | |
144 EmptyString()); | |
145 } | 143 } |
146 | 144 |
147 void OAuth1LoginManager::OnOAuth1VerificationSucceeded( | 145 void OAuth1LoginManager::OnOAuth1VerificationSucceeded( |
148 const std::string& user_name, const std::string& sid, | 146 const std::string& user_name, const std::string& sid, |
149 const std::string& lsid, const std::string& auth) { | 147 const std::string& lsid, const std::string& auth) { |
150 LOG(INFO) << "OAuth1 token verification succeeded"; | 148 LOG(INFO) << "OAuth1 token verification succeeded"; |
151 // Kick off sync engine. | 149 // Kick off sync engine. |
152 GaiaAuthConsumer::ClientLoginResult credentials(sid, lsid, auth, | 150 GaiaAuthConsumer::ClientLoginResult credentials(sid, lsid, auth, |
153 std::string()); | 151 std::string()); |
154 TokenService* token_service = | 152 TokenService* token_service = |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 } else { | 212 } else { |
215 LOG(INFO) << "Failed to get OAuth1 token/secret encrypted."; | 213 LOG(INFO) << "Failed to get OAuth1 token/secret encrypted."; |
216 // Set the OAuth status invalid so that the user will go through full | 214 // Set the OAuth status invalid so that the user will go through full |
217 // GAIA login next time. | 215 // GAIA login next time. |
218 UserManager::Get()->SaveUserOAuthStatus( | 216 UserManager::Get()->SaveUserOAuthStatus( |
219 user->email(), User::OAUTH1_TOKEN_STATUS_INVALID); | 217 user->email(), User::OAUTH1_TOKEN_STATUS_INVALID); |
220 } | 218 } |
221 } | 219 } |
222 | 220 |
223 } // namespace chromeos | 221 } // namespace chromeos |
OLD | NEW |