| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/client/default_activation_client.h" | 5 #include "ui/aura/client/default_activation_client.h" |
| 6 | 6 |
| 7 #include "ui/aura/client/activation_change_observer.h" | 7 #include "ui/aura/client/activation_change_observer.h" |
| 8 #include "ui/aura/client/activation_delegate.h" | 8 #include "ui/aura/client/activation_delegate.h" |
| 9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 | 10 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 95 } |
| 96 | 96 |
| 97 //////////////////////////////////////////////////////////////////////////////// | 97 //////////////////////////////////////////////////////////////////////////////// |
| 98 // DefaultActivationClient, WindowObserver implementation: | 98 // DefaultActivationClient, WindowObserver implementation: |
| 99 | 99 |
| 100 void DefaultActivationClient::OnWindowDestroyed(Window* window) { | 100 void DefaultActivationClient::OnWindowDestroyed(Window* window) { |
| 101 if (window == last_active_) | 101 if (window == last_active_) |
| 102 last_active_ = NULL; | 102 last_active_ = NULL; |
| 103 | 103 |
| 104 if (window == GetActiveWindow()) { | 104 if (window == GetActiveWindow()) { |
| 105 window->RemoveObserver(this); | |
| 106 active_windows_.pop_back(); | 105 active_windows_.pop_back(); |
| 107 Window* next_active = GetActiveWindow(); | 106 Window* next_active = GetActiveWindow(); |
| 108 if (next_active && aura::client::GetActivationChangeObserver(next_active)) { | 107 if (next_active && aura::client::GetActivationChangeObserver(next_active)) { |
| 109 aura::client::GetActivationChangeObserver(next_active)->OnWindowActivated( | 108 aura::client::GetActivationChangeObserver(next_active)->OnWindowActivated( |
| 110 next_active, NULL); | 109 next_active, NULL); |
| 111 } | 110 } |
| 112 return; | 111 return; |
| 113 } | 112 } |
| 114 | 113 |
| 115 RemoveActiveWindow(window); | 114 RemoveActiveWindow(window); |
| 116 } | 115 } |
| 117 | 116 |
| 118 void DefaultActivationClient::RemoveActiveWindow(Window* window) { | 117 void DefaultActivationClient::RemoveActiveWindow(Window* window) { |
| 119 for (unsigned int i = 0; i < active_windows_.size(); ++i) { | 118 for (unsigned int i = 0; i < active_windows_.size(); ++i) { |
| 120 if (active_windows_[i] == window) { | 119 if (active_windows_[i] == window) { |
| 121 active_windows_.erase(active_windows_.begin() + i); | 120 active_windows_.erase(active_windows_.begin() + i); |
| 122 window->RemoveObserver(this); | 121 window->RemoveObserver(this); |
| 123 return; | 122 return; |
| 124 } | 123 } |
| 125 } | 124 } |
| 126 } | 125 } |
| 127 | 126 |
| 128 } // namespace client | 127 } // namespace client |
| 129 } // namespace aura | 128 } // namespace aura |
| OLD | NEW |