| 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/wm/core/default_activation_client.h" | 5 #include "ui/wm/core/default_activation_client.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
| 9 #include "ui/wm/public/activation_change_observer.h" | 9 #include "ui/wm/public/activation_change_observer.h" |
| 10 #include "ui/wm/public/activation_delegate.h" | 10 #include "ui/wm/public/activation_delegate.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 aura::Window* last_active = GetActiveWindow(); | 71 aura::Window* last_active = GetActiveWindow(); |
| 72 if (last_active == window) | 72 if (last_active == window) |
| 73 return; | 73 return; |
| 74 | 74 |
| 75 last_active_ = last_active; | 75 last_active_ = last_active; |
| 76 RemoveActiveWindow(window); | 76 RemoveActiveWindow(window); |
| 77 active_windows_.push_back(window); | 77 active_windows_.push_back(window); |
| 78 window->parent()->StackChildAtTop(window); | 78 window->parent()->StackChildAtTop(window); |
| 79 window->AddObserver(this); | 79 window->AddObserver(this); |
| 80 | 80 |
| 81 FOR_EACH_OBSERVER(aura::client::ActivationChangeObserver, observers_, | 81 for (auto& observer : observers_) |
| 82 OnWindowActivated(reason, window, last_active)); | 82 observer.OnWindowActivated(reason, window, last_active); |
| 83 | 83 |
| 84 aura::client::ActivationChangeObserver* observer = | 84 aura::client::ActivationChangeObserver* observer = |
| 85 aura::client::GetActivationChangeObserver(last_active); | 85 aura::client::GetActivationChangeObserver(last_active); |
| 86 if (observer) { | 86 if (observer) { |
| 87 observer->OnWindowActivated(reason, window, last_active); | 87 observer->OnWindowActivated(reason, window, last_active); |
| 88 } | 88 } |
| 89 observer = aura::client::GetActivationChangeObserver(window); | 89 observer = aura::client::GetActivationChangeObserver(window); |
| 90 if (observer) { | 90 if (observer) { |
| 91 observer->OnWindowActivated(reason, window, last_active); | 91 observer->OnWindowActivated(reason, window, last_active); |
| 92 } | 92 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 for (unsigned int i = 0; i < active_windows_.size(); ++i) { | 158 for (unsigned int i = 0; i < active_windows_.size(); ++i) { |
| 159 if (active_windows_[i] == window) { | 159 if (active_windows_[i] == window) { |
| 160 active_windows_.erase(active_windows_.begin() + i); | 160 active_windows_.erase(active_windows_.begin() + i); |
| 161 window->RemoveObserver(this); | 161 window->RemoveObserver(this); |
| 162 return; | 162 return; |
| 163 } | 163 } |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 | 166 |
| 167 } // namespace wm | 167 } // namespace wm |
| OLD | NEW |