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

Delta Between Two Patch Sets: src/FilterEngine.cpp

Issue 11018003: Filter changed callback (Closed)
Left Patch Set: Filter changed callback Created July 19, 2013, 8:33 a.m.
Right Patch Set: Filter changed callback Created July 22, 2013, 9:16 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « libadblockplus.gyp ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 void FilterEngine::UpdateCheckDone(const std::string& eventName, FilterEngine::U pdaterCallback callback, JsValueList& params) 273 void FilterEngine::UpdateCheckDone(const std::string& eventName, FilterEngine::U pdaterCallback callback, JsValueList& params)
274 { 274 {
275 jsEngine->RemoveEventCallback(eventName); 275 jsEngine->RemoveEventCallback(eventName);
276 276
277 std::string error(params.size() >= 1 && !params[0]->IsNull() ? params[0]->AsSt ring() : ""); 277 std::string error(params.size() >= 1 && !params[0]->IsNull() ? params[0]->AsSt ring() : "");
278 callback(error); 278 callback(error);
279 } 279 }
280 280
281 void FilterEngine::SetFilterChangeCallback(FilterEngine::FilterChangeCallback ca llback) 281 void FilterEngine::SetFilterChangeCallback(FilterEngine::FilterChangeCallback ca llback)
282 { 282 {
283 jsEngine->SetEventCallback(eventName, std::tr1::bind(&FilterEngine::FilterChan ged, 283 jsEngine->SetEventCallback("filterChange", std::tr1::bind(&FilterEngine::Filte rChanged,
284 this, "filterChange", callback, std::tr1::placeholders::_1)); 284 this, callback, std::tr1::placeholders::_1));
Wladimir Palant 2013/07/19 09:37:57 Still not point passing "filterChange" to the call
285 } 285 }
286 286
287 void FilterEngine::RemoveFilterChangeCallback() 287 void FilterEngine::RemoveFilterChangeCallback()
288 { 288 {
289 jsEngine->RemoveEventCallback(eventName); 289 jsEngine->RemoveEventCallback("filterChange");
Wladimir Palant 2013/07/19 09:37:57 Does this even compile with the eventName variable
290 } 290 }
291 291
292 void FilterEngine::FilterChanged(const std::string& eventName, FilterEngine::Fil terChangeCallback callback, JsValueList& params) 292 void FilterEngine::FilterChanged(FilterEngine::FilterChangeCallback callback, Js ValueList& params)
293 { 293 {
294 std::string action(params.size() >= 1 && !params[0]->IsNull() ? params[0]->AsS tring() : ""); 294 std::string action(params.size() >= 1 && !params[0]->IsNull() ? params[0]->AsS tring() : "");
295 std::string url(params.size() >= 2 && !params[1]->IsNull() ? params[1]->AsStri ng() : ""); 295 JsValuePtr item(params.size() >= 2 ? params[1] : jsEngine->NewValue(false));
Wladimir Palant 2013/07/19 09:37:57 Please keep the second parameter generic, somethin
296 callback(action, url); 296 callback(action, item);
297 } 297 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld