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

Side by Side Diff: components/gcm_driver/gcm_account_mapper.cc

Issue 594383003: [GCM] Passing GCMClient::AccountTokenInfo list to GCMDriver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@account-mapper
Patch Set: Addressing CR comments Created 6 years, 2 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
« no previous file with comments | « components/gcm_driver/gcm_account_mapper.h ('k') | components/gcm_driver/gcm_client.h » ('j') | 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 "components/gcm_driver/gcm_account_mapper.h" 5 #include "components/gcm_driver/gcm_account_mapper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/guid.h" 8 #include "base/guid.h"
9 #include "base/time/clock.h" 9 #include "base/time/clock.h"
10 #include "base/time/default_clock.h" 10 #include "base/time/default_clock.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 void GCMAccountMapper::Initialize( 49 void GCMAccountMapper::Initialize(
50 const std::vector<AccountMapping>& account_mappings) { 50 const std::vector<AccountMapping>& account_mappings) {
51 DCHECK(!initialized_); 51 DCHECK(!initialized_);
52 initialized_ = true; 52 initialized_ = true;
53 accounts_ = account_mappings; 53 accounts_ = account_mappings;
54 gcm_driver_->AddAppHandler(kGCMAccountMapperAppId, this); 54 gcm_driver_->AddAppHandler(kGCMAccountMapperAppId, this);
55 GetRegistration(); 55 GetRegistration();
56 } 56 }
57 57
58 void GCMAccountMapper::SetAccountTokens( 58 void GCMAccountMapper::SetAccountTokens(
59 const std::vector<GCMClient::AccountTokenInfo> account_tokens) { 59 const std::vector<GCMClient::AccountTokenInfo>& account_tokens) {
60 // If account mapper is not ready to handle tasks yet, save the latest 60 // If account mapper is not ready to handle tasks yet, save the latest
61 // account tokens and return. 61 // account tokens and return.
62 if (!IsReady()) { 62 if (!IsReady()) {
63 pending_account_tokens_ = account_tokens; 63 pending_account_tokens_ = account_tokens;
64 // If mapper is initialized, but still does not have registration ID, 64 // If mapper is initialized, but still does not have registration ID,
65 // maybe the registration gave up. Retrying in case. 65 // maybe the registration gave up. Retrying in case.
66 if (initialized_) 66 if (initialized_)
67 GetRegistration(); 67 GetRegistration();
68 return; 68 return;
69 } 69 }
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 } 348 }
349 349
350 return accounts_.end(); 350 return accounts_.end();
351 } 351 }
352 352
353 void GCMAccountMapper::SetClockForTesting(scoped_ptr<base::Clock> clock) { 353 void GCMAccountMapper::SetClockForTesting(scoped_ptr<base::Clock> clock) {
354 clock_ = clock.Pass(); 354 clock_ = clock.Pass();
355 } 355 }
356 356
357 } // namespace gcm 357 } // namespace gcm
OLDNEW
« no previous file with comments | « components/gcm_driver/gcm_account_mapper.h ('k') | components/gcm_driver/gcm_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698