| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_AURA_TEST_TEST_ACTIVATION_CLIENT_H_ | 5 #ifndef UI_AURA_TEST_TEST_ACTIVATION_CLIENT_H_ |
| 6 #define UI_AURA_TEST_TEST_ACTIVATION_CLIENT_H_ | 6 #define UI_AURA_TEST_TEST_ACTIVATION_CLIENT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "ui/aura/client/activation_client.h" | 11 #include "ui/aura/client/activation_client.h" |
| 12 #include "ui/aura/window_observer.h" | 12 #include "ui/aura/window_observer.h" |
| 13 | 13 |
| 14 namespace aura { | 14 namespace aura { |
| 15 class RootWindow; | 15 class RootWindow; |
| 16 namespace test { | 16 namespace test { |
| 17 | 17 |
| 18 class TestActivationClient : public client::ActivationClient, | 18 class TestActivationClient : public client::ActivationClient, |
| 19 public WindowObserver { | 19 public WindowObserver { |
| 20 public: | 20 public: |
| 21 explicit TestActivationClient(RootWindow* root_window); | 21 explicit TestActivationClient(RootWindow* root_window); |
| 22 virtual ~TestActivationClient(); | 22 virtual ~TestActivationClient(); |
| 23 | 23 |
| 24 // Overridden from client::ActivationClient: | 24 // Overridden from client::ActivationClient: |
| 25 virtual void ActivateWindow(Window* window) OVERRIDE; | 25 virtual void ActivateWindow(Window* window) OVERRIDE; |
| 26 virtual void DeactivateWindow(Window* window) OVERRIDE; | 26 virtual void DeactivateWindow(Window* window) OVERRIDE; |
| 27 virtual Window* GetActiveWindow() OVERRIDE; | 27 virtual Window* GetActiveWindow() OVERRIDE; |
| 28 virtual bool OnWillFocusWindow(Window* window, const Event* event) OVERRIDE; | 28 virtual bool OnWillFocusWindow(Window* window, const Event* event) OVERRIDE; |
| 29 virtual bool CanActivateWindow(Window* window) const OVERRIDE; |
| 29 | 30 |
| 30 // Overridden from WindowObserver: | 31 // Overridden from WindowObserver: |
| 31 virtual void OnWindowDestroyed(Window* window) OVERRIDE; | 32 virtual void OnWindowDestroyed(Window* window) OVERRIDE; |
| 32 | 33 |
| 33 private: | 34 private: |
| 34 void RemoveActiveWindow(Window* window); | 35 void RemoveActiveWindow(Window* window); |
| 35 | 36 |
| 36 // This class explicitly does NOT store the active window in a window property | 37 // This class explicitly does NOT store the active window in a window property |
| 37 // to make sure that storing the active window in a property is not treated as | 38 // to make sure that storing the active window in a property is not treated as |
| 38 // part of the aura API. Assumptions to that end will cause tests that use | 39 // part of the aura API. Assumptions to that end will cause tests that use |
| 39 // this client to fail. | 40 // this client to fail. |
| 40 std::vector<Window*> active_windows_; | 41 std::vector<Window*> active_windows_; |
| 41 | 42 |
| 42 DISALLOW_COPY_AND_ASSIGN(TestActivationClient); | 43 DISALLOW_COPY_AND_ASSIGN(TestActivationClient); |
| 43 }; | 44 }; |
| 44 | 45 |
| 45 } // namespace test | 46 } // namespace test |
| 46 } // namespace aura | 47 } // namespace aura |
| 47 | 48 |
| 48 #endif // UI_AURA_TEST_TEST_ACTIVATION_CLIENT_H_ | 49 #endif // UI_AURA_TEST_TEST_ACTIVATION_CLIENT_H_ |
| OLD | NEW |