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

Unified Diff: components/proximity_auth/cryptauth/cryptauth_device_manager.h

Issue 1248533003: Hook up CryptAuthGCMManager to the enrollment and device sync managers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix webui Created 5 years, 5 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: components/proximity_auth/cryptauth/cryptauth_device_manager.h
diff --git a/components/proximity_auth/cryptauth/cryptauth_device_manager.h b/components/proximity_auth/cryptauth/cryptauth_device_manager.h
index f1dfebeb981cea931136b1e6b17276026ae40171..ea16cd0ab992d4a1798c8878d1f692a8ccd4d8ab 100644
--- a/components/proximity_auth/cryptauth/cryptauth_device_manager.h
+++ b/components/proximity_auth/cryptauth/cryptauth_device_manager.h
@@ -10,6 +10,7 @@
#include "base/observer_list.h"
#include "base/time/clock.h"
#include "base/time/time.h"
+#include "components/proximity_auth/cryptauth/cryptauth_gcm_manager.h"
#include "components/proximity_auth/cryptauth/proto/cryptauth_api.pb.h"
#include "components/proximity_auth/cryptauth/sync_scheduler.h"
@@ -27,7 +28,8 @@ class CryptAuthClientFactory;
// The manager periodically syncs the user's devices from CryptAuth to keep the
// list of unlock keys fresh. If a sync attempts fails, the manager will
// schedule the next sync more aggressively to recover.
-class CryptAuthDeviceManager : public SyncScheduler::Delegate {
+class CryptAuthDeviceManager : public SyncScheduler::Delegate,
+ public CryptAuthGCMManager::Observer {
public:
// Respresents the success result of a sync attempt.
enum class SyncResult { SUCCESS, FAILURE };
@@ -56,11 +58,14 @@ class CryptAuthDeviceManager : public SyncScheduler::Delegate {
// Creates the manager:
// |clock|: Used to determine the time between sync attempts.
// |client_factory|: Creates CryptAuthClient instances to perform each sync.
+ // |gcm_manager|: Notifies when GCM push messages trigger device syncs.
+ // Not owned and must outlive this instance.
// |pref_service|: Stores syncing metadata and unlock key information to
// persist across browser restarts. Must already be registered
// with RegisterPrefs().
CryptAuthDeviceManager(scoped_ptr<base::Clock> clock,
scoped_ptr<CryptAuthClientFactory> client_factory,
+ CryptAuthGCMManager* gcm_manager,
PrefService* pref_service);
~CryptAuthDeviceManager() override;
@@ -108,6 +113,9 @@ class CryptAuthDeviceManager : public SyncScheduler::Delegate {
virtual scoped_ptr<SyncScheduler> CreateSyncScheduler();
private:
+ // CryptAuthGCMManager::Observer:
+ void OnResyncMessage() override;
+
// Updates |unlock_keys_| by fetching the list stored in |pref_service_|.
void UpdateUnlockKeysFromPrefs();
@@ -125,7 +133,11 @@ class CryptAuthDeviceManager : public SyncScheduler::Delegate {
// Creates CryptAuthClient instances for each sync attempt.
scoped_ptr<CryptAuthClientFactory> client_factory_;
- // Contains perferences that outlive the lifetime of this object and across
+ // Notifies when GCM push messages trigger device sync. Not owned and must
+ // outlive this instance.
+ CryptAuthGCMManager* gcm_manager_;
+
+ // Contains preferences that outlive the lifetime of this object and across
// process restarts. |pref_service_| must outlive the lifetime of this
// instance.
PrefService* const pref_service_;
« no previous file with comments | « components/proximity_auth/cryptauth/BUILD.gn ('k') | components/proximity_auth/cryptauth/cryptauth_device_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698