OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "services/ui/demo/mus_demo_external.h" |
| 6 |
| 7 #include "services/service_manager/public/cpp/service_context.h" |
| 8 #include "services/ui/demo/window_tree_data.h" |
| 9 #include "services/ui/public/interfaces/constants.mojom.h" |
| 10 #include "ui/aura/mus/window_tree_client.h" |
| 11 #include "ui/aura/mus/window_tree_host_mus.h" |
| 12 |
| 13 namespace ui { |
| 14 namespace demo { |
| 15 |
| 16 // Size of square in pixels to draw. |
| 17 const int kSquareSize = 500; |
| 18 |
| 19 MusDemoExternal::MusDemoExternal() {} |
| 20 |
| 21 MusDemoExternal::~MusDemoExternal() {} |
| 22 |
| 23 void MusDemoExternal::OnStartImpl( |
| 24 std::unique_ptr<aura::WindowTreeClient>& window_tree_client, |
| 25 std::unique_ptr<WindowTreeData>& window_tree_data) { |
| 26 context()->connector()->BindInterface(ui::mojom::kServiceName, |
| 27 &window_tree_host_factory_); |
| 28 mojom::WindowTreeClientPtr tree_client; |
| 29 window_tree_client = base::MakeUnique<aura::WindowTreeClient>( |
| 30 context()->connector(), this, nullptr, MakeRequest(&tree_client)); |
| 31 // TODO(tonikitoo,fwang): Open two external windows with different square |
| 32 // sizes. |
| 33 window_tree_data = base::MakeUnique<WindowTreeData>( |
| 34 window_tree_host_factory_.get(), std::move(tree_client), kSquareSize); |
| 35 } |
| 36 |
| 37 void MusDemoExternal::OnEmbed( |
| 38 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { |
| 39 InitWindowTreeData(std::move(window_tree_host)); |
| 40 } |
| 41 |
| 42 void MusDemoExternal::OnEmbedRootDestroyed( |
| 43 aura::WindowTreeHostMus* window_tree_host) { |
| 44 CleanupWindowTreeData(); |
| 45 } |
| 46 |
| 47 } // namespace demo |
| 48 } // namespace ui |
OLD | NEW |