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, | |
22 scoped_ptr<NavigationRequestInfo> request_info, | 21 scoped_ptr<NavigationRequestInfo> request_info, |
23 ResourceRequestBody* request_body, | |
24 NavigationURLLoaderDelegate* delegate) | 22 NavigationURLLoaderDelegate* delegate) |
25 : delegate_(delegate), | 23 : delegate_(delegate), |
26 weak_factory_(this) { | 24 weak_factory_(this) { |
27 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 25 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
28 | 26 |
29 core_ = new NavigationURLLoaderImplCore(weak_factory_.GetWeakPtr()); | 27 core_ = new NavigationURLLoaderImplCore(weak_factory_.GetWeakPtr()); |
30 BrowserThread::PostTask( | 28 BrowserThread::PostTask( |
31 BrowserThread::IO, FROM_HERE, | 29 BrowserThread::IO, FROM_HERE, |
32 base::Bind(&NavigationURLLoaderImplCore::Start, base::Unretained(core_), | 30 base::Bind(&NavigationURLLoaderImplCore::Start, base::Unretained(core_), |
33 browser_context->GetResourceContext(), frame_tree_node_id, | 31 browser_context->GetResourceContext(), frame_tree_node_id, |
34 common_params, base::Passed(&request_info), | 32 base::Passed(&request_info))); |
35 make_scoped_refptr(request_body))); | |
36 } | 33 } |
37 | 34 |
38 NavigationURLLoaderImpl::~NavigationURLLoaderImpl() { | 35 NavigationURLLoaderImpl::~NavigationURLLoaderImpl() { |
39 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 36 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
40 | 37 |
41 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, core_); | 38 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, core_); |
42 core_ = nullptr; | 39 core_ = nullptr; |
43 } | 40 } |
44 | 41 |
45 void NavigationURLLoaderImpl::FollowRedirect() { | 42 void NavigationURLLoaderImpl::FollowRedirect() { |
(...skipping 27 matching lines...) Expand all Loading... |
73 delegate_->OnRequestFailed(net_error); | 70 delegate_->OnRequestFailed(net_error); |
74 } | 71 } |
75 | 72 |
76 void NavigationURLLoaderImpl::NotifyRequestStarted(base::TimeTicks timestamp) { | 73 void NavigationURLLoaderImpl::NotifyRequestStarted(base::TimeTicks timestamp) { |
77 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 74 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
78 | 75 |
79 delegate_->OnRequestStarted(timestamp); | 76 delegate_->OnRequestStarted(timestamp); |
80 } | 77 } |
81 | 78 |
82 } // namespace content | 79 } // namespace content |
OLD | NEW |