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

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

Issue 722043004: Clean up wake on wifi handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 6 years, 1 month 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/chromeos/net/wake_on_wifi_manager.h
diff --git a/chrome/browser/chromeos/net/wake_on_wifi_manager.h b/chrome/browser/chromeos/net/wake_on_wifi_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..bdbe2364d968f1c88ebcd9077ac6984d007efacf
--- /dev/null
+++ b/chrome/browser/chromeos/net/wake_on_wifi_manager.h
@@ -0,0 +1,61 @@
+// Copyright 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.
+
+#ifndef CHROME_BROWSER_CHROMEOS_NET_WAKE_ON_WIFI_MANAGER_H_
+#define CHROME_BROWSER_CHROMEOS_NET_WAKE_ON_WIFI_MANAGER_H_
+
+#include "base/containers/scoped_ptr_hash_map.h"
+#include "base/macros.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
+
+class Profile;
+
+namespace chromeos {
+
+// This class is responsible for managing the various wake-on-wifi related bits
+// of functionality in chrome. It is responsible for communicating the user's
+// preferences to shill as well as listening for connections to the Google GCM
+// servers and sending that connection information down to shill. This class is
+// owned by ChromeBrowserMainPartsChromeos. This class is also NOT thread-safe
+// and should only be called on the UI thread.
+class WakeOnWifiManager : public content::NotificationObserver {
+ public:
+ enum WakeOnWifiFeature {
+ WAKE_ON_NONE = 0,
+ WAKE_ON_PACKET = 1,
+ WAKE_ON_SSID = 2,
+ WAKE_ON_PACKET_AND_SSID = 3,
+ };
+
+ static WakeOnWifiManager* Get();
+
+ WakeOnWifiManager();
+ ~WakeOnWifiManager() override;
+
+ // Should be called whenever the primary user changes their preference for the
+ // wake-on-wifi features that should be enabled.
+ void OnPreferenceChanged(WakeOnWifiFeature feature);
+
+ // content::NotificationObserver override.
+ void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) override;
+
+ private:
+ void OnProfileAdded(Profile* profile);
+ void OnProfileDestroyed(Profile* profile);
+
+ class WakeOnPacketConnectionObserver;
+ base::ScopedPtrHashMap<Profile*, WakeOnPacketConnectionObserver>
+ connection_observers_;
+
+ content::NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(WakeOnWifiManager);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_NET_WAKE_ON_WIFI_MANAGER_H_
« no previous file with comments | « chrome/browser/chromeos/chrome_browser_main_chromeos.cc ('k') | chrome/browser/chromeos/net/wake_on_wifi_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698