| 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 | 10 |
| 11 #include "mojo/common/binding_set.h" | 11 #include "mojo/common/binding_set.h" |
| 12 #include "mojo/common/tracing_impl.h" | 12 #include "mojo/common/tracing_impl.h" |
| 13 #include "mojo/public/cpp/application/application_delegate.h" | 13 #include "mojo/public/cpp/application/application_delegate.h" |
| 14 #include "services/ui/launcher/launch_instance.h" | 14 #include "services/ui/launcher/launch_instance.h" |
| 15 #include "services/ui/launcher/launcher.mojom.h" | 15 #include "services/ui/launcher/launcher.mojom.h" |
| 16 | 16 |
| 17 namespace launcher { | 17 namespace launcher { |
| 18 | 18 |
| 19 class LauncherApp : public mojo::ApplicationDelegate, | 19 class LauncherApp : public mojo::ApplicationDelegate, public Launcher { |
| 20 public mojo::InterfaceFactory<Launcher>, | |
| 21 public Launcher { | |
| 22 public: | 20 public: |
| 23 LauncherApp(); | 21 LauncherApp(); |
| 24 ~LauncherApp() override; | 22 ~LauncherApp() override; |
| 25 | 23 |
| 26 private: | 24 private: |
| 27 // |ApplicationDelegate|: | 25 // |ApplicationDelegate|: |
| 28 void Initialize(mojo::ApplicationImpl* app_impl) override; | 26 void Initialize(mojo::ApplicationImpl* app_impl) override; |
| 29 bool ConfigureIncomingConnection( | 27 bool ConfigureIncomingConnection( |
| 30 mojo::ApplicationConnection* connection) override; | 28 mojo::ApplicationConnection* connection) override; |
| 31 | 29 |
| 32 // mojo::InterfaceRequest<Launcher> implementation | |
| 33 void Create(const mojo::ConnectionContext& connection_context, | |
| 34 mojo::InterfaceRequest<Launcher> request) override; | |
| 35 | |
| 36 // |Launcher|: | 30 // |Launcher|: |
| 37 void Launch(const mojo::String& application_url) override; | 31 void Launch(const mojo::String& application_url) override; |
| 38 | 32 |
| 39 void OnLaunchTermination(uint32_t id); | 33 void OnLaunchTermination(uint32_t id); |
| 40 | 34 |
| 41 mojo::ApplicationImpl* app_impl_; | 35 mojo::ApplicationImpl* app_impl_; |
| 42 mojo::TracingImpl tracing_; | 36 mojo::TracingImpl tracing_; |
| 43 | 37 |
| 44 mojo::BindingSet<Launcher> bindings_; | 38 mojo::BindingSet<Launcher> bindings_; |
| 45 std::unordered_map<uint32_t, std::unique_ptr<LaunchInstance>> | 39 std::unordered_map<uint32_t, std::unique_ptr<LaunchInstance>> |
| 46 launch_instances_; | 40 launch_instances_; |
| 47 uint32_t next_id_; | 41 uint32_t next_id_; |
| 48 | 42 |
| 49 DISALLOW_COPY_AND_ASSIGN(LauncherApp); | 43 DISALLOW_COPY_AND_ASSIGN(LauncherApp); |
| 50 }; | 44 }; |
| 51 | 45 |
| 52 } // namespace launcher | 46 } // namespace launcher |
| 53 | 47 |
| 54 #endif // SERVICES_UI_LAUNCHER_LAUNCHER_APP_H_ | 48 #endif // SERVICES_UI_LAUNCHER_LAUNCHER_APP_H_ |
| OLD | NEW |