| LEFT | RIGHT |
| 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-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 */ | 65 */ |
| 66 typedef std::tr1::function<void(JsValueList& params)> EventCallback; | 66 typedef std::tr1::function<void(JsValueList& params)> EventCallback; |
| 67 | 67 |
| 68 /** | 68 /** |
| 69 * Maps events to callback functions. | 69 * Maps events to callback functions. |
| 70 */ | 70 */ |
| 71 typedef std::map<std::string, EventCallback> EventMap; | 71 typedef std::map<std::string, EventCallback> EventMap; |
| 72 | 72 |
| 73 /** | 73 /** |
| 74 * Creates a new JavaScript engine instance. | 74 * Creates a new JavaScript engine instance. |
| 75 * @param appInfo Information about the app, used for update checks. | 75 * @param appInfo Information about the app. |
| 76 * @return New `JsEngine` instance. | 76 * @return New `JsEngine` instance. |
| 77 */ | 77 */ |
| 78 static JsEnginePtr New(const AppInfo& appInfo = AppInfo()); | 78 static JsEnginePtr New(const AppInfo& appInfo = AppInfo()); |
| 79 | 79 |
| 80 /** | 80 /** |
| 81 * Registers the callback function for an event. | 81 * Registers the callback function for an event. |
| 82 * @param eventName Event name. | 82 * @param eventName Event name. Note that this can be any string - it's a |
| 83 * general purpose event handling mechanism. |
| 83 * @param callback Event callback function. | 84 * @param callback Event callback function. |
| 84 */ | 85 */ |
| 85 void SetEventCallback(const std::string& eventName, EventCallback callback); | 86 void SetEventCallback(const std::string& eventName, EventCallback callback); |
| 86 | 87 |
| 87 /** | 88 /** |
| 88 * Removes the callback function for an event. | 89 * Removes the callback function for an event. |
| 89 * @param eventName Event name. | 90 * @param eventName Event name. |
| 90 */ | 91 */ |
| 91 void RemoveEventCallback(const std::string& eventName); | 92 void RemoveEventCallback(const std::string& eventName); |
| 92 | 93 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 FileSystemPtr fileSystem; | 217 FileSystemPtr fileSystem; |
| 217 WebRequestPtr webRequest; | 218 WebRequestPtr webRequest; |
| 218 LogSystemPtr logSystem; | 219 LogSystemPtr logSystem; |
| 219 v8::Isolate* isolate; | 220 v8::Isolate* isolate; |
| 220 V8ValueHolder<v8::Context> context; | 221 V8ValueHolder<v8::Context> context; |
| 221 EventMap eventCallbacks; | 222 EventMap eventCallbacks; |
| 222 }; | 223 }; |
| 223 } | 224 } |
| 224 | 225 |
| 225 #endif | 226 #endif |
| LEFT | RIGHT |