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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 void ConnectToClient(scoped_ptr<ConnectToApplicationParams> params); | 49 void ConnectToClient(scoped_ptr<ConnectToApplicationParams> params); |
50 | 50 |
51 // Required before GetProcessId can be called. | 51 // Required before GetProcessId can be called. |
52 void SetNativeRunner(NativeRunner* native_runner); | 52 void SetNativeRunner(NativeRunner* native_runner); |
53 | 53 |
54 void BindPIDReceiver(InterfaceRequest<mojom::PIDReceiver> pid_receiver); | 54 void BindPIDReceiver(InterfaceRequest<mojom::PIDReceiver> pid_receiver); |
55 | 55 |
56 Application* application() { return application_.get(); } | 56 Application* application() { return application_.get(); } |
57 const Identity& identity() const { return identity_; } | 57 const Identity& identity() const { return identity_; } |
58 int id() const { return id_; } | 58 uint32_t id() const { return id_; } |
59 base::ProcessId pid() const { return pid_; } | 59 base::ProcessId pid() const { return pid_; } |
60 void set_pid(base::ProcessId pid) { pid_ = pid; } | 60 void set_pid(base::ProcessId pid) { pid_ = pid; } |
61 base::Closure on_application_end() const { return on_application_end_; } | 61 base::Closure on_application_end() const { return on_application_end_; } |
62 void set_requesting_content_handler_id(uint32_t id) { | 62 void set_requesting_content_handler_id(uint32_t id) { |
63 requesting_content_handler_id_ = id; | 63 requesting_content_handler_id_ = id; |
64 } | 64 } |
65 uint32_t requesting_content_handler_id() const { | 65 uint32_t requesting_content_handler_id() const { |
66 return requesting_content_handler_id_; | 66 return requesting_content_handler_id_; |
67 } | 67 } |
68 | 68 |
69 private: | 69 private: |
70 // Shell implementation: | 70 // Shell implementation: |
71 void ConnectToApplication( | 71 void ConnectToApplication( |
72 URLRequestPtr app_request, | 72 URLRequestPtr app_request, |
73 InterfaceRequest<ServiceProvider> services, | 73 InterfaceRequest<ServiceProvider> services, |
74 ServiceProviderPtr exposed_services, | 74 ServiceProviderPtr exposed_services, |
75 CapabilityFilterPtr filter, | 75 CapabilityFilterPtr filter, |
76 const ConnectToApplicationCallback& callback) override; | 76 const ConnectToApplicationCallback& callback) override; |
77 void QuitApplication() override; | 77 void QuitApplication() override; |
78 | 78 |
79 // PIDReceiver implementation: | 79 // PIDReceiver implementation: |
80 void SetPID(uint32_t pid) override; | 80 void SetPID(uint32_t pid) override; |
81 | 81 |
82 static int GenerateUniqueID(); | 82 uint32_t GenerateUniqueID() const; |
83 | 83 |
84 void CallAcceptConnection(scoped_ptr<ConnectToApplicationParams> params); | 84 void CallAcceptConnection(scoped_ptr<ConnectToApplicationParams> params); |
85 | 85 |
86 void OnConnectionError(); | 86 void OnConnectionError(); |
87 | 87 |
88 void OnQuitRequestedResult(bool can_quit); | 88 void OnQuitRequestedResult(bool can_quit); |
89 | 89 |
90 void DestroyRunner(); | 90 void DestroyRunner(); |
91 | 91 |
92 ApplicationManager* const manager_; | 92 ApplicationManager* const manager_; |
93 // An id that identifies this instance. Distinct from pid, as a single process | 93 // An id that identifies this instance. Distinct from pid, as a single process |
94 // may vend multiple application instances, and this object may exist before a | 94 // may vend multiple application instances, and this object may exist before a |
95 // process is launched. | 95 // process is launched. |
96 const int id_; | 96 const uint32_t id_; |
97 const Identity identity_; | 97 const Identity identity_; |
98 const bool allow_any_application_; | 98 const bool allow_any_application_; |
99 uint32_t requesting_content_handler_id_; | 99 uint32_t requesting_content_handler_id_; |
100 base::Closure on_application_end_; | 100 base::Closure on_application_end_; |
101 ApplicationPtr application_; | 101 ApplicationPtr application_; |
102 Binding<Shell> binding_; | 102 Binding<Shell> binding_; |
103 Binding<mojom::PIDReceiver> pid_receiver_binding_; | 103 Binding<mojom::PIDReceiver> pid_receiver_binding_; |
104 bool queue_requests_; | 104 bool queue_requests_; |
105 std::vector<ConnectToApplicationParams*> queued_client_requests_; | 105 std::vector<ConnectToApplicationParams*> queued_client_requests_; |
106 NativeRunner* native_runner_; | 106 NativeRunner* native_runner_; |
107 base::ProcessId pid_; | 107 base::ProcessId pid_; |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(ApplicationInstance); | 109 DISALLOW_COPY_AND_ASSIGN(ApplicationInstance); |
110 }; | 110 }; |
111 | 111 |
112 } // namespace shell | 112 } // namespace shell |
113 } // namespace mojo | 113 } // namespace mojo |
114 | 114 |
115 #endif // MOJO_SHELL_APPLICATION_INSTANCE_H_ | 115 #endif // MOJO_SHELL_APPLICATION_INSTANCE_H_ |
OLD | NEW |