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. |
66 // Requests a new connection to an application. Returns a pointer to the | 67 // Requests a new connection to an application. Returns a pointer to the |
67 // connection if the connection is permitted by this application's delegate, | 68 // connection if the connection is permitted by this application's delegate, |
68 // or nullptr otherwise. Caller does not take ownership. The pointer remains | 69 // or nullptr otherwise. Caller does not take ownership. The pointer remains |
69 // valid until an error occurs on the connection with the Shell, or until the | 70 // valid until an error occurs on the connection with the Shell, or until the |
70 // ApplicationImpl is destroyed, whichever occurs first. | 71 // ApplicationImpl is destroyed, whichever occurs first. |
71 // TODO(vtl): Deprecate/remove this. | 72 // TODO(vtl): Deprecate/remove this. |
72 ApplicationConnection* ConnectToApplication(const String& application_url); | 73 ApplicationConnection* ConnectToApplicationDeprecated( |
| 74 const String& application_url); |
73 | 75 |
| 76 // DEPRECATED. (You should probably use something from connect.h instead.) |
74 // Connect to application identified by |application_url| and connect to the | 77 // Connect to application identified by |application_url| and connect to the |
75 // service implementation of the interface identified by |Interface|. | 78 // service implementation of the interface identified by |Interface|. |
76 // TODO(vtl): Deprecate/remove this. | 79 // TODO(vtl): Deprecate/remove this. |
77 template <typename Interface> | 80 template <typename Interface> |
78 void ConnectToService(const std::string& application_url, | 81 void ConnectToServiceDeprecated(const std::string& application_url, |
79 InterfacePtr<Interface>* ptr) { | 82 InterfacePtr<Interface>* ptr) { |
80 ConnectToApplication(application_url)->ConnectToService(ptr); | 83 ConnectToApplicationDeprecated(application_url)->ConnectToService(ptr); |
81 } | 84 } |
82 | 85 |
83 // Blocks until the |Application| is initialized (i.e., |Initialize()| is | 86 // Blocks until the |Application| is initialized (i.e., |Initialize()| is |
84 // received), if it is not already. | 87 // received), if it is not already. |
85 void WaitForInitialize(); | 88 void WaitForInitialize(); |
86 | 89 |
87 // Unbinds the Shell and Application connections. Can be used to re-bind the | 90 // Unbinds the Shell and Application connections. Can be used to re-bind the |
88 // handles to another implementation of ApplicationImpl, for instance when | 91 // handles to another implementation of ApplicationImpl, for instance when |
89 // running apptests. | 92 // running apptests. |
90 void UnbindConnections(InterfaceRequest<Application>* application_request, | 93 void UnbindConnections(InterfaceRequest<Application>* application_request, |
(...skipping 19 matching lines...) Expand all Loading... |
110 ShellPtr shell_; | 113 ShellPtr shell_; |
111 std::string url_; | 114 std::string url_; |
112 std::vector<std::string> args_; | 115 std::vector<std::string> args_; |
113 | 116 |
114 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); | 117 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); |
115 }; | 118 }; |
116 | 119 |
117 } // namespace mojo | 120 } // namespace mojo |
118 | 121 |
119 #endif // MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_IMPL_H_ | 122 #endif // MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_IMPL_H_ |
OLD | NEW |