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

Unified Diff: google_apis/gcm/gcm_client_impl.cc

Issue 226893002: Revert of [GCM] Adding periodic checkin controlled by G-services settings (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « google_apis/gcm/gcm_client_impl.h ('k') | google_apis/gcm/gcm_client_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/gcm/gcm_client_impl.cc
diff --git a/google_apis/gcm/gcm_client_impl.cc b/google_apis/gcm/gcm_client_impl.cc
index 18f6176ce077952c8b27aab1795abcbcbc16c998..9aaa043285e8774c24159866596b7134fad6274b 100644
--- a/google_apis/gcm/gcm_client_impl.cc
+++ b/google_apis/gcm/gcm_client_impl.cc
@@ -11,7 +11,6 @@
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/sequenced_task_runner.h"
-#include "base/strings/string_number_conversions.h"
#include "base/time/default_clock.h"
#include "google_apis/gcm/base/mcs_message.h"
#include "google_apis/gcm/base/mcs_util.h"
@@ -214,8 +213,6 @@
device_checkin_info_.android_id = result->device_android_id;
device_checkin_info_.secret = result->device_security_token;
base::Time last_checkin_time = result->last_checkin_time;
- gservices_settings_ = result->gservices_settings;
- gservices_digest_ = result->gservices_digest;
InitializeMCSClient(result.Pass());
if (device_checkin_info_.IsValid()) {
@@ -288,35 +285,31 @@
}
void GCMClientImpl::StartCheckin() {
- CheckinRequest::RequestInfo request_info(
- device_checkin_info_.android_id,
- device_checkin_info_.secret,
- gservices_digest_,
- account_ids_,
- chrome_build_proto_);
checkin_request_.reset(
- new CheckinRequest(request_info,
+ new CheckinRequest(base::Bind(&GCMClientImpl::OnCheckinCompleted,
+ weak_ptr_factory_.GetWeakPtr()),
kDefaultBackoffPolicy,
- base::Bind(&GCMClientImpl::OnCheckinCompleted,
- weak_ptr_factory_.GetWeakPtr()),
+ chrome_build_proto_,
+ device_checkin_info_.android_id,
+ device_checkin_info_.secret,
+ account_ids_,
url_request_context_getter_));
checkin_request_->Start();
}
-void GCMClientImpl::OnCheckinCompleted(
- const checkin_proto::AndroidCheckinResponse& checkin_response) {
+void GCMClientImpl::OnCheckinCompleted(uint64 android_id,
+ uint64 security_token) {
checkin_request_.reset();
- if (!checkin_response.has_android_id() ||
- !checkin_response.has_security_token()) {
- // TODO(fgorski): I don't think a retry here will help, we should probably
+ CheckinInfo checkin_info;
+ checkin_info.android_id = android_id;
+ checkin_info.secret = security_token;
+
+ if (!checkin_info.IsValid()) {
+ // TODO(fgorski): I don't think a retry here will help, we should probalby
// start over. By checking in with (0, 0).
return;
}
-
- CheckinInfo checkin_info;
- checkin_info.android_id = checkin_response.android_id();
- checkin_info.secret = checkin_response.security_token();
if (state_ == INITIAL_DEVICE_CHECKIN) {
OnFirstTimeDeviceCheckinCompleted(checkin_info);
@@ -334,7 +327,6 @@
last_checkin_time,
base::Bind(&GCMClientImpl::SetLastCheckinTimeCallback,
weak_ptr_factory_.GetWeakPtr()));
- UpdateGServicesSettings(checkin_response);
SchedulePeriodicCheckin(last_checkin_time);
}
}
@@ -702,31 +694,4 @@
send_error_details);
}
-void GCMClientImpl::UpdateGServicesSettings(
- const checkin_proto::AndroidCheckinResponse& checkin_response) {
- if (!checkin_response.has_digest() ||
- checkin_response.digest() == gservices_digest_) {
- return;
- }
-
- gservices_digest_ = checkin_response.digest();
- gservices_settings_.clear();
-
- for (int i = 0; i < checkin_response.setting_size(); ++i) {
- std::string name = checkin_response.setting(i).name();
- std::string value = checkin_response.setting(i).value();
- gservices_settings_[name] = value;
- }
-
- gcm_store_->SetGServicesSettings(
- gservices_settings_,
- gservices_digest_,
- base::Bind(&GCMClientImpl::UpdateGServicesSettingsCallback,
- weak_ptr_factory_.GetWeakPtr()));
-}
-
-void GCMClientImpl::UpdateGServicesSettingsCallback(bool success) {
- DCHECK(success);
-}
-
} // namespace gcm
« no previous file with comments | « google_apis/gcm/gcm_client_impl.h ('k') | google_apis/gcm/gcm_client_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698