OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/mus/demo/mus_demo.h" | 5 #include "components/mus/demo/mus_demo.h" |
6 | 6 |
7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 #include "components/bitmap_uploader/bitmap_uploader.h" | 8 #include "components/bitmap_uploader/bitmap_uploader.h" |
9 #include "components/mus/public/cpp/window_tree_host_factory.h" | 9 #include "components/mus/public/cpp/window_tree_host_factory.h" |
10 #include "third_party/skia/include/core/SkCanvas.h" | 10 #include "third_party/skia/include/core/SkCanvas.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 canvas->drawRect(rect, paint); | 52 canvas->drawRect(rect, paint); |
53 } | 53 } |
54 | 54 |
55 } // namespace | 55 } // namespace |
56 | 56 |
57 MusDemo::MusDemo() {} | 57 MusDemo::MusDemo() {} |
58 | 58 |
59 MusDemo::~MusDemo() {} | 59 MusDemo::~MusDemo() {} |
60 | 60 |
61 void MusDemo::Initialize(mojo::Connector* connector, | 61 void MusDemo::Initialize(shell::Connector* connector, |
62 const mojo::Identity& identity, | 62 const shell::Identity& identity, |
63 uint32_t id) { | 63 uint32_t id) { |
64 connector_ = connector; | 64 connector_ = connector; |
65 | 65 |
66 CreateWindowTreeHost(connector_, this, &window_tree_host_, this); | 66 CreateWindowTreeHost(connector_, this, &window_tree_host_, this); |
67 window_tree_host_->SetTitle("MUS Demo"); | 67 window_tree_host_->SetTitle("MUS Demo"); |
68 } | 68 } |
69 | 69 |
70 bool MusDemo::AcceptConnection(mojo::Connection* connection) { | 70 bool MusDemo::AcceptConnection(shell::Connection* connection) { |
71 return true; | 71 return true; |
72 } | 72 } |
73 | 73 |
74 void MusDemo::OnEmbed(mus::Window* window) { | 74 void MusDemo::OnEmbed(mus::Window* window) { |
75 window_ = window; | 75 window_ = window; |
76 | 76 |
77 // Initialize bitmap uploader for sending frames to MUS. | 77 // Initialize bitmap uploader for sending frames to MUS. |
78 uploader_.reset(new bitmap_uploader::BitmapUploader(window_)); | 78 uploader_.reset(new bitmap_uploader::BitmapUploader(window_)); |
79 uploader_->Init(connector_); | 79 uploader_->Init(connector_); |
80 | 80 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 scoped_ptr<std::vector<unsigned char>> data( | 150 scoped_ptr<std::vector<unsigned char>> data( |
151 new std::vector<unsigned char>(addr, addr + bytes)); | 151 new std::vector<unsigned char>(addr, addr + bytes)); |
152 bitmap_.unlockPixels(); | 152 bitmap_.unlockPixels(); |
153 | 153 |
154 // Send frame to MUS via BitmapUploader. | 154 // Send frame to MUS via BitmapUploader. |
155 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data), | 155 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data), |
156 bitmap_uploader::BitmapUploader::BGRA); | 156 bitmap_uploader::BitmapUploader::BGRA); |
157 } | 157 } |
158 | 158 |
159 } // namespace mus_demo | 159 } // namespace mus_demo |
OLD | NEW |