Index: chrome/browser/services/gcm/chromeos_gcm_app_handler.cc |
diff --git a/chrome/browser/services/gcm/chromeos_gcm_app_handler.cc b/chrome/browser/services/gcm/chromeos_gcm_app_handler.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c2888aef555294516dc654998f4e5688f97d7453 |
--- /dev/null |
+++ b/chrome/browser/services/gcm/chromeos_gcm_app_handler.cc |
@@ -0,0 +1,46 @@ |
+// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/services/gcm/chromeos_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" |
+ |
+namespace gcm { |
+ |
+ChromeOSGCMAppHandler::ChromeOSGCMAppHandler() { |
+} |
+ |
+ChromeOSGCMAppHandler::~ChromeOSGCMAppHandler() { |
+} |
+ |
+// static |
+void ChromeOSGCMAppHandler::ErrorCallback( |
+ const std::string& error_name, |
+ const std::string& error) { |
+ LOG(ERROR) << "GCM D-Bus method error " << error_name << ": " << error; |
+} |
+ |
+void ChromeOSGCMAppHandler::OnConnected(const net::IPEndPoint& ip_endpoint) { |
+ ip_endpoint_ = ip_endpoint; |
+ chromeos::DBusThreadManager::Get()-> |
+ GetShillManagerClient()-> |
+ AddWakeOnPacketConnection( |
+ ip_endpoint, |
+ base::Bind(&base::DoNothing), |
+ base::Bind(&ChromeOSGCMAppHandler::ErrorCallback)); |
+} |
+ |
+void ChromeOSGCMAppHandler::OnDisconnected() { |
+ chromeos::DBusThreadManager::Get()-> |
+ GetShillManagerClient()-> |
+ RemoveWakeOnPacketConnection( |
+ ip_endpoint_, |
+ base::Bind(&base::DoNothing), |
+ base::Bind(&ChromeOSGCMAppHandler::ErrorCallback)); |
+} |
+ |
+} // namespace gcm |