OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/mus/public/cpp/scoped_window_ptr.h" | 5 #include "services/ui/public/cpp/scoped_window_ptr.h" |
6 | 6 |
7 #include "components/mus/public/cpp/window.h" | 7 #include "services/ui/public/cpp/window.h" |
8 #include "components/mus/public/cpp/window_observer.h" | 8 #include "services/ui/public/cpp/window_observer.h" |
9 #include "components/mus/public/cpp/window_tree_client.h" | 9 #include "services/ui/public/cpp/window_tree_client.h" |
10 | 10 |
11 namespace mus { | 11 namespace mus { |
12 | 12 |
13 ScopedWindowPtr::ScopedWindowPtr(Window* window) : window_(window) { | 13 ScopedWindowPtr::ScopedWindowPtr(Window* window) : window_(window) { |
14 window_->AddObserver(this); | 14 window_->AddObserver(this); |
15 } | 15 } |
16 | 16 |
17 ScopedWindowPtr::~ScopedWindowPtr() { | 17 ScopedWindowPtr::~ScopedWindowPtr() { |
18 if (window_) | 18 if (window_) |
19 DeleteWindowOrWindowManager(window_); | 19 DeleteWindowOrWindowManager(window_); |
(...skipping 15 matching lines...) Expand all Loading... |
35 window_->RemoveObserver(this); | 35 window_->RemoveObserver(this); |
36 window_ = nullptr; | 36 window_ = nullptr; |
37 } | 37 } |
38 | 38 |
39 void ScopedWindowPtr::OnWindowDestroying(Window* window) { | 39 void ScopedWindowPtr::OnWindowDestroying(Window* window) { |
40 DCHECK_EQ(window_, window); | 40 DCHECK_EQ(window_, window); |
41 DetachFromWindow(); | 41 DetachFromWindow(); |
42 } | 42 } |
43 | 43 |
44 } // namespace mus | 44 } // namespace mus |
OLD | NEW |