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/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/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/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "services/service_manager/public/cpp/connector.h" | 12 #include "services/service_manager/public/cpp/connector.h" |
13 #include "services/service_manager/public/cpp/interface_registry.h" | |
14 #include "services/service_manager/public/cpp/service_context.h" | 13 #include "services/service_manager/public/cpp/service_context.h" |
15 #include "services/ui/public/cpp/property_type_converters.h" | 14 #include "services/ui/public/cpp/property_type_converters.h" |
16 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 15 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
17 #include "ui/aura/mus/property_converter.h" | 16 #include "ui/aura/mus/property_converter.h" |
18 #include "ui/views/mus/aura_init.h" | 17 #include "ui/views/mus/aura_init.h" |
19 #include "ui/views/mus/mus_client.h" | 18 #include "ui/views/mus/mus_client.h" |
20 #include "ui/views/mus/pointer_watcher_event_router.h" | 19 #include "ui/views/mus/pointer_watcher_event_router.h" |
21 #include "ui/views/pointer_watcher.h" | 20 #include "ui/views/pointer_watcher.h" |
22 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
23 #include "ui/views/widget/widget_delegate.h" | 22 #include "ui/views/widget/widget_delegate.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 views::Widget* target) override { | 54 views::Widget* target) override { |
56 if (event.IsTouchPointerEvent()) | 55 if (event.IsTouchPointerEvent()) |
57 touch_hud_renderer_->HandleTouchEvent(event); | 56 touch_hud_renderer_->HandleTouchEvent(event); |
58 } | 57 } |
59 | 58 |
60 TouchHudRenderer* touch_hud_renderer_; | 59 TouchHudRenderer* touch_hud_renderer_; |
61 | 60 |
62 DISALLOW_COPY_AND_ASSIGN(TouchHudUI); | 61 DISALLOW_COPY_AND_ASSIGN(TouchHudUI); |
63 }; | 62 }; |
64 | 63 |
65 TouchHudApplication::TouchHudApplication() : binding_(this) {} | 64 TouchHudApplication::TouchHudApplication() : binding_(this) { |
| 65 registry_.AddInterface<mash::mojom::Launchable>(this); |
| 66 } |
66 TouchHudApplication::~TouchHudApplication() {} | 67 TouchHudApplication::~TouchHudApplication() {} |
67 | 68 |
68 void TouchHudApplication::OnStart() { | 69 void TouchHudApplication::OnStart() { |
69 aura_init_ = base::MakeUnique<views::AuraInit>( | 70 aura_init_ = base::MakeUnique<views::AuraInit>( |
70 context()->connector(), context()->identity(), "views_mus_resources.pak", | 71 context()->connector(), context()->identity(), "views_mus_resources.pak", |
71 std::string(), nullptr, views::AuraInit::Mode::AURA_MUS); | 72 std::string(), nullptr, views::AuraInit::Mode::AURA_MUS); |
72 } | 73 } |
73 | 74 |
74 bool TouchHudApplication::OnConnect( | 75 void TouchHudApplication::OnBindInterface( |
75 const service_manager::ServiceInfo& remote_info, | 76 const service_manager::ServiceInfo& source_info, |
76 service_manager::InterfaceRegistry* registry) { | 77 const std::string& interface_name, |
77 registry->AddInterface<mash::mojom::Launchable>(this); | 78 mojo::ScopedMessagePipeHandle interface_pipe) { |
78 return true; | 79 registry_.BindInterface(source_info.identity, interface_name, |
| 80 std::move(interface_pipe)); |
79 } | 81 } |
80 | 82 |
81 void TouchHudApplication::Launch(uint32_t what, mash::mojom::LaunchMode how) { | 83 void TouchHudApplication::Launch(uint32_t what, mash::mojom::LaunchMode how) { |
82 if (!widget_) { | 84 if (!widget_) { |
83 widget_ = new views::Widget; | 85 widget_ = new views::Widget; |
84 views::Widget::InitParams params( | 86 views::Widget::InitParams params( |
85 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 87 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
86 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 88 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
87 params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; | 89 params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; |
88 params.accept_events = false; | 90 params.accept_events = false; |
(...skipping 12 matching lines...) Expand all Loading... |
101 | 103 |
102 void TouchHudApplication::Create( | 104 void TouchHudApplication::Create( |
103 const service_manager::Identity& remote_identity, | 105 const service_manager::Identity& remote_identity, |
104 mash::mojom::LaunchableRequest request) { | 106 mash::mojom::LaunchableRequest request) { |
105 binding_.Close(); | 107 binding_.Close(); |
106 binding_.Bind(std::move(request)); | 108 binding_.Bind(std::move(request)); |
107 } | 109 } |
108 | 110 |
109 } // namespace touch_hud | 111 } // namespace touch_hud |
110 } // namespace ash | 112 } // namespace ash |
OLD | NEW |