OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SHELL_TEST_TEST_ACTIVATION_DELEGATE_H_ | 5 #ifndef UI_AURA_SHELL_TEST_TEST_ACTIVATION_DELEGATE_H_ |
6 #define UI_AURA_SHELL_TEST_TEST_ACTIVATION_DELEGATE_H_ | 6 #define UI_AURA_SHELL_TEST_TEST_ACTIVATION_DELEGATE_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_delegate.h" | 11 #include "ui/aura/client/activation_delegate.h" |
12 | 12 |
13 namespace aura { | 13 namespace aura { |
14 class Window; | 14 class Window; |
15 } | 15 } |
16 | 16 |
17 namespace aura_shell { | 17 namespace aura_shell { |
18 namespace test { | 18 namespace test { |
19 | 19 |
20 // A test ActivationDelegate that can be used to track activation changes for | 20 // A test ActivationDelegate that can be used to track activation changes for |
21 // an aura::Window. | 21 // an aura::Window. |
22 class TestActivationDelegate : public aura::ActivationDelegate { | 22 class TestActivationDelegate : public aura::client::ActivationDelegate { |
23 public: | 23 public: |
24 TestActivationDelegate(); | 24 TestActivationDelegate(); |
25 explicit TestActivationDelegate(bool activate); | 25 explicit TestActivationDelegate(bool activate); |
26 | 26 |
27 // Associates this delegate with a Window. | 27 // Associates this delegate with a Window. |
28 void SetWindow(aura::Window* window); | 28 void SetWindow(aura::Window* window); |
29 | 29 |
30 bool window_was_active() const { return window_was_active_; } | 30 bool window_was_active() const { return window_was_active_; } |
31 void set_activate(bool v) { activate_ = v; } | 31 void set_activate(bool v) { activate_ = v; } |
32 int activated_count() const { return activated_count_; } | 32 int activated_count() const { return activated_count_; } |
33 int lost_active_count() const { return lost_active_count_; } | 33 int lost_active_count() const { return lost_active_count_; } |
34 int should_activate_count() const { return should_activate_count_; } | 34 int should_activate_count() const { return should_activate_count_; } |
35 void Clear() { | 35 void Clear() { |
36 activated_count_ = lost_active_count_ = should_activate_count_ = 0; | 36 activated_count_ = lost_active_count_ = should_activate_count_ = 0; |
37 window_was_active_ = false; | 37 window_was_active_ = false; |
38 } | 38 } |
39 | 39 |
40 // Overridden from ActivationDelegate: | 40 // Overridden from client::ActivationDelegate: |
41 virtual bool ShouldActivate(aura::Event* event) OVERRIDE; | 41 virtual bool ShouldActivate(aura::Event* event) OVERRIDE; |
42 virtual void OnActivated() OVERRIDE; | 42 virtual void OnActivated() OVERRIDE; |
43 virtual void OnLostActive() OVERRIDE; | 43 virtual void OnLostActive() OVERRIDE; |
44 | 44 |
45 private: | 45 private: |
46 aura::Window* window_; | 46 aura::Window* window_; |
47 bool window_was_active_; | 47 bool window_was_active_; |
48 bool activate_; | 48 bool activate_; |
49 int activated_count_; | 49 int activated_count_; |
50 int lost_active_count_; | 50 int lost_active_count_; |
51 int should_activate_count_; | 51 int should_activate_count_; |
52 | 52 |
53 DISALLOW_COPY_AND_ASSIGN(TestActivationDelegate); | 53 DISALLOW_COPY_AND_ASSIGN(TestActivationDelegate); |
54 }; | 54 }; |
55 | 55 |
56 } // namespace test | 56 } // namespace test |
57 } // namespace aura_shell | 57 } // namespace aura_shell |
58 | 58 |
59 #endif // UI_AURA_SHELL_TEST_TEST_ACTIVATION_DELEGATE_H_ | 59 #endif // UI_AURA_SHELL_TEST_TEST_ACTIVATION_DELEGATE_H_ |
OLD | NEW |