1 //****************************************************************************** 2 // Copyright (c) 2005-2013 by Jan Van hijfte 3 // 4 // See the included file COPYING.TXT for details about the copyright. 5 // 6 // This program is distributed in the hope that it will be useful, 7 // but WITHOUT ANY WARRANTY; without even the implied warranty of 8 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9 //****************************************************************************** 10 11 12 #ifndef QWEBENGINEPAGE_HOOK_H 13 #define QWEBENGINEPAGE_HOOK_H 14 15 #include <qwebenginepage.h> 16 17 #include "qobject_hook.h" 18 19 class QWebEnginePage_hook : public QObject_hook { 20 Q_OBJECT 21 public: QWebEnginePage_hook(QObject * handle)22 QWebEnginePage_hook(QObject *handle) : QObject_hook(handle) { 23 loadStarted_event.func = NULL; 24 loadProgress_event.func = NULL; 25 loadFinished_event.func = NULL; 26 linkHovered_event.func = NULL; 27 /*statusBarMessage_event.func = NULL;*/ 28 selectionChanged_event.func = NULL; 29 /*frameCreated_event.func = NULL;*/ 30 geometryChangeRequested_event.func = NULL; 31 /*repaintRequested_event.func = NULL;*/ 32 /*scrollRequested_event.func = NULL;*/ 33 windowCloseRequested_event.func = NULL; 34 /*printRequested_event.func = NULL;*/ 35 /*linkClicked_event.func = NULL;*/ 36 /*toolBarVisibilityChangeRequested_event.func = NULL; 37 statusBarVisibilityChangeRequested_event.func = NULL; 38 menuBarVisibilityChangeRequested_event.func = NULL;*/ 39 /*unsupportedContent_event.func = NULL; 40 downloadRequested_event.func = NULL; 41 microFocusChanged_event.func = NULL;*/ 42 contentsChanged_event.func = NULL; 43 /*databaseQuotaExceeded_event.func = NULL; 44 applicationCacheQuotaExceeded_event.func = NULL; 45 saveFrameStateRequested_event.func = NULL; 46 restoreFrameStateRequested_event.func = NULL; 47 viewportChangeRequested_event.func = NULL;*/ 48 featurePermissionRequested_event.func = NULL; 49 featurePermissionRequestCanceled_event.func = NULL; 50 } hook_loadStarted(QHook & hook)51 void hook_loadStarted(QHook &hook) { 52 if ( !loadStarted_event.func ) 53 connect(handle, SIGNAL(loadStarted()), this, SLOT(loadStarted_hook())); 54 loadStarted_event = hook; 55 if ( !hook.func ) 56 disconnect(handle, SIGNAL(loadStarted()), this, SLOT(loadStarted_hook())); 57 } hook_loadProgress(QHook & hook)58 void hook_loadProgress(QHook &hook) { 59 if ( !loadProgress_event.func ) 60 connect(handle, SIGNAL(loadProgress(int)), this, SLOT(loadProgress_hook(int))); 61 loadProgress_event = hook; 62 if ( !hook.func ) 63 disconnect(handle, SIGNAL(loadProgress(int)), this, SLOT(loadProgress_hook(int))); 64 } hook_loadFinished(QHook & hook)65 void hook_loadFinished(QHook &hook) { 66 if ( !loadFinished_event.func ) 67 connect(handle, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished_hook(bool))); 68 loadFinished_event = hook; 69 if ( !hook.func ) 70 disconnect(handle, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished_hook(bool))); 71 } hook_linkHovered(QHook & hook)72 void hook_linkHovered(QHook &hook) { 73 if ( !linkHovered_event.func ) 74 connect(handle, SIGNAL(linkHovered(const QString&, const QString&, const QString&)), this, SLOT(linkHovered_hook(const QString&, const QString&, const QString&))); 75 linkHovered_event = hook; 76 if ( !hook.func ) 77 disconnect(handle, SIGNAL(linkHovered(const QString&, const QString&, const QString&)), this, SLOT(linkHovered_hook(const QString&, const QString&, const QString&))); 78 } 79 /* 80 void hook_statusBarMessage(QHook &hook) { 81 if ( !statusBarMessage_event.func ) 82 connect(handle, SIGNAL(statusBarMessage(const QString&)), this, SLOT(statusBarMessage_hook(const QString&))); 83 statusBarMessage_event = hook; 84 if ( !hook.func ) 85 disconnect(handle, SIGNAL(statusBarMessage(const QString&)), this, SLOT(statusBarMessage_hook(const QString&))); 86 }*/ hook_selectionChanged(QHook & hook)87 void hook_selectionChanged(QHook &hook) { 88 if ( !selectionChanged_event.func ) 89 connect(handle, SIGNAL(selectionChanged()), this, SLOT(selectionChanged_hook())); 90 selectionChanged_event = hook; 91 if ( !hook.func ) 92 disconnect(handle, SIGNAL(selectionChanged()), this, SLOT(selectionChanged_hook())); 93 } 94 /* 95 void hook_frameCreated(QHook &hook) { 96 if ( !frameCreated_event.func ) 97 connect(handle, SIGNAL(frameCreated(QWebFrame*)), this, SLOT(frameCreated_hook(QWebFrame*))); 98 frameCreated_event = hook; 99 if ( !hook.func ) 100 disconnect(handle, SIGNAL(frameCreated(QWebFrame*)), this, SLOT(frameCreated_hook(QWebFrame*))); 101 }*/ hook_geometryChangeRequested(QHook & hook)102 void hook_geometryChangeRequested(QHook &hook) { 103 if ( !geometryChangeRequested_event.func ) 104 connect(handle, SIGNAL(geometryChangeRequested(const QRect&)), this, SLOT(geometryChangeRequested_hook(const QRect&))); 105 geometryChangeRequested_event = hook; 106 if ( !hook.func ) 107 disconnect(handle, SIGNAL(geometryChangeRequested(const QRect&)), this, SLOT(geometryChangeRequested_hook(const QRect&))); 108 } 109 /* 110 void hook_repaintRequested(QHook &hook) { 111 if ( !repaintRequested_event.func ) 112 connect(handle, SIGNAL(repaintRequested(const QRect&)), this, SLOT(repaintRequested_hook(const QRect&))); 113 repaintRequested_event = hook; 114 if ( !hook.func ) 115 disconnect(handle, SIGNAL(repaintRequested(const QRect&)), this, SLOT(repaintRequested_hook(const QRect&))); 116 } 117 void hook_scrollRequested(QHook &hook) { 118 if ( !scrollRequested_event.func ) 119 connect(handle, SIGNAL(scrollRequested(int, int, const QRect&)), this, SLOT(scrollRequested_hook(int, int, const QRect&))); 120 scrollRequested_event = hook; 121 if ( !hook.func ) 122 disconnect(handle, SIGNAL(scrollRequested(int, int, const QRect&)), this, SLOT(scrollRequested_hook(int, int, const QRect&))); 123 }*/ hook_windowCloseRequested(QHook & hook)124 void hook_windowCloseRequested(QHook &hook) { 125 if ( !windowCloseRequested_event.func ) 126 connect(handle, SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested_hook())); 127 windowCloseRequested_event = hook; 128 if ( !hook.func ) 129 disconnect(handle, SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested_hook())); 130 } 131 /* 132 void hook_printRequested(QHook &hook) { 133 if ( !printRequested_event.func ) 134 connect(handle, SIGNAL(printRequested(QWebFrame*)), this, SLOT(printRequested_hook(QWebFrame*))); 135 printRequested_event = hook; 136 if ( !hook.func ) 137 disconnect(handle, SIGNAL(printRequested(QWebFrame*)), this, SLOT(printRequested_hook(QWebFrame*))); 138 } 139 void hook_linkClicked(QHook &hook) { 140 if ( !linkClicked_event.func ) 141 connect(handle, SIGNAL(linkClicked(const QUrl&)), this, SLOT(linkClicked_hook(const QUrl&))); 142 linkClicked_event = hook; 143 if ( !hook.func ) 144 disconnect(handle, SIGNAL(linkClicked(const QUrl&)), this, SLOT(linkClicked_hook(const QUrl&))); 145 } 146 void hook_toolBarVisibilityChangeRequested(QHook &hook) { 147 if ( !toolBarVisibilityChangeRequested_event.func ) 148 connect(handle, SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SLOT(toolBarVisibilityChangeRequested_hook(bool))); 149 toolBarVisibilityChangeRequested_event = hook; 150 if ( !hook.func ) 151 disconnect(handle, SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SLOT(toolBarVisibilityChangeRequested_hook(bool))); 152 } 153 void hook_statusBarVisibilityChangeRequested(QHook &hook) { 154 if ( !statusBarVisibilityChangeRequested_event.func ) 155 connect(handle, SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SLOT(statusBarVisibilityChangeRequested_hook(bool))); 156 statusBarVisibilityChangeRequested_event = hook; 157 if ( !hook.func ) 158 disconnect(handle, SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SLOT(statusBarVisibilityChangeRequested_hook(bool))); 159 } 160 void hook_menuBarVisibilityChangeRequested(QHook &hook) { 161 if ( !menuBarVisibilityChangeRequested_event.func ) 162 connect(handle, SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SLOT(menuBarVisibilityChangeRequested_hook(bool))); 163 menuBarVisibilityChangeRequested_event = hook; 164 if ( !hook.func ) 165 disconnect(handle, SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SLOT(menuBarVisibilityChangeRequested_hook(bool))); 166 } 167 void hook_unsupportedContent(QHook &hook) { 168 if ( !unsupportedContent_event.func ) 169 connect(handle, SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(unsupportedContent_hook(QNetworkReply*))); 170 unsupportedContent_event = hook; 171 if ( !hook.func ) 172 disconnect(handle, SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(unsupportedContent_hook(QNetworkReply*))); 173 } 174 void hook_downloadRequested(QHook &hook) { 175 if ( !downloadRequested_event.func ) 176 connect(handle, SIGNAL(downloadRequested(const QNetworkRequest&)), this, SLOT(downloadRequested_hook(const QNetworkRequest&))); 177 downloadRequested_event = hook; 178 if ( !hook.func ) 179 disconnect(handle, SIGNAL(downloadRequested(const QNetworkRequest&)), this, SLOT(downloadRequested_hook(const QNetworkRequest&))); 180 } 181 void hook_microFocusChanged(QHook &hook) { 182 if ( !microFocusChanged_event.func ) 183 connect(handle, SIGNAL(microFocusChanged()), this, SLOT(microFocusChanged_hook())); 184 microFocusChanged_event = hook; 185 if ( !hook.func ) 186 disconnect(handle, SIGNAL(microFocusChanged()), this, SLOT(microFocusChanged_hook())); 187 }*/ hook_contentsChanged(QHook & hook)188 void hook_contentsChanged(QHook &hook) { 189 if ( !contentsChanged_event.func ) 190 connect(handle, SIGNAL(contentsChanged()), this, SLOT(contentsChanged_hook())); 191 contentsChanged_event = hook; 192 if ( !hook.func ) 193 disconnect(handle, SIGNAL(contentsChanged()), this, SLOT(contentsChanged_hook())); 194 } 195 /* 196 void hook_databaseQuotaExceeded(QHook &hook) { 197 if ( !databaseQuotaExceeded_event.func ) 198 connect(handle, SIGNAL(databaseQuotaExceeded(QWebFrame*, QString)), this, SLOT(databaseQuotaExceeded_hook(QWebFrame*, QString))); 199 databaseQuotaExceeded_event = hook; 200 if ( !hook.func ) 201 disconnect(handle, SIGNAL(databaseQuotaExceeded(QWebFrame*, QString)), this, SLOT(databaseQuotaExceeded_hook(QWebFrame*, QString))); 202 } 203 void hook_applicationCacheQuotaExceeded(QHook &hook) { 204 if ( !applicationCacheQuotaExceeded_event.func ) 205 connect(handle, SIGNAL(applicationCacheQuotaExceeded(QWebSecurityOrigin*, quint64, quint64)), this, SLOT(applicationCacheQuotaExceeded_hook(QWebSecurityOrigin*, quint64, quint64))); 206 applicationCacheQuotaExceeded_event = hook; 207 if ( !hook.func ) 208 disconnect(handle, SIGNAL(applicationCacheQuotaExceeded(QWebSecurityOrigin*, quint64, quint64)), this, SLOT(applicationCacheQuotaExceeded_hook(QWebSecurityOrigin*, quint64, quint64))); 209 } 210 void hook_saveFrameStateRequested(QHook &hook) { 211 if ( !saveFrameStateRequested_event.func ) 212 connect(handle, SIGNAL(saveFrameStateRequested(QWebFrame*, QWebHistoryItem*)), this, SLOT(saveFrameStateRequested_hook(QWebFrame*, QWebHistoryItem*))); 213 saveFrameStateRequested_event = hook; 214 if ( !hook.func ) 215 disconnect(handle, SIGNAL(saveFrameStateRequested(QWebFrame*, QWebHistoryItem*)), this, SLOT(saveFrameStateRequested_hook(QWebFrame*, QWebHistoryItem*))); 216 } 217 void hook_restoreFrameStateRequested(QHook &hook) { 218 if ( !restoreFrameStateRequested_event.func ) 219 connect(handle, SIGNAL(restoreFrameStateRequested(QWebFrame*)), this, SLOT(restoreFrameStateRequested_hook(QWebFrame*))); 220 restoreFrameStateRequested_event = hook; 221 if ( !hook.func ) 222 disconnect(handle, SIGNAL(restoreFrameStateRequested(QWebFrame*)), this, SLOT(restoreFrameStateRequested_hook(QWebFrame*))); 223 } 224 void hook_viewportChangeRequested(QHook &hook) { 225 if ( !viewportChangeRequested_event.func ) 226 connect(handle, SIGNAL(viewportChangeRequested()), this, SLOT(viewportChangeRequested_hook())); 227 viewportChangeRequested_event = hook; 228 if ( !hook.func ) 229 disconnect(handle, SIGNAL(viewportChangeRequested()), this, SLOT(viewportChangeRequested_hook())); 230 }*/ hook_featurePermissionRequested(QHook & hook)231 void hook_featurePermissionRequested(QHook &hook) { 232 if ( !featurePermissionRequested_event.func ) 233 connect(handle, SIGNAL(featurePermissionRequested(QWebFrame*, QWebEnginePage::Feature)), this, SLOT(featurePermissionRequested_hook(QWebFrame*, QWebEnginePage::Feature))); 234 featurePermissionRequested_event = hook; 235 if ( !hook.func ) 236 disconnect(handle, SIGNAL(featurePermissionRequested(QWebFrame*, QWebEnginePage::Feature)), this, SLOT(featurePermissionRequested_hook(QWebFrame*, QWebEnginePage::Feature))); 237 } hook_featurePermissionRequestCanceled(QHook & hook)238 void hook_featurePermissionRequestCanceled(QHook &hook) { 239 if ( !featurePermissionRequestCanceled_event.func ) 240 connect(handle, SIGNAL(featurePermissionRequestCanceled(QWebFrame*, QWebEnginePage::Feature)), this, SLOT(featurePermissionRequestCanceled_hook(QWebFrame*, QWebEnginePage::Feature))); 241 featurePermissionRequestCanceled_event = hook; 242 if ( !hook.func ) 243 disconnect(handle, SIGNAL(featurePermissionRequestCanceled(QWebFrame*, QWebEnginePage::Feature)), this, SLOT(featurePermissionRequestCanceled_hook(QWebFrame*, QWebEnginePage::Feature))); 244 } 245 246 private slots: loadStarted_hook()247 void loadStarted_hook() { 248 if ( loadStarted_event.func ) { 249 typedef void (*func_type)(void *data); 250 (*(func_type)loadStarted_event.func)(loadStarted_event.data); 251 } 252 } loadProgress_hook(int progress)253 void loadProgress_hook(int progress) { 254 if ( loadProgress_event.func ) { 255 typedef void (*func_type)(void *data, int progress); 256 (*(func_type)loadProgress_event.func)(loadProgress_event.data, progress); 257 } 258 } loadFinished_hook(bool ok)259 void loadFinished_hook(bool ok) { 260 if ( loadFinished_event.func ) { 261 typedef void (*func_type)(void *data, bool ok); 262 (*(func_type)loadFinished_event.func)(loadFinished_event.data, ok); 263 } 264 } linkHovered_hook(const QString & link,const QString & title,const QString & textContent)265 void linkHovered_hook(const QString& link, const QString& title, const QString& textContent) { 266 if ( linkHovered_event.func ) { 267 typedef void (*func_type)(void *data, PWideString link, PWideString title, PWideString textContent); 268 PWideString t_link; 269 PWideString t_title; 270 PWideString t_textContent; 271 initializePWideString(t_link); 272 initializePWideString(t_title); 273 initializePWideString(t_textContent); 274 copyQStringToPWideString(link, t_link); 275 copyQStringToPWideString(title, t_title); 276 copyQStringToPWideString(textContent, t_textContent); 277 (*(func_type)linkHovered_event.func)(linkHovered_event.data, t_link, t_title, t_textContent); 278 finalizePWideString(t_link); 279 finalizePWideString(t_title); 280 finalizePWideString(t_textContent); 281 } 282 } 283 /* 284 void statusBarMessage_hook(const QString& text) { 285 if ( statusBarMessage_event.func ) { 286 typedef void (*func_type)(void *data, PWideString text); 287 PWideString t_text; 288 initializePWideString(t_text); 289 copyQStringToPWideString(text, t_text); 290 (*(func_type)statusBarMessage_event.func)(statusBarMessage_event.data, t_text); 291 finalizePWideString(t_text); 292 } 293 }*/ selectionChanged_hook()294 void selectionChanged_hook() { 295 if ( selectionChanged_event.func ) { 296 typedef void (*func_type)(void *data); 297 (*(func_type)selectionChanged_event.func)(selectionChanged_event.data); 298 } 299 } 300 /* 301 void frameCreated_hook(QWebFrame* frame) { 302 if ( frameCreated_event.func ) { 303 typedef void (*func_type)(void *data, QWebFrameH frame); 304 (*(func_type)frameCreated_event.func)(frameCreated_event.data, (QWebFrameH)frame); 305 } 306 }*/ geometryChangeRequested_hook(const QRect & geom)307 void geometryChangeRequested_hook(const QRect& geom) { 308 if ( geometryChangeRequested_event.func ) { 309 typedef void (*func_type)(void *data, PRect geom); 310 PRect t_geom; 311 copyQRectToPRect(geom, t_geom); 312 (*(func_type)geometryChangeRequested_event.func)(geometryChangeRequested_event.data, t_geom); 313 } 314 } 315 /* 316 void repaintRequested_hook(const QRect& dirtyRect) { 317 if ( repaintRequested_event.func ) { 318 typedef void (*func_type)(void *data, PRect dirtyRect); 319 PRect t_dirtyRect; 320 copyQRectToPRect(dirtyRect, t_dirtyRect); 321 (*(func_type)repaintRequested_event.func)(repaintRequested_event.data, t_dirtyRect); 322 } 323 } 324 void scrollRequested_hook(int dx, int dy, const QRect& scrollViewRect) { 325 if ( scrollRequested_event.func ) { 326 typedef void (*func_type)(void *data, int dx, int dy, PRect scrollViewRect); 327 PRect t_scrollViewRect; 328 copyQRectToPRect(scrollViewRect, t_scrollViewRect); 329 (*(func_type)scrollRequested_event.func)(scrollRequested_event.data, dx, dy, t_scrollViewRect); 330 } 331 }*/ windowCloseRequested_hook()332 void windowCloseRequested_hook() { 333 if ( windowCloseRequested_event.func ) { 334 typedef void (*func_type)(void *data); 335 (*(func_type)windowCloseRequested_event.func)(windowCloseRequested_event.data); 336 } 337 } 338 /* 339 void printRequested_hook(QWebFrame* frame) { 340 if ( printRequested_event.func ) { 341 typedef void (*func_type)(void *data, QWebFrameH frame); 342 (*(func_type)printRequested_event.func)(printRequested_event.data, (QWebFrameH)frame); 343 } 344 } 345 void linkClicked_hook(const QUrl& url) { 346 if ( linkClicked_event.func ) { 347 typedef void (*func_type)(void *data, const QUrlH url); 348 (*(func_type)linkClicked_event.func)(linkClicked_event.data, (const QUrlH)&url); 349 } 350 } 351 void toolBarVisibilityChangeRequested_hook(bool visible) { 352 if ( toolBarVisibilityChangeRequested_event.func ) { 353 typedef void (*func_type)(void *data, bool visible); 354 (*(func_type)toolBarVisibilityChangeRequested_event.func)(toolBarVisibilityChangeRequested_event.data, visible); 355 } 356 } 357 void statusBarVisibilityChangeRequested_hook(bool visible) { 358 if ( statusBarVisibilityChangeRequested_event.func ) { 359 typedef void (*func_type)(void *data, bool visible); 360 (*(func_type)statusBarVisibilityChangeRequested_event.func)(statusBarVisibilityChangeRequested_event.data, visible); 361 } 362 } 363 void menuBarVisibilityChangeRequested_hook(bool visible) { 364 if ( menuBarVisibilityChangeRequested_event.func ) { 365 typedef void (*func_type)(void *data, bool visible); 366 (*(func_type)menuBarVisibilityChangeRequested_event.func)(menuBarVisibilityChangeRequested_event.data, visible); 367 } 368 } 369 void unsupportedContent_hook(QNetworkReply* reply) { 370 if ( unsupportedContent_event.func ) { 371 typedef void (*func_type)(void *data, QNetworkReplyH reply); 372 (*(func_type)unsupportedContent_event.func)(unsupportedContent_event.data, (QNetworkReplyH)reply); 373 } 374 } 375 void downloadRequested_hook(const QNetworkRequest& request) { 376 if ( downloadRequested_event.func ) { 377 typedef void (*func_type)(void *data, const QNetworkRequestH request); 378 (*(func_type)downloadRequested_event.func)(downloadRequested_event.data, (const QNetworkRequestH)&request); 379 } 380 } 381 void microFocusChanged_hook() { 382 if ( microFocusChanged_event.func ) { 383 typedef void (*func_type)(void *data); 384 (*(func_type)microFocusChanged_event.func)(microFocusChanged_event.data); 385 } 386 }*/ contentsChanged_hook()387 void contentsChanged_hook() { 388 if ( contentsChanged_event.func ) { 389 typedef void (*func_type)(void *data); 390 (*(func_type)contentsChanged_event.func)(contentsChanged_event.data); 391 } 392 } 393 /* 394 void databaseQuotaExceeded_hook(QWebFrame* frame, QString databaseName) { 395 if ( databaseQuotaExceeded_event.func ) { 396 typedef void (*func_type)(void *data, QWebFrameH frame, PWideString databaseName); 397 PWideString t_databaseName; 398 initializePWideString(t_databaseName); 399 copyQStringToPWideString(databaseName, t_databaseName); 400 (*(func_type)databaseQuotaExceeded_event.func)(databaseQuotaExceeded_event.data, (QWebFrameH)frame, t_databaseName); 401 finalizePWideString(t_databaseName); 402 } 403 } 404 void applicationCacheQuotaExceeded_hook(QWebSecurityOrigin* origin, quint64 defaultOriginQuota, quint64 totalSpaceNeeded) { 405 if ( applicationCacheQuotaExceeded_event.func ) { 406 typedef void (*func_type)(void *data, QWebSecurityOriginH origin, quint64 defaultOriginQuota, quint64 totalSpaceNeeded); 407 (*(func_type)applicationCacheQuotaExceeded_event.func)(applicationCacheQuotaExceeded_event.data, (QWebSecurityOriginH)origin, defaultOriginQuota, totalSpaceNeeded); 408 } 409 } 410 void saveFrameStateRequested_hook(QWebFrame* frame, QWebHistoryItem* item) { 411 if ( saveFrameStateRequested_event.func ) { 412 typedef void (*func_type)(void *data, QWebFrameH frame, QWebHistoryItemH item); 413 (*(func_type)saveFrameStateRequested_event.func)(saveFrameStateRequested_event.data, (QWebFrameH)frame, (QWebHistoryItemH)item); 414 } 415 } 416 void restoreFrameStateRequested_hook(QWebFrame* frame) { 417 if ( restoreFrameStateRequested_event.func ) { 418 typedef void (*func_type)(void *data, QWebFrameH frame); 419 (*(func_type)restoreFrameStateRequested_event.func)(restoreFrameStateRequested_event.data, (QWebFrameH)frame); 420 } 421 } 422 void viewportChangeRequested_hook() { 423 if ( viewportChangeRequested_event.func ) { 424 typedef void (*func_type)(void *data); 425 (*(func_type)viewportChangeRequested_event.func)(viewportChangeRequested_event.data); 426 } 427 }*/ featurePermissionRequested_hook(QWebFrame * frame,QWebEnginePage::Feature feature)428 void featurePermissionRequested_hook(QWebFrame* frame, QWebEnginePage::Feature feature) { 429 if ( featurePermissionRequested_event.func ) { 430 typedef void (*func_type)(void *data, QWebFrameH frame, QWebEnginePage::Feature feature); 431 (*(func_type)featurePermissionRequested_event.func)(featurePermissionRequested_event.data, (QWebFrameH)frame, feature); 432 } 433 } featurePermissionRequestCanceled_hook(QWebFrame * frame,QWebEnginePage::Feature feature)434 void featurePermissionRequestCanceled_hook(QWebFrame* frame, QWebEnginePage::Feature feature) { 435 if ( featurePermissionRequestCanceled_event.func ) { 436 typedef void (*func_type)(void *data, QWebFrameH frame, QWebEnginePage::Feature feature); 437 (*(func_type)featurePermissionRequestCanceled_event.func)(featurePermissionRequestCanceled_event.data, (QWebFrameH)frame, feature); 438 } 439 } 440 private: 441 QHook loadStarted_event; 442 QHook loadProgress_event; 443 QHook loadFinished_event; 444 QHook linkHovered_event; 445 /*QHook statusBarMessage_event;*/ 446 QHook selectionChanged_event; 447 /*QHook frameCreated_event;*/ 448 QHook geometryChangeRequested_event; 449 /*QHook repaintRequested_event; 450 QHook scrollRequested_event;*/ 451 QHook windowCloseRequested_event; 452 /*QHook printRequested_event; 453 QHook linkClicked_event; 454 QHook toolBarVisibilityChangeRequested_event; 455 QHook statusBarVisibilityChangeRequested_event; 456 QHook menuBarVisibilityChangeRequested_event; 457 QHook unsupportedContent_event; 458 QHook downloadRequested_event; 459 QHook microFocusChanged_event;*/ 460 QHook contentsChanged_event; 461 /*QHook databaseQuotaExceeded_event; 462 QHook applicationCacheQuotaExceeded_event; 463 QHook saveFrameStateRequested_event; 464 QHook restoreFrameStateRequested_event; 465 QHook viewportChangeRequested_event;*/ 466 QHook featurePermissionRequested_event; 467 QHook featurePermissionRequestCanceled_event; 468 }; 469 470 471 #endif 472