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/server_view_drawn_tracker.h" | 5 #include "components/mus/server_view_drawn_tracker.h" |
6 | 6 |
7 #include "components/mus/server_view.h" | 7 #include "components/mus/server_view.h" |
8 #include "components/mus/server_view_drawn_tracker_observer.h" | 8 #include "components/mus/server_view_drawn_tracker_observer.h" |
9 | 9 |
10 namespace mus { | 10 namespace view_manager { |
11 | 11 |
12 ServerViewDrawnTracker::ServerViewDrawnTracker( | 12 ServerViewDrawnTracker::ServerViewDrawnTracker( |
13 ServerView* view, | 13 ServerView* view, |
14 ServerViewDrawnTrackerObserver* observer) | 14 ServerViewDrawnTrackerObserver* observer) |
15 : view_(view), observer_(observer), drawn_(view->IsDrawn()) { | 15 : view_(view), observer_(observer), drawn_(view->IsDrawn()) { |
16 AddObservers(); | 16 AddObservers(); |
17 } | 17 } |
18 | 18 |
19 ServerViewDrawnTracker::~ServerViewDrawnTracker() { | 19 ServerViewDrawnTracker::~ServerViewDrawnTracker() { |
20 RemoveObservers(); | 20 RemoveObservers(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 AddObservers(); | 62 AddObservers(); |
63 const bool is_drawn = view_->IsDrawn(); | 63 const bool is_drawn = view_->IsDrawn(); |
64 SetDrawn(is_drawn ? nullptr : old_parent, is_drawn); | 64 SetDrawn(is_drawn ? nullptr : old_parent, is_drawn); |
65 } | 65 } |
66 | 66 |
67 void ServerViewDrawnTracker::OnViewVisibilityChanged(ServerView* view) { | 67 void ServerViewDrawnTracker::OnViewVisibilityChanged(ServerView* view) { |
68 const bool is_drawn = view_->IsDrawn(); | 68 const bool is_drawn = view_->IsDrawn(); |
69 SetDrawn(is_drawn ? nullptr : view->parent(), is_drawn); | 69 SetDrawn(is_drawn ? nullptr : view->parent(), is_drawn); |
70 } | 70 } |
71 | 71 |
72 } // namespace mus | 72 } // namespace view_manager |
OLD | NEW |