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_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_CHROMEOS_H_ |
6 #define CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_CHROMEOS_H_ | 6 #define CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_CHROMEOS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "ash/session_state_observer.h" | 11 #include "ash/session_state_observer.h" |
12 #include "ash/wm/window_state_observer.h" | 12 #include "ash/wm/window_state_observer.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/scoped_ptr.h" |
14 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 15 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
15 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
16 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
17 #include "ui/aura/window_observer.h" | 18 #include "ui/aura/window_observer.h" |
18 | 19 |
19 class Browser; | 20 class Browser; |
| 21 class MultiUserNotificationBlockerChromeOS; |
| 22 class MultiUserNotificationBlockerChromeOSTest; |
20 class Profile; | 23 class Profile; |
21 | 24 |
22 namespace aura { | 25 namespace aura { |
23 class Window; | 26 class Window; |
24 class WindowObserver; | 27 class WindowObserver; |
25 } | 28 } |
26 | 29 |
27 namespace chrome { | 30 namespace chrome { |
28 | 31 |
29 class AppObserver; | 32 class AppObserver; |
(...skipping 21 matching lines...) Expand all Loading... |
51 explicit MultiUserWindowManagerChromeOS(const std::string& active_user_id); | 54 explicit MultiUserWindowManagerChromeOS(const std::string& active_user_id); |
52 virtual ~MultiUserWindowManagerChromeOS(); | 55 virtual ~MultiUserWindowManagerChromeOS(); |
53 | 56 |
54 // MultiUserWindowManager overrides: | 57 // MultiUserWindowManager overrides: |
55 virtual void SetWindowOwner( | 58 virtual void SetWindowOwner( |
56 aura::Window* window, const std::string& user_id) OVERRIDE; | 59 aura::Window* window, const std::string& user_id) OVERRIDE; |
57 virtual const std::string& GetWindowOwner(aura::Window* window) OVERRIDE; | 60 virtual const std::string& GetWindowOwner(aura::Window* window) OVERRIDE; |
58 virtual void ShowWindowForUser( | 61 virtual void ShowWindowForUser( |
59 aura::Window* window, const std::string& user_id) OVERRIDE; | 62 aura::Window* window, const std::string& user_id) OVERRIDE; |
60 virtual bool AreWindowsSharedAmongUsers() OVERRIDE; | 63 virtual bool AreWindowsSharedAmongUsers() OVERRIDE; |
| 64 virtual void GetOwnersOfVisibleWindows( |
| 65 std::set<std::string>* user_ids) OVERRIDE; |
61 virtual bool IsWindowOnDesktopOfUser(aura::Window* window, | 66 virtual bool IsWindowOnDesktopOfUser(aura::Window* window, |
62 const std::string& user_id) OVERRIDE; | 67 const std::string& user_id) OVERRIDE; |
63 virtual const std::string& GetUserPresentingWindow( | 68 virtual const std::string& GetUserPresentingWindow( |
64 aura::Window* window) OVERRIDE; | 69 aura::Window* window) OVERRIDE; |
65 virtual void AddUser(Profile* profile) OVERRIDE; | 70 virtual void AddUser(Profile* profile) OVERRIDE; |
66 | 71 |
67 // SessionStateObserver overrides: | 72 // SessionStateObserver overrides: |
68 virtual void ActiveUserChanged(const std::string& user_id) OVERRIDE; | 73 virtual void ActiveUserChanged(const std::string& user_id) OVERRIDE; |
69 | 74 |
70 // WindowObserver overrides: | 75 // WindowObserver overrides: |
(...skipping 11 matching lines...) Expand all Loading... |
82 virtual void OnWindowShowTypeChanged( | 87 virtual void OnWindowShowTypeChanged( |
83 ash::wm::WindowState* state, | 88 ash::wm::WindowState* state, |
84 ash::wm::WindowShowType old_type) OVERRIDE; | 89 ash::wm::WindowShowType old_type) OVERRIDE; |
85 | 90 |
86 // content::NotificationObserver overrides: | 91 // content::NotificationObserver overrides: |
87 virtual void Observe(int type, | 92 virtual void Observe(int type, |
88 const content::NotificationSource& source, | 93 const content::NotificationSource& source, |
89 const content::NotificationDetails& details) OVERRIDE; | 94 const content::NotificationDetails& details) OVERRIDE; |
90 | 95 |
91 private: | 96 private: |
| 97 friend class ::MultiUserNotificationBlockerChromeOSTest; |
| 98 |
92 class WindowEntry { | 99 class WindowEntry { |
93 public: | 100 public: |
94 explicit WindowEntry(const std::string& user_id) | 101 explicit WindowEntry(const std::string& user_id) |
95 : owner_(user_id), | 102 : owner_(user_id), |
96 show_for_user_(user_id), | 103 show_for_user_(user_id), |
97 show_(true) {} | 104 show_(true) {} |
98 virtual ~WindowEntry() {} | 105 virtual ~WindowEntry() {} |
99 | 106 |
100 // Returns the owner of this window. This cannot be changed. | 107 // Returns the owner of this window. This cannot be changed. |
101 const std::string& owner() const { return owner_; } | 108 const std::string& owner() const { return owner_; } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 UserIDToShellWindowObserver user_id_to_app_observer_; | 175 UserIDToShellWindowObserver user_id_to_app_observer_; |
169 | 176 |
170 // A map which remembers for owned transient windows their own visibility. | 177 // A map which remembers for owned transient windows their own visibility. |
171 TransientWindowToVisibility transient_window_to_visibility_; | 178 TransientWindowToVisibility transient_window_to_visibility_; |
172 | 179 |
173 // The currently selected active user. It is used to find the proper | 180 // The currently selected active user. It is used to find the proper |
174 // visibility state in various cases. The state is stored here instead of | 181 // visibility state in various cases. The state is stored here instead of |
175 // being read from the user manager to be in sync while a switch occurs. | 182 // being read from the user manager to be in sync while a switch occurs. |
176 std::string current_user_id_; | 183 std::string current_user_id_; |
177 | 184 |
| 185 // The blocker which controls the desktop notification visibility based on the |
| 186 // current multi-user status. |
| 187 scoped_ptr<MultiUserNotificationBlockerChromeOS> notification_blocker_; |
| 188 |
178 // The notification registrar to track the creation of browser windows. | 189 // The notification registrar to track the creation of browser windows. |
179 content::NotificationRegistrar registrar_; | 190 content::NotificationRegistrar registrar_; |
180 | 191 |
181 // Suppress changes to the visibility flag while we are changing it ourselves. | 192 // Suppress changes to the visibility flag while we are changing it ourselves. |
182 bool suppress_visibility_changes_; | 193 bool suppress_visibility_changes_; |
183 | 194 |
184 // Caching the current multi profile mode since the detection which mode is | 195 // Caching the current multi profile mode since the detection which mode is |
185 // used is quite expensive. | 196 // used is quite expensive. |
186 static MultiProfileMode multi_user_mode_; | 197 static MultiProfileMode multi_user_mode_; |
187 | 198 |
188 DISALLOW_COPY_AND_ASSIGN(MultiUserWindowManagerChromeOS); | 199 DISALLOW_COPY_AND_ASSIGN(MultiUserWindowManagerChromeOS); |
189 }; | 200 }; |
190 | 201 |
191 } // namespace chrome | 202 } // namespace chrome |
192 | 203 |
193 #endif // CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_CHROMEOS_H
_ | 204 #endif // CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_CHROMEOS_H
_ |
OLD | NEW |