OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/shell/application_instance.h" | 5 #include "mojo/shell/application_instance.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "mojo/application/public/interfaces/content_handler.mojom.h" | 9 #include "mojo/application/public/interfaces/content_handler.mojom.h" |
10 #include "mojo/common/common_type_converters.h" | 10 #include "mojo/common/common_type_converters.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 GURL url(url_string); | 87 GURL url(url_string); |
88 if (!url.is_valid()) { | 88 if (!url.is_valid()) { |
89 LOG(ERROR) << "Error: invalid URL: " << url_string; | 89 LOG(ERROR) << "Error: invalid URL: " << url_string; |
90 callback.Run(kInvalidContentHandlerID); | 90 callback.Run(kInvalidContentHandlerID); |
91 return; | 91 return; |
92 } | 92 } |
93 if (allow_any_application_ || filter_.find(url.spec()) != filter_.end()) { | 93 if (allow_any_application_ || filter_.find(url.spec()) != filter_.end()) { |
94 CapabilityFilter capability_filter = GetPermissiveCapabilityFilter(); | 94 CapabilityFilter capability_filter = GetPermissiveCapabilityFilter(); |
95 if (!filter.is_null()) | 95 if (!filter.is_null()) |
96 capability_filter = filter->filter.To<CapabilityFilter>(); | 96 capability_filter = filter->filter.To<CapabilityFilter>(); |
97 manager_->ConnectToApplication( | 97 |
98 this, app_request.Pass(), std::string(), services.Pass(), | 98 scoped_ptr<ConnectToApplicationParams> params( |
99 exposed_services.Pass(), capability_filter, base::Closure(), callback); | 99 new ConnectToApplicationParams); |
| 100 params->SetOriginatorInfo(this); |
| 101 params->SetURLInfo(app_request.Pass()); |
| 102 params->set_services(services.Pass()); |
| 103 params->set_exposed_services(exposed_services.Pass()); |
| 104 params->set_filter(capability_filter); |
| 105 params->set_connect_callback(callback); |
| 106 manager_->ConnectToApplication(params.Pass()); |
100 } else { | 107 } else { |
101 LOG(WARNING) << "CapabilityFilter prevented connection from: " << | 108 LOG(WARNING) << "CapabilityFilter prevented connection from: " << |
102 identity_.url << " to: " << url.spec(); | 109 identity_.url << " to: " << url.spec(); |
103 callback.Run(kInvalidContentHandlerID); | 110 callback.Run(kInvalidContentHandlerID); |
104 } | 111 } |
105 } | 112 } |
106 | 113 |
107 void ApplicationInstance::QuitApplication() { | 114 void ApplicationInstance::QuitApplication() { |
108 queue_requests_ = true; | 115 queue_requests_ = true; |
109 application_->OnQuitRequested( | 116 application_->OnQuitRequested( |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 175 |
169 queue_requests_ = false; | 176 queue_requests_ = false; |
170 for (auto request : queued_client_requests_) | 177 for (auto request : queued_client_requests_) |
171 CallAcceptConnection(make_scoped_ptr(request)); | 178 CallAcceptConnection(make_scoped_ptr(request)); |
172 | 179 |
173 queued_client_requests_.clear(); | 180 queued_client_requests_.clear(); |
174 } | 181 } |
175 | 182 |
176 } // namespace shell | 183 } // namespace shell |
177 } // namespace mojo | 184 } // namespace mojo |
OLD | NEW |