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

Side by Side Diff: google_apis/gcm/gcm_client_impl.cc

Issue 171513004: [GCM] Adding a list of accounts present on the client to checkin request (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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 "google_apis/gcm/gcm_client_impl.h" 5 #include "google_apis/gcm/gcm_client_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 pending_unregistrations_deleter_(&pending_unregistrations_), 119 pending_unregistrations_deleter_(&pending_unregistrations_),
120 weak_ptr_factory_(this) { 120 weak_ptr_factory_(this) {
121 } 121 }
122 122
123 GCMClientImpl::~GCMClientImpl() { 123 GCMClientImpl::~GCMClientImpl() {
124 } 124 }
125 125
126 void GCMClientImpl::Initialize( 126 void GCMClientImpl::Initialize(
127 const checkin_proto::ChromeBuildProto& chrome_build_proto, 127 const checkin_proto::ChromeBuildProto& chrome_build_proto,
128 const base::FilePath& path, 128 const base::FilePath& path,
129 const std::vector<std::string>& account_ids,
129 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, 130 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner,
130 const scoped_refptr<net::URLRequestContextGetter>& 131 const scoped_refptr<net::URLRequestContextGetter>&
131 url_request_context_getter, 132 url_request_context_getter,
132 Delegate* delegate) { 133 Delegate* delegate) {
133 DCHECK_EQ(UNINITIALIZED, state_); 134 DCHECK_EQ(UNINITIALIZED, state_);
134 DCHECK(url_request_context_getter); 135 DCHECK(url_request_context_getter);
135 DCHECK(delegate); 136 DCHECK(delegate);
136 137
137 chrome_build_proto_.CopyFrom(chrome_build_proto); 138 chrome_build_proto_.CopyFrom(chrome_build_proto);
138 url_request_context_getter_ = url_request_context_getter; 139 url_request_context_getter_ = url_request_context_getter;
140 account_ids_ = account_ids;
139 141
140 gcm_store_.reset(new GCMStoreImpl(false, path, blocking_task_runner)); 142 gcm_store_.reset(new GCMStoreImpl(false, path, blocking_task_runner));
141 gcm_store_->Load(base::Bind(&GCMClientImpl::OnLoadCompleted, 143 gcm_store_->Load(base::Bind(&GCMClientImpl::OnLoadCompleted,
142 weak_ptr_factory_.GetWeakPtr())); 144 weak_ptr_factory_.GetWeakPtr()));
143 145
144 delegate_ = delegate; 146 delegate_ = delegate;
145 147
146 // |mcs_client_| might already be set for testing at this point. No need to 148 // |mcs_client_| might already be set for testing at this point. No need to
147 // create a |connection_factory_|. 149 // create a |connection_factory_|.
148 if (!mcs_client_.get()) { 150 if (!mcs_client_.get()) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 233
232 void GCMClientImpl::StartCheckin(const CheckinInfo& checkin_info) { 234 void GCMClientImpl::StartCheckin(const CheckinInfo& checkin_info) {
233 checkin_request_.reset( 235 checkin_request_.reset(
234 new CheckinRequest( 236 new CheckinRequest(
235 base::Bind(&GCMClientImpl::OnCheckinCompleted, 237 base::Bind(&GCMClientImpl::OnCheckinCompleted,
236 weak_ptr_factory_.GetWeakPtr()), 238 weak_ptr_factory_.GetWeakPtr()),
237 kDefaultBackoffPolicy, 239 kDefaultBackoffPolicy,
238 chrome_build_proto_, 240 chrome_build_proto_,
239 checkin_info.android_id, 241 checkin_info.android_id,
240 checkin_info.secret, 242 checkin_info.secret,
243 account_ids_,
241 url_request_context_getter_)); 244 url_request_context_getter_));
242 checkin_request_->Start(); 245 checkin_request_->Start();
243 } 246 }
244 247
245 void GCMClientImpl::OnCheckinCompleted(uint64 android_id, 248 void GCMClientImpl::OnCheckinCompleted(uint64 android_id,
246 uint64 security_token) { 249 uint64 security_token) {
247 checkin_request_.reset(); 250 checkin_request_.reset();
248 251
249 CheckinInfo checkin_info; 252 CheckinInfo checkin_info;
250 checkin_info.android_id = android_id; 253 checkin_info.android_id = android_id;
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 if (iter != incoming_message.data.end()) 490 if (iter != incoming_message.data.end())
488 message_id = iter->second; 491 message_id = iter->second;
489 delegate->OnMessageSendError(app_id, message_id, SERVER_ERROR); 492 delegate->OnMessageSendError(app_id, message_id, SERVER_ERROR);
490 } 493 }
491 494
492 void GCMClientImpl::SetMCSClientForTesting(scoped_ptr<MCSClient> mcs_client) { 495 void GCMClientImpl::SetMCSClientForTesting(scoped_ptr<MCSClient> mcs_client) {
493 mcs_client_ = mcs_client.Pass(); 496 mcs_client_ = mcs_client.Pass();
494 } 497 }
495 498
496 } // namespace gcm 499 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698