| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 ATL::CComPtr<IHTMLElement> htmlElement; | 224 ATL::CComPtr<IHTMLElement> htmlElement; |
| 225 if (FAILED(eventObject->get_srcElement(&htmlElement)) || !htmlElement) { | 225 if (FAILED(eventObject->get_srcElement(&htmlElement)) || !htmlElement) { |
| 226 return; | 226 return; |
| 227 } | 227 } |
| 228 ATL::CComBSTR tag; | 228 ATL::CComBSTR tag; |
| 229 htmlElement->get_tagName(&tag); | 229 htmlElement->get_tagName(&tag); |
| 230 const wchar_t expectedTag[] = { L"a" }; | 230 const wchar_t expectedTag[] = { L"a" }; |
| 231 if (_wcsnicmp(tag, expectedTag, min(sizeof(expectedTag), tag.Length())) != 0)
{ | 231 if (_wcsnicmp(tag, expectedTag, min(sizeof(expectedTag), tag.Length())) != 0)
{ |
| 232 return; | 232 return; |
| 233 } | 233 } |
| 234 auto classAttr = GetHtmlElementAttribute(*htmlElement, ATL::CComBSTR(L"class")
); | 234 auto classAttr = GetHtmlElementAttribute(*htmlElement, L"class"); |
| 235 if (classAttr.attributeValue == L"closeButton") | 235 if (classAttr.attributeValue == L"closeButton") |
| 236 { | 236 { |
| 237 if (m_onCloseCallback) | 237 if (m_onCloseCallback) |
| 238 m_onCloseCallback(); | 238 m_onCloseCallback(); |
| 239 return; | 239 return; |
| 240 } | 240 } |
| 241 if (!m_onLinkClickedCallback) | 241 if (!m_onLinkClickedCallback) |
| 242 { | 242 { |
| 243 return; | 243 return; |
| 244 } | 244 } |
| 245 auto linkIDAttr = GetHtmlElementAttribute(*htmlElement, ATL::CComBSTR(L"data-l
inkID")); | 245 auto linkIDAttr = GetHtmlElementAttribute(*htmlElement, L"data-linkID"); |
| 246 uint32_t linkID = 0; | 246 uint32_t linkID = 0; |
| 247 if (!linkIDAttr.attributeValue.empty() && (linkID = std::stoi(linkIDAttr.attri
buteValue)) < m_links.size()) | 247 if (!linkIDAttr.attributeValue.empty() && (linkID = std::stoi(linkIDAttr.attri
buteValue)) < m_links.size()) |
| 248 { | 248 { |
| 249 m_onLinkClickedCallback(m_links[linkID]); | 249 m_onLinkClickedCallback(m_links[linkID]); |
| 250 if (m_onCloseCallback) | 250 if (m_onCloseCallback) |
| 251 m_onCloseCallback(); | 251 m_onCloseCallback(); |
| 252 } | 252 } |
| 253 } | 253 } |
| 254 | 254 |
| 255 void __stdcall NotificationWindow::OnHTMLDocumentSelectStart(IHTMLEventObj* even
tObject) | 255 void __stdcall NotificationWindow::OnHTMLDocumentSelectStart(IHTMLEventObj* even
tObject) |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 { | 362 { |
| 363 DestroyWindow(); | 363 DestroyWindow(); |
| 364 return 0; | 364 return 0; |
| 365 } | 365 } |
| 366 | 366 |
| 367 void NotificationBorderWindow::OnFinalMessage(HWND) { | 367 void NotificationBorderWindow::OnFinalMessage(HWND) { |
| 368 if (!!m_onDestroyedCallback) { | 368 if (!!m_onDestroyedCallback) { |
| 369 m_onDestroyedCallback(); | 369 m_onDestroyedCallback(); |
| 370 } | 370 } |
| 371 } | 371 } |
| OLD | NEW |