| 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 // CookieAccountant implementation. | 5 // CookieAccountant implementation. |
| 6 #include "ceee/ie/plugin/bho/cookie_accountant.h" | 6 #include "ceee/ie/plugin/bho/cookie_accountant.h" |
| 7 | 7 |
| 8 #include <atlbase.h> | 8 #include <atlbase.h> |
| 9 #include <wininet.h> | 9 #include <wininet.h> |
| 10 | 10 |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 continue; // Skip non-cookie headers. | 215 continue; // Skip non-cookie headers. |
| 216 std::string cookie_data = header_line.substr( | 216 std::string cookie_data = header_line.substr( |
| 217 name_pos + std::string(kSetCookieHeaderName).size()); | 217 name_pos + std::string(kSetCookieHeaderName).size()); |
| 218 // TODO(cindylau@chromium.org): Get the URL for the HTTP request from | 218 // TODO(cindylau@chromium.org): Get the URL for the HTTP request from |
| 219 // IHttpNegotiate::BeginningTransaction. | 219 // IHttpNegotiate::BeginningTransaction. |
| 220 RecordCookie(std::string(), cookie_data, current_time); | 220 RecordCookie(std::string(), cookie_data, current_time); |
| 221 } | 221 } |
| 222 } | 222 } |
| 223 | 223 |
| 224 void CookieAccountant::PatchWininetFunctions() { | 224 void CookieAccountant::PatchWininetFunctions() { |
| 225 { |
| 226 AutoLock lock(lock_); |
| 227 if (patching_wininet_functions_) |
| 228 return; |
| 229 patching_wininet_functions_ = true; |
| 230 } |
| 225 if (!internet_set_cookie_ex_a_patch_.is_patched()) { | 231 if (!internet_set_cookie_ex_a_patch_.is_patched()) { |
| 226 DWORD error = internet_set_cookie_ex_a_patch_.Patch( | 232 DWORD error = internet_set_cookie_ex_a_patch_.Patch( |
| 227 kMsHtmlModuleName, kWinInetModuleName, | 233 kMsHtmlModuleName, kWinInetModuleName, |
| 228 kInternetSetCookieExAFunctionName, InternetSetCookieExAPatch); | 234 kInternetSetCookieExAFunctionName, InternetSetCookieExAPatch); |
| 229 DCHECK(error == NO_ERROR || !internet_set_cookie_ex_a_patch_.is_patched()); | 235 DCHECK(error == NO_ERROR || !internet_set_cookie_ex_a_patch_.is_patched()); |
| 230 } | 236 } |
| 231 if (!internet_set_cookie_ex_w_patch_.is_patched()) { | 237 if (!internet_set_cookie_ex_w_patch_.is_patched()) { |
| 232 DWORD error = internet_set_cookie_ex_w_patch_.Patch( | 238 DWORD error = internet_set_cookie_ex_w_patch_.Patch( |
| 233 kMsHtmlModuleName, kWinInetModuleName, | 239 kMsHtmlModuleName, kWinInetModuleName, |
| 234 kInternetSetCookieExWFunctionName, InternetSetCookieExWPatch); | 240 kInternetSetCookieExWFunctionName, InternetSetCookieExWPatch); |
| 235 DCHECK(error == NO_ERROR || !internet_set_cookie_ex_w_patch_.is_patched()); | 241 DCHECK(error == NO_ERROR || !internet_set_cookie_ex_w_patch_.is_patched()); |
| 236 } | 242 } |
| 237 DCHECK(internet_set_cookie_ex_a_patch_.is_patched() || | 243 DCHECK(internet_set_cookie_ex_a_patch_.is_patched() || |
| 238 internet_set_cookie_ex_w_patch_.is_patched()); | 244 internet_set_cookie_ex_w_patch_.is_patched()); |
| 245 { |
| 246 AutoLock lock(lock_); |
| 247 patching_wininet_functions_ = false; |
| 248 } |
| 239 } | 249 } |
| OLD | NEW |