OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PUBLIC_CPP_APPLICATION_APPLICATION_IMPL_H_ | 5 #ifndef MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_IMPL_H_ |
6 #define MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_IMPL_H_ | 6 #define MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_IMPL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "mojo/public/cpp/application/application_delegate.h" | 12 #include "mojo/public/cpp/application/application_delegate.h" |
13 #include "mojo/public/cpp/application/lib/service_registry.h" | |
14 #include "mojo/public/cpp/system/macros.h" | 13 #include "mojo/public/cpp/system/macros.h" |
15 #include "mojo/public/interfaces/application/application.mojom.h" | 14 #include "mojo/public/interfaces/application/application.mojom.h" |
16 #include "mojo/public/interfaces/application/application_connector.mojom.h" | 15 #include "mojo/public/interfaces/application/application_connector.mojom.h" |
17 #include "mojo/public/interfaces/application/shell.mojom.h" | 16 #include "mojo/public/interfaces/application/shell.mojom.h" |
18 | 17 |
19 namespace mojo { | 18 namespace mojo { |
20 | 19 |
| 20 class ServiceProviderImpl; |
| 21 |
21 // Implements the Application interface, which the shell uses for basic | 22 // Implements the Application interface, which the shell uses for basic |
22 // communication with an application (e.g., to connect clients to services | 23 // communication with an application (e.g., to connect clients to services |
23 // provided by an application). Also provides the application access to the | 24 // provided by an application). Also provides the application access to the |
24 // Shell, which, e.g., may be used by an application to connect to other | 25 // Shell, which, e.g., may be used by an application to connect to other |
25 // services. | 26 // services. |
26 // | 27 // |
27 // Typically, you create one or more classes implementing your APIs (e.g., | 28 // Typically, you create one or more classes implementing your APIs (e.g., |
28 // FooImpl implementing Foo). See bindings/binding.h for more information. Then | 29 // FooImpl implementing Foo). See bindings/binding.h for more information. Then |
29 // you implement an mojo::ApplicationDelegate whose | 30 // you implement an mojo::ApplicationDelegate whose |
30 // ConfigureIncomingConnection() adds services to each connection. Finally, you | 31 // ConfigureIncomingConnection() adds services to each connection. Finally, you |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 void Initialize(InterfaceHandle<Shell> shell, | 75 void Initialize(InterfaceHandle<Shell> shell, |
75 Array<String> args, | 76 Array<String> args, |
76 const mojo::String& url) override; | 77 const mojo::String& url) override; |
77 void AcceptConnection(const String& requestor_url, | 78 void AcceptConnection(const String& requestor_url, |
78 InterfaceRequest<ServiceProvider> services, | 79 InterfaceRequest<ServiceProvider> services, |
79 InterfaceHandle<ServiceProvider> exposed_services, | 80 InterfaceHandle<ServiceProvider> exposed_services, |
80 const String& url) override; | 81 const String& url) override; |
81 void RequestQuit() override; | 82 void RequestQuit() override; |
82 | 83 |
83 private: | 84 private: |
84 using ServiceRegistryList = | 85 std::vector<std::unique_ptr<ServiceProviderImpl>> service_provider_impls_; |
85 std::vector<std::unique_ptr<internal::ServiceRegistry>>; | |
86 ServiceRegistryList incoming_service_registries_; | |
87 ApplicationDelegate* delegate_; | 86 ApplicationDelegate* delegate_; |
88 Binding<Application> binding_; | 87 Binding<Application> binding_; |
89 ShellPtr shell_; | 88 ShellPtr shell_; |
90 std::string url_; | 89 std::string url_; |
91 std::vector<std::string> args_; | 90 std::vector<std::string> args_; |
92 | 91 |
93 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); | 92 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); |
94 }; | 93 }; |
95 | 94 |
96 } // namespace mojo | 95 } // namespace mojo |
97 | 96 |
98 #endif // MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_IMPL_H_ | 97 #endif // MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_IMPL_H_ |
OLD | NEW |