Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Unified Diff: chrome/browser/policy/user_policy_signin_service.cc

Issue 11618024: [signin] Support for CrOS and OAuth2AccessTokenConsumer services. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: OnlineAttempt (CrOS) correctly imports UserManager Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..1c0ec2172e0ef0857b8be17964e81d7e17e0577a 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,14 @@ void UserPolicySigninService::OnGetTokenFailure(
const GoogleServiceAuthError& error) {
DLOG(WARNING) << "Could not fetch access token for "
<< kServiceScopeChromeOSDeviceManagement;
+
+ // Let AboutSigninInternals know about the failed token fetch.
+ DCHECK(profile_);
+ 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);
@@ -295,7 +307,15 @@ void UserPolicySigninService::OnGetTokenSuccess(
const std::string& access_token,
const base::Time& expiration_time) {
oauth_access_token_ = access_token;
- DVLOG(1) << "Fetched new scoped OAuth token:" << oauth_access_token_;
+ DVLOG(1) << "Fetched new scoped OAuth token:" << access_token;
+
+ DCHECK(profile_);
+ 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.

Powered by Google App Engine
This is Rietveld 408576698