OLD | NEW |
(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 "mash/shelf/shelf_application.h" |
| 6 |
| 7 #include <stdint.h> |
| 8 |
| 9 #include "components/mus/public/cpp/property_type_converters.h" |
| 10 #include "mash/shelf/shelf_view.h" |
| 11 #include "mash/wm/public/interfaces/container.mojom.h" |
| 12 #include "mojo/shell/public/cpp/application_impl.h" |
| 13 #include "ui/views/mus/aura_init.h" |
| 14 #include "ui/views/mus/native_widget_mus.h" |
| 15 #include "ui/views/mus/window_manager_connection.h" |
| 16 |
| 17 namespace mash { |
| 18 namespace shelf { |
| 19 |
| 20 ShelfApplication::ShelfApplication() {} |
| 21 |
| 22 ShelfApplication::~ShelfApplication() {} |
| 23 |
| 24 void ShelfApplication::Initialize(mojo::ApplicationImpl* app) { |
| 25 tracing_.Initialize(app); |
| 26 |
| 27 aura_init_.reset(new views::AuraInit(app, "views_mus_resources.pak")); |
| 28 views::WindowManagerConnection::Create(app); |
| 29 |
| 30 views::Widget* widget = new views::Widget; |
| 31 views::Widget::InitParams params( |
| 32 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
| 33 params.delegate = new ShelfView(app); |
| 34 |
| 35 std::map<std::string, std::vector<uint8_t>> properties; |
| 36 properties[mash::wm::mojom::kWindowContainer_Property] = |
| 37 mojo::TypeConverter<const std::vector<uint8_t>, int32_t>::Convert( |
| 38 mash::wm::mojom::CONTAINER_USER_SHELF); |
| 39 mus::Window* window = |
| 40 views::WindowManagerConnection::Get()->NewWindow(properties); |
| 41 params.native_widget = new views::NativeWidgetMus( |
| 42 widget, app->shell(), window, mus::mojom::SURFACE_TYPE_DEFAULT); |
| 43 widget->Init(params); |
| 44 widget->Show(); |
| 45 } |
| 46 |
| 47 bool ShelfApplication::ConfigureIncomingConnection( |
| 48 mojo::ApplicationConnection* connection) { |
| 49 return true; |
| 50 } |
| 51 |
| 52 } // namespace shelf |
| 53 } // namespace mash |
OLD | NEW |