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

Unified Diff: components/gcm_driver/gcm_client_impl.cc

Issue 320993003: [GCM] Add app handler support for connection events (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add basic tests 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: components/gcm_driver/gcm_client_impl.cc
diff --git a/components/gcm_driver/gcm_client_impl.cc b/components/gcm_driver/gcm_client_impl.cc
index 2d05aea939a59eda7d7e37e99df7b7e87e3e663a..b7d4a673c12d60316c0e7a9e1f02f09320b956ef 100644
--- a/components/gcm_driver/gcm_client_impl.cc
+++ b/components/gcm_driver/gcm_client_impl.cc
@@ -250,6 +250,7 @@ scoped_ptr<ConnectionFactory> GCMInternalsBuilder::BuildConnectionFactory(
GCMClientImpl::GCMClientImpl(scoped_ptr<GCMInternalsBuilder> internals_builder)
: internals_builder_(internals_builder.Pass()),
state_(UNINITIALIZED),
+ delegate_(NULL),
clock_(internals_builder_->BuildClock()),
url_request_context_getter_(NULL),
pending_registration_requests_deleter_(&pending_registration_requests_),
@@ -505,6 +506,7 @@ void GCMClientImpl::UpdateRegistrationCallback(bool success) {
void GCMClientImpl::Stop() {
device_checkin_info_.Reset();
connection_factory_.reset();
+ delegate_->OnDisconnected();
mcs_client_.reset();
checkin_request_.reset();
pending_registration_requests_.clear();
@@ -735,13 +737,14 @@ void GCMClientImpl::OnActivityRecorded() {
void GCMClientImpl::OnConnected(const GURL& current_server,
const net::IPEndPoint& ip_endpoint) {
- // TODO(zea): inform GCMClient::Delegate and app handlers as well.
+ // TODO(gcm): expose current server in debug page.
delegate_->OnActivityRecorded();
+ delegate_->OnConnected(ip_endpoint);
}
void GCMClientImpl::OnDisconnected() {
- // TODO(zea): inform GCMClient::Delegate and app handlers as well.
delegate_->OnActivityRecorded();
+ delegate_->OnDisconnected();
}
void GCMClientImpl::OnMessageReceivedFromMCS(const gcm::MCSMessage& message) {

Powered by Google App Engine
This is Rietveld 408576698