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 "ui/aura/window.h" | 7 #include "ui/aura/window.h" |
8 #include "ui/wm/public/activation_change_observer.h" | 8 #include "ui/wm/public/activation_change_observer.h" |
9 #include "ui/wm/public/activation_delegate.h" | 9 #include "ui/wm/public/activation_delegate.h" |
10 | 10 |
11 namespace wm { | 11 namespace wm { |
12 | 12 |
13 // Takes care of observing root window destruction & destroying the client. | 13 // Takes care of observing root window destruction & destroying the client. |
14 class DefaultActivationClient::Deleter : public aura::WindowObserver { | 14 class DefaultActivationClient::Deleter : public aura::WindowObserver { |
15 public: | 15 public: |
16 Deleter(DefaultActivationClient* client, aura::Window* root_window) | 16 Deleter(DefaultActivationClient* client, aura::Window* root_window) |
17 : client_(client), | 17 : client_(client), |
18 root_window_(root_window) { | 18 root_window_(root_window) { |
19 root_window_->AddObserver(this); | 19 root_window_->AddObserver(this); |
20 } | 20 } |
21 | 21 |
22 private: | 22 private: |
23 virtual ~Deleter() {} | 23 virtual ~Deleter() {} |
24 | 24 |
25 // Overridden from WindowObserver: | 25 // Overridden from WindowObserver: |
26 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE { | 26 virtual void OnWindowDestroyed(aura::Window* window) override { |
27 DCHECK_EQ(window, root_window_); | 27 DCHECK_EQ(window, root_window_); |
28 root_window_->RemoveObserver(this); | 28 root_window_->RemoveObserver(this); |
29 delete client_; | 29 delete client_; |
30 delete this; | 30 delete this; |
31 } | 31 } |
32 | 32 |
33 DefaultActivationClient* client_; | 33 DefaultActivationClient* client_; |
34 aura::Window* root_window_; | 34 aura::Window* root_window_; |
35 | 35 |
36 DISALLOW_COPY_AND_ASSIGN(Deleter); | 36 DISALLOW_COPY_AND_ASSIGN(Deleter); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 for (unsigned int i = 0; i < active_windows_.size(); ++i) { | 143 for (unsigned int i = 0; i < active_windows_.size(); ++i) { |
144 if (active_windows_[i] == window) { | 144 if (active_windows_[i] == window) { |
145 active_windows_.erase(active_windows_.begin() + i); | 145 active_windows_.erase(active_windows_.begin() + i); |
146 window->RemoveObserver(this); | 146 window->RemoveObserver(this); |
147 return; | 147 return; |
148 } | 148 } |
149 } | 149 } |
150 } | 150 } |
151 | 151 |
152 } // namespace wm | 152 } // namespace wm |
OLD | NEW |