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

Unified Diff: chrome/browser/chromeos/net/wake_on_wifi_connection_observer.h

Issue 1891633002: Remove unnecessary calls to AddWakeOnPaketConnection and RemoveWakeOnPacketConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/net/wake_on_wifi_connection_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/net/wake_on_wifi_connection_observer.h
diff --git a/chrome/browser/chromeos/net/wake_on_wifi_connection_observer.h b/chrome/browser/chromeos/net/wake_on_wifi_connection_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..9508a0317bd6e8d7510baf26d3a4673f41ce129d
--- /dev/null
+++ b/chrome/browser/chromeos/net/wake_on_wifi_connection_observer.h
@@ -0,0 +1,70 @@
+// Copyright 2016 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.
+
+#ifndef CHROME_BROWSER_CHROMEOS_NET_WAKE_ON_WIFI_CONNECTION_OBSERVER_H_
+#define CHROME_BROWSER_CHROMEOS_NET_WAKE_ON_WIFI_CONNECTION_OBSERVER_H_
+
+#include "base/gtest_prod_util.h"
+#include "base/macros.h"
+#include "chrome/browser/chromeos/net/wake_on_wifi_manager.h"
+#include "components/gcm_driver/gcm_connection_observer.h"
+#include "content/public/browser/notification_observer.h"
+#include "net/base/ip_endpoint.h"
+
+class Profile;
+
+namespace chromeos {
+
+class ConnectionObserverTest;
+class NetworkDeviceHandler;
+
+// Simple class that listens for a connection to the GCM server and passes the
+// connection information down to shill. Each instance of this class is
+// associated with a profile.
+class WakeOnWifiConnectionObserver : public gcm::GCMConnectionObserver {
+ public:
+ ~WakeOnWifiConnectionObserver() override;
+
+ // Handles the case when the wifi properties have been received along with
+ // attempting to begin listening for wake on wifi packets on the given IP
+ // endpoint. The listening will only begin if wake on packet is enabled on the
+ // device.
+ void HandleWifiDevicePropertiesReady();
+
+ // gcm::GCMConnectionObserver overrides:
+ void OnConnected(const net::IPEndPoint& ip_endpoint) override;
+ void OnDisconnected() override;
+
+ void set_feature(WakeOnWifiManager::WakeOnWifiFeature feature) {
+ feature_ = feature;
+ }
+
+ private:
+ FRIEND_TEST_ALL_PREFIXES(WakeOnWifiObserverTest, TestWakeOnWifiPacketAdd);
+ FRIEND_TEST_ALL_PREFIXES(WakeOnWifiObserverTest,
+ TestWakeOnWifiPacketRemove);
+ FRIEND_TEST_ALL_PREFIXES(WakeOnWifiObserverTest, TestWakeOnWifiNoneAdd);
+ FRIEND_TEST_ALL_PREFIXES(WakeOnWifiObserverTest, TestWakeOnWifiNoneRemove);
+ friend class WakeOnWifiManager;
+
+ WakeOnWifiConnectionObserver(Profile* profile,
+ bool wifi_properties_received,
+ WakeOnWifiManager::WakeOnWifiFeature feature,
+ NetworkDeviceHandler* network_device_handler);
+
+ void AddWakeOnPacketConnection();
+ void RemoveWakeOnPacketConnection();
+
+ Profile* profile_;
+ net::IPEndPoint ip_endpoint_;
+ bool wifi_properties_received_;
+ WakeOnWifiManager::WakeOnWifiFeature feature_;
+ NetworkDeviceHandler* network_device_handler_;
+
+ DISALLOW_COPY_AND_ASSIGN(WakeOnWifiConnectionObserver);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_NET_WAKE_ON_WIFI_CONNECTION_OBSERVER_H_
« no previous file with comments | « no previous file | chrome/browser/chromeos/net/wake_on_wifi_connection_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698