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 #include "ui/aura/test/test_activation_client.h" | 5 #include "ui/aura/test/test_activation_client.h" |
6 | 6 |
7 #include "ui/aura/client/activation_delegate.h" | 7 #include "ui/aura/client/activation_delegate.h" |
8 #include "ui/aura/root_window.h" | 8 #include "ui/aura/root_window.h" |
9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 if (active_windows_.empty()) | 52 if (active_windows_.empty()) |
53 return NULL; | 53 return NULL; |
54 return active_windows_.back(); | 54 return active_windows_.back(); |
55 } | 55 } |
56 | 56 |
57 bool TestActivationClient::OnWillFocusWindow(Window* window, | 57 bool TestActivationClient::OnWillFocusWindow(Window* window, |
58 const Event* event) { | 58 const Event* event) { |
59 return true; | 59 return true; |
60 } | 60 } |
61 | 61 |
| 62 bool TestActivationClient::CanActivateWindow(Window* window) const { |
| 63 return true; |
| 64 } |
| 65 |
62 //////////////////////////////////////////////////////////////////////////////// | 66 //////////////////////////////////////////////////////////////////////////////// |
63 // TestActivationClient, WindowObserver implementation: | 67 // TestActivationClient, WindowObserver implementation: |
64 | 68 |
65 void TestActivationClient::OnWindowDestroyed(Window* window) { | 69 void TestActivationClient::OnWindowDestroyed(Window* window) { |
66 if (window == GetActiveWindow()) { | 70 if (window == GetActiveWindow()) { |
67 window->RemoveObserver(this); | 71 window->RemoveObserver(this); |
68 active_windows_.pop_back(); | 72 active_windows_.pop_back(); |
69 Window* next_active = GetActiveWindow(); | 73 Window* next_active = GetActiveWindow(); |
70 if (next_active && aura::client::GetActivationDelegate(next_active)) | 74 if (next_active && aura::client::GetActivationDelegate(next_active)) |
71 aura::client::GetActivationDelegate(next_active)->OnActivated(); | 75 aura::client::GetActivationDelegate(next_active)->OnActivated(); |
72 return; | 76 return; |
73 } | 77 } |
74 | 78 |
75 RemoveActiveWindow(window); | 79 RemoveActiveWindow(window); |
76 } | 80 } |
77 | 81 |
78 void TestActivationClient::RemoveActiveWindow(Window* window) { | 82 void TestActivationClient::RemoveActiveWindow(Window* window) { |
79 for (unsigned int i = 0; i < active_windows_.size(); ++i) { | 83 for (unsigned int i = 0; i < active_windows_.size(); ++i) { |
80 if (active_windows_[i] == window) { | 84 if (active_windows_[i] == window) { |
81 active_windows_.erase(active_windows_.begin() + i); | 85 active_windows_.erase(active_windows_.begin() + i); |
82 window->RemoveObserver(this); | 86 window->RemoveObserver(this); |
83 return; | 87 return; |
84 } | 88 } |
85 } | 89 } |
86 } | 90 } |
87 | 91 |
88 } // namespace test | 92 } // namespace test |
89 } // namespace aura | 93 } // namespace aura |
OLD | NEW |