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

Unified Diff: chrome/browser/services/gcm/chromeos_gcm_connection_observer.cc

Issue 597683005: GCM: D-Bus methods for wake-on-packet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolved DEPS conflict Created 6 years, 3 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: chrome/browser/services/gcm/chromeos_gcm_connection_observer.cc
diff --git a/chrome/browser/services/gcm/chromeos_gcm_connection_observer.cc b/chrome/browser/services/gcm/chromeos_gcm_connection_observer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..99a18735cfa4f19b2c73ac69a116a9073c5dfaae
--- /dev/null
+++ b/chrome/browser/services/gcm/chromeos_gcm_connection_observer.cc
@@ -0,0 +1,47 @@
+// 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_connection_observer.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 {
+
+ChromeOSGCMConnectionObserver::ChromeOSGCMConnectionObserver() {
+}
+
+ChromeOSGCMConnectionObserver::~ChromeOSGCMConnectionObserver() {
+}
+
+// static
+void ChromeOSGCMConnectionObserver::ErrorCallback(
+ const std::string& error_name,
+ const std::string& error) {
+ LOG(ERROR) << "GCM D-Bus method error " << error_name << ": " << error;
+}
+
+void ChromeOSGCMConnectionObserver::OnConnected(
+ const net::IPEndPoint& ip_endpoint) {
+ ip_endpoint_ = ip_endpoint;
+ chromeos::DBusThreadManager::Get()->
+ GetShillManagerClient()->
+ AddWakeOnPacketConnection(
+ ip_endpoint,
+ base::Bind(&base::DoNothing),
+ base::Bind(&ChromeOSGCMConnectionObserver::ErrorCallback));
+}
+
+void ChromeOSGCMConnectionObserver::OnDisconnected() {
+ chromeos::DBusThreadManager::Get()->
+ GetShillManagerClient()->
+ RemoveWakeOnPacketConnection(
+ ip_endpoint_,
+ base::Bind(&base::DoNothing),
+ base::Bind(&ChromeOSGCMConnectionObserver::ErrorCallback));
+}
+
+} // namespace gcm
« no previous file with comments | « chrome/browser/services/gcm/chromeos_gcm_connection_observer.h ('k') | chrome/browser/services/gcm/gcm_profile_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698