| Index: components/gcm_driver/default_gcm_app_handler.cc
|
| diff --git a/components/gcm_driver/default_gcm_app_handler.cc b/components/gcm_driver/default_gcm_app_handler.cc
|
| index 2e745a031c8fac5d4a7699181be01d22eec47c93..61fe96ca06d2cfcd8fe6ae7b8d98d8fe58e1ce85 100644
|
| --- a/components/gcm_driver/default_gcm_app_handler.cc
|
| +++ b/components/gcm_driver/default_gcm_app_handler.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "components/gcm_driver/default_gcm_app_handler.h"
|
|
|
| +#include "base/callback.h"
|
| #include "base/logging.h"
|
| #include "net/base/ip_endpoint.h"
|
|
|
| @@ -37,14 +38,34 @@ void DefaultGCMAppHandler::OnSendError(
|
| << app_id;
|
| }
|
|
|
| +// static
|
| +void DefaultGCMAppHandler::NullCallback(const std::string& result) {
|
| +}
|
| +
|
| +// static
|
| +void DefaultGCMAppHandler::ErrorCallback(
|
| + const std::string& error_name,
|
| + const std::string& error) {
|
| + LOG(ERROR) << "GCM D-Bus method error " << error_name << ": " << error;
|
| +}
|
| +
|
| void DefaultGCMAppHandler::OnConnected(const net::IPEndPoint& ip_endpoint) {
|
| - // TODO(semenzato): update CrOS NIC state.
|
| - DVLOG(1) << "GCM connected to " << ip_endpoint.ToString();
|
| + const std::string ip_endpoint_string = ip_endpoint.ToString();
|
| + if (on_connected_cb_)
|
| + on_connected_cb_(ip_endpoint);
|
| }
|
|
|
| void DefaultGCMAppHandler::OnDisconnected() {
|
| - // TODO(semenzato): update CrOS NIC state.
|
| - DVLOG(1) << "GCM disconnected";
|
| + if (on_disconnected_cb_)
|
| + on_disconnected_cb_();
|
| +}
|
| +
|
| +// static
|
| +void DefaultGCMAppHandler::RegisterConnectionCallbacks(
|
| + void (*on_connected_cb)(const net::IPEndPoint& ip_endpoint),
|
| + void (*on_disconnected_cb)()) {
|
| + on_connected_cb_ = on_connected_cb;
|
| + on_disconnected_cb_ = on_disconnected_cb;
|
| }
|
|
|
| } // namespace gcm
|
|
|