Chromium Code Reviews| Index: chrome/browser/policy/user_policy_signin_service.cc |
| diff --git a/chrome/browser/policy/user_policy_signin_service.cc b/chrome/browser/policy/user_policy_signin_service.cc |
| index a56644f5d577a1d5473050d92d025d7bd9ab1f91..58d1f5b09c65d8bf2dde3bf3c51e77c5ef1a58a0 100644 |
| --- a/chrome/browser/policy/user_policy_signin_service.cc |
| +++ b/chrome/browser/policy/user_policy_signin_service.cc |
| @@ -12,6 +12,8 @@ |
| #include "chrome/browser/policy/user_cloud_policy_manager_factory.h" |
| #include "chrome/browser/prefs/pref_service.h" |
| #include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/signin/about_signin_internals.h" |
| +#include "chrome/browser/signin/about_signin_internals_factory.h" |
| #include "chrome/browser/signin/signin_manager.h" |
| #include "chrome/browser/signin/signin_manager_factory.h" |
| #include "chrome/browser/signin/token_service.h" |
| @@ -24,6 +26,8 @@ |
| #include "google_apis/gaia/gaia_urls.h" |
| #include "google_apis/gaia/oauth2_access_token_fetcher.h" |
| +using content::BrowserThread; |
| + |
| namespace { |
| // Various OAuth service scopes required to do CloudPolicyClient registration. |
| const char kServiceScopeChromeOSDeviceManagement[] = |
| @@ -286,6 +290,16 @@ void UserPolicySigninService::OnGetTokenFailure( |
| const GoogleServiceAuthError& error) { |
| DLOG(WARNING) << "Could not fetch access token for " |
| << kServiceScopeChromeOSDeviceManagement; |
| + |
| + // TODO(vishwath): This can be removed when refactoring this class to use |
| + // OAuth2TokenService instead. |
| + // Let AboutSigninInternals know about the failed token fetch. |
| + DCHECK(profile_); |
|
Mattias Nissler (ping if slow)
2012/12/20 09:16:11
Any good reason for this DCHECK? If |profile_| is
|
| + AboutSigninInternalsFactory::GetForProfile(profile_)-> |
| + NotifyTokenReceivedFailure( |
| + signin_internals_util::kUserPolicySigninServiceToken, |
| + error.ToString()); |
| + |
| oauth2_access_token_fetcher_.reset(); |
| // If there was a pending fetch request, let them know the fetch failed. |
| NotifyPendingFetchCallback(false); |
| @@ -294,8 +308,19 @@ void UserPolicySigninService::OnGetTokenFailure( |
| void UserPolicySigninService::OnGetTokenSuccess( |
| const std::string& access_token, |
| const base::Time& expiration_time) { |
| + // Pass along the new access token to the CloudPolicyClient. |
|
Mattias Nissler (ping if slow)
2012/12/20 09:16:11
nit: This comment is stale and probably a merge ar
|
| oauth_access_token_ = access_token; |
| - DVLOG(1) << "Fetched new scoped OAuth token:" << oauth_access_token_; |
| + DVLOG(1) << "Fetched new scoped OAuth token:" << access_token; |
| + |
| + // TODO(vishwath): This can be removed when refactoring this class to use |
| + // OAuth2TokenService instead. |
|
Andrew T Wilson (Slow)
2012/12/21 11:42:29
Remove this comment, as we are not going to refact
|
| + DCHECK(profile_); |
|
Mattias Nissler (ping if slow)
2012/12/20 09:16:11
same here.
|
| + AboutSigninInternalsFactory::GetForProfile(profile_)-> |
| + NotifyTokenReceivedSuccess( |
| + signin_internals_util::kUserPolicySigninServiceToken, |
| + access_token, |
| + true); |
| + |
| oauth2_access_token_fetcher_.reset(); |
| // Now we've gotten our access token - contact GAIA to see if this is a |
| // hosted domain. |