Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Side by Side Diff: services/ui/view_manager/view_host_impl.cc

Issue 1415493003: mozart: Initial commit of the view manager. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/bind.h"
6 #include "base/bind_helpers.h"
7 #include "services/ui/view_manager/view_host_impl.h"
8
9 namespace view_manager {
10
11 ViewHostImpl::ViewHostImpl(
12 ViewRegistry* registry,
13 ViewState* state,
14 mojo::InterfaceRequest<mojo::ui::ViewHost> view_host_request)
15 : registry_(registry),
16 state_(state),
17 binding_(this, view_host_request.Pass()) {}
18
19 ViewHostImpl::~ViewHostImpl() {}
20
21 void ViewHostImpl::GetServiceProvider(
22 mojo::InterfaceRequest<mojo::ServiceProvider> service_provider) {
23 state_->GetServiceProvider(service_provider.Pass());
24 }
25
26 void ViewHostImpl::RequestLayout() {
27 registry_->RequestLayout(state_);
28 }
29
30 void ViewHostImpl::AddChild(uint32_t child_key,
31 mojo::ui::ViewTokenPtr child_view_token) {
32 registry_->AddChild(state_, child_key, child_view_token.Pass());
33 }
34
35 void ViewHostImpl::RemoveChild(uint32_t child_key) {
36 registry_->RemoveChild(state_, child_key);
37 }
38
39 static void RunLayoutChildCallback(
40 const ViewHostImpl::LayoutChildCallback& callback,
41 mojo::ui::ViewLayoutInfoPtr info) {
42 callback.Run(info.Pass());
43 }
44
45 void ViewHostImpl::LayoutChild(
46 uint32_t child_key,
47 mojo::ui::ViewLayoutParamsPtr child_layout_params,
48 const LayoutChildCallback& callback) {
49 registry_->LayoutChild(state_, child_key, child_layout_params.Pass(),
50 base::Bind(&RunLayoutChildCallback, callback));
51 }
52
53 } // namespace view_manager
OLDNEW
« no previous file with comments | « services/ui/view_manager/view_host_impl.h ('k') | services/ui/view_manager/view_layout_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698