| 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 UI_WM_CORE_DEFAULT_ACTIVATION_CLIENT_H_ | 5 #ifndef UI_WM_CORE_DEFAULT_ACTIVATION_CLIENT_H_ |
| 6 #define UI_WM_CORE_DEFAULT_ACTIVATION_CLIENT_H_ | 6 #define UI_WM_CORE_DEFAULT_ACTIVATION_CLIENT_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // that just need basic behavior (e.g. activate windows whenever requested, | 26 // that just need basic behavior (e.g. activate windows whenever requested, |
| 27 // restack windows at the top when they're activated, etc.). This object deletes | 27 // restack windows at the top when they're activated, etc.). This object deletes |
| 28 // itself when the root window it is associated with is destroyed. | 28 // itself when the root window it is associated with is destroyed. |
| 29 class WM_EXPORT DefaultActivationClient : public aura::client::ActivationClient, | 29 class WM_EXPORT DefaultActivationClient : public aura::client::ActivationClient, |
| 30 public aura::WindowObserver { | 30 public aura::WindowObserver { |
| 31 public: | 31 public: |
| 32 explicit DefaultActivationClient(aura::Window* root_window); | 32 explicit DefaultActivationClient(aura::Window* root_window); |
| 33 | 33 |
| 34 // Overridden from aura::client::ActivationClient: | 34 // Overridden from aura::client::ActivationClient: |
| 35 virtual void AddObserver( | 35 virtual void AddObserver( |
| 36 aura::client::ActivationChangeObserver* observer) OVERRIDE; | 36 aura::client::ActivationChangeObserver* observer) override; |
| 37 virtual void RemoveObserver( | 37 virtual void RemoveObserver( |
| 38 aura::client::ActivationChangeObserver* observer) OVERRIDE; | 38 aura::client::ActivationChangeObserver* observer) override; |
| 39 virtual void ActivateWindow(aura::Window* window) OVERRIDE; | 39 virtual void ActivateWindow(aura::Window* window) override; |
| 40 virtual void DeactivateWindow(aura::Window* window) OVERRIDE; | 40 virtual void DeactivateWindow(aura::Window* window) override; |
| 41 virtual aura::Window* GetActiveWindow() OVERRIDE; | 41 virtual aura::Window* GetActiveWindow() override; |
| 42 virtual aura::Window* GetActivatableWindow(aura::Window* window) OVERRIDE; | 42 virtual aura::Window* GetActivatableWindow(aura::Window* window) override; |
| 43 virtual aura::Window* GetToplevelWindow(aura::Window* window) OVERRIDE; | 43 virtual aura::Window* GetToplevelWindow(aura::Window* window) override; |
| 44 virtual bool CanActivateWindow(aura::Window* window) const OVERRIDE; | 44 virtual bool CanActivateWindow(aura::Window* window) const override; |
| 45 | 45 |
| 46 // Overridden from WindowObserver: | 46 // Overridden from WindowObserver: |
| 47 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; | 47 virtual void OnWindowDestroyed(aura::Window* window) override; |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 class Deleter; | 50 class Deleter; |
| 51 | 51 |
| 52 virtual ~DefaultActivationClient(); | 52 virtual ~DefaultActivationClient(); |
| 53 void RemoveActiveWindow(aura::Window* window); | 53 void RemoveActiveWindow(aura::Window* window); |
| 54 | 54 |
| 55 // This class explicitly does NOT store the active window in a window property | 55 // This class explicitly does NOT store the active window in a window property |
| 56 // to make sure that ActivationChangeObserver is not treated as part of the | 56 // to make sure that ActivationChangeObserver is not treated as part of the |
| 57 // aura API. Assumptions to that end will cause tests that use this client to | 57 // aura API. Assumptions to that end will cause tests that use this client to |
| 58 // fail. | 58 // fail. |
| 59 std::vector<aura::Window*> active_windows_; | 59 std::vector<aura::Window*> active_windows_; |
| 60 | 60 |
| 61 // The window which was active before the currently active one. | 61 // The window which was active before the currently active one. |
| 62 aura::Window* last_active_; | 62 aura::Window* last_active_; |
| 63 | 63 |
| 64 ObserverList<aura::client::ActivationChangeObserver> observers_; | 64 ObserverList<aura::client::ActivationChangeObserver> observers_; |
| 65 | 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(DefaultActivationClient); | 66 DISALLOW_COPY_AND_ASSIGN(DefaultActivationClient); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 } // namespace wm | 69 } // namespace wm |
| 70 | 70 |
| 71 #endif // UI_WM_CORE_DEFAULT_ACTIVATION_CLIENT_H_ | 71 #endif // UI_WM_CORE_DEFAULT_ACTIVATION_CLIENT_H_ |
| OLD | NEW |