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

Side by Side Diff: chrome/browser/chromeos/net/wake_on_wifi_manager.h

Issue 745123002: Link GCM heartbeat with wake on wifi preference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix missing include Created 6 years 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/net/wake_on_wifi_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_CHROMEOS_NET_WAKE_ON_WIFI_MANAGER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_NET_WAKE_ON_WIFI_MANAGER_H_
6 #define CHROME_BROWSER_CHROMEOS_NET_WAKE_ON_WIFI_MANAGER_H_ 6 #define CHROME_BROWSER_CHROMEOS_NET_WAKE_ON_WIFI_MANAGER_H_
7 7
8 #include "base/containers/scoped_ptr_hash_map.h" 8 #include "base/containers/scoped_ptr_hash_map.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "content/public/browser/notification_observer.h" 10 #include "content/public/browser/notification_observer.h"
11 #include "content/public/browser/notification_registrar.h" 11 #include "content/public/browser/notification_registrar.h"
12 12
13 class Profile; 13 class Profile;
14 14
15 namespace chromeos { 15 namespace chromeos {
16 16
17 // This class is responsible for managing the various wake-on-wifi related bits 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 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 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 20 // servers and sending that connection information down to shill. This class is
21 // owned by ChromeBrowserMainPartsChromeos. This class is also NOT thread-safe 21 // owned by ChromeBrowserMainPartsChromeos. This class is also NOT thread-safe
22 // and should only be called on the UI thread. 22 // and should only be called on the UI thread.
23 class WakeOnWifiManager : public content::NotificationObserver { 23 class WakeOnWifiManager : public content::NotificationObserver {
24 public: 24 public:
25 enum WakeOnWifiFeature { 25 enum WakeOnWifiFeature {
26 WAKE_ON_NONE = 0, 26 WAKE_ON_NONE = 0,
27 WAKE_ON_PACKET = 1, 27 WAKE_ON_PACKET = 1,
28 WAKE_ON_SSID = 2, 28 WAKE_ON_SSID = 2,
29 WAKE_ON_PACKET_AND_SSID = 3, 29 WAKE_ON_PACKET_AND_SSID = 3,
30 INVALID = 4,
30 }; 31 };
31 32
32 static WakeOnWifiManager* Get(); 33 static WakeOnWifiManager* Get();
33 34
34 WakeOnWifiManager(); 35 WakeOnWifiManager();
35 ~WakeOnWifiManager() override; 36 ~WakeOnWifiManager() override;
36 37
37 // Should be called whenever the primary user changes their preference for the 38 // Should be called whenever the primary user changes their preference for the
38 // wake-on-wifi features that should be enabled. 39 // wake-on-wifi features that should be enabled.
39 void OnPreferenceChanged(WakeOnWifiFeature feature); 40 void OnPreferenceChanged(WakeOnWifiFeature feature);
40 41
41 // content::NotificationObserver override. 42 // content::NotificationObserver override.
42 void Observe(int type, 43 void Observe(int type,
43 const content::NotificationSource& source, 44 const content::NotificationSource& source,
44 const content::NotificationDetails& details) override; 45 const content::NotificationDetails& details) override;
45 46
46 private: 47 private:
47 void OnProfileAdded(Profile* profile); 48 void OnProfileAdded(Profile* profile);
48 void OnProfileDestroyed(Profile* profile); 49 void OnProfileDestroyed(Profile* profile);
49 50
51 WakeOnWifiFeature current_feature_;
52
50 class WakeOnPacketConnectionObserver; 53 class WakeOnPacketConnectionObserver;
51 base::ScopedPtrHashMap<Profile*, WakeOnPacketConnectionObserver> 54 base::ScopedPtrHashMap<Profile*, WakeOnPacketConnectionObserver>
52 connection_observers_; 55 connection_observers_;
53 56
54 content::NotificationRegistrar registrar_; 57 content::NotificationRegistrar registrar_;
55 58
56 DISALLOW_COPY_AND_ASSIGN(WakeOnWifiManager); 59 DISALLOW_COPY_AND_ASSIGN(WakeOnWifiManager);
57 }; 60 };
58 61
59 } // namespace chromeos 62 } // namespace chromeos
60 63
61 #endif // CHROME_BROWSER_CHROMEOS_NET_WAKE_ON_WIFI_MANAGER_H_ 64 #endif // CHROME_BROWSER_CHROMEOS_NET_WAKE_ON_WIFI_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/net/wake_on_wifi_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698