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 #ifndef SERVICES_UI_LAUNCHER_LAUNCH_INSTANCE_H_ | 5 #ifndef SERVICES_UI_LAUNCHER_LAUNCH_INSTANCE_H_ |
6 #define SERVICES_UI_LAUNCHER_LAUNCH_INSTANCE_H_ | 6 #define SERVICES_UI_LAUNCHER_LAUNCH_INSTANCE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "mojo/public/cpp/application/application_delegate.h" | |
12 #include "mojo/public/cpp/application/application_impl.h" | |
13 #include "mojo/public/cpp/bindings/binding.h" | 11 #include "mojo/public/cpp/bindings/binding.h" |
14 #include "mojo/services/gfx/composition/interfaces/compositor.mojom.h" | 12 #include "mojo/services/gfx/composition/interfaces/compositor.mojom.h" |
15 #include "mojo/services/native_viewport/interfaces/native_viewport.mojom.h" | 13 #include "mojo/services/native_viewport/interfaces/native_viewport.mojom.h" |
16 #include "mojo/services/native_viewport/interfaces/native_viewport_event_dispatc
her.mojom.h" | 14 #include "mojo/services/native_viewport/interfaces/native_viewport_event_dispatc
her.mojom.h" |
17 #include "mojo/services/ui/views/interfaces/view_manager.mojom.h" | 15 #include "mojo/services/ui/views/interfaces/view_manager.mojom.h" |
18 #include "mojo/services/ui/views/interfaces/view_provider.mojom.h" | 16 #include "mojo/services/ui/views/interfaces/view_provider.mojom.h" |
19 | 17 |
20 namespace launcher { | 18 namespace launcher { |
21 | 19 |
22 class LauncherViewTree; | 20 class LauncherViewTree; |
23 | 21 |
24 class LaunchInstance : public mojo::NativeViewportEventDispatcher { | 22 class LaunchInstance : public mojo::NativeViewportEventDispatcher { |
25 public: | 23 public: |
26 LaunchInstance(mojo::ApplicationImpl* app_impl, | 24 LaunchInstance(mojo::NativeViewportPtr viewport, |
27 mojo::NativeViewportPtr viewport, | |
28 mojo::ui::ViewProviderPtr view_provider, | 25 mojo::ui::ViewProviderPtr view_provider, |
29 mojo::gfx::composition::Compositor* compositor, | 26 mojo::gfx::composition::Compositor* compositor, |
30 mojo::ui::ViewManager* view_manager, | 27 mojo::ui::ViewManager* view_manager, |
31 const base::Closure& shutdown_callback); | 28 const base::Closure& shutdown_callback); |
32 ~LaunchInstance() override; | 29 ~LaunchInstance() override; |
33 | 30 |
34 void Launch(); | 31 void Launch(); |
35 | 32 |
36 private: | 33 private: |
37 // |NativeViewportEventDispatcher|: | 34 // |NativeViewportEventDispatcher|: |
38 void OnEvent(mojo::EventPtr event, | 35 void OnEvent(mojo::EventPtr event, |
39 const mojo::Callback<void()>& callback) override; | 36 const mojo::Callback<void()>& callback) override; |
40 | 37 |
41 void InitViewport(); | 38 void InitViewport(); |
42 void OnViewportConnectionError(); | 39 void OnViewportConnectionError(); |
43 void OnViewportCreated(mojo::ViewportMetricsPtr metrics); | 40 void OnViewportCreated(mojo::ViewportMetricsPtr metrics); |
44 void OnViewportMetricsChanged(mojo::ViewportMetricsPtr metrics); | 41 void OnViewportMetricsChanged(mojo::ViewportMetricsPtr metrics); |
45 void RequestUpdatedViewportMetrics(); | 42 void RequestUpdatedViewportMetrics(); |
46 | 43 |
47 mojo::ApplicationImpl* app_impl_; | |
48 mojo::NativeViewportPtr viewport_; | 44 mojo::NativeViewportPtr viewport_; |
49 mojo::ui::ViewProviderPtr view_provider_; | 45 mojo::ui::ViewProviderPtr view_provider_; |
50 | 46 |
51 mojo::gfx::composition::Compositor* compositor_; | 47 mojo::gfx::composition::Compositor* const compositor_; |
52 mojo::ui::ViewManager* view_manager_; | 48 mojo::ui::ViewManager* const view_manager_; |
53 base::Closure shutdown_callback_; | 49 base::Closure shutdown_callback_; |
54 | 50 |
55 mojo::Binding<NativeViewportEventDispatcher> | 51 mojo::Binding<NativeViewportEventDispatcher> |
56 viewport_event_dispatcher_binding_; | 52 viewport_event_dispatcher_binding_; |
57 | 53 |
58 std::unique_ptr<LauncherViewTree> view_tree_; | 54 std::unique_ptr<LauncherViewTree> view_tree_; |
59 | 55 |
60 mojo::ui::ViewOwnerPtr client_view_owner_; | 56 mojo::ui::ViewOwnerPtr client_view_owner_; |
61 | 57 |
62 DISALLOW_COPY_AND_ASSIGN(LaunchInstance); | 58 DISALLOW_COPY_AND_ASSIGN(LaunchInstance); |
63 }; | 59 }; |
64 | 60 |
65 } // namespace launcher | 61 } // namespace launcher |
66 | 62 |
67 #endif // SERVICES_UI_LAUNCHER_LAUNCH_INSTANCE_H_ | 63 #endif // SERVICES_UI_LAUNCHER_LAUNCH_INSTANCE_H_ |
OLD | NEW |