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

Side by Side Diff: components/mus/example/common/mus_views_init.cc

Issue 1390353007: Adds MUSViewsInit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix windows Created 5 years, 2 months 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 "components/mus/example/common/mus_views_init.h"
6
7 #include "components/mus/example/wm/wm.mojom.h"
8 #include "components/mus/public/cpp/view_tree_connection.h"
9 #include "components/mus/public/interfaces/view_tree.mojom.h"
10 #include "mandoline/ui/aura/aura_init.h"
11 #include "mandoline/ui/aura/native_widget_view_manager.h"
12 #include "mojo/application/public/cpp/application_connection.h"
13 #include "mojo/application/public/cpp/application_impl.h"
14
15 MUSViewsInit::MUSViewsInit(mojo::ApplicationImpl* app) : app_(app) {}
16
17 MUSViewsInit::~MUSViewsInit() {}
18
19 mus::View* MUSViewsInit::CreateWindow() {
20 mojom::WMPtr wm;
21 mojo::URLRequestPtr request(mojo::URLRequest::New());
22 request->url = "mojo:example_wm";
23 app_->ConnectToService(request.Pass(), &wm);
24 mojo::ViewTreeClientPtr view_tree_client;
25 mojo::InterfaceRequest<mojo::ViewTreeClient> view_tree_client_request =
26 GetProxy(&view_tree_client);
27 wm->OpenWindow(view_tree_client.Pass());
28 mus::ViewTreeConnection* view_tree_connection =
29 mus::ViewTreeConnection::Create(
30 this, view_tree_client_request.Pass(),
31 mus::ViewTreeConnection::CreateType::WAIT_FOR_EMBED);
32 DCHECK(view_tree_connection->GetRoot());
33 return view_tree_connection->GetRoot();
34 }
35
36 views::NativeWidget* MUSViewsInit::CreateNativeWidget(
37 views::internal::NativeWidgetDelegate* delegate) {
38 return new mandoline::NativeWidgetViewManager(delegate, app_->shell(),
39 CreateWindow());
40 }
41
42 void MUSViewsInit::OnBeforeWidgetInit(
43 views::Widget::InitParams* params,
44 views::internal::NativeWidgetDelegate* delegate) {}
45
46 void MUSViewsInit::OnEmbed(mus::View* root) {
47 if (!aura_init_) {
48 aura_init_.reset(
49 new mandoline::AuraInit(root, app_->shell(), "example_resources.pak"));
50 }
51 }
52
53 void MUSViewsInit::OnConnectionLost(mus::ViewTreeConnection* connection) {}
54
55 #if defined(OS_WIN)
56 HICON MUSViewsInit::GetSmallWindowIcon() const {
57 return nullptr;
58 }
59 #endif
OLDNEW
« no previous file with comments | « components/mus/example/common/mus_views_init.h ('k') | components/mus/example/window_type_launcher/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698