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 | 97 manager_->ConnectToApplication( |
98 scoped_ptr<ConnectToApplicationParams> params( | 98 this, app_request.Pass(), std::string(), services.Pass(), |
99 new ConnectToApplicationParams); | 99 exposed_services.Pass(), capability_filter, base::Closure(), callback); |
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()); | |
107 } else { | 100 } else { |
108 LOG(WARNING) << "CapabilityFilter prevented connection from: " << | 101 LOG(WARNING) << "CapabilityFilter prevented connection from: " << |
109 identity_.url << " to: " << url.spec(); | 102 identity_.url << " to: " << url.spec(); |
110 callback.Run(kInvalidContentHandlerID); | 103 callback.Run(kInvalidContentHandlerID); |
111 } | 104 } |
112 } | 105 } |
113 | 106 |
114 void ApplicationInstance::QuitApplication() { | 107 void ApplicationInstance::QuitApplication() { |
115 queue_requests_ = true; | 108 queue_requests_ = true; |
116 application_->OnQuitRequested( | 109 application_->OnQuitRequested( |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 168 |
176 queue_requests_ = false; | 169 queue_requests_ = false; |
177 for (auto request : queued_client_requests_) | 170 for (auto request : queued_client_requests_) |
178 CallAcceptConnection(make_scoped_ptr(request)); | 171 CallAcceptConnection(make_scoped_ptr(request)); |
179 | 172 |
180 queued_client_requests_.clear(); | 173 queued_client_requests_.clear(); |
181 } | 174 } |
182 | 175 |
183 } // namespace shell | 176 } // namespace shell |
184 } // namespace mojo | 177 } // namespace mojo |
OLD | NEW |