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

Side by Side Diff: chrome/browser/signin/fake_profile_oauth2_token_service.cc

Issue 23382008: Making OAuth2TokenService multi-login aware, updating callers, minor fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing CR comments. Created 7 years, 3 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
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/signin/fake_profile_oauth2_token_service.h" 5 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
6 6
7 FakeProfileOAuth2TokenService::PendingRequest::PendingRequest() { 7 FakeProfileOAuth2TokenService::PendingRequest::PendingRequest() {
8 } 8 }
9 9
10 FakeProfileOAuth2TokenService::PendingRequest::~PendingRequest() { 10 FakeProfileOAuth2TokenService::PendingRequest::~PendingRequest() {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 std::vector<FakeProfileOAuth2TokenService::PendingRequest> requests = 78 std::vector<FakeProfileOAuth2TokenService::PendingRequest> requests =
79 GetPendingRequests(); 79 GetPendingRequests();
80 // Walk the requests and notify the callbacks. 80 // Walk the requests and notify the callbacks.
81 for (std::vector<PendingRequest>::iterator it = pending_requests_.begin(); 81 for (std::vector<PendingRequest>::iterator it = pending_requests_.begin();
82 it != pending_requests_.end(); ++it) { 82 it != pending_requests_.end(); ++it) {
83 if (it->request && (all_scopes || it->scopes == scope)) 83 if (it->request && (all_scopes || it->scopes == scope))
84 it->request->InformConsumer(error, access_token, expiration); 84 it->request->InformConsumer(error, access_token, expiration);
85 } 85 }
86 } 86 }
87 87
88 std::string FakeProfileOAuth2TokenService::GetRefreshToken() { 88 std::string FakeProfileOAuth2TokenService::GetRefreshToken(
89 const std::string& account_id) {
89 return refresh_token_; 90 return refresh_token_;
90 } 91 }
91 92
92 net::URLRequestContextGetter* 93 net::URLRequestContextGetter*
93 FakeProfileOAuth2TokenService::GetRequestContext() { 94 FakeProfileOAuth2TokenService::GetRequestContext() {
94 return NULL; 95 return NULL;
95 } 96 }
96 97
97 std::vector<FakeProfileOAuth2TokenService::PendingRequest> 98 std::vector<FakeProfileOAuth2TokenService::PendingRequest>
98 FakeProfileOAuth2TokenService::GetPendingRequests() { 99 FakeProfileOAuth2TokenService::GetPendingRequests() {
99 std::vector<PendingRequest> valid_requests; 100 std::vector<PendingRequest> valid_requests;
100 for (std::vector<PendingRequest>::iterator it = pending_requests_.begin(); 101 for (std::vector<PendingRequest>::iterator it = pending_requests_.begin();
101 it != pending_requests_.end(); ++it) { 102 it != pending_requests_.end(); ++it) {
102 if (it->request) 103 if (it->request)
103 valid_requests.push_back(*it); 104 valid_requests.push_back(*it);
104 } 105 }
105 return valid_requests; 106 return valid_requests;
106 } 107 }
107 108
108 void FakeProfileOAuth2TokenService::FetchOAuth2Token( 109 void FakeProfileOAuth2TokenService::FetchOAuth2Token(
109 RequestImpl* request, 110 RequestImpl* request,
111 const std::string& account_id,
110 net::URLRequestContextGetter* getter, 112 net::URLRequestContextGetter* getter,
111 const std::string& client_id, 113 const std::string& client_id,
112 const std::string& client_secret, 114 const std::string& client_secret,
113 const ScopeSet& scopes) { 115 const ScopeSet& scopes) {
116 // TODO(fgorski): Add the |account_id| to the |PendingRequest|.
114 PendingRequest pending_request; 117 PendingRequest pending_request;
115 pending_request.client_id = client_id; 118 pending_request.client_id = client_id;
116 pending_request.client_secret = client_secret; 119 pending_request.client_secret = client_secret;
117 pending_request.scopes = scopes; 120 pending_request.scopes = scopes;
118 pending_request.request = request->AsWeakPtr(); 121 pending_request.request = request->AsWeakPtr();
119 pending_requests_.push_back(pending_request); 122 pending_requests_.push_back(pending_request);
120 } 123 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698