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