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 "content/browser/loader/navigation_url_loader_impl.h" | 5 #include "content/browser/loader/navigation_url_loader_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "content/browser/frame_host/navigation_request_info.h" | 9 #include "content/browser/frame_host/navigation_request_info.h" |
10 #include "content/browser/loader/navigation_url_loader_delegate.h" | 10 #include "content/browser/loader/navigation_url_loader_delegate.h" |
11 #include "content/browser/loader/navigation_url_loader_impl_core.h" | 11 #include "content/browser/loader/navigation_url_loader_impl_core.h" |
12 #include "content/public/browser/browser_context.h" | 12 #include "content/public/browser/browser_context.h" |
13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
14 #include "content/public/browser/stream_handle.h" | 14 #include "content/public/browser/stream_handle.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 NavigationURLLoaderImpl::NavigationURLLoaderImpl( | 18 NavigationURLLoaderImpl::NavigationURLLoaderImpl( |
19 BrowserContext* browser_context, | 19 BrowserContext* browser_context, |
20 int64 frame_tree_node_id, | 20 int64 frame_tree_node_id, |
21 const CommonNavigationParams& common_params, | 21 const CommonNavigationParams& common_params, |
22 scoped_ptr<NavigationRequestInfo> request_info, | 22 scoped_ptr<NavigationRequestInfo> request_info, |
23 ResourceRequestBody* request_body, | |
24 NavigationURLLoaderDelegate* delegate) | 23 NavigationURLLoaderDelegate* delegate) |
25 : delegate_(delegate), | 24 : delegate_(delegate), |
26 weak_factory_(this) { | 25 weak_factory_(this) { |
27 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 26 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
28 | 27 |
29 core_ = new NavigationURLLoaderImplCore(weak_factory_.GetWeakPtr()); | 28 core_ = new NavigationURLLoaderImplCore(weak_factory_.GetWeakPtr()); |
30 BrowserThread::PostTask( | 29 BrowserThread::PostTask( |
31 BrowserThread::IO, FROM_HERE, | 30 BrowserThread::IO, FROM_HERE, |
32 base::Bind(&NavigationURLLoaderImplCore::Start, base::Unretained(core_), | 31 base::Bind(&NavigationURLLoaderImplCore::Start, base::Unretained(core_), |
33 browser_context->GetResourceContext(), frame_tree_node_id, | 32 browser_context->GetResourceContext(), frame_tree_node_id, |
34 common_params, base::Passed(&request_info), | 33 common_params, base::Passed(&request_info))); |
35 make_scoped_refptr(request_body))); | |
36 } | 34 } |
37 | 35 |
38 NavigationURLLoaderImpl::~NavigationURLLoaderImpl() { | 36 NavigationURLLoaderImpl::~NavigationURLLoaderImpl() { |
39 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 37 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
40 | 38 |
41 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, core_); | 39 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, core_); |
42 core_ = nullptr; | 40 core_ = nullptr; |
43 } | 41 } |
44 | 42 |
45 void NavigationURLLoaderImpl::FollowRedirect() { | 43 void NavigationURLLoaderImpl::FollowRedirect() { |
(...skipping 21 matching lines...) Expand all Loading... |
67 delegate_->OnResponseStarted(response, body.Pass()); | 65 delegate_->OnResponseStarted(response, body.Pass()); |
68 } | 66 } |
69 | 67 |
70 void NavigationURLLoaderImpl::NotifyRequestFailed(int net_error) { | 68 void NavigationURLLoaderImpl::NotifyRequestFailed(int net_error) { |
71 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 69 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
72 | 70 |
73 delegate_->OnRequestFailed(net_error); | 71 delegate_->OnRequestFailed(net_error); |
74 } | 72 } |
75 | 73 |
76 } // namespace content | 74 } // namespace content |
OLD | NEW |