| 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/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // the ApplicationImpl is destroyed. | 87 // the ApplicationImpl is destroyed. |
| 88 Shell* shell() const { return shell_.get(); } | 88 Shell* shell() const { return shell_.get(); } |
| 89 | 89 |
| 90 const std::string& url() const { return url_; } | 90 const std::string& url() const { return url_; } |
| 91 | 91 |
| 92 AppLifetimeHelper* app_lifetime_helper() { return &app_lifetime_helper_; } | 92 AppLifetimeHelper* app_lifetime_helper() { return &app_lifetime_helper_; } |
| 93 | 93 |
| 94 // Requests a new connection to an application. Returns a pointer to the | 94 // Requests a new connection to an application. Returns a pointer to the |
| 95 // connection if the connection is permitted by this application's delegate, | 95 // connection if the connection is permitted by this application's delegate, |
| 96 // or nullptr otherwise. Caller takes ownership. | 96 // or nullptr otherwise. Caller takes ownership. |
| 97 // TODO(beng): consider replacing default value in a separate CL per style | 97 scoped_ptr<ApplicationConnection> ConnectToApplication(URLRequestPtr request); |
| 98 // guide. | 98 scoped_ptr<ApplicationConnection> ConnectToApplicationWithCapabilityFilter( |
| 99 scoped_ptr<ApplicationConnection> ConnectToApplication( | |
| 100 URLRequestPtr request, | 99 URLRequestPtr request, |
| 101 CapabilityFilterPtr filter = nullptr); | 100 CapabilityFilterPtr filter); |
| 102 | 101 |
| 103 // Connect to application identified by |request->url| and connect to the | 102 // Connect to application identified by |request->url| and connect to the |
| 104 // service implementation of the interface identified by |Interface|. | 103 // service implementation of the interface identified by |Interface|. |
| 105 template <typename Interface> | 104 template <typename Interface> |
| 106 void ConnectToService(mojo::URLRequestPtr request, | 105 void ConnectToService(mojo::URLRequestPtr request, |
| 107 InterfacePtr<Interface>* ptr) { | 106 InterfacePtr<Interface>* ptr) { |
| 108 scoped_ptr<ApplicationConnection> connection = | 107 scoped_ptr<ApplicationConnection> connection = |
| 109 ConnectToApplication(request.Pass()); | 108 ConnectToApplication(request.Pass()); |
| 110 if (!connection.get()) | 109 if (!connection.get()) |
| 111 return; | 110 return; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 AppLifetimeHelper app_lifetime_helper_; | 148 AppLifetimeHelper app_lifetime_helper_; |
| 150 bool quit_requested_; | 149 bool quit_requested_; |
| 151 base::WeakPtrFactory<ApplicationImpl> weak_factory_; | 150 base::WeakPtrFactory<ApplicationImpl> weak_factory_; |
| 152 | 151 |
| 153 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); | 152 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); |
| 154 }; | 153 }; |
| 155 | 154 |
| 156 } // namespace mojo | 155 } // namespace mojo |
| 157 | 156 |
| 158 #endif // MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ | 157 #endif // MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ |
| OLD | NEW |