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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 | 69 |
| 70 // The Mojo shell. This will return a valid pointer after Initialize() has | 70 // The Mojo shell. This will return a valid pointer after Initialize() has |
| 71 // been invoked. It will remain valid until UnbindConnections() is invoked or | 71 // been invoked. It will remain valid until UnbindConnections() is invoked or |
| 72 // the ApplicationImpl is destroyed. | 72 // the ApplicationImpl is destroyed. |
| 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 |
|
sky
2015/06/19 19:22:19
Update this documentation.
Fady Samuel
2015/06/26 22:41:20
Done.
| |
| 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. |
| 84 ApplicationConnection* ConnectToApplication(mojo::URLRequestPtr request); | 84 ApplicationConnection* ConnectToApplication(mojo::URLRequestPtr request); |
| 85 | 85 |
| 86 // Closes the |connection|. | |
| 87 void CloseConnection(ApplicationConnection* connection); | |
| 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. |
| 95 void Initialize(ShellPtr shell, const mojo::String& url) override; | 98 void Initialize(ShellPtr shell, const mojo::String& url) override; |
| (...skipping 39 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 |