Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Unified Diff: components/view_manager/server_view_drawn_tracker.cc

Issue 1344573002: Mandoline: Rename components/view_manager to components/mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/view_manager/server_view_drawn_tracker.cc
diff --git a/components/view_manager/server_view_drawn_tracker.cc b/components/view_manager/server_view_drawn_tracker.cc
deleted file mode 100644
index f513161bf050532bf3346eef02fe368df4bf5b76..0000000000000000000000000000000000000000
--- a/components/view_manager/server_view_drawn_tracker.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/view_manager/server_view_drawn_tracker.h"
-
-#include "components/view_manager/server_view.h"
-#include "components/view_manager/server_view_drawn_tracker_observer.h"
-
-namespace view_manager {
-
-ServerViewDrawnTracker::ServerViewDrawnTracker(
- ServerView* view,
- ServerViewDrawnTrackerObserver* observer)
- : view_(view), observer_(observer), drawn_(view->IsDrawn()) {
- AddObservers();
-}
-
-ServerViewDrawnTracker::~ServerViewDrawnTracker() {
- RemoveObservers();
-}
-
-void ServerViewDrawnTracker::SetDrawn(ServerView* ancestor, bool drawn) {
- if (drawn == drawn_)
- return;
-
- drawn_ = drawn;
- observer_->OnDrawnStateChanged(ancestor, view_, drawn);
-}
-
-void ServerViewDrawnTracker::AddObservers() {
- if (!view_)
- return;
-
- for (ServerView* v = view_; v; v = v->parent()) {
- v->AddObserver(this);
- views_.insert(v);
- }
-}
-
-void ServerViewDrawnTracker::RemoveObservers() {
- for (ServerView* view : views_)
- view->RemoveObserver(this);
-
- views_.clear();
-}
-
-void ServerViewDrawnTracker::OnViewDestroyed(ServerView* view) {
- // As views are removed before being destroyed, resulting in
- // OnViewHierarchyChanged() and us removing ourself as an observer, the only
- // view we should ever get notified of destruction on is |view_|.
- DCHECK_EQ(view, view_);
- RemoveObservers();
- view_ = nullptr;
- SetDrawn(nullptr, false);
-}
-
-void ServerViewDrawnTracker::OnViewHierarchyChanged(ServerView* view,
- ServerView* new_parent,
- ServerView* old_parent) {
- RemoveObservers();
- AddObservers();
- const bool is_drawn = view_->IsDrawn();
- SetDrawn(is_drawn ? nullptr : old_parent, is_drawn);
-}
-
-void ServerViewDrawnTracker::OnViewVisibilityChanged(ServerView* view) {
- const bool is_drawn = view_->IsDrawn();
- SetDrawn(is_drawn ? nullptr : view->parent(), is_drawn);
-}
-
-} // namespace view_manager
« no previous file with comments | « components/view_manager/server_view_drawn_tracker.h ('k') | components/view_manager/server_view_drawn_tracker_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698