OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "examples/ui/tile/tile_view.h" | 6 #include "examples/ui/tile/tile_view.h" |
7 #include "mojo/public/cpp/application/connect.h" | 7 #include "mojo/public/cpp/application/connect.h" |
8 #include "mojo/services/geometry/cpp/geometry_util.h" | 8 #include "mojo/services/geometry/cpp/geometry_util.h" |
9 | 9 |
10 namespace examples { | 10 namespace examples { |
(...skipping 29 matching lines...) Expand all Loading... |
40 void TileView::ConnectViews() { | 40 void TileView::ConnectViews() { |
41 uint32_t child_key = 0; | 41 uint32_t child_key = 0; |
42 for (const auto& url : params_.view_urls) { | 42 for (const auto& url : params_.view_urls) { |
43 // Start connecting to the view provider. | 43 // Start connecting to the view provider. |
44 mojo::ui::ViewProviderPtr provider; | 44 mojo::ui::ViewProviderPtr provider; |
45 mojo::ConnectToService(app_connector(), url, mojo::GetProxy(&provider)); | 45 mojo::ConnectToService(app_connector(), url, mojo::GetProxy(&provider)); |
46 | 46 |
47 LOG(INFO) << "Connecting to view: child_key=" << child_key | 47 LOG(INFO) << "Connecting to view: child_key=" << child_key |
48 << ", url=" << url; | 48 << ", url=" << url; |
49 mojo::ui::ViewOwnerPtr child_view_owner; | 49 mojo::ui::ViewOwnerPtr child_view_owner; |
50 provider->CreateView(mojo::GetProxy(&child_view_owner), nullptr, nullptr); | 50 provider->CreateView(mojo::GetProxy(&child_view_owner), nullptr); |
51 | 51 |
52 GetViewContainer()->AddChild(child_key, child_view_owner.Pass()); | 52 GetViewContainer()->AddChild(child_key, child_view_owner.Pass()); |
53 views_.emplace(std::make_pair( | 53 views_.emplace(std::make_pair( |
54 child_key, std::unique_ptr<ViewData>(new ViewData(url, child_key)))); | 54 child_key, std::unique_ptr<ViewData>(new ViewData(url, child_key)))); |
55 | 55 |
56 child_key++; | 56 child_key++; |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 void TileView::OnChildAttached(uint32_t child_key, | 60 void TileView::OnChildAttached(uint32_t child_key, |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 metadata->version = scene_version(); | 254 metadata->version = scene_version(); |
255 scene()->Publish(metadata.Pass()); | 255 scene()->Publish(metadata.Pass()); |
256 } | 256 } |
257 | 257 |
258 TileView::ViewData::ViewData(const std::string& url, uint32_t key) | 258 TileView::ViewData::ViewData(const std::string& url, uint32_t key) |
259 : url(url), key(key) {} | 259 : url(url), key(key) {} |
260 | 260 |
261 TileView::ViewData::~ViewData() {} | 261 TileView::ViewData::~ViewData() {} |
262 | 262 |
263 } // namespace examples | 263 } // namespace examples |
OLD | NEW |