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_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ | 5 #ifndef MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ |
6 #define MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ | 6 #define MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 | 73 |
74 const std::string& url() const { return url_; } | 74 const std::string& url() const { return url_; } |
75 | 75 |
76 AppLifetimeHelper* app_lifetime_helper() { return &app_lifetime_helper_; } | 76 AppLifetimeHelper* app_lifetime_helper() { return &app_lifetime_helper_; } |
77 | 77 |
78 // Requests a new connection to an application. Returns a pointer to the | 78 // Requests a new connection to an application. Returns a pointer to the |
79 // connection if the connection is permitted by this application's delegate, | 79 // connection if the connection is permitted by this application's delegate, |
80 // or nullptr otherwise. Caller does not take ownership. The pointer remains | 80 // or nullptr otherwise. Caller does not take ownership. The pointer remains |
81 // valid until an error occurs on the connection with the Shell, until the | 81 // valid until an error occurs on the connection with the Shell, until the |
82 // ApplicationImpl is destroyed, or until the connection is closed through a | 82 // ApplicationImpl is destroyed, or until the connection is closed through a |
83 // call to ApplicationConnection::CloseConnection. | 83 // call to ApplicationConnection::CloseConnection. If |terminate_cb| is |
sky
2015/07/22 23:56:33
It's not when the app is terminated, but rather wh
xhwang
2015/07/23 21:57:15
Done.
| |
84 // provided, it will be fired when the application is terminated. | |
84 ApplicationConnection* ConnectToApplication(mojo::URLRequestPtr request); | 85 ApplicationConnection* ConnectToApplication(mojo::URLRequestPtr request); |
86 ApplicationConnection* ConnectToApplication( | |
87 mojo::URLRequestPtr request, | |
88 const base::Closure& terminate_cb); | |
85 | 89 |
86 // Closes the |connection|. | 90 // Closes the |connection|. |
87 void CloseConnection(ApplicationConnection* connection); | 91 void CloseConnection(ApplicationConnection* connection); |
88 | 92 |
89 // Connect to application identified by |request->url| and connect to the | 93 // Connect to application identified by |request->url| and connect to the |
90 // service implementation of the interface identified by |Interface|. | 94 // service implementation of the interface identified by |Interface|. |
91 template <typename Interface> | 95 template <typename Interface> |
92 void ConnectToService(mojo::URLRequestPtr request, | 96 void ConnectToService(mojo::URLRequestPtr request, |
93 InterfacePtr<Interface>* ptr) { | 97 InterfacePtr<Interface>* ptr) { |
94 ApplicationConnection* connection = ConnectToApplication(request.Pass()); | 98 ApplicationConnection* connection = ConnectToApplication(request.Pass()); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 bool quit_requested_; | 145 bool quit_requested_; |
142 bool in_destructor_; | 146 bool in_destructor_; |
143 base::WeakPtrFactory<ApplicationImpl> weak_factory_; | 147 base::WeakPtrFactory<ApplicationImpl> weak_factory_; |
144 | 148 |
145 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); | 149 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); |
146 }; | 150 }; |
147 | 151 |
148 } // namespace mojo | 152 } // namespace mojo |
149 | 153 |
150 #endif // MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ | 154 #endif // MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ |
OLD | NEW |