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

Side by Side Diff: chrome/browser/services/gcm/gcm_account_tracker.cc

Issue 452603002: [GCM] Adding checkin server scope in GCM Account Tracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removing trailing slash from the scope Created 6 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/services/gcm/gcm_account_tracker.h" 5 #include "chrome/browser/services/gcm/gcm_account_tracker.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "google_apis/gaia/google_service_auth_error.h" 11 #include "google_apis/gaia/google_service_auth_error.h"
12 12
13 namespace gcm { 13 namespace gcm {
14 14
15 namespace { 15 namespace {
16 const char kGCMGroupServerScope[] = "https://www.googleapis.com/auth/gcm"; 16 const char kGCMGroupServerScope[] = "https://www.googleapis.com/auth/gcm";
17 const char kGCMCheckinServerScope[] =
18 "https://www.googleapis.com/auth/android_checkin";
17 const char kGCMAccountTrackerName[] = "gcm_account_tracker"; 19 const char kGCMAccountTrackerName[] = "gcm_account_tracker";
18 } // namespace 20 } // namespace
19 21
20 GCMAccountTracker::AccountInfo::AccountInfo(const std::string& email, 22 GCMAccountTracker::AccountInfo::AccountInfo(const std::string& email,
21 AccountState state) 23 AccountState state)
22 : email(email), state(state) { 24 : email(email), state(state) {
23 } 25 }
24 26
25 GCMAccountTracker::AccountInfo::~AccountInfo() { 27 GCMAccountTracker::AccountInfo::~AccountInfo() {
26 } 28 }
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 GetToken(iter); 211 GetToken(iter);
210 } 212 }
211 } 213 }
212 214
213 void GCMAccountTracker::GetToken(AccountInfos::iterator& account_iter) { 215 void GCMAccountTracker::GetToken(AccountInfos::iterator& account_iter) {
214 DCHECK(GetTokenService()); 216 DCHECK(GetTokenService());
215 DCHECK_EQ(account_iter->second.state, TOKEN_NEEDED); 217 DCHECK_EQ(account_iter->second.state, TOKEN_NEEDED);
216 218
217 OAuth2TokenService::ScopeSet scopes; 219 OAuth2TokenService::ScopeSet scopes;
218 scopes.insert(kGCMGroupServerScope); 220 scopes.insert(kGCMGroupServerScope);
221 scopes.insert(kGCMCheckinServerScope);
219 scoped_ptr<OAuth2TokenService::Request> request = 222 scoped_ptr<OAuth2TokenService::Request> request =
220 GetTokenService()->StartRequest(account_iter->first, scopes, this); 223 GetTokenService()->StartRequest(account_iter->first, scopes, this);
221 224
222 pending_token_requests_.push_back(request.release()); 225 pending_token_requests_.push_back(request.release());
223 account_iter->second.state = GETTING_TOKEN; 226 account_iter->second.state = GETTING_TOKEN;
224 } 227 }
225 228
226 void GCMAccountTracker::OnAccountSignedIn(const gaia::AccountIds& ids) { 229 void GCMAccountTracker::OnAccountSignedIn(const gaia::AccountIds& ids) {
227 DVLOG(1) << "Account signed in: " << ids.email; 230 DVLOG(1) << "Account signed in: " << ids.email;
228 AccountInfos::iterator iter = account_infos_.find(ids.account_key); 231 AccountInfos::iterator iter = account_infos_.find(ids.account_key);
(...skipping 18 matching lines...) Expand all
247 iter->second.state = ACCOUNT_REMOVED; 250 iter->second.state = ACCOUNT_REMOVED;
248 CompleteCollectingTokens(); 251 CompleteCollectingTokens();
249 } 252 }
250 253
251 OAuth2TokenService* GCMAccountTracker::GetTokenService() { 254 OAuth2TokenService* GCMAccountTracker::GetTokenService() {
252 DCHECK(account_tracker_->identity_provider()); 255 DCHECK(account_tracker_->identity_provider());
253 return account_tracker_->identity_provider()->GetTokenService(); 256 return account_tracker_->identity_provider()->GetTokenService();
254 } 257 }
255 258
256 } // namespace gcm 259 } // namespace gcm
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698