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

Side by Side Diff: chrome/browser/ui/ash/multi_user/multi_user_window_manager.h

Issue 1428213004: This CL replaces std::string user_id in ash/* with AccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update after review. Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_H_ 5 #ifndef CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_H_
6 #define CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_H_ 6 #define CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 class AccountId;
12 class Browser; 13 class Browser;
13 14
14 namespace content { 15 namespace content {
15 class BrowserContext; 16 class BrowserContext;
16 } 17 }
17 18
18 namespace aura { 19 namespace aura {
19 class Window; 20 class Window;
20 } 21 }
21 22
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // A function to set an |instance| of a created MultiUserWinwdowManager object 90 // A function to set an |instance| of a created MultiUserWinwdowManager object
90 // with a given |mode| for test purposes. 91 // with a given |mode| for test purposes.
91 static void SetInstanceForTest(MultiUserWindowManager* instance, 92 static void SetInstanceForTest(MultiUserWindowManager* instance,
92 MultiProfileMode mode); 93 MultiProfileMode mode);
93 94
94 // Assigns an owner to a passed window. Note that this window's parent should 95 // Assigns an owner to a passed window. Note that this window's parent should
95 // be a direct child of the root window. 96 // be a direct child of the root window.
96 // A user switch will automatically change the visibility - and - if the 97 // A user switch will automatically change the visibility - and - if the
97 // current user is not the owner it will immediately hidden. If the window 98 // current user is not the owner it will immediately hidden. If the window
98 // had already be registered this function will run into a DCHECK violation. 99 // had already be registered this function will run into a DCHECK violation.
99 virtual void SetWindowOwner( 100 virtual void SetWindowOwner(aura::Window* window,
100 aura::Window* window, const std::string& user_id) = 0; 101 const AccountId& account_id) = 0;
101 102
102 // See who owns this window. The return value is the user id or an empty 103 // See who owns this window. The return value is the user account id or an
103 // string if not assigned yet. 104 // empty AccountId if not assigned yet.
104 virtual const std::string& GetWindowOwner(aura::Window* window) const = 0; 105 virtual const AccountId& GetWindowOwner(aura::Window* window) const = 0;
105 106
106 // Allows to show an owned window for another users. If the window is not 107 // Allows to show an owned window for another users. If the window is not
107 // owned, this call will return immediately. (The FileManager for example 108 // owned, this call will return immediately. (The FileManager for example
108 // might be available for every user and not belong explicitly to one). 109 // might be available for every user and not belong explicitly to one).
109 // Note that a window can only be shown on one desktop at a time. Note that 110 // Note that a window can only be shown on one desktop at a time. Note that
110 // when the window gets minimized, it will automatically fall back to the 111 // when the window gets minimized, it will automatically fall back to the
111 // owner's desktop. 112 // owner's desktop.
112 virtual void ShowWindowForUser( 113 virtual void ShowWindowForUser(aura::Window* window,
113 aura::Window* window, const std::string& user_id) = 0; 114 const AccountId& account_id) = 0;
114 115
115 // Returns true when windows are shared among users. 116 // Returns true when windows are shared among users.
116 virtual bool AreWindowsSharedAmongUsers() const = 0; 117 virtual bool AreWindowsSharedAmongUsers() const = 0;
117 118
118 // Get the owners for the visible windows and set them to |user_ids|. 119 // Get the owners for the visible windows and set them to |account_ids|.
119 virtual void GetOwnersOfVisibleWindows( 120 virtual void GetOwnersOfVisibleWindows(
120 std::set<std::string>* user_ids) const = 0; 121 std::set<AccountId>* account_ids) const = 0;
121 122
122 // A query call for a given window to see if it is on the given user's 123 // A query call for a given window to see if it is on the given user's
123 // desktop. 124 // desktop.
124 virtual bool IsWindowOnDesktopOfUser(aura::Window* window, 125 virtual bool IsWindowOnDesktopOfUser(aura::Window* window,
125 const std::string& user_id) const = 0; 126 const AccountId& account_id) const = 0;
126 127
127 // Get the user on which the window is currently shown. If an empty string is 128 // Get the user on which the window is currently shown. If an empty string is
128 // passed back the window will be presented for every user. 129 // passed back the window will be presented for every user.
129 virtual const std::string& GetUserPresentingWindow( 130 virtual const AccountId& GetUserPresentingWindow(
130 aura::Window* window) const = 0; 131 aura::Window* window) const = 0;
131 132
132 // Adds user to monitor starting and running V1/V2 application windows. 133 // Adds user to monitor starting and running V1/V2 application windows.
133 // Returns immediately if the user (identified by a |profile|) is already 134 // Returns immediately if the user (identified by a |profile|) is already
134 // known to the manager. Note: This function is not implemented as a 135 // known to the manager. Note: This function is not implemented as a
135 // SessionStateObserver to coordinate the timing of the addition with other 136 // SessionStateObserver to coordinate the timing of the addition with other
136 // modules. 137 // modules.
137 virtual void AddUser(content::BrowserContext* profile) = 0; 138 virtual void AddUser(content::BrowserContext* profile) = 0;
138 139
139 // Manages observers. 140 // Manages observers.
140 virtual void AddObserver(Observer* observer) = 0; 141 virtual void AddObserver(Observer* observer) = 0;
141 virtual void RemoveObserver(Observer* observer) = 0; 142 virtual void RemoveObserver(Observer* observer) = 0;
142 143
143 protected: 144 protected:
144 virtual ~MultiUserWindowManager() {} 145 virtual ~MultiUserWindowManager() {}
145 146
146 private: 147 private:
147 // Caching the current multi profile mode since the detection is expensive. 148 // Caching the current multi profile mode since the detection is expensive.
148 static MultiProfileMode multi_user_mode_; 149 static MultiProfileMode multi_user_mode_;
149 }; 150 };
150 151
151 } // namespace chrome 152 } // namespace chrome
152 153
153 #endif // CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_H_ 154 #endif // CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/multi_user/multi_user_util.cc ('k') | chrome/browser/ui/ash/multi_user/multi_user_window_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698