OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/public/common/url_fetcher.h" | 5 #include "content/public/common/url_fetcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ptr_util.h" |
8 #include "content/common/net/url_request_user_data.h" | 9 #include "content/common/net/url_request_user_data.h" |
9 #include "net/url_request/url_fetcher.h" | 10 #include "net/url_request/url_fetcher.h" |
10 | 11 |
11 namespace content { | 12 namespace content { |
12 | 13 |
13 namespace { | 14 namespace { |
14 | 15 |
15 base::SupportsUserData::Data* CreateURLRequestUserData(int render_process_id, | 16 std::unique_ptr<base::SupportsUserData::Data> CreateURLRequestUserData( |
16 int render_frame_id) { | 17 int render_process_id, |
17 return new URLRequestUserData(render_process_id, render_frame_id); | 18 int render_frame_id) { |
| 19 return base::MakeUnique<URLRequestUserData>(render_process_id, |
| 20 render_frame_id); |
18 } | 21 } |
19 | 22 |
20 } // namespace | 23 } // namespace |
21 | 24 |
22 void AssociateURLFetcherWithRenderFrame( | 25 void AssociateURLFetcherWithRenderFrame( |
23 net::URLFetcher* url_fetcher, | 26 net::URLFetcher* url_fetcher, |
24 const base::Optional<url::Origin>& initiator, | 27 const base::Optional<url::Origin>& initiator, |
25 int render_process_id, | 28 int render_process_id, |
26 int render_frame_id) { | 29 int render_frame_id) { |
27 url_fetcher->SetInitiator(initiator); | 30 url_fetcher->SetInitiator(initiator); |
28 url_fetcher->SetURLRequestUserData( | 31 url_fetcher->SetURLRequestUserData( |
29 URLRequestUserData::kUserDataKey, | 32 URLRequestUserData::kUserDataKey, |
30 base::Bind(&CreateURLRequestUserData, render_process_id, | 33 base::Bind(&CreateURLRequestUserData, render_process_id, |
31 render_frame_id)); | 34 render_frame_id)); |
32 } | 35 } |
33 | 36 |
34 } // namespace content | 37 } // namespace content |
OLD | NEW |