OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/browser/loader/navigation_url_loader_impl.h" | |
6 | |
7 #include "base/bind.h" | |
8 #include "base/location.h" | |
9 #include "content/browser/frame_host/navigation_request_info.h" | |
10 #include "content/browser/loader/navigation_url_loader_core.h" | |
11 #include "content/public/browser/browser_context.h" | |
12 #include "content/public/browser/browser_thread.h" | |
13 #include "content/public/browser/stream_handle.h" | |
14 | |
15 namespace content { | |
16 | |
17 NavigationURLLoaderImpl::NavigationURLLoaderImpl( | |
18 BrowserContext* browser_context, | |
19 int64 frame_tree_node_id, | |
20 const CommonNavigationParams& common_params, | |
21 scoped_ptr<NavigationRequestInfo> request_info, | |
22 ResourceRequestBody* request_body, | |
23 NavigationURLLoader::Delegate* delegate) | |
24 : delegate_(delegate), | |
mmenke
2014/10/22 15:32:58
nit: +2 indent
davidben
2014/10/22 20:58:04
Done.
| |
25 weak_factory_(this) { | |
26 core_ = new NavigationURLLoaderCore(weak_factory_.GetWeakPtr()); | |
27 BrowserThread::PostTask( | |
28 BrowserThread::IO, FROM_HERE, | |
29 base::Bind(&NavigationURLLoaderCore::Start, base::Unretained(core_), | |
30 browser_context->GetResourceContext(), frame_tree_node_id, | |
31 common_params, base::Passed(&request_info), | |
32 make_scoped_refptr(request_body))); | |
33 } | |
34 | |
35 NavigationURLLoaderImpl::~NavigationURLLoaderImpl() { | |
36 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, core_); | |
37 core_ = nullptr; | |
38 } | |
39 | |
40 void NavigationURLLoaderImpl::FollowRedirect() { | |
mmenke
2014/10/22 15:32:58
Suggest adding thread dchecks here and in Navigati
davidben
2014/10/22 20:58:04
Done. (I actually ended up removing them now that
| |
41 BrowserThread::PostTask( | |
42 BrowserThread::IO, FROM_HERE, | |
43 base::Bind(&NavigationURLLoaderCore::FollowRedirect, | |
44 base::Unretained(core_))); | |
45 } | |
46 | |
47 void NavigationURLLoaderImpl::NotifyRequestRedirected( | |
48 const net::RedirectInfo& redirect_info, | |
49 ResourceResponse* response) { | |
50 delegate_->OnRequestRedirected(redirect_info, response); | |
51 } | |
52 | |
53 void NavigationURLLoaderImpl::NotifyResponseStarted( | |
54 ResourceResponse* response, | |
55 scoped_ptr<StreamHandle> body) { | |
56 delegate_->OnResponseStarted(response, body.Pass()); | |
57 } | |
58 | |
59 void NavigationURLLoaderImpl::NotifyRequestFailed(int net_error) { | |
60 delegate_->OnRequestFailed(net_error); | |
61 } | |
62 | |
63 } // namespace content | |
OLD | NEW |