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

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

Issue 2119963002: Move mus to //services/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 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_tracker.h ('k') | components/mus/ws/user_id_tracker_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/ws/user_id_tracker.cc
diff --git a/components/mus/ws/user_id_tracker.cc b/components/mus/ws/user_id_tracker.cc
deleted file mode 100644
index 40a7dde987bd9f74b463080dda9920c8178034ae..0000000000000000000000000000000000000000
--- a/components/mus/ws/user_id_tracker.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-// 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.
-
-#include "components/mus/ws/user_id_tracker.h"
-
-#include "components/mus/ws/user_id_tracker_observer.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
-
-namespace mus {
-namespace ws {
-
-UserIdTracker::UserIdTracker() : active_id_(shell::mojom::kRootUserID) {
- ids_.insert(active_id_);
-}
-
-UserIdTracker::~UserIdTracker() {
-}
-
-bool UserIdTracker::IsValidUserId(const UserId& id) const {
- return ids_.count(id) > 0;
-}
-
-void UserIdTracker::SetActiveUserId(const UserId& id) {
- DCHECK(IsValidUserId(id));
- if (id == active_id_)
- return;
-
- const UserId previously_active_id = active_id_;
- active_id_ = id;
- FOR_EACH_OBSERVER(UserIdTrackerObserver, observers_,
- OnActiveUserIdChanged(previously_active_id, id));
-}
-
-void UserIdTracker::AddUserId(const UserId& id) {
- if (IsValidUserId(id))
- return;
-
- ids_.insert(id);
- FOR_EACH_OBSERVER(UserIdTrackerObserver, observers_, OnUserIdAdded(id));
-}
-
-void UserIdTracker::RemoveUserId(const UserId& id) {
- DCHECK(IsValidUserId(id));
- ids_.erase(id);
- FOR_EACH_OBSERVER(UserIdTrackerObserver, observers_, OnUserIdRemoved(id));
-}
-
-void UserIdTracker::AddObserver(UserIdTrackerObserver* observer) {
- observers_.AddObserver(observer);
-}
-
-void UserIdTracker::RemoveObserver(UserIdTrackerObserver* observer) {
- observers_.RemoveObserver(observer);
-}
-
-void UserIdTracker::Bind(mojom::UserAccessManagerRequest request) {
- bindings_.AddBinding(this, std::move(request));
-}
-
-void UserIdTracker::SetActiveUser(const mojo::String& user_id) {
- if (!IsValidUserId(user_id))
- AddUserId(user_id);
- SetActiveUserId(user_id);
-}
-
-} // namespace ws
-} // namespace mus
« no previous file with comments | « components/mus/ws/user_id_tracker.h ('k') | components/mus/ws/user_id_tracker_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698