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

Unified Diff: components/mus/ws/user_id_tracker.h

Issue 1757403002: More user id tracking for mus: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweaks Created 4 years, 10 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
« no previous file with comments | « components/mus/ws/user_id.h ('k') | components/mus/ws/user_id_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/ws/user_id_tracker.h
diff --git a/components/mus/ws/user_id_tracker.h b/components/mus/ws/user_id_tracker.h
new file mode 100644
index 0000000000000000000000000000000000000000..5a97e6e0c59d7a61e32c8ad62437cccf9a31809b
--- /dev/null
+++ b/components/mus/ws/user_id_tracker.h
@@ -0,0 +1,49 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_MUS_WS_USER_ID_TRACKER_H_
+#define COMPONENTS_MUS_WS_USER_ID_TRACKER_H_
+
+#include <stdint.h>
+
+#include <set>
+
+#include "base/macros.h"
+#include "base/observer_list.h"
+#include "components/mus/ws/user_id.h"
+
+namespace mus {
+namespace ws {
+
+class UserIdTrackerObserver;
+
+// Tracks the set of known/valid user ids.
+class UserIdTracker {
+ public:
+ UserIdTracker();
+ ~UserIdTracker();
+
+ bool IsValidUserId(UserId id) const;
+
+ void SetActiveUserId(UserId id);
+ void AddUserId(UserId id);
+ void RemoveUserId(UserId id);
+
+ void AddObserver(UserIdTrackerObserver* observer);
+ void RemoveObserver(UserIdTrackerObserver* observer);
+
+ private:
+ using UserIdSet = std::set<UserId>;
+
+ base::ObserverList<UserIdTrackerObserver> observers_;
+ UserIdSet ids_;
+ UserId active_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(UserIdTracker);
+};
+
+} // namespace ws
+} // namespace mus
+
+#endif // COMPONENTS_MUS_WS_USER_ID_TRACKER_H_
« no previous file with comments | « components/mus/ws/user_id.h ('k') | components/mus/ws/user_id_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698