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> |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // Returns any initial configuration arguments, passed by the Shell. | 56 // Returns any initial configuration arguments, passed by the Shell. |
57 const std::vector<std::string>& args() const { return args_; } | 57 const std::vector<std::string>& args() const { return args_; } |
58 bool HasArg(const std::string& arg) const; | 58 bool HasArg(const std::string& arg) const; |
59 | 59 |
60 // Creates a new |ApplicationConnector|. The result can be bound to an | 60 // Creates a new |ApplicationConnector|. The result can be bound to an |
61 // |ApplicationConnectorPtr| and used to connect to other applications. (It | 61 // |ApplicationConnectorPtr| and used to connect to other applications. (It |
62 // returns an |InterfaceHandle| instead of an |InterfacePtr| to facilitate | 62 // returns an |InterfaceHandle| instead of an |InterfacePtr| to facilitate |
63 // passing it to another thread.) | 63 // passing it to another thread.) |
64 InterfaceHandle<ApplicationConnector> CreateApplicationConnector(); | 64 InterfaceHandle<ApplicationConnector> CreateApplicationConnector(); |
65 | 65 |
66 // DEPRECATED. | |
67 // Requests a new connection to an application. Returns a pointer to the | |
68 // connection if the connection is permitted by this application's delegate, | |
69 // or nullptr otherwise. Caller does not take ownership. The pointer remains | |
70 // valid until an error occurs on the connection with the Shell, or until the | |
71 // ApplicationImpl is destroyed, whichever occurs first. | |
72 // TODO(vtl): Deprecate/remove this. | |
73 ApplicationConnection* ConnectToApplicationDeprecated( | |
74 const String& application_url); | |
75 | |
76 // Blocks until the |Application| is initialized (i.e., |Initialize()| is | 66 // Blocks until the |Application| is initialized (i.e., |Initialize()| is |
77 // received), if it is not already. | 67 // received), if it is not already. |
78 void WaitForInitialize(); | 68 void WaitForInitialize(); |
79 | 69 |
80 // Unbinds the Shell and Application connections. Can be used to re-bind the | 70 // Unbinds the Shell and Application connections. Can be used to re-bind the |
81 // handles to another implementation of ApplicationImpl, for instance when | 71 // handles to another implementation of ApplicationImpl, for instance when |
82 // running apptests. | 72 // running apptests. |
83 void UnbindConnections(InterfaceRequest<Application>* application_request, | 73 void UnbindConnections(InterfaceRequest<Application>* application_request, |
84 ShellPtr* shell); | 74 ShellPtr* shell); |
85 | 75 |
86 // |Application| implementation. | 76 // |Application| implementation. |
87 void Initialize(InterfaceHandle<Shell> shell, | 77 void Initialize(InterfaceHandle<Shell> shell, |
88 Array<String> args, | 78 Array<String> args, |
89 const mojo::String& url) override; | 79 const mojo::String& url) override; |
90 void AcceptConnection(const String& requestor_url, | 80 void AcceptConnection(const String& requestor_url, |
91 InterfaceRequest<ServiceProvider> services, | 81 InterfaceRequest<ServiceProvider> services, |
92 InterfaceHandle<ServiceProvider> exposed_services, | 82 InterfaceHandle<ServiceProvider> exposed_services, |
93 const String& url) override; | 83 const String& url) override; |
94 void RequestQuit() override; | 84 void RequestQuit() override; |
95 | 85 |
96 private: | 86 private: |
97 using ServiceRegistryList = | 87 using ServiceRegistryList = |
98 std::vector<std::unique_ptr<internal::ServiceRegistry>>; | 88 std::vector<std::unique_ptr<internal::ServiceRegistry>>; |
99 ServiceRegistryList incoming_service_registries_; | 89 ServiceRegistryList incoming_service_registries_; |
100 ServiceRegistryList outgoing_service_registries_; | |
101 ApplicationDelegate* delegate_; | 90 ApplicationDelegate* delegate_; |
102 Binding<Application> binding_; | 91 Binding<Application> binding_; |
103 ShellPtr shell_; | 92 ShellPtr shell_; |
104 std::string url_; | 93 std::string url_; |
105 std::vector<std::string> args_; | 94 std::vector<std::string> args_; |
106 | 95 |
107 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); | 96 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); |
108 }; | 97 }; |
109 | 98 |
110 } // namespace mojo | 99 } // namespace mojo |
111 | 100 |
112 #endif // MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_IMPL_H_ | 101 #endif // MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_IMPL_H_ |
OLD | NEW |