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

Side by Side Diff: chrome/browser/extensions/api/identity/account_tracker.cc

Issue 33173005: Correctly deal with tokens for supervised users in ProfileOAuth2TokenService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/extensions/api/identity/account_tracker.h" 5 #include "chrome/browser/extensions/api/identity/account_tracker.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 void AccountTracker::AddObserver(Observer* observer) { 45 void AccountTracker::AddObserver(Observer* observer) {
46 observer_list_.AddObserver(observer); 46 observer_list_.AddObserver(observer);
47 } 47 }
48 48
49 void AccountTracker::RemoveObserver(Observer* observer) { 49 void AccountTracker::RemoveObserver(Observer* observer) {
50 observer_list_.RemoveObserver(observer); 50 observer_list_.RemoveObserver(observer);
51 } 51 }
52 52
53 void AccountTracker::OnRefreshTokenAvailable(const std::string& account_id) { 53 void AccountTracker::OnRefreshTokenAvailable(const std::string& account_id) {
54 // Ignore refresh tokens if there is no primary account ID at all.
55 ProfileOAuth2TokenService* token_service =
56 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_);
57 if (token_service->GetPrimaryAccountId().empty())
58 return;
59
54 DVLOG(1) << "AVAILABLE " << account_id; 60 DVLOG(1) << "AVAILABLE " << account_id;
55 ClearAuthError(account_id); 61 ClearAuthError(account_id);
56 UpdateSignInState(account_id, true); 62 UpdateSignInState(account_id, true);
57 } 63 }
58 64
59 void AccountTracker::OnRefreshTokenRevoked(const std::string& account_id) { 65 void AccountTracker::OnRefreshTokenRevoked(const std::string& account_id) {
60 DVLOG(1) << "REVOKED " << account_id; 66 DVLOG(1) << "REVOKED " << account_id;
61 UpdateSignInState(account_id, false); 67 UpdateSignInState(account_id, false);
62 } 68 }
63 69
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 LOG(ERROR) << "OnOAuthError"; 246 LOG(ERROR) << "OnOAuthError";
241 tracker_->OnUserInfoFetchFailure(this); 247 tracker_->OnUserInfoFetchFailure(this);
242 } 248 }
243 249
244 void AccountIdFetcher::OnNetworkError(int response_code) { 250 void AccountIdFetcher::OnNetworkError(int response_code) {
245 LOG(ERROR) << "OnNetworkError " << response_code; 251 LOG(ERROR) << "OnNetworkError " << response_code;
246 tracker_->OnUserInfoFetchFailure(this); 252 tracker_->OnUserInfoFetchFailure(this);
247 } 253 }
248 254
249 } // namespace extensions 255 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698