Revert of Mandoline UI Process: Update namespaces and file names (patchset #9 id...
[chromium-blink-merge.git] / components / mus / public / cpp / lib / view_tree_host_factory.cc
blob7259d4a40b64fae72c7153cf05be5d391e4a4919
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.
5 #include "components/mus/public/cpp/view_tree_host_factory.h"
7 #include "components/mus/public/cpp/view_tree_connection.h"
8 #include "components/mus/public/cpp/view_tree_delegate.h"
9 #include "mojo/application/public/cpp/application_impl.h"
11 namespace mojo {
13 void CreateViewTreeHost(ViewTreeHostFactory* factory,
14 ViewTreeHostClientPtr host_client,
15 ViewTreeDelegate* delegate,
16 ViewTreeHostPtr* host) {
17 ViewTreeClientPtr tree_client;
18 ViewTreeConnection::Create(delegate, GetProxy(&tree_client));
19 factory->CreateViewTreeHost(GetProxy(host), host_client.Pass(),
20 tree_client.Pass());
23 void CreateSingleViewTreeHost(ApplicationImpl* app,
24 ViewTreeDelegate* delegate,
25 ViewTreeHostPtr* host) {
26 mojo::ViewTreeHostFactoryPtr factory;
27 mojo::URLRequestPtr request(mojo::URLRequest::New());
28 request->url = "mojo:mus";
29 app->ConnectToService(request.Pass(), &factory);
30 CreateViewTreeHost(factory.get(), mojo::ViewTreeHostClientPtr(), delegate,
31 host);
34 } // namespace mojo