Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: src/engine/NotificationWindow.cpp

Issue 6567422169448448: Issue 119 - Switch to injecting CSS for element hiding (Closed)
Left Patch Set: rebase and address comments Created April 13, 2015, 8:04 a.m.
Right Patch Set: rename OnQuit Created Sept. 30, 2016, 3:25 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « dependencies ('k') | src/plugin/AdblockPlusClient.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 const std::wstring filePath = htmlFileDir + L"NotificationWindow.html"; 119 const std::wstring filePath = htmlFileDir + L"NotificationWindow.html";
120 std::wifstream ifs(filePath); 120 std::wifstream ifs(filePath);
121 assert(ifs.good() && "Cannot open NotificationWindow.html file"); 121 assert(ifs.good() && "Cannot open NotificationWindow.html file");
122 if (!ifs.good()) 122 if (!ifs.good())
123 { 123 {
124 throw std::runtime_error("Cannot read NotificationWindow.html"); 124 throw std::runtime_error("Cannot read NotificationWindow.html");
125 } 125 }
126 m_htmlPage.assign((std::istreambuf_iterator<wchar_t>(ifs)), std::istreambuf_it erator<wchar_t>()); 126 m_htmlPage.assign((std::istreambuf_iterator<wchar_t>(ifs)), std::istreambuf_it erator<wchar_t>());
127 127
128 m_links = ToUtf16Strings(notification.GetLinks()); 128 m_links = ToUtf16Strings(notification.GetLinks());
129 auto body = ToUtf16String(notification.GetMessageString()); 129 auto body = ToUtf16String(notification.GetTexts().message);
130 uint32_t linkIDCounter = 0; 130 uint32_t linkIDCounter = 0;
131 body = ReplaceMulti(body, L"<a>", [this, &linkIDCounter]()->std::wstring 131 body = ReplaceMulti(body, L"<a>", [this, &linkIDCounter]()->std::wstring
132 { 132 {
133 return L"<a href=\"#\" data-linkID=\"" + std::to_wstring(linkIDCounter++) + L"\">"; 133 return L"<a href=\"#\" data-linkID=\"" + std::to_wstring(linkIDCounter++) + L"\">";
134 }); 134 });
135 assert(linkIDCounter == m_links.size() && "The amount of links in the text is different from the amount of provided links"); 135 assert(linkIDCounter == m_links.size() && "The amount of links in the text is different from the amount of provided links");
136 m_htmlPage = ReplaceMulti(m_htmlPage, L"<!--Title-->", ToUtf16String(notificat ion.GetTitle())); 136 m_htmlPage = ReplaceMulti(m_htmlPage, L"<!--Title-->", ToUtf16String(notificat ion.GetTexts().title));
137 m_htmlPage = ReplaceMulti(m_htmlPage, L"<!--Body-->", body); 137 m_htmlPage = ReplaceMulti(m_htmlPage, L"<!--Body-->", body);
138 } 138 }
139 139
140 NotificationWindow::~NotificationWindow() 140 NotificationWindow::~NotificationWindow()
141 { 141 {
142 } 142 }
143 143
144 LRESULT NotificationWindow::OnCreate(const CREATESTRUCT* /*createStruct*/) { 144 LRESULT NotificationWindow::OnCreate(const CREATESTRUCT* /*createStruct*/) {
145 { 145 {
146 DCHandle hdc(GetDC()); 146 DCHandle hdc(GetDC());
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld