blob: 6f32ea71a1f51d8b61ecb62ad8dea7151bbca863 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/aura/test/test_activation_client.h"
#include "ui/aura/window.h"
namespace aura {
namespace test {
////////////////////////////////////////////////////////////////////////////////
// TestActivationClient, public:
TestActivationClient::TestActivationClient() : active_window_(NULL) {
ActivationClient::SetActivationClient(this);
}
TestActivationClient::~TestActivationClient() {
}
////////////////////////////////////////////////////////////////////////////////
// TestActivationClient, ActivationClient implementation:
void TestActivationClient::ActivateWindow(Window* window) {
if (active_window_)
active_window_->RemoveObserver(this);
active_window_ = window;
active_window_->AddObserver(this);
}
void TestActivationClient::DeactivateWindow(Window* window) {
if (window == active_window_) {
if (active_window_)
active_window_->RemoveObserver(this);
active_window_ = NULL;
}
}
Window* TestActivationClient::GetActiveWindow() {
return active_window_;
}
bool TestActivationClient::CanFocusWindow(Window* window) const {
return true;
}
////////////////////////////////////////////////////////////////////////////////
// TestActivationClient, WindowObserver implementation:
void TestActivationClient::OnWindowDestroyed(Window* window) {
if (window == active_window_) {
window->RemoveObserver(this);
active_window_ = NULL;
}
}
} // namespace test
} // namespace aura
|