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

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

Issue 823703004: Tracking push events for lucid sleep (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Version 2 with NotificationService Created 5 years, 11 months 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
index ea9de92f62410318f80c9d13826ecef2c5529256..84993e15769ed0f1a1ac822881eab6b9638cc31d 100644
--- a/chrome/browser/chromeos/net/wake_on_wifi_manager.h
+++ b/chrome/browser/chromeos/net/wake_on_wifi_manager.h
@@ -5,11 +5,20 @@
#ifndef CHROME_BROWSER_CHROMEOS_NET_WAKE_ON_WIFI_MANAGER_H_
#define CHROME_BROWSER_CHROMEOS_NET_WAKE_ON_WIFI_MANAGER_H_
+#include <set>
+#include <string>
+
+#include "base/callback.h"
+#include "base/cancelable_callback.h"
#include "base/containers/scoped_ptr_hash_map.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
+#include "chromeos/dbus/power_manager_client.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+#include "extensions/browser/event_router.h"
+#include "extensions/browser/extension_registry_observer.h"
+#include "extensions/browser/process_manager_observer.h"
class Profile;
@@ -17,6 +26,14 @@ namespace base {
class DictionaryValue;
}
+namespace content {
+class BrowserContext;
+}
+
+namespace extensions {
+class Extension;
+}
+
namespace chromeos {
// This class is responsible for managing the various wake-on-wifi related bits
@@ -25,7 +42,9 @@ namespace chromeos {
// 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 {
+class WakeOnWifiManager : public content::NotificationObserver,
+ public extensions::ExtensionRegistryObserver,
+ public PowerManagerClient::Observer {
public:
enum WakeOnWifiFeature {
WAKE_ON_NONE = 0x00,
@@ -58,16 +77,51 @@ class WakeOnWifiManager : public content::NotificationObserver {
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
+ // extensions::ExtensionRegistryObserver override.
+ void OnExtensionLoaded(content::BrowserContext* context,
+ const extensions::Extension* extension) override;
+
+ // PowerManagerClient::Observer override.
+ void SuspendImminent() override;
+ void SuspendDone(const base::TimeDelta& duration) override;
+ void DarkSuspendImminent() override;
+
private:
void OnProfileAdded(Profile* profile);
void OnProfileDestroyed(Profile* profile);
+ // Called when the system is about to perform a regular suspend or a dark
+ // suspend.
+ void OnSuspendImminent(bool dark_suspend);
+
+ // Maybe report readiness to suspend to the PowerManagerClient.
+ void MaybeReportSuspendReadiness();
+
+ // Called when an extension message has been dispatched.
+ void OnExtensionMessageDispatched(
+ extensions::EventRouter::DispatchDetails* details);
+
+ // Called when a previously dispatched extension message is acked by
+ // the extension renderer.
+ void OnExtensionMessageAcked(int message_id);
+
+ // Called when the ExtensionSystem for profile is ready to process requests.
+ void OnExtensionSystemReady(Profile* profile);
+
WakeOnWifiFeature current_feature_;
class WakeOnPacketConnectionObserver;
base::ScopedPtrHashMap<Profile*, WakeOnPacketConnectionObserver>
connection_observers_;
+ // Ids for extensions that have the GCM permission set.
+ std::set<std::string> gcm_extensions_;
+
+ bool suspend_is_pending_;
+ std::set<int> unacked_extension_messages_;
+ base::Closure power_manager_callback_;
+ base::CancelableClosure suspend_readiness_callback_;
+
content::NotificationRegistrar registrar_;
base::WeakPtrFactory<WakeOnWifiManager> weak_ptr_factory_;
« no previous file with comments | « no previous file | chrome/browser/chromeos/net/wake_on_wifi_manager.cc » ('j') | extensions/browser/event_router.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698