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 const std::string& view_associates_urls, |
27 const base::Closure& shutdown_callback); | 28 const base::Closure& shutdown_callback); |
28 ~LaunchInstance() override; | 29 ~LaunchInstance() override; |
29 | 30 |
30 void Launch(); | 31 void Launch(); |
31 | 32 |
| 33 void OnViewAssociateConnectionError(); |
| 34 |
32 private: | 35 private: |
33 // |NativeViewportEventDispatcher|: | 36 // |NativeViewportEventDispatcher|: |
34 void OnEvent(mojo::EventPtr event, | 37 void OnEvent(mojo::EventPtr event, |
35 const mojo::Callback<void()>& callback) override; | 38 const mojo::Callback<void()>& callback) override; |
36 | 39 |
37 void OnCompositorConnectionError(); | 40 void OnCompositorConnectionError(); |
38 void OnViewManagerConnectionError(); | 41 void OnViewManagerConnectionError(); |
39 | 42 |
40 void InitViewport(); | 43 void InitViewport(); |
41 void OnViewportConnectionError(); | 44 void OnViewportConnectionError(); |
42 void OnViewportCreated(mojo::ViewportMetricsPtr metrics); | 45 void OnViewportCreated(mojo::ViewportMetricsPtr metrics); |
43 void OnViewportMetricsChanged(mojo::ViewportMetricsPtr metrics); | 46 void OnViewportMetricsChanged(mojo::ViewportMetricsPtr metrics); |
44 void RequestUpdatedViewportMetrics(); | 47 void RequestUpdatedViewportMetrics(); |
45 | 48 |
46 mojo::ApplicationImpl* app_impl_; | 49 mojo::ApplicationImpl* app_impl_; |
47 std::string app_url_; | 50 std::string app_url_; |
| 51 std::string view_associate_urls_; |
48 base::Closure shutdown_callback_; | 52 base::Closure shutdown_callback_; |
49 | 53 |
50 mojo::gfx::composition::CompositorPtr compositor_; | 54 mojo::gfx::composition::CompositorPtr compositor_; |
51 mojo::ui::ViewManagerPtr view_manager_; | 55 mojo::ui::ViewManagerPtr view_manager_; |
52 | 56 |
53 mojo::NativeViewportPtr viewport_; | 57 mojo::NativeViewportPtr viewport_; |
54 mojo::Binding<NativeViewportEventDispatcher> | 58 mojo::Binding<NativeViewportEventDispatcher> |
55 viewport_event_dispatcher_binding_; | 59 viewport_event_dispatcher_binding_; |
56 | 60 |
57 std::unique_ptr<LauncherViewTree> view_tree_; | 61 std::unique_ptr<LauncherViewTree> view_tree_; |
58 | 62 |
| 63 std::vector<mojo::ui::ViewAssociateOwnerPtr> view_associate_owners_; |
| 64 |
59 mojo::ui::ViewOwnerPtr client_view_owner_; | 65 mojo::ui::ViewOwnerPtr client_view_owner_; |
60 | 66 |
61 DISALLOW_COPY_AND_ASSIGN(LaunchInstance); | 67 DISALLOW_COPY_AND_ASSIGN(LaunchInstance); |
62 }; | 68 }; |
63 | 69 |
64 } // namespace launcher | 70 } // namespace launcher |
65 | 71 |
66 #endif // SERVICES_UI_LAUNCHER_LAUNCH_INSTANCE_H_ | 72 #endif // SERVICES_UI_LAUNCHER_LAUNCH_INSTANCE_H_ |
OLD | NEW |