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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 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 "base/containers/scoped_ptr_hash_map.h"
9 #include "base/macros.h"
10 #include "content/public/browser/notification_observer.h"
11 #include "content/public/browser/notification_registrar.h"
12
13 class Profile;
14
15 namespace chromeos {
16
17 // This class is responsible for managing the various wake-on-wifi related bits
18 // of functionality in chrome. It is responsible for communicating the user's
19 // preferences to shill as well as listening for connections to the Google GCM
20 // servers and sending that connection information down to shill. This class is
21 // owned by ChromeBrowserMainPartsChromeos. This class is also NOT thread-safe
22 // and should only be called on the UI thread.
23 class WakeOnWifiManager : public content::NotificationObserver {
24 public:
25 enum WakeOnWifiFeature {
26 WAKE_ON_NONE = 0,
27 WAKE_ON_PACKET = 1,
28 WAKE_ON_SSID = 2,
29 WAKE_ON_PACKET_AND_SSID = 3,
30 };
31
32 static WakeOnWifiManager* Get();
33
34 WakeOnWifiManager();
35 ~WakeOnWifiManager() override;
36
37 // Should be called whenever the primary user changes their preference for the
38 // wake-on-wifi features that should be enabled.
39 void OnPreferenceChanged(WakeOnWifiFeature feature);
40
41 // content::NotificationObserver override.
42 void Observe(int type,
43 const content::NotificationSource& source,
44 const content::NotificationDetails& details) override;
45
46 private:
47 void OnProfileAdded(Profile* profile);
48 void OnProfileDestroyed(Profile* profile);
49
50 class WakeOnPacketConnectionObserver;
51 base::ScopedPtrHashMap<Profile*, WakeOnPacketConnectionObserver>
52 connection_observers_;
53
54 content::NotificationRegistrar registrar_;
55
56 DISALLOW_COPY_AND_ASSIGN(WakeOnWifiManager);
57 };
58
59 } // namespace chromeos
60
61 #endif // CHROME_BROWSER_CHROMEOS_NET_WAKE_ON_WIFI_MANAGER_H_
OLDNEW
« 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