Пример #1
0
        private Page(Session client, Target target, FrameTree frameTree, bool ignoreHTTPSErrors, TaskQueue screenshotTaskQueue)
        {
            _client           = client;
            _target           = target;
            Keyboard          = new Keyboard(client);
            _mouse            = new Mouse(client, Keyboard);
            Touchscreen       = new Touchscreen(client, Keyboard);
            _frameManager     = new FrameManager(client, frameTree, this);
            _networkManager   = new NetworkManager(client);
            _emulationManager = new EmulationManager(client);
            Tracing           = new Tracing(client);
            _pageBindings     = new Dictionary <string, Func <object> >();

            _ignoreHTTPSErrors = ignoreHTTPSErrors;

            _screenshotTaskQueue = screenshotTaskQueue;

            //TODO: Do we need this bubble?
            _frameManager.FrameAttached  += (sender, e) => FrameAttached?.Invoke(this, e);
            _frameManager.FrameDetached  += (sender, e) => FrameDetached?.Invoke(this, e);
            _frameManager.FrameNavigated += (sender, e) => FrameNavigated?.Invoke(this, e);

            _networkManager.RequestCreated  += (sender, e) => RequestCreated?.Invoke(this, e);
            _networkManager.RequestFailed   += (sender, e) => RequestFailed?.Invoke(this, e);
            _networkManager.ResponseCreated += (sender, e) => ResponseCreated?.Invoke(this, e);
            _networkManager.RequestFinished += (sender, e) => RequestFinished?.Invoke(this, e);

            _client.MessageReceived += client_MessageReceived;
        }