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 "mash/shelf/shelf_application.h" | 5 #include "mash/shelf/shelf_application.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "components/mus/public/cpp/property_type_converters.h" | 9 #include "components/mus/public/cpp/property_type_converters.h" |
10 #include "mash/shelf/shelf_view.h" | 10 #include "mash/shelf/shelf_view.h" |
11 #include "mash/wm/public/interfaces/container.mojom.h" | 11 #include "mash/wm/public/interfaces/container.mojom.h" |
12 #include "mojo/shell/public/cpp/application_impl.h" | 12 #include "mojo/shell/public/cpp/shell.h" |
13 #include "ui/views/mus/aura_init.h" | 13 #include "ui/views/mus/aura_init.h" |
14 #include "ui/views/mus/native_widget_mus.h" | 14 #include "ui/views/mus/native_widget_mus.h" |
15 #include "ui/views/mus/window_manager_connection.h" | 15 #include "ui/views/mus/window_manager_connection.h" |
16 | 16 |
17 namespace mash { | 17 namespace mash { |
18 namespace shelf { | 18 namespace shelf { |
19 | 19 |
20 ShelfApplication::ShelfApplication() {} | 20 ShelfApplication::ShelfApplication() {} |
21 | 21 |
22 ShelfApplication::~ShelfApplication() {} | 22 ShelfApplication::~ShelfApplication() {} |
23 | 23 |
24 void ShelfApplication::Initialize(mojo::ApplicationImpl* app) { | 24 void ShelfApplication::Initialize(mojo::Shell* shell, |
25 tracing_.Initialize(app); | 25 const std::string& url, |
| 26 uint32_t id) { |
| 27 tracing_.Initialize(shell, url); |
26 | 28 |
27 aura_init_.reset(new views::AuraInit(app, "views_mus_resources.pak")); | 29 aura_init_.reset(new views::AuraInit(shell, "views_mus_resources.pak")); |
28 views::WindowManagerConnection::Create(app); | 30 views::WindowManagerConnection::Create(shell); |
29 | 31 |
30 // Construct the shelf using a container tagged for positioning by the WM. | 32 // Construct the shelf using a container tagged for positioning by the WM. |
31 views::Widget* widget = new views::Widget; | 33 views::Widget* widget = new views::Widget; |
32 views::Widget::InitParams params( | 34 views::Widget::InitParams params( |
33 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 35 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
34 std::map<std::string, std::vector<uint8_t>> properties; | 36 std::map<std::string, std::vector<uint8_t>> properties; |
35 properties[mash::wm::mojom::kWindowContainer_Property] = | 37 properties[mash::wm::mojom::kWindowContainer_Property] = |
36 mojo::TypeConverter<const std::vector<uint8_t>, int32_t>::Convert( | 38 mojo::TypeConverter<const std::vector<uint8_t>, int32_t>::Convert( |
37 static_cast<int32_t>(mash::wm::mojom::Container::USER_SHELF)); | 39 static_cast<int32_t>(mash::wm::mojom::Container::USER_SHELF)); |
38 mus::Window* window = | 40 mus::Window* window = |
39 views::WindowManagerConnection::Get()->NewWindow(properties); | 41 views::WindowManagerConnection::Get()->NewWindow(properties); |
40 params.native_widget = new views::NativeWidgetMus( | 42 params.native_widget = new views::NativeWidgetMus( |
41 widget, app->shell(), window, mus::mojom::SurfaceType::DEFAULT); | 43 widget, shell, window, mus::mojom::SurfaceType::DEFAULT); |
42 widget->Init(params); | 44 widget->Init(params); |
43 widget->SetContentsView(new ShelfView(app)); | 45 widget->SetContentsView(new ShelfView(shell)); |
44 // Call CenterWindow to mimic Widget::Init's placement with a widget delegate. | 46 // Call CenterWindow to mimic Widget::Init's placement with a widget delegate. |
45 widget->CenterWindow(widget->GetContentsView()->GetPreferredSize()); | 47 widget->CenterWindow(widget->GetContentsView()->GetPreferredSize()); |
46 widget->Show(); | 48 widget->Show(); |
47 } | 49 } |
48 | 50 |
49 bool ShelfApplication::AcceptConnection( | |
50 mojo::ApplicationConnection* connection) { | |
51 return true; | |
52 } | |
53 | |
54 } // namespace shelf | 51 } // namespace shelf |
55 } // namespace mash | 52 } // namespace mash |
OLD | NEW |