Index: components/view_manager/public/cpp/lib/scoped_view_ptr.cc |
diff --git a/components/view_manager/public/cpp/lib/scoped_view_ptr.cc b/components/view_manager/public/cpp/lib/scoped_view_ptr.cc |
deleted file mode 100644 |
index 93e231ab7a94f3438e48a75a36c39addf672ae80..0000000000000000000000000000000000000000 |
--- a/components/view_manager/public/cpp/lib/scoped_view_ptr.cc |
+++ /dev/null |
@@ -1,45 +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/public/cpp/scoped_view_ptr.h" |
- |
-#include "components/view_manager/public/cpp/view.h" |
-#include "components/view_manager/public/cpp/view_observer.h" |
-#include "components/view_manager/public/cpp/view_tree_connection.h" |
- |
-namespace mojo { |
- |
-ScopedViewPtr::ScopedViewPtr(View* view) |
- : view_(view) { |
- view_->AddObserver(this); |
-} |
- |
-ScopedViewPtr::~ScopedViewPtr() { |
- if (view_) |
- DeleteViewOrViewManager(view_); |
- DetachFromView(); |
-} |
- |
-// static |
-void ScopedViewPtr::DeleteViewOrViewManager(View* view) { |
- if (view->connection()->GetRoot() == view) |
- delete view->connection(); |
- else |
- view->Destroy(); |
-} |
- |
-void ScopedViewPtr::DetachFromView() { |
- if (!view_) |
- return; |
- |
- view_->RemoveObserver(this); |
- view_ = nullptr; |
-} |
- |
-void ScopedViewPtr::OnViewDestroying(View* view) { |
- DCHECK_EQ(view_, view); |
- DetachFromView(); |
-} |
- |
-} // namespace mojo |