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_moniker.h" | 5 #include "chrome_frame/urlmon_moniker.h" |
6 | 6 |
7 #include <shlguid.h> | 7 #include <shlguid.h> |
8 | 8 |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "chrome_frame/bho.h" | 10 #include "chrome_frame/bho.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 namespace { | 26 namespace { |
27 std::string FindReferrerFromHeaders(const wchar_t* headers, | 27 std::string FindReferrerFromHeaders(const wchar_t* headers, |
28 const wchar_t* additional_headers) { | 28 const wchar_t* additional_headers) { |
29 std::string referrer; | 29 std::string referrer; |
30 | 30 |
31 const wchar_t* both_headers[] = { headers, additional_headers }; | 31 const wchar_t* both_headers[] = { headers, additional_headers }; |
32 for (int i = 0; referrer.empty() && i < arraysize(both_headers); ++i) { | 32 for (int i = 0; referrer.empty() && i < arraysize(both_headers); ++i) { |
33 if (!both_headers[i]) | 33 if (!both_headers[i]) |
34 continue; | 34 continue; |
35 std::string raw_headers_utf8 = WideToUTF8(both_headers[i]); | 35 std::string raw_headers_utf8 = WideToUTF8(both_headers[i]); |
36 std::string http_headers = | 36 net::HttpUtil::HeadersIterator it(raw_headers_utf8.begin(), |
37 net::HttpUtil::AssembleRawHeaders(raw_headers_utf8.c_str(), | 37 raw_headers_utf8.end(), "\r\n"); |
38 raw_headers_utf8.length()); | |
39 net::HttpUtil::HeadersIterator it(http_headers.begin(), | |
40 http_headers.end(), "\r\n"); | |
41 while (it.GetNext()) { | 38 while (it.GetNext()) { |
42 if (LowerCaseEqualsASCII(it.name(), "referer")) { | 39 if (LowerCaseEqualsASCII(it.name(), "referer")) { |
43 referrer = it.values(); | 40 referrer = it.values(); |
44 break; | 41 break; |
45 } | 42 } |
46 } | 43 } |
47 } | 44 } |
48 | 45 |
49 return referrer; | 46 return referrer; |
50 } | 47 } |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 } else if (cache_out) { | 603 } else if (cache_out) { |
607 *cache_out = cache.Detach(); | 604 *cache_out = cache.Detach(); |
608 } | 605 } |
609 | 606 |
610 bscb->OnStopBinding(hr, NULL); | 607 bscb->OnStopBinding(hr, NULL); |
611 } | 608 } |
612 | 609 |
613 return hr; | 610 return hr; |
614 } | 611 } |
615 | 612 |
OLD | NEW |