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