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

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

Issue 225403019: Revert of [GCM] Adding basic G-services handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | « google_apis/gcm/gcm_client_impl.cc ('k') | 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 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( 213 void OnCheckInCompleted(uint64 android_id, uint64 secret);
214 const checkin_proto::AndroidCheckinResponse& checkin_response);
215 void StartMCSLogin(); 214 void StartMCSLogin();
216 215
217 base::DefaultClock clock_; 216 base::DefaultClock clock_;
218 217
219 CommandLine command_line_; 218 CommandLine command_line_;
220 219
221 base::FilePath gcm_store_path_; 220 base::FilePath gcm_store_path_;
222 uint64 android_id_; 221 uint64 android_id_;
223 uint64 secret_; 222 uint64 secret_;
224 std::string server_host_; 223 std::string server_host_;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 } 416 }
418 417
419 void MCSProbe::CheckIn() { 418 void MCSProbe::CheckIn() {
420 LOG(INFO) << "Check-in request initiated."; 419 LOG(INFO) << "Check-in request initiated.";
421 checkin_proto::ChromeBuildProto chrome_build_proto; 420 checkin_proto::ChromeBuildProto chrome_build_proto;
422 chrome_build_proto.set_platform( 421 chrome_build_proto.set_platform(
423 checkin_proto::ChromeBuildProto::PLATFORM_LINUX); 422 checkin_proto::ChromeBuildProto::PLATFORM_LINUX);
424 chrome_build_proto.set_channel( 423 chrome_build_proto.set_channel(
425 checkin_proto::ChromeBuildProto::CHANNEL_CANARY); 424 checkin_proto::ChromeBuildProto::CHANNEL_CANARY);
426 chrome_build_proto.set_chrome_version(kChromeVersion); 425 chrome_build_proto.set_chrome_version(kChromeVersion);
427
428 CheckinRequest::RequestInfo request_info(
429 0, 0, std::string(), std::vector<std::string>(), chrome_build_proto);
430
431 checkin_request_.reset(new CheckinRequest( 426 checkin_request_.reset(new CheckinRequest(
432 request_info, 427 base::Bind(&MCSProbe::OnCheckInCompleted, base::Unretained(this)),
433 kDefaultBackoffPolicy, 428 kDefaultBackoffPolicy,
434 base::Bind(&MCSProbe::OnCheckInCompleted, base::Unretained(this)), 429 chrome_build_proto,
430 0,
431 0,
432 std::vector<std::string>(),
435 url_request_context_getter_.get())); 433 url_request_context_getter_.get()));
436 checkin_request_->Start(); 434 checkin_request_->Start();
437 } 435 }
438 436
439 void MCSProbe::OnCheckInCompleted( 437 void MCSProbe::OnCheckInCompleted(uint64 android_id, uint64 secret) {
440 const checkin_proto::AndroidCheckinResponse& checkin_response) {
441 bool success = checkin_response.has_android_id() &&
442 checkin_response.android_id() != 0UL &&
443 checkin_response.has_security_token() &&
444 checkin_response.security_token() != 0UL;
445 LOG(INFO) << "Check-in request completion " 438 LOG(INFO) << "Check-in request completion "
446 << (success ? "success!" : "failure!"); 439 << (android_id ? "success!" : "failure!");
447 440 if (!android_id || !secret)
448 if (!success)
449 return; 441 return;
450 442 android_id_ = android_id;
451 android_id_ = checkin_response.android_id(); 443 secret_ = secret;
452 secret_ = checkin_response.security_token();
453 444
454 gcm_store_->SetDeviceCredentials(android_id_, 445 gcm_store_->SetDeviceCredentials(android_id_,
455 secret_, 446 secret_,
456 base::Bind(&MCSProbe::UpdateCallback, 447 base::Bind(&MCSProbe::UpdateCallback,
457 base::Unretained(this))); 448 base::Unretained(this)));
458 449
459 StartMCSLogin(); 450 StartMCSLogin();
460 } 451 }
461 452
462 void MCSProbe::StartMCSLogin() { 453 void MCSProbe::StartMCSLogin() {
(...skipping 27 matching lines...) Expand all
490 481
491 return 0; 482 return 0;
492 } 483 }
493 484
494 } // namespace 485 } // namespace
495 } // namespace gcm 486 } // namespace gcm
496 487
497 int main(int argc, char* argv[]) { 488 int main(int argc, char* argv[]) {
498 return gcm::MCSProbeMain(argc, argv); 489 return gcm::MCSProbeMain(argc, argv);
499 } 490 }
OLDNEW
« no previous file with comments | « 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