eric6/WebBrowser/AdBlock/AdBlockUrlInterceptor.py

Wed, 30 Dec 2020 11:00:44 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 30 Dec 2020 11:00:44 +0100
branch
maintenance
changeset 7924
8a96736d465e
parent 7781
607a6098cb44
child 8218
7c09585bd960
permissions
-rw-r--r--

Updated copyright for 2021.

# -*- coding: utf-8 -*-

# Copyright (c) 2016 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing an URL interceptor base class.
"""

from ..Network.UrlInterceptor import UrlInterceptor


class AdBlockUrlInterceptor(UrlInterceptor):
    """
    Class implementing an URL interceptor for AdBlock.
    """
    def __init__(self, manager, parent=None):
        """
        Constructor
        
        @param manager reference to the AdBlock manager
        @type AdBlockManager
        @param parent referemce to the parent object
        @type QObject
        """
        super(AdBlockUrlInterceptor, self).__init__(parent)
        
        self.__manager = manager
    
    def interceptRequest(self, info):
        """
        Public method to intercept a request.
        
        @param info request info object
        @type QWebEngineUrlRequestInfo
        """
        if self.__manager.block(info):
            info.block(True)

eric ide

mercurial