Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: content/common/net/url_fetcher_impl.cc

Issue 10383271: Make AssociateWithRenderView() a free function in the 'content' namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: actually rename fn Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/common/net/url_fetcher_impl.h ('k') | content/public/common/url_fetcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/common/net/url_fetcher_impl.h" 5 #include "content/common/net/url_fetcher_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop_proxy.h" 8 #include "base/message_loop_proxy.h"
9 #include "content/common/net/url_fetcher_core.h" 9 #include "content/common/net/url_fetcher_core.h"
10 #include "content/common/net/url_request_user_data.h" 10 #include "content/common/net/url_request_user_data.h"
(...skipping 22 matching lines...) Expand all
33 // static 33 // static
34 void content::URLFetcher::CancelAll() { 34 void content::URLFetcher::CancelAll() {
35 URLFetcherImpl::CancelAll(); 35 URLFetcherImpl::CancelAll();
36 } 36 }
37 37
38 // static 38 // static
39 void content::URLFetcher::SetEnableInterceptionForTests(bool enabled) { 39 void content::URLFetcher::SetEnableInterceptionForTests(bool enabled) {
40 URLFetcherCore::SetEnableInterceptionForTests(enabled); 40 URLFetcherCore::SetEnableInterceptionForTests(enabled);
41 } 41 }
42 42
43 namespace {
44
45 base::SupportsUserData::Data* CreateURLRequestUserData(
46 int render_process_id,
47 int render_view_id) {
48 return new URLRequestUserData(render_process_id, render_view_id);
49 }
50
51 } // namespace
52
53 namespace content {
54
55 void AssociateURLFetcherWithRenderView(net::URLFetcher* url_fetcher,
56 const GURL& first_party_for_cookies,
57 int render_process_id,
58 int render_view_id) {
59 url_fetcher->SetFirstPartyForCookies(first_party_for_cookies);
60 url_fetcher->SetURLRequestUserData(
61 URLRequestUserData::kUserDataKey,
62 base::Bind(&CreateURLRequestUserData,
63 render_process_id, render_view_id));
64 }
65
66 } // namespace content
43 67
44 URLFetcherImpl::URLFetcherImpl(const GURL& url, 68 URLFetcherImpl::URLFetcherImpl(const GURL& url,
45 RequestType request_type, 69 RequestType request_type,
46 content::URLFetcherDelegate* d) 70 content::URLFetcherDelegate* d)
47 : ALLOW_THIS_IN_INITIALIZER_LIST( 71 : ALLOW_THIS_IN_INITIALIZER_LIST(
48 core_(new content::URLFetcherCore(this, url, request_type, d))) { 72 core_(new content::URLFetcherCore(this, url, request_type, d))) {
49 } 73 }
50 74
51 URLFetcherImpl::~URLFetcherImpl() { 75 URLFetcherImpl::~URLFetcherImpl() {
52 core_->Stop(); 76 core_->Stop();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 void URLFetcherImpl::GetExtraRequestHeaders( 115 void URLFetcherImpl::GetExtraRequestHeaders(
92 net::HttpRequestHeaders* headers) const { 116 net::HttpRequestHeaders* headers) const {
93 GetExtraRequestHeaders(headers); 117 GetExtraRequestHeaders(headers);
94 } 118 }
95 119
96 void URLFetcherImpl::SetRequestContext( 120 void URLFetcherImpl::SetRequestContext(
97 net::URLRequestContextGetter* request_context_getter) { 121 net::URLRequestContextGetter* request_context_getter) {
98 core_->SetRequestContext(request_context_getter); 122 core_->SetRequestContext(request_context_getter);
99 } 123 }
100 124
101 namespace { 125 void URLFetcherImpl::SetFirstPartyForCookies(
102 126 const GURL& first_party_for_cookies) {
103 base::SupportsUserData::Data* CreateURLRequestUserData( 127 core_->SetFirstPartyForCookies(first_party_for_cookies);
104 int render_process_id,
105 int render_view_id) {
106 return new URLRequestUserData(render_process_id, render_view_id);
107 } 128 }
108 129
109 } // namespace 130 void URLFetcherImpl::SetURLRequestUserData(
110 131 const void* key,
111 void URLFetcherImpl::AssociateWithRenderView( 132 const CreateDataCallback& create_data_callback) {
112 const GURL& first_party_for_cookies, 133 core_->SetURLRequestUserData(key, create_data_callback);
113 int render_process_id,
114 int render_view_id) {
115 core_->SetFirstPartyForCookies(first_party_for_cookies);
116 core_->SetURLRequestUserData(
117 URLRequestUserData::kUserDataKey,
118 base::Bind(&CreateURLRequestUserData,
119 render_process_id, render_view_id));
120 } 134 }
121 135
122 void URLFetcherImpl::SetAutomaticallyRetryOn5xx(bool retry) { 136 void URLFetcherImpl::SetAutomaticallyRetryOn5xx(bool retry) {
123 core_->SetAutomaticallyRetryOn5xx(retry); 137 core_->SetAutomaticallyRetryOn5xx(retry);
124 } 138 }
125 139
126 void URLFetcherImpl::SetMaxRetries(int max_retries) { 140 void URLFetcherImpl::SetMaxRetries(int max_retries) {
127 core_->SetMaxRetries(max_retries); 141 core_->SetMaxRetries(max_retries);
128 } 142 }
129 143
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 233
220 // static 234 // static
221 content::URLFetcherFactory* URLFetcherImpl::factory() { 235 content::URLFetcherFactory* URLFetcherImpl::factory() {
222 return g_factory; 236 return g_factory;
223 } 237 }
224 238
225 // static 239 // static
226 void URLFetcherImpl::set_factory(content::URLFetcherFactory* factory) { 240 void URLFetcherImpl::set_factory(content::URLFetcherFactory* factory) {
227 g_factory = factory; 241 g_factory = factory;
228 } 242 }
OLDNEW
« no previous file with comments | « content/common/net/url_fetcher_impl.h ('k') | content/public/common/url_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698