| 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 #include "mojo/application/public/cpp/application_impl.h" | 5 #include "mojo/application/public/cpp/application_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 termination_closure_(termination_closure), | 52 termination_closure_(termination_closure), |
| 53 app_lifetime_helper_(this), | 53 app_lifetime_helper_(this), |
| 54 quit_requested_(false), | 54 quit_requested_(false), |
| 55 weak_factory_(this) {} | 55 weak_factory_(this) {} |
| 56 | 56 |
| 57 ApplicationImpl::~ApplicationImpl() { | 57 ApplicationImpl::~ApplicationImpl() { |
| 58 app_lifetime_helper_.OnQuit(); | 58 app_lifetime_helper_.OnQuit(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 scoped_ptr<ApplicationConnection> ApplicationImpl::ConnectToApplication( | 61 scoped_ptr<ApplicationConnection> ApplicationImpl::ConnectToApplication( |
| 62 mojo::URLRequestPtr request, | 62 URLRequestPtr request) { |
| 63 CapabilityFilterPtr filter) { | 63 return ConnectToApplicationWithCapabilityFilter(request.Pass(), nullptr); |
| 64 } |
| 65 |
| 66 scoped_ptr<ApplicationConnection> |
| 67 ApplicationImpl::ConnectToApplicationWithCapabilityFilter( |
| 68 URLRequestPtr request, |
| 69 CapabilityFilterPtr filter) { |
| 64 if (!shell_) | 70 if (!shell_) |
| 65 return nullptr; | 71 return nullptr; |
| 66 ServiceProviderPtr local_services; | 72 ServiceProviderPtr local_services; |
| 67 InterfaceRequest<ServiceProvider> local_request = GetProxy(&local_services); | 73 InterfaceRequest<ServiceProvider> local_request = GetProxy(&local_services); |
| 68 ServiceProviderPtr remote_services; | 74 ServiceProviderPtr remote_services; |
| 69 std::string application_url = request->url.To<std::string>(); | 75 std::string application_url = request->url.To<std::string>(); |
| 70 shell_->ConnectToApplication(request.Pass(), GetProxy(&remote_services), | 76 shell_->ConnectToApplication(request.Pass(), GetProxy(&remote_services), |
| 71 local_services.Pass(), filter.Pass()); | 77 local_services.Pass(), filter.Pass()); |
| 72 // We allow all interfaces on outgoing connections since we are presumably in | 78 // We allow all interfaces on outgoing connections since we are presumably in |
| 73 // a position to know who we're talking to. | 79 // a position to know who we're talking to. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 return; | 162 return; |
| 157 shell_ = nullptr; | 163 shell_ = nullptr; |
| 158 } | 164 } |
| 159 | 165 |
| 160 void ApplicationImpl::QuitNow() { | 166 void ApplicationImpl::QuitNow() { |
| 161 delegate_->Quit(); | 167 delegate_->Quit(); |
| 162 termination_closure_.Run(); | 168 termination_closure_.Run(); |
| 163 } | 169 } |
| 164 | 170 |
| 165 } // namespace mojo | 171 } // namespace mojo |
| OLD | NEW |