OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome_frame/urlmon_url_request.h" | 5 #include "chrome_frame/urlmon_url_request.h" |
6 | 6 |
7 #include <wininet.h> | 7 #include <wininet.h> |
8 #include <urlmon.h> | 8 #include <urlmon.h> |
9 | 9 |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 if (!extra_headers().empty()) { | 549 if (!extra_headers().empty()) { |
550 // TODO(robertshield): We may need to sanitize headers on POST here. | 550 // TODO(robertshield): We may need to sanitize headers on POST here. |
551 new_headers += extra_headers(); | 551 new_headers += extra_headers(); |
552 } | 552 } |
553 | 553 |
554 if (!referrer().empty()) { | 554 if (!referrer().empty()) { |
555 // Referrer is famously misspelled in HTTP: | 555 // Referrer is famously misspelled in HTTP: |
556 new_headers += StringPrintf("Referer: %s\r\n", referrer().c_str()); | 556 new_headers += StringPrintf("Referer: %s\r\n", referrer().c_str()); |
557 } | 557 } |
558 | 558 |
| 559 // In the rare case if "User-Agent" string is already in |current_headers|. |
| 560 new_headers += AppendCFUserAgentString(current_headers, NULL); |
| 561 |
559 if (!new_headers.empty()) { | 562 if (!new_headers.empty()) { |
560 *additional_headers = reinterpret_cast<wchar_t*>( | 563 *additional_headers = reinterpret_cast<wchar_t*>( |
561 CoTaskMemAlloc((new_headers.size() + 1) * sizeof(wchar_t))); | 564 CoTaskMemAlloc((new_headers.size() + 1) * sizeof(wchar_t))); |
562 | 565 |
563 if (*additional_headers == NULL) { | 566 if (*additional_headers == NULL) { |
564 NOTREACHED(); | 567 NOTREACHED(); |
565 hr = E_OUTOFMEMORY; | 568 hr = E_OUTOFMEMORY; |
566 } else { | 569 } else { |
567 lstrcpynW(*additional_headers, ASCIIToWide(new_headers).c_str(), | 570 lstrcpynW(*additional_headers, ASCIIToWide(new_headers).c_str(), |
568 new_headers.size()); | 571 new_headers.size()); |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 privacy_info_.privacy_records[UTF8ToWide(url)]; | 1158 privacy_info_.privacy_records[UTF8ToWide(url)]; |
1156 | 1159 |
1157 privacy_entry.flags |= flags; | 1160 privacy_entry.flags |= flags; |
1158 privacy_entry.policy_ref = UTF8ToWide(policy_ref); | 1161 privacy_entry.policy_ref = UTF8ToWide(policy_ref); |
1159 | 1162 |
1160 if (fire_privacy_event && IsWindow(notification_window_)) { | 1163 if (fire_privacy_event && IsWindow(notification_window_)) { |
1161 PostMessage(notification_window_, WM_FIRE_PRIVACY_CHANGE_NOTIFICATION, 1, | 1164 PostMessage(notification_window_, WM_FIRE_PRIVACY_CHANGE_NOTIFICATION, 1, |
1162 0); | 1165 0); |
1163 } | 1166 } |
1164 } | 1167 } |
OLD | NEW |