| 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 "chrome_frame/http_negotiate.h" | 5 #include "chrome_frame/http_negotiate.h" | 
| 6 | 6 | 
| 7 #include <atlbase.h> | 7 #include <atlbase.h> | 
| 8 #include <atlcom.h> | 8 #include <atlcom.h> | 
| 9 #include <htiframe.h> | 9 #include <htiframe.h> | 
| 10 | 10 | 
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 224     LPCWSTR url, LPCWSTR headers, DWORD reserved, LPWSTR* additional_headers) { | 224     LPCWSTR url, LPCWSTR headers, DWORD reserved, LPWSTR* additional_headers) { | 
| 225   DVLOG(1) << __FUNCTION__ << " " << url << " headers:\n" << headers; | 225   DVLOG(1) << __FUNCTION__ << " " << url << " headers:\n" << headers; | 
| 226 | 226 | 
| 227   HRESULT hr = original(me, url, headers, reserved, additional_headers); | 227   HRESULT hr = original(me, url, headers, reserved, additional_headers); | 
| 228 | 228 | 
| 229   if (FAILED(hr)) { | 229   if (FAILED(hr)) { | 
| 230     DLOG(WARNING) << __FUNCTION__ << " Delegate returned an error"; | 230     DLOG(WARNING) << __FUNCTION__ << " Delegate returned an error"; | 
| 231     return hr; | 231     return hr; | 
| 232   } | 232   } | 
| 233   if (modify_user_agent_) { | 233   if (modify_user_agent_) { | 
| 234     std::string updated(AppendCFUserAgentString(headers, *additional_headers)); | 234     std::string updated_headers; | 
|  | 235     if (IsGcfDefaultRenderer() && | 
|  | 236         RendererTypeForUrl(url) == RENDERER_TYPE_CHROME_DEFAULT_RENDERER) { | 
|  | 237       // Replace the user-agent header with Chrome's. | 
|  | 238       updated_headers = ReplaceOrAddUserAgent(*additional_headers, | 
|  | 239                                               http_utils::GetChromeUserAgent()); | 
|  | 240     } else { | 
|  | 241       updated_headers = AppendCFUserAgentString(headers, *additional_headers); | 
|  | 242     } | 
| 235     *additional_headers = reinterpret_cast<wchar_t*>(::CoTaskMemRealloc( | 243     *additional_headers = reinterpret_cast<wchar_t*>(::CoTaskMemRealloc( | 
| 236         *additional_headers, (updated.length() + 1) * sizeof(wchar_t))); | 244         *additional_headers, | 
| 237     lstrcpyW(*additional_headers, ASCIIToWide(updated).c_str()); | 245         (updated_headers.length() + 1) * sizeof(wchar_t))); | 
|  | 246     lstrcpyW(*additional_headers, ASCIIToWide(updated_headers).c_str()); | 
| 238   } | 247   } | 
| 239   return S_OK; | 248   return S_OK; | 
| 240 } | 249 } | 
| OLD | NEW | 
|---|