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

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

Issue 293063002: Multiple account support in chrome.identity.getAuthToken (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use full name of enable-new-profile-management Created 6 years, 6 months 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 else 70 else
71 return std::vector<AccountIds>(); 71 return std::vector<AccountIds>();
72 72
73 } else if (is_visible) { 73 } else if (is_visible) {
74 accounts.push_back(state.ids); 74 accounts.push_back(state.ids);
75 } 75 }
76 } 76 }
77 return accounts; 77 return accounts;
78 } 78 }
79 79
80 std::string AccountTracker::FindAccountKeyByGaiaId(const std::string& gaia_id) {
81 for (std::map<std::string, AccountState>::const_iterator it =
82 accounts_.begin();
83 it != accounts_.end();
84 ++it) {
85 const AccountState& state = it->second;
86 if (state.ids.gaia == gaia_id) {
87 return state.ids.account_key;
88 }
89 }
90
91 return std::string();
92 }
93
80 void AccountTracker::OnRefreshTokenAvailable(const std::string& account_id) { 94 void AccountTracker::OnRefreshTokenAvailable(const std::string& account_id) {
81 // Ignore refresh tokens if there is no primary account ID at all. 95 // Ignore refresh tokens if there is no primary account ID at all.
82 if (signin_manager_account_id().empty()) 96 if (signin_manager_account_id().empty())
83 return; 97 return;
84 98
85 DVLOG(1) << "AVAILABLE " << account_id; 99 DVLOG(1) << "AVAILABLE " << account_id;
86 ClearAuthError(account_id); 100 ClearAuthError(account_id);
87 UpdateSignInState(account_id, true); 101 UpdateSignInState(account_id, true);
88 } 102 }
89 103
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 LOG(ERROR) << "OnOAuthError"; 333 LOG(ERROR) << "OnOAuthError";
320 tracker_->OnUserInfoFetchFailure(this); 334 tracker_->OnUserInfoFetchFailure(this);
321 } 335 }
322 336
323 void AccountIdFetcher::OnNetworkError(int response_code) { 337 void AccountIdFetcher::OnNetworkError(int response_code) {
324 LOG(ERROR) << "OnNetworkError " << response_code; 338 LOG(ERROR) << "OnNetworkError " << response_code;
325 tracker_->OnUserInfoFetchFailure(this); 339 tracker_->OnUserInfoFetchFailure(this);
326 } 340 }
327 341
328 } // namespace extensions 342 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/identity/account_tracker.h ('k') | chrome/browser/extensions/api/identity/gaia_web_auth_flow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698