| 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 "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 14 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
| 15 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
| 16 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
| 17 #include "ui/aura/window_observer.h" | 17 #include "ui/aura/window_observer.h" |
| 18 #include "ui/views/corewm/transient_window_observer.h" |
| 18 | 19 |
| 19 class Browser; | 20 class Browser; |
| 20 class Profile; | 21 class Profile; |
| 21 | 22 |
| 22 namespace aura { | 23 namespace aura { |
| 23 class Window; | 24 class Window; |
| 24 class WindowObserver; | 25 class WindowObserver; |
| 25 } | 26 } |
| 26 | 27 |
| 27 namespace chrome { | 28 namespace chrome { |
| 28 | 29 |
| 29 class AppObserver; | 30 class AppObserver; |
| 30 | 31 |
| 31 // This ChromeOS implementation of the MultiUserWindowManager interface is | 32 // This ChromeOS implementation of the MultiUserWindowManager interface is |
| 32 // detecting app and browser creations, tagging their windows automatically and | 33 // detecting app and browser creations, tagging their windows automatically and |
| 33 // using (currently) show and hide to make the owned windows visible - or not. | 34 // using (currently) show and hide to make the owned windows visible - or not. |
| 34 // If it becomes necessary, the function |SetWindowVisibility| can be | 35 // If it becomes necessary, the function |SetWindowVisibility| can be |
| 35 // overwritten to match new ways of doing this. | 36 // overwritten to match new ways of doing this. |
| 36 // Note: | 37 // Note: |
| 37 // - aura::Window::Hide() is currently hiding the window and all owned transient | 38 // - aura::Window::Hide() is currently hiding the window and all owned transient |
| 38 // children. However aura::Window::Show() is only showing the window itself. | 39 // children. However aura::Window::Show() is only showing the window itself. |
| 39 // To address that, all transient children (and their children) are remembered | 40 // To address that, all transient children (and their children) are remembered |
| 40 // in |transient_window_to_visibility_| and monitored to keep track of the | 41 // in |transient_window_to_visibility_| and monitored to keep track of the |
| 41 // visibility changes from the owning user. This way the visibility can be | 42 // visibility changes from the owning user. This way the visibility can be |
| 42 // changed back to its requested state upon showing by us - or when the window | 43 // changed back to its requested state upon showing by us - or when the window |
| 43 // gets detached from its current owning parent. | 44 // gets detached from its current owning parent. |
| 44 class MultiUserWindowManagerChromeOS : public MultiUserWindowManager, | 45 class MultiUserWindowManagerChromeOS |
| 45 public ash::SessionStateObserver, | 46 : public MultiUserWindowManager, |
| 46 public aura::WindowObserver, | 47 public ash::SessionStateObserver, |
| 47 public content::NotificationObserver, | 48 public ash::wm::WindowStateObserver, |
| 48 public ash::wm::WindowStateObserver { | 49 public aura::WindowObserver, |
| 50 public content::NotificationObserver, |
| 51 public views::corewm::TransientWindowObserver { |
| 49 public: | 52 public: |
| 50 // Create the manager and use |active_user_id| as the active user. | 53 // Create the manager and use |active_user_id| as the active user. |
| 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; |
| 61 virtual bool IsWindowOnDesktopOfUser(aura::Window* window, | 64 virtual bool IsWindowOnDesktopOfUser(aura::Window* window, |
| 62 const std::string& user_id) OVERRIDE; | 65 const std::string& user_id) OVERRIDE; |
| 63 virtual const std::string& GetUserPresentingWindow( | 66 virtual const std::string& GetUserPresentingWindow( |
| 64 aura::Window* window) OVERRIDE; | 67 aura::Window* window) OVERRIDE; |
| 65 virtual void AddUser(Profile* profile) OVERRIDE; | 68 virtual void AddUser(Profile* profile) OVERRIDE; |
| 66 | 69 |
| 67 // SessionStateObserver overrides: | 70 // SessionStateObserver overrides: |
| 68 virtual void ActiveUserChanged(const std::string& user_id) OVERRIDE; | 71 virtual void ActiveUserChanged(const std::string& user_id) OVERRIDE; |
| 69 | 72 |
| 70 // WindowObserver overrides: | 73 // WindowObserver overrides: |
| 71 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; | 74 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; |
| 72 virtual void OnWindowVisibilityChanging(aura::Window* window, | 75 virtual void OnWindowVisibilityChanging(aura::Window* window, |
| 73 bool visible) OVERRIDE; | 76 bool visible) OVERRIDE; |
| 74 virtual void OnWindowVisibilityChanged(aura::Window* window, | 77 virtual void OnWindowVisibilityChanged(aura::Window* window, |
| 75 bool visible) OVERRIDE; | 78 bool visible) OVERRIDE; |
| 76 virtual void OnAddTransientChild(aura::Window* window, | 79 |
| 77 aura::Window* transient) OVERRIDE; | 80 // TransientWindowObserver overrides: |
| 78 virtual void OnRemoveTransientChild(aura::Window* window, | 81 virtual void OnTransientChildAdded(aura::Window* window, |
| 79 aura::Window* transient) OVERRIDE; | 82 aura::Window* transient) OVERRIDE; |
| 83 virtual void OnTransientChildRemoved(aura::Window* window, |
| 84 aura::Window* transient) OVERRIDE; |
| 80 | 85 |
| 81 // Window .. overrides: | 86 // Window .. overrides: |
| 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; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 // Caching the current multi profile mode since the detection which mode is | 189 // Caching the current multi profile mode since the detection which mode is |
| 185 // used is quite expensive. | 190 // used is quite expensive. |
| 186 static MultiProfileMode multi_user_mode_; | 191 static MultiProfileMode multi_user_mode_; |
| 187 | 192 |
| 188 DISALLOW_COPY_AND_ASSIGN(MultiUserWindowManagerChromeOS); | 193 DISALLOW_COPY_AND_ASSIGN(MultiUserWindowManagerChromeOS); |
| 189 }; | 194 }; |
| 190 | 195 |
| 191 } // namespace chrome | 196 } // namespace chrome |
| 192 | 197 |
| 193 #endif // CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_CHROMEOS_H
_ | 198 #endif // CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_CHROMEOS_H
_ |
| OLD | NEW |