OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "services/ui/demo/window_tree_data.h" | 5 #include "services/ui/demo/window_tree_data.h" |
6 | 6 |
7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 -SkFloatToScalar(canvas_size.height() * 0.5f)); | 52 -SkFloatToScalar(canvas_size.height() * 0.5f)); |
53 } | 53 } |
54 | 54 |
55 canvas->drawRect(rect, paint); | 55 canvas->drawRect(rect, paint); |
56 } | 56 } |
57 | 57 |
58 } // namespace | 58 } // namespace |
59 | 59 |
60 WindowTreeData::WindowTreeData(int square_size) : square_size_(square_size) {} | 60 WindowTreeData::WindowTreeData(int square_size) : square_size_(square_size) {} |
61 | 61 |
| 62 WindowTreeData::WindowTreeData(mojom::WindowTreeHostFactory* factory, |
| 63 mojom::WindowTreeClientPtr tree_client, |
| 64 int square_size) |
| 65 : square_size_(square_size) { |
| 66 factory->CreateWindowTreeHost(MakeRequest(&host_), std::move(tree_client)); |
| 67 } |
| 68 |
62 WindowTreeData::~WindowTreeData() {} | 69 WindowTreeData::~WindowTreeData() {} |
63 | 70 |
64 aura::Window* WindowTreeData::bitmap_window() { | 71 aura::Window* WindowTreeData::bitmap_window() { |
65 DCHECK(!window_tree_host_->window()->children().empty()); | 72 DCHECK(!window_tree_host_->window()->children().empty()); |
66 return window_tree_host_->window()->children()[0]; | 73 return window_tree_host_->window()->children()[0]; |
67 } | 74 } |
68 | 75 |
69 void WindowTreeData::Init( | 76 void WindowTreeData::Init( |
70 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { | 77 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { |
71 window_tree_host->InitHost(); | 78 window_tree_host->InitHost(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 gfx::ImageSkiaRep image_skia_rep(bitmap, 1); | 119 gfx::ImageSkiaRep image_skia_rep(bitmap, 1); |
113 gfx::ImageSkia image_skia(image_skia_rep); | 120 gfx::ImageSkia image_skia(image_skia_rep); |
114 gfx::Image image(image_skia); | 121 gfx::Image image(image_skia); |
115 | 122 |
116 window_delegate_->SetImage(image); | 123 window_delegate_->SetImage(image); |
117 bitmap_window()->SchedulePaintInRect(gfx::Rect(bounds.size())); | 124 bitmap_window()->SchedulePaintInRect(gfx::Rect(bounds.size())); |
118 } | 125 } |
119 | 126 |
120 } // namespace demo | 127 } // namespace demo |
121 } // namespace ui | 128 } // namespace ui |
OLD | NEW |