Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
|
Lei Zhang
2014/11/18 01:57:54
nit: no (c), same in .cc file.
Chirantan Ekbote
2014/11/18 20:37:39
Done.
| |
| 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" | |
|
Lei Zhang
2014/11/18 01:57:54
Can you use base/containers/scoped_ptr_hash_map.h
Chirantan Ekbote
2014/11/18 02:16:17
Ok
Chirantan Ekbote
2014/11/18 20:37:39
Done.
| |
| 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. | |
|
Lei Zhang
2014/11/18 01:57:55
Is this class single-threaded? It runs on the UI t
Chirantan Ekbote
2014/11/18 02:16:17
Yes, this class is not thread-safe. I will add a
Lei Zhang
2014/11/18 02:22:38
Please sprinkle in a few DCHECK_CURRENTLY_ON() cal
Chirantan Ekbote
2014/11/18 20:37:39
Done.
| |
| 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(); | |
|
Lei Zhang
2014/11/18 01:57:55
Do you really need this and |g_wake_on_wifi_manage
Chirantan Ekbote
2014/11/18 02:16:17
I'm not sure I follow what you mean. How do you g
Lei Zhang
2014/11/18 02:22:38
Sorry, I was thinking of BrowserProcess owning thi
| |
| 34 | |
| 35 WakeOnWifiManager(); | |
| 36 ~WakeOnWifiManager() override; | |
| 37 | |
| 38 // Should be called whenever the user changes their preference for the | |
|
michaelpg
2014/11/18 01:31:59
nit: whenever the *primary* user changes their pre
Chirantan Ekbote
2014/11/18 01:54:35
Done.
| |
| 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> > | |
|
michaelpg
2014/11/18 01:31:59
nit: use >> without space
Chirantan Ekbote
2014/11/18 01:54:35
Done.
| |
| 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 |