| Index: components/mus/example/common/mus_views_init.cc
|
| diff --git a/components/mus/example/common/mus_views_init.cc b/components/mus/example/common/mus_views_init.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e1f4fafc96c5928da88dd849d03bf650457ca22d
|
| --- /dev/null
|
| +++ b/components/mus/example/common/mus_views_init.cc
|
| @@ -0,0 +1,59 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "components/mus/example/common/mus_views_init.h"
|
| +
|
| +#include "components/mus/example/wm/wm.mojom.h"
|
| +#include "components/mus/public/cpp/view_tree_connection.h"
|
| +#include "components/mus/public/interfaces/view_tree.mojom.h"
|
| +#include "mandoline/ui/aura/aura_init.h"
|
| +#include "mandoline/ui/aura/native_widget_view_manager.h"
|
| +#include "mojo/application/public/cpp/application_connection.h"
|
| +#include "mojo/application/public/cpp/application_impl.h"
|
| +
|
| +MUSViewsInit::MUSViewsInit(mojo::ApplicationImpl* app) : app_(app) {}
|
| +
|
| +MUSViewsInit::~MUSViewsInit() {}
|
| +
|
| +mus::View* MUSViewsInit::CreateWindow() {
|
| + mojom::WMPtr wm;
|
| + mojo::URLRequestPtr request(mojo::URLRequest::New());
|
| + request->url = "mojo:example_wm";
|
| + app_->ConnectToService(request.Pass(), &wm);
|
| + mojo::ViewTreeClientPtr view_tree_client;
|
| + mojo::InterfaceRequest<mojo::ViewTreeClient> view_tree_client_request =
|
| + GetProxy(&view_tree_client);
|
| + wm->OpenWindow(view_tree_client.Pass());
|
| + mus::ViewTreeConnection* view_tree_connection =
|
| + mus::ViewTreeConnection::Create(
|
| + this, view_tree_client_request.Pass(),
|
| + mus::ViewTreeConnection::CreateType::WAIT_FOR_EMBED);
|
| + DCHECK(view_tree_connection->GetRoot());
|
| + return view_tree_connection->GetRoot();
|
| +}
|
| +
|
| +views::NativeWidget* MUSViewsInit::CreateNativeWidget(
|
| + views::internal::NativeWidgetDelegate* delegate) {
|
| + return new mandoline::NativeWidgetViewManager(delegate, app_->shell(),
|
| + CreateWindow());
|
| +}
|
| +
|
| +void MUSViewsInit::OnBeforeWidgetInit(
|
| + views::Widget::InitParams* params,
|
| + views::internal::NativeWidgetDelegate* delegate) {}
|
| +
|
| +void MUSViewsInit::OnEmbed(mus::View* root) {
|
| + if (!aura_init_) {
|
| + aura_init_.reset(
|
| + new mandoline::AuraInit(root, app_->shell(), "example_resources.pak"));
|
| + }
|
| +}
|
| +
|
| +void MUSViewsInit::OnConnectionLost(mus::ViewTreeConnection* connection) {}
|
| +
|
| +#if defined(OS_WIN)
|
| +HICON MUSViewsInit::GetSmallWindowIcon() const {
|
| + return nullptr;
|
| +}
|
| +#endif
|
|
|