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 26 matching lines...) Expand all Loading... |
37 CookieAccountant::~CookieAccountant() { | 37 CookieAccountant::~CookieAccountant() { |
38 if (internet_set_cookie_ex_a_patch_.is_patched()) | 38 if (internet_set_cookie_ex_a_patch_.is_patched()) |
39 internet_set_cookie_ex_a_patch_.Unpatch(); | 39 internet_set_cookie_ex_a_patch_.Unpatch(); |
40 if (internet_set_cookie_ex_w_patch_.is_patched()) | 40 if (internet_set_cookie_ex_w_patch_.is_patched()) |
41 internet_set_cookie_ex_w_patch_.Unpatch(); | 41 internet_set_cookie_ex_w_patch_.Unpatch(); |
42 } | 42 } |
43 | 43 |
44 ProductionCookieAccountant::ProductionCookieAccountant() { | 44 ProductionCookieAccountant::ProductionCookieAccountant() { |
45 } | 45 } |
46 | 46 |
| 47 // static |
| 48 ProductionCookieAccountant* ProductionCookieAccountant::GetInstance() { |
| 49 return Singleton<ProductionCookieAccountant>::get(); |
| 50 } |
| 51 |
47 CookieAccountant* CookieAccountant::GetInstance() { | 52 CookieAccountant* CookieAccountant::GetInstance() { |
48 // Unit tests can set singleton_instance_ directly. | 53 // Unit tests can set singleton_instance_ directly. |
49 if (singleton_instance_ == NULL) | 54 if (singleton_instance_ == NULL) |
50 singleton_instance_ = ProductionCookieAccountant::get(); | 55 singleton_instance_ = ProductionCookieAccountant::GetInstance(); |
51 return singleton_instance_; | 56 return singleton_instance_; |
52 } | 57 } |
53 | 58 |
54 DWORD WINAPI CookieAccountant::InternetSetCookieExAPatch( | 59 DWORD WINAPI CookieAccountant::InternetSetCookieExAPatch( |
55 LPCSTR url, LPCSTR cookie_name, LPCSTR cookie_data, | 60 LPCSTR url, LPCSTR cookie_name, LPCSTR cookie_data, |
56 DWORD flags, DWORD_PTR reserved) { | 61 DWORD flags, DWORD_PTR reserved) { |
57 base::Time current_time = base::Time::Now(); | 62 base::Time current_time = base::Time::Now(); |
58 DWORD cookie_state = ::InternetSetCookieExA(url, cookie_name, cookie_data, | 63 DWORD cookie_state = ::InternetSetCookieExA(url, cookie_name, cookie_data, |
59 flags, reserved); | 64 flags, reserved); |
60 CookieAccountant::GetInstance()->RecordCookie(url, cookie_data, | 65 CookieAccountant::GetInstance()->RecordCookie(url, cookie_data, |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 kInternetSetCookieExWFunctionName, InternetSetCookieExWPatch); | 245 kInternetSetCookieExWFunctionName, InternetSetCookieExWPatch); |
241 DCHECK(error == NO_ERROR || !internet_set_cookie_ex_w_patch_.is_patched()); | 246 DCHECK(error == NO_ERROR || !internet_set_cookie_ex_w_patch_.is_patched()); |
242 } | 247 } |
243 DCHECK(internet_set_cookie_ex_a_patch_.is_patched() || | 248 DCHECK(internet_set_cookie_ex_a_patch_.is_patched() || |
244 internet_set_cookie_ex_w_patch_.is_patched()); | 249 internet_set_cookie_ex_w_patch_.is_patched()); |
245 { | 250 { |
246 AutoLock lock(lock_); | 251 AutoLock lock(lock_); |
247 patching_wininet_functions_ = false; | 252 patching_wininet_functions_ = false; |
248 } | 253 } |
249 } | 254 } |
OLD | NEW |