| 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 #include "ui/aura/test/test_activation_client.h" | |
| 6 | |
| 7 #include "ui/aura/window.h" | |
| 8 | |
| 9 namespace aura { | |
| 10 namespace test { | |
| 11 | |
| 12 //////////////////////////////////////////////////////////////////////////////// | |
| 13 // TestActivationClient, public: | |
| 14 | |
| 15 TestActivationClient::TestActivationClient() : active_window_(NULL) { | |
| 16 ActivationClient::SetActivationClient(this); | |
| 17 } | |
| 18 | |
| 19 TestActivationClient::~TestActivationClient() { | |
| 20 } | |
| 21 | |
| 22 //////////////////////////////////////////////////////////////////////////////// | |
| 23 // TestActivationClient, ActivationClient implementation: | |
| 24 | |
| 25 void TestActivationClient::ActivateWindow(Window* window) { | |
| 26 if (active_window_) | |
| 27 active_window_->RemoveObserver(this); | |
| 28 active_window_ = window; | |
| 29 active_window_->AddObserver(this); | |
| 30 } | |
| 31 | |
| 32 void TestActivationClient::DeactivateWindow(Window* window) { | |
| 33 if (window == active_window_) { | |
| 34 if (active_window_) | |
| 35 active_window_->RemoveObserver(this); | |
| 36 active_window_ = NULL; | |
| 37 } | |
| 38 } | |
| 39 | |
| 40 Window* TestActivationClient::GetActiveWindow() { | |
| 41 return active_window_; | |
| 42 } | |
| 43 | |
| 44 bool TestActivationClient::CanFocusWindow(Window* window) const { | |
| 45 return true; | |
| 46 } | |
| 47 | |
| 48 //////////////////////////////////////////////////////////////////////////////// | |
| 49 // TestActivationClient, WindowObserver implementation: | |
| 50 | |
| 51 void TestActivationClient::OnWindowDestroyed(Window* window) { | |
| 52 if (window == active_window_) { | |
| 53 window->RemoveObserver(this); | |
| 54 active_window_ = NULL; | |
| 55 } | |
| 56 } | |
| 57 | |
| 58 } // namespace test | |
| 59 } // namespace aura | |
| OLD | NEW |