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/package_manager/package_manager_impl.h" | 5 #include "mojo/package_manager/package_manager_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "mojo/application/public/interfaces/content_handler.mojom.h" | 8 #include "mojo/application/public/interfaces/content_handler.mojom.h" |
9 #include "mojo/fetcher/about_fetcher.h" | 9 #include "mojo/fetcher/about_fetcher.h" |
10 #include "mojo/fetcher/data_fetcher.h" | 10 #include "mojo/fetcher/data_fetcher.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 InterfaceRequest<Application>* application_request) { | 133 InterfaceRequest<Application>* application_request) { |
134 shell::Identity content_handler_identity; | 134 shell::Identity content_handler_identity; |
135 URLResponsePtr response; | 135 URLResponsePtr response; |
136 if (ShouldHandleWithContentHandler(fetcher, | 136 if (ShouldHandleWithContentHandler(fetcher, |
137 target_url, | 137 target_url, |
138 target_filter, | 138 target_filter, |
139 &content_handler_identity, | 139 &content_handler_identity, |
140 &response)) { | 140 &response)) { |
141 ContentHandlerConnection* connection = | 141 ContentHandlerConnection* connection = |
142 GetContentHandler(content_handler_identity, source); | 142 GetContentHandler(content_handler_identity, source); |
143 connection->content_handler()->StartApplication(application_request->Pass(), | 143 connection->StartApplication(application_request->Pass(), response.Pass()); |
144 response.Pass()); | |
145 return connection->id(); | 144 return connection->id(); |
146 } | 145 } |
147 return Shell::kInvalidContentHandlerID; | 146 return Shell::kInvalidContentHandlerID; |
148 } | 147 } |
149 | 148 |
150 GURL PackageManagerImpl::ResolveURL(const GURL& url) { | 149 GURL PackageManagerImpl::ResolveURL(const GURL& url) { |
151 return url_resolver_.get() ? url_resolver_->ResolveMojoURL(url) : url; | 150 return url_resolver_.get() ? url_resolver_->ResolveMojoURL(url) : url; |
152 } | 151 } |
153 | 152 |
154 bool PackageManagerImpl::ShouldHandleWithContentHandler( | 153 bool PackageManagerImpl::ShouldHandleWithContentHandler( |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 void PackageManagerImpl::OnContentHandlerConnectionClosed( | 232 void PackageManagerImpl::OnContentHandlerConnectionClosed( |
234 ContentHandlerConnection* connection) { | 233 ContentHandlerConnection* connection) { |
235 // Remove the mapping. | 234 // Remove the mapping. |
236 auto it = identity_to_content_handler_.find(connection->identity()); | 235 auto it = identity_to_content_handler_.find(connection->identity()); |
237 DCHECK(it != identity_to_content_handler_.end()); | 236 DCHECK(it != identity_to_content_handler_.end()); |
238 identity_to_content_handler_.erase(it); | 237 identity_to_content_handler_.erase(it); |
239 } | 238 } |
240 | 239 |
241 } // namespace package_manager | 240 } // namespace package_manager |
242 } // namespace mojo | 241 } // namespace mojo |
OLD | NEW |