OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_LAUNCHER_APP_H_ | 5 #ifndef SERVICES_UI_LAUNCHER_LAUNCHER_APP_H_ |
6 #define SERVICES_UI_LAUNCHER_LAUNCHER_APP_H_ | 6 #define SERVICES_UI_LAUNCHER_LAUNCHER_APP_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <unordered_map> | 9 #include <unordered_map> |
| 10 #include <vector> |
10 | 11 |
11 #include "mojo/common/binding_set.h" | 12 #include "mojo/common/binding_set.h" |
12 #include "mojo/common/tracing_impl.h" | 13 #include "mojo/common/tracing_impl.h" |
13 #include "mojo/public/cpp/application/application_delegate.h" | 14 #include "mojo/public/cpp/application/application_impl_base.h" |
14 #include "services/ui/launcher/launch_instance.h" | 15 #include "services/ui/launcher/launch_instance.h" |
15 #include "services/ui/launcher/launcher.mojom.h" | 16 #include "services/ui/launcher/launcher.mojom.h" |
16 | 17 |
17 namespace launcher { | 18 namespace launcher { |
18 | 19 |
19 class LauncherApp : public mojo::ApplicationDelegate, public Launcher { | 20 class LauncherApp : public mojo::ApplicationImplBase, public Launcher { |
20 public: | 21 public: |
21 LauncherApp(); | 22 LauncherApp(); |
22 ~LauncherApp() override; | 23 ~LauncherApp() override; |
23 | 24 |
24 private: | 25 private: |
25 // |ApplicationDelegate|: | 26 // |ApplicationImplBase|: |
26 void Initialize(mojo::ApplicationImpl* app_impl) override; | 27 void OnInitialize() override; |
27 void InitCompositor(); | 28 void InitCompositor(); |
28 void InitViewManager(); | 29 void InitViewManager(); |
29 void InitViewAssociates(const std::string& associate_urls_command_line_param); | 30 void InitViewAssociates(const std::string& associate_urls_command_line_param); |
30 bool ConfigureIncomingConnection( | 31 bool OnAcceptConnection( |
31 mojo::ServiceProviderImpl* service_provider_impl) override; | 32 mojo::ServiceProviderImpl* service_provider_impl) override; |
32 | 33 |
33 // |Launcher|: | 34 // |Launcher|: |
34 void Launch(const mojo::String& application_url) override; | 35 void Launch(const mojo::String& application_url) override; |
35 void LaunchOnViewport( | 36 void LaunchOnViewport( |
36 mojo::InterfaceHandle<mojo::NativeViewport> viewport, | 37 mojo::InterfaceHandle<mojo::NativeViewport> viewport, |
37 mojo::InterfaceHandle<mojo::ui::ViewProvider> view_provider) override; | 38 mojo::InterfaceHandle<mojo::ui::ViewProvider> view_provider) override; |
38 | 39 |
39 void LaunchInternal(mojo::NativeViewportPtr viewport, | 40 void LaunchInternal(mojo::NativeViewportPtr viewport, |
40 mojo::ui::ViewProviderPtr view_provider); | 41 mojo::ui::ViewProviderPtr view_provider); |
41 void OnLaunchTermination(uint32_t id); | 42 void OnLaunchTermination(uint32_t id); |
42 | 43 |
43 void OnCompositorConnectionError(); | 44 void OnCompositorConnectionError(); |
44 void OnViewManagerConnectionError(); | 45 void OnViewManagerConnectionError(); |
45 void OnViewAssociateConnectionError(); | 46 void OnViewAssociateConnectionError(); |
46 | 47 |
47 mojo::ApplicationImpl* app_impl_; | |
48 mojo::TracingImpl tracing_; | 48 mojo::TracingImpl tracing_; |
49 | 49 |
50 mojo::BindingSet<Launcher> bindings_; | 50 mojo::BindingSet<Launcher> bindings_; |
51 std::unordered_map<uint32_t, std::unique_ptr<LaunchInstance>> | 51 std::unordered_map<uint32_t, std::unique_ptr<LaunchInstance>> |
52 launch_instances_; | 52 launch_instances_; |
53 | 53 |
54 uint32_t next_id_; | 54 uint32_t next_id_; |
55 | 55 |
56 mojo::gfx::composition::CompositorPtr compositor_; | 56 mojo::gfx::composition::CompositorPtr compositor_; |
57 mojo::ui::ViewManagerPtr view_manager_; | 57 mojo::ui::ViewManagerPtr view_manager_; |
58 std::vector<mojo::ui::ViewAssociateOwnerPtr> view_associate_owners_; | 58 std::vector<mojo::ui::ViewAssociateOwnerPtr> view_associate_owners_; |
59 | 59 |
60 DISALLOW_COPY_AND_ASSIGN(LauncherApp); | 60 DISALLOW_COPY_AND_ASSIGN(LauncherApp); |
61 }; | 61 }; |
62 | 62 |
63 } // namespace launcher | 63 } // namespace launcher |
64 | 64 |
65 #endif // SERVICES_UI_LAUNCHER_LAUNCHER_APP_H_ | 65 #endif // SERVICES_UI_LAUNCHER_LAUNCHER_APP_H_ |
OLD | NEW |