| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_NET_WAKE_ON_WIFI_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_NET_WAKE_ON_WIFI_MANAGER_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/memory/linked_ptr.h" |
| 12 #include "content/public/browser/notification_observer.h" |
| 13 #include "content/public/browser/notification_registrar.h" |
| 14 |
| 15 class Profile; |
| 16 |
| 17 namespace chromeos { |
| 18 |
| 19 // This class is responsible for managing the various wake-on-wifi related bits |
| 20 // of functionality in chrome. It is responsible for communicating the user's |
| 21 // preferences to shill as well as listening for connections to the Google GCM |
| 22 // servers and sending that connection information down to shill. This class is |
| 23 // owned by ChromeBrowserMainPartsChromeos. |
| 24 class WakeOnWifiManager : public content::NotificationObserver { |
| 25 public: |
| 26 enum WakeOnWifiFeature { |
| 27 WAKE_ON_NONE = 0, |
| 28 WAKE_ON_PACKET = 1, |
| 29 WAKE_ON_SSID = 2, |
| 30 WAKE_ON_PACKET_AND_SSID = 3, |
| 31 }; |
| 32 |
| 33 static WakeOnWifiManager* Get(); |
| 34 |
| 35 WakeOnWifiManager(); |
| 36 ~WakeOnWifiManager() override; |
| 37 |
| 38 // Should be called whenever the user changes their preference for the |
| 39 // wake-on-wifi features that should be enabled. |
| 40 void OnPreferenceChanged(WakeOnWifiFeature feature); |
| 41 |
| 42 // content::NotificationObserver override. |
| 43 void Observe(int type, |
| 44 const content::NotificationSource& source, |
| 45 const content::NotificationDetails& details) override; |
| 46 |
| 47 private: |
| 48 void OnProfileAdded(Profile* profile); |
| 49 void OnProfileDestroyed(Profile* profile); |
| 50 |
| 51 class WakeOnPacketConnectionObserver; |
| 52 std::map<Profile*, linked_ptr<WakeOnPacketConnectionObserver> > |
| 53 connection_observers_; |
| 54 |
| 55 content::NotificationRegistrar registrar_; |
| 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(WakeOnWifiManager); |
| 58 }; |
| 59 |
| 60 } // namespace chromeos |
| 61 |
| 62 #endif // CHROME_BROWSER_CHROMEOS_NET_WAKE_ON_WIFI_MANAGER_H_ |
| OLD | NEW |