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

Side by Side Diff: google_apis/gcm/tools/mcs_probe.cc

Issue 215363007: [GCM] Adding basic G-services handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 // A standalone tool for testing MCS connections and the MCS client on their 5 // A standalone tool for testing MCS connections and the MCS client on their
6 // own. 6 // own.
7 7
8 #include <cstddef> 8 #include <cstddef>
9 #include <cstdio> 9 #include <cstdio>
10 #include <string> 10 #include <string>
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 uint64 secret() const { return secret_; } 203 uint64 secret() const { return secret_; }
204 204
205 private: 205 private:
206 void CheckIn(); 206 void CheckIn();
207 void InitializeNetworkState(); 207 void InitializeNetworkState();
208 void BuildNetworkSession(); 208 void BuildNetworkSession();
209 209
210 void LoadCallback(scoped_ptr<GCMStore::LoadResult> load_result); 210 void LoadCallback(scoped_ptr<GCMStore::LoadResult> load_result);
211 void UpdateCallback(bool success); 211 void UpdateCallback(bool success);
212 void ErrorCallback(); 212 void ErrorCallback();
213 void OnCheckInCompleted(uint64 android_id, uint64 secret); 213 void OnCheckInCompleted(
214 const checkin_proto::AndroidCheckinResponse& checkin_response);
214 void StartMCSLogin(); 215 void StartMCSLogin();
215 216
216 base::DefaultClock clock_; 217 base::DefaultClock clock_;
217 218
218 CommandLine command_line_; 219 CommandLine command_line_;
219 220
220 base::FilePath gcm_store_path_; 221 base::FilePath gcm_store_path_;
221 uint64 android_id_; 222 uint64 android_id_;
222 uint64 secret_; 223 uint64 secret_;
223 std::string server_host_; 224 std::string server_host_;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 base::Bind(&MCSProbe::OnCheckInCompleted, base::Unretained(this)), 429 base::Bind(&MCSProbe::OnCheckInCompleted, base::Unretained(this)),
429 kDefaultBackoffPolicy, 430 kDefaultBackoffPolicy,
430 chrome_build_proto, 431 chrome_build_proto,
431 0, 432 0,
432 0, 433 0,
433 std::vector<std::string>(), 434 std::vector<std::string>(),
434 url_request_context_getter_.get())); 435 url_request_context_getter_.get()));
435 checkin_request_->Start(); 436 checkin_request_->Start();
436 } 437 }
437 438
438 void MCSProbe::OnCheckInCompleted(uint64 android_id, uint64 secret) { 439 void MCSProbe::OnCheckInCompleted(
440 const checkin_proto::AndroidCheckinResponse& checkin_response) {
439 LOG(INFO) << "Check-in request completion " 441 LOG(INFO) << "Check-in request completion "
440 << (android_id ? "success!" : "failure!"); 442 << (checkin_response.has_android_id() ? "success!" : "failure!");
fgorski 2014/03/28 14:30:51 add a check if android ID is 0 or not.
fgorski 2014/03/29 01:09:32 Done.
441 if (!android_id || !secret) 443 if (!checkin_response.has_android_id() ||
444 !checkin_response.has_security_token())
442 return; 445 return;
443 android_id_ = android_id; 446
444 secret_ = secret; 447 android_id_ = checkin_response.android_id();
448 secret_ = checkin_response.security_token();
445 449
446 gcm_store_->SetDeviceCredentials(android_id_, 450 gcm_store_->SetDeviceCredentials(android_id_,
447 secret_, 451 secret_,
448 base::Bind(&MCSProbe::UpdateCallback, 452 base::Bind(&MCSProbe::UpdateCallback,
449 base::Unretained(this))); 453 base::Unretained(this)));
450 454
451 StartMCSLogin(); 455 StartMCSLogin();
452 } 456 }
453 457
454 void MCSProbe::StartMCSLogin() { 458 void MCSProbe::StartMCSLogin() {
(...skipping 27 matching lines...) Expand all
482 486
483 return 0; 487 return 0;
484 } 488 }
485 489
486 } // namespace 490 } // namespace
487 } // namespace gcm 491 } // namespace gcm
488 492
489 int main(int argc, char* argv[]) { 493 int main(int argc, char* argv[]) {
490 return gcm::MCSProbeMain(argc, argv); 494 return gcm::MCSProbeMain(argc, argv);
491 } 495 }
OLDNEW
« google_apis/gcm/gcm_client_impl.cc ('K') | « google_apis/gcm/gcm_client_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698