OLD | NEW |
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 Browser; | 12 class Browser; |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 class BrowserContext; | 15 class BrowserContext; |
16 } | 16 } |
17 | 17 |
| 18 namespace user_manager { |
| 19 class UserID; |
| 20 } |
| 21 |
18 namespace aura { | 22 namespace aura { |
19 class Window; | 23 class Window; |
20 } | 24 } |
21 | 25 |
22 namespace chrome { | 26 namespace chrome { |
23 | 27 |
24 class MultiUserWindowManagerChromeOS; | 28 class MultiUserWindowManagerChromeOS; |
25 | 29 |
26 // The MultiUserWindowManager manages windows from multiple users by presenting | 30 // The MultiUserWindowManager manages windows from multiple users by presenting |
27 // only user relevant windows to the current user. The manager is automatically | 31 // only user relevant windows to the current user. The manager is automatically |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // with a given |mode| for test purposes. | 94 // with a given |mode| for test purposes. |
91 static void SetInstanceForTest(MultiUserWindowManager* instance, | 95 static void SetInstanceForTest(MultiUserWindowManager* instance, |
92 MultiProfileMode mode); | 96 MultiProfileMode mode); |
93 | 97 |
94 // Assigns an owner to a passed window. Note that this window's parent should | 98 // Assigns an owner to a passed window. Note that this window's parent should |
95 // be a direct child of the root window. | 99 // be a direct child of the root window. |
96 // A user switch will automatically change the visibility - and - if the | 100 // 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 | 101 // 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. | 102 // had already be registered this function will run into a DCHECK violation. |
99 virtual void SetWindowOwner( | 103 virtual void SetWindowOwner( |
100 aura::Window* window, const std::string& user_id) = 0; | 104 aura::Window* window, const user_manager::UserID& user_id) = 0; |
101 | 105 |
102 // See who owns this window. The return value is the user id or an empty | 106 // See who owns this window. The return value is the user id or an empty |
103 // string if not assigned yet. | 107 // string if not assigned yet. |
104 virtual const std::string& GetWindowOwner(aura::Window* window) const = 0; | 108 virtual const user_manager::UserID& GetWindowOwner(aura::Window* window) const
= 0; |
105 | 109 |
106 // Allows to show an owned window for another users. If the window is not | 110 // 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 | 111 // owned, this call will return immediately. (The FileManager for example |
108 // might be available for every user and not belong explicitly to one). | 112 // 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 | 113 // 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 | 114 // when the window gets minimized, it will automatically fall back to the |
111 // owner's desktop. | 115 // owner's desktop. |
112 virtual void ShowWindowForUser( | 116 virtual void ShowWindowForUser( |
113 aura::Window* window, const std::string& user_id) = 0; | 117 aura::Window* window, const user_manager::UserID& user_id) = 0; |
114 | 118 |
115 // Returns true when windows are shared among users. | 119 // Returns true when windows are shared among users. |
116 virtual bool AreWindowsSharedAmongUsers() const = 0; | 120 virtual bool AreWindowsSharedAmongUsers() const = 0; |
117 | 121 |
118 // Get the owners for the visible windows and set them to |user_ids|. | 122 // Get the owners for the visible windows and set them to |user_ids|. |
119 virtual void GetOwnersOfVisibleWindows( | 123 virtual void GetOwnersOfVisibleWindows( |
120 std::set<std::string>* user_ids) const = 0; | 124 std::set<user_manager::UserID>* user_ids) const = 0; |
121 | 125 |
122 // A query call for a given window to see if it is on the given user's | 126 // A query call for a given window to see if it is on the given user's |
123 // desktop. | 127 // desktop. |
124 virtual bool IsWindowOnDesktopOfUser(aura::Window* window, | 128 virtual bool IsWindowOnDesktopOfUser(aura::Window* window, |
125 const std::string& user_id) const = 0; | 129 const user_manager::UserID& user_id) cons
t = 0; |
126 | 130 |
127 // Get the user on which the window is currently shown. If an empty string is | 131 // 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. | 132 // passed back the window will be presented for every user. |
129 virtual const std::string& GetUserPresentingWindow( | 133 virtual const user_manager::UserID& GetUserPresentingWindow( |
130 aura::Window* window) const = 0; | 134 aura::Window* window) const = 0; |
131 | 135 |
132 // Adds user to monitor starting and running V1/V2 application windows. | 136 // Adds user to monitor starting and running V1/V2 application windows. |
133 // Returns immediately if the user (identified by a |profile|) is already | 137 // Returns immediately if the user (identified by a |profile|) is already |
134 // known to the manager. Note: This function is not implemented as a | 138 // known to the manager. Note: This function is not implemented as a |
135 // SessionStateObserver to coordinate the timing of the addition with other | 139 // SessionStateObserver to coordinate the timing of the addition with other |
136 // modules. | 140 // modules. |
137 virtual void AddUser(content::BrowserContext* profile) = 0; | 141 virtual void AddUser(content::BrowserContext* profile) = 0; |
138 | 142 |
139 // Manages observers. | 143 // Manages observers. |
140 virtual void AddObserver(Observer* observer) = 0; | 144 virtual void AddObserver(Observer* observer) = 0; |
141 virtual void RemoveObserver(Observer* observer) = 0; | 145 virtual void RemoveObserver(Observer* observer) = 0; |
142 | 146 |
143 protected: | 147 protected: |
144 virtual ~MultiUserWindowManager() {} | 148 virtual ~MultiUserWindowManager() {} |
145 | 149 |
146 private: | 150 private: |
147 // Caching the current multi profile mode since the detection is expensive. | 151 // Caching the current multi profile mode since the detection is expensive. |
148 static MultiProfileMode multi_user_mode_; | 152 static MultiProfileMode multi_user_mode_; |
149 }; | 153 }; |
150 | 154 |
151 } // namespace chrome | 155 } // namespace chrome |
152 | 156 |
153 #endif // CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_H_ | 157 #endif // CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_H_ |
OLD | NEW |