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

Unified Diff: chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
Index: chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h
diff --git a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h
index 6ca57b6b7adbbb53e011de93d939eec00322073f..972c1f20d1e580e9e67a524bf5dfd0debe02c81e 100644
--- a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h
+++ b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h
@@ -13,6 +13,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
+#include "components/user_manager/user_id.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "ui/aura/window_observer.h"
@@ -69,7 +70,7 @@ class MultiUserWindowManagerChromeOS
};
// Create the manager and use |active_user_id| as the active user.
- explicit MultiUserWindowManagerChromeOS(const std::string& active_user_id);
+ explicit MultiUserWindowManagerChromeOS(const user_manager::UserID& active_user_id);
~MultiUserWindowManagerChromeOS() override;
// Initializes the manager after its creation. Should only be called once.
@@ -77,25 +78,25 @@ class MultiUserWindowManagerChromeOS
// MultiUserWindowManager overrides:
void SetWindowOwner(
- aura::Window* window, const std::string& user_id) override;
- const std::string& GetWindowOwner(
+ aura::Window* window, const user_manager::UserID& user_id) override;
+ const user_manager::UserID& GetWindowOwner(
aura::Window* window) const override;
void ShowWindowForUser(
- aura::Window* window, const std::string& user_id) override;
+ aura::Window* window, const user_manager::UserID& user_id) override;
bool AreWindowsSharedAmongUsers() const override;
void GetOwnersOfVisibleWindows(
- std::set<std::string>* user_ids) const override;
+ std::set<user_manager::UserID>* user_ids) const override;
bool IsWindowOnDesktopOfUser(
aura::Window* window,
- const std::string& user_id) const override;
- const std::string& GetUserPresentingWindow(
+ const user_manager::UserID& user_id) const override;
+ const user_manager::UserID& GetUserPresentingWindow(
aura::Window* window) const override;
void AddUser(content::BrowserContext* context) override;
void AddObserver(Observer* observer) override;
void RemoveObserver(Observer* observer) override;
// SessionStateObserver overrides:
- void ActiveUserChanged(const std::string& user_id) override;
+ void ActiveUserChanged(const user_manager::UserID& user_id) override;
// WindowObserver overrides:
void OnWindowDestroyed(aura::Window* window) override;
@@ -120,31 +121,31 @@ class MultiUserWindowManagerChromeOS
bool IsAnimationRunningForTest();
// Returns the current user for unit tests.
- const std::string& GetCurrentUserForTest() const;
+ const user_manager::UserID& GetCurrentUserForTest() const;
protected:
friend class UserSwitchAnimatorChromeOS;
class WindowEntry {
public:
- explicit WindowEntry(const std::string& user_id)
+ explicit WindowEntry(const user_manager::UserID& user_id)
: owner_(user_id),
show_for_user_(user_id),
show_(true) {}
virtual ~WindowEntry() {}
// Returns the owner of this window. This cannot be changed.
- const std::string& owner() const { return owner_; }
+ const user_manager::UserID& owner() const { return owner_; }
// Returns the user for which this should be shown.
- const std::string& show_for_user() const { return show_for_user_; }
+ const user_manager::UserID& show_for_user() const { return show_for_user_; }
// Returns if the window should be shown for the "show user" or not.
bool show() const { return show_; }
// Set the user which will display the window on the owned desktop. If
// an empty user id gets passed the owner will be used.
- void set_show_for_user(const std::string& user_id) {
+ void set_show_for_user(const user_manager::UserID& user_id) {
show_for_user_ = user_id.empty() ? owner_ : user_id;
}
@@ -153,10 +154,10 @@ class MultiUserWindowManagerChromeOS
private:
// The user id of the owner of this window.
- const std::string owner_;
+ const user_manager::UserID owner_;
// The user id of the user on which desktop the window gets shown.
- std::string show_for_user_;
+ user_manager::UserID show_for_user_;
// True if the window should be visible for the user which shows the window.
bool show_;
@@ -169,7 +170,7 @@ class MultiUserWindowManagerChromeOS
// Show a window for a user without switching the user.
// Returns true when the window moved to a new desktop.
bool ShowWindowForUserIntern(aura::Window* window,
- const std::string& user_id);
+ const user_manager::UserID& user_id);
// Show / hide the given window. Note: By not doing this within the functions,
// this allows to either switching to different ways to show/hide and / or to
@@ -191,7 +192,7 @@ class MultiUserWindowManagerChromeOS
friend class ::MultiUserNotificationBlockerChromeOSTest;
friend class ash::test::MultiUserWindowManagerChromeOSTest;
- typedef std::map<std::string, AppObserver*> UserIDToAppWindowObserver;
+ typedef std::map<user_manager::UserID, AppObserver*> UserIDToAppWindowObserver;
typedef std::map<aura::Window*, bool> TransientWindowToVisibility;
// Add a browser window to the system so that the owner can be remembered.
@@ -242,7 +243,9 @@ class MultiUserWindowManagerChromeOS
// The currently selected active user. It is used to find the proper
// visibility state in various cases. The state is stored here instead of
// being read from the user manager to be in sync while a switch occurs.
- std::string current_user_id_;
+ user_manager::UserID current_user_id_;
+
+ const user_manager::UserID null_user_id_;
// The blocker which controls the desktop notification visibility based on the
// current multi-user status.

Powered by Google App Engine
This is Rietveld 408576698