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