OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "net/url_request/url_request.h" | 5 #include "net/url_request/url_request.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/metrics/stats_counters.h" | 10 #include "base/metrics/stats_counters.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 void URLRequest::SetExtraRequestHeaderById(int id, const string& value, | 216 void URLRequest::SetExtraRequestHeaderById(int id, const string& value, |
217 bool overwrite) { | 217 bool overwrite) { |
218 DCHECK(!is_pending_); | 218 DCHECK(!is_pending_); |
219 NOTREACHED() << "implement me!"; | 219 NOTREACHED() << "implement me!"; |
220 } | 220 } |
221 | 221 |
222 void URLRequest::SetExtraRequestHeaderByName(const string& name, | 222 void URLRequest::SetExtraRequestHeaderByName(const string& name, |
223 const string& value, | 223 const string& value, |
224 bool overwrite) { | 224 bool overwrite) { |
225 DCHECK(!is_pending_); | 225 DCHECK(!is_pending_); |
226 NOTREACHED() << "implement me!"; | 226 if (overwrite) { |
| 227 extra_request_headers_.SetHeader(name, value); |
| 228 } else { |
| 229 extra_request_headers_.SetHeaderIfMissing(name, value); |
| 230 } |
227 } | 231 } |
228 | 232 |
229 void URLRequest::SetExtraRequestHeaders( | 233 void URLRequest::SetExtraRequestHeaders( |
230 const HttpRequestHeaders& headers) { | 234 const HttpRequestHeaders& headers) { |
231 DCHECK(!is_pending_); | 235 DCHECK(!is_pending_); |
232 extra_request_headers_ = headers; | 236 extra_request_headers_ = headers; |
233 | 237 |
234 // NOTE: This method will likely become non-trivial once the other setters | 238 // NOTE: This method will likely become non-trivial once the other setters |
235 // for request headers are implemented. | 239 // for request headers are implemented. |
236 } | 240 } |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 if (found != user_data_.end()) | 695 if (found != user_data_.end()) |
692 return found->second.get(); | 696 return found->second.get(); |
693 return NULL; | 697 return NULL; |
694 } | 698 } |
695 | 699 |
696 void URLRequest::SetUserData(const void* key, UserData* data) { | 700 void URLRequest::SetUserData(const void* key, UserData* data) { |
697 user_data_[key] = linked_ptr<UserData>(data); | 701 user_data_[key] = linked_ptr<UserData>(data); |
698 } | 702 } |
699 | 703 |
700 } // namespace net | 704 } // namespace net |
OLD | NEW |