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

Unified Diff: components/gcm_driver/default_gcm_app_handler.cc

Issue 409883006: GCM: D-Bus methods for wake-on-packet (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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/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..8a2c555f006d0cde0317e80864702f6bb93ad171 100644
--- a/components/gcm_driver/default_gcm_app_handler.cc
+++ b/components/gcm_driver/default_gcm_app_handler.cc
@@ -4,7 +4,10 @@
#include "components/gcm_driver/default_gcm_app_handler.h"
+#include "base/callback.h"
#include "base/logging.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/shill_manager_client.h"
#include "net/base/ip_endpoint.h"
namespace gcm {
@@ -37,14 +40,31 @@ 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();
+ LOG(ERROR) << "GCM connected to " << ip_endpoint_string;
Daniel Erat 2014/07/22 20:32:01 don't forget to change this back
+
+ chromeos::DBusThreadManager::Get()->
+ GetShillManagerClient()->
+ AddWakeOnPacketConnection(
+ ip_endpoint_string,
+ base::Bind(&base::DoNothing),
+ base::Bind(&DefaultGCMAppHandler::ErrorCallback));
}
void DefaultGCMAppHandler::OnDisconnected() {
- // TODO(semenzato): update CrOS NIC state.
- DVLOG(1) << "GCM disconnected";
+ LOG(ERROR) << "GCM disconnected";
Daniel Erat 2014/07/22 20:32:01 or this
}
} // namespace gcm

Powered by Google App Engine
This is Rietveld 408576698