| 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 MOJO_SHELL_APPLICATION_INSTANCE_H_ | 5 #ifndef MOJO_SHELL_APPLICATION_INSTANCE_H_ |
| 6 #define MOJO_SHELL_APPLICATION_INSTANCE_H_ | 6 #define MOJO_SHELL_APPLICATION_INSTANCE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 // Encapsulates a connection to an instance of an application, tracked by the | 31 // Encapsulates a connection to an instance of an application, tracked by the |
| 32 // shell's ApplicationManager. | 32 // shell's ApplicationManager. |
| 33 class ApplicationInstance : public mojom::Shell, | 33 class ApplicationInstance : public mojom::Shell, |
| 34 public mojom::PIDReceiver { | 34 public mojom::PIDReceiver { |
| 35 public: | 35 public: |
| 36 ApplicationInstance( | 36 ApplicationInstance( |
| 37 mojom::ShellClientPtr shell_client, | 37 mojom::ShellClientPtr shell_client, |
| 38 ApplicationManager* manager, | 38 ApplicationManager* manager, |
| 39 const Identity& identity, | 39 const Identity& identity, |
| 40 const base::Closure& on_application_end, | |
| 41 const String& application_name); | 40 const String& application_name); |
| 42 ~ApplicationInstance() override; | 41 ~ApplicationInstance() override; |
| 43 | 42 |
| 44 void InitializeApplication(); | 43 void InitializeApplication(); |
| 45 | 44 |
| 46 void ConnectToClient(scoped_ptr<ConnectParams> params); | 45 void ConnectToClient(scoped_ptr<ConnectParams> params); |
| 47 | 46 |
| 48 // Required before GetProcessId can be called. | 47 // Required before GetProcessId can be called. |
| 49 void SetNativeRunner(NativeRunner* native_runner); | 48 void SetNativeRunner(NativeRunner* native_runner); |
| 50 | 49 |
| 51 void BindPIDReceiver(InterfaceRequest<mojom::PIDReceiver> pid_receiver); | 50 void BindPIDReceiver(InterfaceRequest<mojom::PIDReceiver> pid_receiver); |
| 52 | 51 |
| 53 mojom::ShellClient* shell_client() { return shell_client_.get(); } | 52 mojom::ShellClient* shell_client() { return shell_client_.get(); } |
| 54 const Identity& identity() const { return identity_; } | 53 const Identity& identity() const { return identity_; } |
| 55 uint32_t id() const { return id_; } | 54 uint32_t id() const { return id_; } |
| 56 base::ProcessId pid() const { return pid_; } | 55 base::ProcessId pid() const { return pid_; } |
| 57 void set_pid(base::ProcessId pid) { pid_ = pid; } | 56 void set_pid(base::ProcessId pid) { pid_ = pid; } |
| 58 base::Closure on_application_end() const { return on_application_end_; } | |
| 59 const String& application_name() const { return application_name_; } | 57 const String& application_name() const { return application_name_; } |
| 60 | 58 |
| 61 private: | 59 private: |
| 62 // Shell implementation: | 60 // Shell implementation: |
| 63 void Connect(const String& app_url, | 61 void Connect(const String& app_url, |
| 64 shell::mojom::InterfaceProviderRequest remote_interfaces, | 62 shell::mojom::InterfaceProviderRequest remote_interfaces, |
| 65 shell::mojom::InterfaceProviderPtr local_interfaces, | 63 shell::mojom::InterfaceProviderPtr local_interfaces, |
| 66 mojom::CapabilityFilterPtr filter, | 64 mojom::CapabilityFilterPtr filter, |
| 67 const ConnectCallback& callback) override; | 65 const ConnectCallback& callback) override; |
| 68 void QuitApplication() override; | 66 void QuitApplication() override; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 80 | 78 |
| 81 void DestroyRunner(); | 79 void DestroyRunner(); |
| 82 | 80 |
| 83 ApplicationManager* const manager_; | 81 ApplicationManager* const manager_; |
| 84 // An id that identifies this instance. Distinct from pid, as a single process | 82 // An id that identifies this instance. Distinct from pid, as a single process |
| 85 // may vend multiple application instances, and this object may exist before a | 83 // may vend multiple application instances, and this object may exist before a |
| 86 // process is launched. | 84 // process is launched. |
| 87 const uint32_t id_; | 85 const uint32_t id_; |
| 88 const Identity identity_; | 86 const Identity identity_; |
| 89 const bool allow_any_application_; | 87 const bool allow_any_application_; |
| 90 base::Closure on_application_end_; | |
| 91 mojom::ShellClientPtr shell_client_; | 88 mojom::ShellClientPtr shell_client_; |
| 92 Binding<mojom::Shell> binding_; | 89 Binding<mojom::Shell> binding_; |
| 93 Binding<mojom::PIDReceiver> pid_receiver_binding_; | 90 Binding<mojom::PIDReceiver> pid_receiver_binding_; |
| 94 bool queue_requests_; | 91 bool queue_requests_; |
| 95 std::vector<ConnectParams*> queued_client_requests_; | 92 std::vector<ConnectParams*> queued_client_requests_; |
| 96 NativeRunner* native_runner_; | 93 NativeRunner* native_runner_; |
| 97 const String application_name_; | 94 const String application_name_; |
| 98 base::ProcessId pid_; | 95 base::ProcessId pid_; |
| 99 | 96 |
| 100 DISALLOW_COPY_AND_ASSIGN(ApplicationInstance); | 97 DISALLOW_COPY_AND_ASSIGN(ApplicationInstance); |
| 101 }; | 98 }; |
| 102 | 99 |
| 103 } // namespace shell | 100 } // namespace shell |
| 104 } // namespace mojo | 101 } // namespace mojo |
| 105 | 102 |
| 106 #endif // MOJO_SHELL_APPLICATION_INSTANCE_H_ | 103 #endif // MOJO_SHELL_APPLICATION_INSTANCE_H_ |
| OLD | NEW |