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

Unified Diff: google_apis/gcm/gcm_client_impl.cc

Issue 317723004: [GCM] Add ConnectionListener support, and hook up to debug page (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
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 b5a3ae6e5c15b4fed6a296193b57144d18429583..6f7dbb78d72db664817bc99ac3e3f5c5fb7e863f 100644
--- a/google_apis/gcm/gcm_client_impl.cc
+++ b/google_apis/gcm/gcm_client_impl.cc
@@ -341,6 +341,7 @@ void GCMClientImpl::InitializeMCSClient(
network_session_,
net_log_.net_log(),
&recorder_);
+ connection_factory_->SetConnectionListener(this);
mcs_client_ = internals_builder_->BuildMCSClient(
chrome_build_info_.version,
clock_.get(),
@@ -711,8 +712,9 @@ GCMClient::GCMStatistics GCMClientImpl::GetStatistics() const {
stats.is_recording = recorder_.is_recording();
stats.gcm_client_state = GetStateString();
stats.connection_client_created = mcs_client_.get() != NULL;
+ if (connection_factory_.get())
+ stats.connection_state = connection_factory_->GetConnectionStateString();
if (mcs_client_.get()) {
- stats.connection_state = mcs_client_->GetStateString();
stats.send_queue_size = mcs_client_->GetSendQueueSize();
stats.resend_queue_size = mcs_client_->GetResendQueueSize();
}
@@ -731,6 +733,17 @@ void GCMClientImpl::OnActivityRecorded() {
delegate_->OnActivityRecorded();
}
+void GCMClientImpl::OnConnected(const GURL& current_endpoint,
+ const net::IPEndPoint& socket_ip) {
+ // TODO(zea): inform GCMClient::Delegate and app handlers as well.
+ delegate_->OnActivityRecorded();
+}
+
+void GCMClientImpl::OnDisconnected() {
+ // TODO(zea): inform GCMClient::Delegate and app handlers as well.
+ delegate_->OnActivityRecorded();
+}
+
void GCMClientImpl::OnMessageReceivedFromMCS(const gcm::MCSMessage& message) {
switch (message.tag()) {
case kLoginResponseTag:
« google_apis/gcm/engine/connection_factory_impl.cc ('K') | « google_apis/gcm/gcm_client_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698