Chromium Code Reviews| 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 Shell* shell() const { return shell_.get(); } | 73 Shell* shell() const { return shell_.get(); } |
| 74 | 74 |
| 75 const std::string& url() const { return url_; } | 75 const std::string& url() const { return url_; } |
| 76 | 76 |
| 77 AppLifetimeHelper* app_lifetime_helper() { return &app_lifetime_helper_; } | 77 AppLifetimeHelper* app_lifetime_helper() { return &app_lifetime_helper_; } |
| 78 | 78 |
| 79 // Requests a new connection to an application. Returns a pointer to the | 79 // Requests a new connection to an application. Returns a pointer to the |
| 80 // connection if the connection is permitted by this application's delegate, | 80 // connection if the connection is permitted by this application's delegate, |
| 81 // or nullptr otherwise. Caller does not take ownership. The pointer remains | 81 // or nullptr otherwise. Caller does not take ownership. The pointer remains |
| 82 // valid until an error occurs on the connection with the Shell, or until the | 82 // valid until an error occurs on the connection with the Shell, or until the |
| 83 // ApplicationImpl is destroyed, whichever occurs first. | 83 // ApplicationImpl is destroyed, whichever occurs first. If |error_cb| is |
| 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(mojo::URLRequestPtr request, | |
| 87 const base::Closure& error_cb); | |
|
sandersd (OOO until July 31)
2015/06/30 21:32:47
It's true that this is caused by a connection erro
xhwang
2015/07/07 20:29:24
Done.
| |
| 85 | 88 |
| 86 // Connect to application identified by |request->url| and connect to the | 89 // Connect to application identified by |request->url| and connect to the |
| 87 // service implementation of the interface identified by |Interface|. | 90 // service implementation of the interface identified by |Interface|. |
| 88 template <typename Interface> | 91 template <typename Interface> |
| 89 void ConnectToService(mojo::URLRequestPtr request, | 92 void ConnectToService(mojo::URLRequestPtr request, |
| 90 InterfacePtr<Interface>* ptr) { | 93 InterfacePtr<Interface>* ptr) { |
| 91 ConnectToApplication(request.Pass())->ConnectToService(ptr); | 94 ConnectToApplication(request.Pass())->ConnectToService(ptr); |
| 92 } | 95 } |
| 93 | 96 |
| 94 // Application implementation. | 97 // Application implementation. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 AppLifetimeHelper app_lifetime_helper_; | 138 AppLifetimeHelper app_lifetime_helper_; |
| 136 bool quit_requested_; | 139 bool quit_requested_; |
| 137 base::WeakPtrFactory<ApplicationImpl> weak_factory_; | 140 base::WeakPtrFactory<ApplicationImpl> weak_factory_; |
| 138 | 141 |
| 139 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); | 142 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); |
| 140 }; | 143 }; |
| 141 | 144 |
| 142 } // namespace mojo | 145 } // namespace mojo |
| 143 | 146 |
| 144 #endif // MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ | 147 #endif // MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ |
| OLD | NEW |