| 205 | } |
| 206 | |
| 207 | bool CookieManager::DeleteCookie(const std::string& url, |
| 208 | const BrowserCookie& cookie) { |
| 209 | std::wstring wide_url = StringUtilities::ToWString(url); |
| 210 | CComPtr<IUri> uri_pointer; |
| 211 | ::CreateUri(wide_url.c_str(), Uri_CREATE_ALLOW_RELATIVE, 0, &uri_pointer); |
| 212 | |
| 213 | CComBSTR host_bstr; |
| 214 | uri_pointer->GetHost(&host_bstr); |
| 215 | std::wstring wide_domain = host_bstr; |
| 216 | |
| 217 | CComBSTR path_bstr; |
| 218 | uri_pointer->GetPath(&path_bstr); |
| 219 | std::wstring wide_path = path_bstr; |
| 220 | |
| 221 | std::string domain = StringUtilities::ToString(wide_domain); |
| 222 | std::string path = StringUtilities::ToString(wide_path); |
| 223 | |
| 224 | // N.B., We can hard-code the value and expiration time, since |
| 225 | // we are deleting the cookie. So the value will be "deleted", |
| 226 | // and the expiration time will be 1000 milliseconds after the |
| 227 | // zero date (or Thu 1 Jan 1970 00:00:01 GMT). |
| 228 | BrowserCookie recursive_cookie = cookie.Copy(); |
| 229 | recursive_cookie.set_domain(domain); |
| 230 | recursive_cookie.set_path(path); |
| 231 | recursive_cookie.set_value("deleted"); |
| 232 | recursive_cookie.set_expiration_time(1000); |
| 233 | return this->RecursivelyDeleteCookie(url, recursive_cookie); |
| 234 | } |
| 235 | |
| 236 | bool CookieManager::RecursivelyDeleteCookie(const std::string& url, |
| 237 | const BrowserCookie& cookie) { |
no test coverage detected