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