| 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 "content/common/net/url_request_user_data.h" | 8 #include "content/common/net/url_request_user_data.h" |
| 9 #include "net/url_request/url_fetcher.h" | 9 #include "net/url_request/url_fetcher.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 namespace URLFetcher { | |
| 14 | |
| 15 // We have to mark the definition as CONTENT_EXPORT, too, as the | |
| 16 // declaration isn't visible from here (since it's protected by an | |
| 17 // #ifdef). | |
| 18 CONTENT_EXPORT net::URLFetcher* Create( | |
| 19 const GURL& url, | |
| 20 net::URLFetcher::RequestType request_type, | |
| 21 net::URLFetcherDelegate* d) { | |
| 22 return net::URLFetcher::Create(url, request_type, d); | |
| 23 } | |
| 24 | |
| 25 } // namespace URLFetcher | |
| 26 | |
| 27 namespace { | 13 namespace { |
| 28 | 14 |
| 29 base::SupportsUserData::Data* CreateURLRequestUserData( | 15 base::SupportsUserData::Data* CreateURLRequestUserData( |
| 30 int render_process_id, | 16 int render_process_id, |
| 31 int render_view_id) { | 17 int render_view_id) { |
| 32 return new URLRequestUserData(render_process_id, render_view_id); | 18 return new URLRequestUserData(render_process_id, render_view_id); |
| 33 } | 19 } |
| 34 | 20 |
| 35 } // namespace | 21 } // namespace |
| 36 | 22 |
| 37 void AssociateURLFetcherWithRenderView(net::URLFetcher* url_fetcher, | 23 void AssociateURLFetcherWithRenderView(net::URLFetcher* url_fetcher, |
| 38 const GURL& first_party_for_cookies, | 24 const GURL& first_party_for_cookies, |
| 39 int render_process_id, | 25 int render_process_id, |
| 40 int render_view_id) { | 26 int render_view_id) { |
| 41 url_fetcher->SetFirstPartyForCookies(first_party_for_cookies); | 27 url_fetcher->SetFirstPartyForCookies(first_party_for_cookies); |
| 42 url_fetcher->SetURLRequestUserData( | 28 url_fetcher->SetURLRequestUserData( |
| 43 URLRequestUserData::kUserDataKey, | 29 URLRequestUserData::kUserDataKey, |
| 44 base::Bind(&CreateURLRequestUserData, | 30 base::Bind(&CreateURLRequestUserData, |
| 45 render_process_id, render_view_id)); | 31 render_process_id, render_view_id)); |
| 46 } | 32 } |
| 47 | 33 |
| 48 } // namespace content | 34 } // namespace content |
| OLD | NEW |