OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "mojo/services/window_manager/window_manager_test_util.h" |
| 6 |
| 7 #include "base/stl_util.h" |
| 8 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 9 #include "ui/gfx/geometry/rect.h" |
| 10 |
| 11 namespace mojo { |
| 12 |
| 13 TestView::TestView(int id, |
| 14 const gfx::Rect& rect, |
| 15 ViewCollector* collector) { |
| 16 ViewPrivate(this).set_id(id); |
| 17 |
| 18 mojo::Rect mojo_rect = *mojo::Rect::From(rect); |
| 19 SetBounds(mojo_rect); |
| 20 |
| 21 collector->AddView(this); |
| 22 } |
| 23 |
| 24 TestView::~TestView() {} |
| 25 |
| 26 TestViewTarget::TestViewTarget(int id, |
| 27 const gfx::Rect& rect, |
| 28 ViewCollector* collector) |
| 29 : ViewTarget(new TestView(id, rect, collector)) { |
| 30 } |
| 31 |
| 32 TestViewTarget::~TestViewTarget() {} |
| 33 |
| 34 void TestViewTarget::AddChild(TestViewTarget* child) { |
| 35 view()->AddChild(child->view()); |
| 36 } |
| 37 |
| 38 ViewCollector::ViewCollector() {} |
| 39 |
| 40 ViewCollector::~ViewCollector() {} |
| 41 |
| 42 void ViewCollector::AddView(TestView* view) { |
| 43 views_.insert(view); |
| 44 } |
| 45 |
| 46 void ViewCollector::Destroy() { |
| 47 STLDeleteElements(&views_); |
| 48 } |
| 49 |
| 50 } // namespace mojo |
OLD | NEW |