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

Unified Diff: ash/devtools/view_element.cc

Issue 2899783002: Move DevTools out of ash and turn it to a component. (Closed)
Patch Set: add README.md Created 3 years, 6 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
« no previous file with comments | « ash/devtools/view_element.h ('k') | ash/devtools/widget_element.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/devtools/view_element.cc
diff --git a/ash/devtools/view_element.cc b/ash/devtools/view_element.cc
deleted file mode 100644
index 862a454ab1bf1fd3f82f397f8243184f7a0895cf..0000000000000000000000000000000000000000
--- a/ash/devtools/view_element.cc
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright 2017 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 "ash/devtools/view_element.h"
-
-#include "ash/devtools/ui_element_delegate.h"
-#include "ui/views/widget/widget.h"
-
-namespace ash {
-namespace devtools {
-
-ViewElement::ViewElement(views::View* view,
- UIElementDelegate* ui_element_delegate,
- UIElement* parent)
- : UIElement(UIElementType::VIEW, ui_element_delegate, parent), view_(view) {
- view_->AddObserver(this);
-}
-
-ViewElement::~ViewElement() {
- view_->RemoveObserver(this);
-}
-
-void ViewElement::OnChildViewRemoved(views::View* parent, views::View* view) {
- DCHECK_EQ(parent, view_);
- auto iter = std::find_if(
- children().begin(), children().end(), [view](UIElement* child) {
- return view ==
- UIElement::GetBackingElement<views::View, ViewElement>(child);
- });
- DCHECK(iter != children().end());
- UIElement* child_element = *iter;
- RemoveChild(child_element);
- delete child_element;
-}
-
-void ViewElement::OnChildViewAdded(views::View* parent, views::View* view) {
- DCHECK_EQ(parent, view_);
- AddChild(new ViewElement(view, delegate(), this),
- children().empty() ? nullptr : children().back());
-}
-
-void ViewElement::OnChildViewReordered(views::View* parent, views::View* view) {
- DCHECK_EQ(parent, view_);
- auto iter = std::find_if(
- children().begin(), children().end(), [view](UIElement* child) {
- return view ==
- UIElement::GetBackingElement<views::View, ViewElement>(child);
- });
- DCHECK(iter != children().end());
- UIElement* child_element = *iter;
- ReorderChild(child_element, parent->GetIndexOf(view));
-}
-
-void ViewElement::OnViewBoundsChanged(views::View* view) {
- DCHECK_EQ(view_, view);
- delegate()->OnUIElementBoundsChanged(this);
-}
-
-void ViewElement::GetBounds(gfx::Rect* bounds) const {
- *bounds = view_->bounds();
-}
-
-void ViewElement::SetBounds(const gfx::Rect& bounds) {
- view_->SetBoundsRect(bounds);
-}
-
-void ViewElement::GetVisible(bool* visible) const {
- *visible = view_->visible();
-}
-
-void ViewElement::SetVisible(bool visible) {
- view_->SetVisible(visible);
-}
-
-std::pair<aura::Window*, gfx::Rect> ViewElement::GetNodeWindowAndBounds()
- const {
- return std::make_pair(view_->GetWidget()->GetNativeWindow(),
- view_->GetBoundsInScreen());
-}
-
-// static
-views::View* ViewElement::From(UIElement* element) {
- DCHECK_EQ(UIElementType::VIEW, element->type());
- return static_cast<ViewElement*>(element)->view_;
-}
-
-} // namespace devtools
-} // namespace ash
« no previous file with comments | « ash/devtools/view_element.h ('k') | ash/devtools/widget_element.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698