| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/touch_hud/mus/touch_hud_application.h" | 5 #include "ash/touch_hud/mus/touch_hud_application.h" |
| 6 | 6 |
| 7 #include "ash/public/interfaces/container.mojom.h" | 7 #include "ash/shared/shell_window_ids.h" |
| 8 #include "ash/touch_hud/touch_hud_renderer.h" | 8 #include "ash/touch_hud/touch_hud_renderer.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "services/service_manager/public/cpp/connector.h" | 11 #include "services/service_manager/public/cpp/connector.h" |
| 12 #include "services/ui/public/cpp/property_type_converters.h" | 12 #include "services/ui/public/cpp/property_type_converters.h" |
| 13 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 13 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
| 14 #include "ui/views/mus/aura_init.h" | 14 #include "ui/views/mus/aura_init.h" |
| 15 #include "ui/views/mus/native_widget_mus.h" | 15 #include "ui/views/mus/native_widget_mus.h" |
| 16 #include "ui/views/mus/pointer_watcher_event_router.h" | 16 #include "ui/views/mus/pointer_watcher_event_router.h" |
| 17 #include "ui/views/mus/window_manager_connection.h" | 17 #include "ui/views/mus/window_manager_connection.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 if (!widget_) { | 81 if (!widget_) { |
| 82 widget_ = new views::Widget; | 82 widget_ = new views::Widget; |
| 83 views::Widget::InitParams params( | 83 views::Widget::InitParams params( |
| 84 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 84 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
| 85 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 85 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| 86 params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; | 86 params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; |
| 87 params.accept_events = false; | 87 params.accept_events = false; |
| 88 params.delegate = new TouchHudUI(window_manager_connection_.get(), widget_); | 88 params.delegate = new TouchHudUI(window_manager_connection_.get(), widget_); |
| 89 | 89 |
| 90 std::map<std::string, std::vector<uint8_t>> properties; | 90 std::map<std::string, std::vector<uint8_t>> properties; |
| 91 properties[ash::mojom::kWindowContainer_Property] = | 91 properties[ui::mojom::WindowManager::kInitialContainerId_Property] = |
| 92 mojo::ConvertTo<std::vector<uint8_t>>( | 92 mojo::ConvertTo<std::vector<uint8_t>>( |
| 93 static_cast<int32_t>(ash::mojom::Container::OVERLAY)); | 93 ash::kShellWindowId_OverlayContainer); |
| 94 properties[ui::mojom::WindowManager::kShowState_Property] = | 94 properties[ui::mojom::WindowManager::kShowState_Property] = |
| 95 mojo::ConvertTo<std::vector<uint8_t>>( | 95 mojo::ConvertTo<std::vector<uint8_t>>( |
| 96 static_cast<int32_t>(ui::mojom::ShowState::FULLSCREEN)); | 96 static_cast<int32_t>(ui::mojom::ShowState::FULLSCREEN)); |
| 97 ui::Window* window = | 97 ui::Window* window = |
| 98 window_manager_connection_.get()->NewTopLevelWindow(properties); | 98 window_manager_connection_.get()->NewTopLevelWindow(properties); |
| 99 params.native_widget = new views::NativeWidgetMus( | 99 params.native_widget = new views::NativeWidgetMus( |
| 100 widget_, window, ui::mojom::SurfaceType::DEFAULT); | 100 widget_, window, ui::mojom::SurfaceType::DEFAULT); |
| 101 widget_->Init(params); | 101 widget_->Init(params); |
| 102 widget_->Show(); | 102 widget_->Show(); |
| 103 } else { | 103 } else { |
| 104 widget_->Close(); | 104 widget_->Close(); |
| 105 base::MessageLoop::current()->QuitWhenIdle(); | 105 base::MessageLoop::current()->QuitWhenIdle(); |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 void TouchHudApplication::Create( | 109 void TouchHudApplication::Create( |
| 110 const service_manager::Identity& remote_identity, | 110 const service_manager::Identity& remote_identity, |
| 111 mash::mojom::LaunchableRequest request) { | 111 mash::mojom::LaunchableRequest request) { |
| 112 binding_.Close(); | 112 binding_.Close(); |
| 113 binding_.Bind(std::move(request)); | 113 binding_.Bind(std::move(request)); |
| 114 } | 114 } |
| 115 | 115 |
| 116 } // namespace touch_hud | 116 } // namespace touch_hud |
| 117 } // namespace ash | 117 } // namespace ash |
| OLD | NEW |