OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/browser/loader/url_loader_factory_impl.h" | 5 #include "content/browser/loader/url_loader_factory_impl.h" |
6 | 6 |
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
8 #include "content/browser/loader/resource_message_filter.h" | 8 #include "content/browser/loader/resource_message_filter.h" |
9 #include "content/common/resource_request.h" | 9 #include "content/common/resource_request.h" |
10 #include "content/common/url_loader.mojom.h" | 10 #include "content/common/url_loader.mojom.h" |
11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
12 #include "mojo/public/cpp/bindings/strong_binding.h" | 12 #include "mojo/public/cpp/bindings/strong_binding.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
16 URLLoaderFactoryImpl::URLLoaderFactoryImpl( | 16 URLLoaderFactoryImpl::URLLoaderFactoryImpl( |
17 scoped_refptr<ResourceMessageFilter> resource_message_filter) | 17 scoped_refptr<ResourceMessageFilter> resource_message_filter) |
18 : resource_message_filter_(std::move(resource_message_filter)) { | 18 : resource_message_filter_(std::move(resource_message_filter)) { |
19 DCHECK(resource_message_filter_); | 19 DCHECK(resource_message_filter_); |
20 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 20 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
21 } | 21 } |
22 | 22 |
23 URLLoaderFactoryImpl::~URLLoaderFactoryImpl() { | 23 URLLoaderFactoryImpl::~URLLoaderFactoryImpl() { |
24 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 24 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
25 } | 25 } |
26 | 26 |
27 void URLLoaderFactoryImpl::CreateLoaderAndStart( | 27 void URLLoaderFactoryImpl::CreateLoaderAndStart( |
28 mojom::URLLoaderRequest request, | 28 mojom::URLLoaderRequest request, |
| 29 int32_t routing_id, |
29 int32_t request_id, | 30 int32_t request_id, |
30 const ResourceRequest& url_request, | 31 const ResourceRequest& url_request, |
31 mojom::URLLoaderClientPtr client) { | 32 mojom::URLLoaderClientPtr client) { |
32 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 33 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
33 | 34 |
34 // TODO(yhirano): Provide the right routing ID. | |
35 const int routing_id = 0; | |
36 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); | 35 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); |
37 rdh->OnRequestResourceWithMojo(routing_id, request_id, url_request, | 36 rdh->OnRequestResourceWithMojo(routing_id, request_id, url_request, |
38 std::move(request), std::move(client), | 37 std::move(request), std::move(client), |
39 resource_message_filter_.get()); | 38 resource_message_filter_.get()); |
40 } | 39 } |
41 | 40 |
42 void URLLoaderFactoryImpl::Create( | 41 void URLLoaderFactoryImpl::Create( |
43 scoped_refptr<ResourceMessageFilter> filter, | 42 scoped_refptr<ResourceMessageFilter> filter, |
44 mojo::InterfaceRequest<mojom::URLLoaderFactory> request) { | 43 mojo::InterfaceRequest<mojom::URLLoaderFactory> request) { |
45 mojo::MakeStrongBinding( | 44 mojo::MakeStrongBinding( |
46 base::WrapUnique(new URLLoaderFactoryImpl(std::move(filter))), | 45 base::WrapUnique(new URLLoaderFactoryImpl(std::move(filter))), |
47 std::move(request)); | 46 std::move(request)); |
48 } | 47 } |
49 | 48 |
50 } // namespace content | 49 } // namespace content |
OLD | NEW |