2014-01-28 00:31:03 +01:00
|
|
|
// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
|
|
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
|
|
// can be found in the LICENSE file.
|
|
|
|
|
2020-08-20 00:23:42 +02:00
|
|
|
#ifndef CEF_TESTS_CEFTESTS_ROUTING_TEST_HANDLER_H_
|
|
|
|
#define CEF_TESTS_CEFTESTS_ROUTING_TEST_HANDLER_H_
|
2014-01-28 00:31:03 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "include/wrapper/cef_message_router.h"
|
2016-11-18 18:31:21 +01:00
|
|
|
#include "tests/ceftests/test_handler.h"
|
2014-01-28 00:31:03 +01:00
|
|
|
|
|
|
|
// Extends TestHandler to provide message routing functionality. The
|
|
|
|
// RoutingTestHandler implementation must be called from subclass
|
|
|
|
// overrides unless otherwise indicated.
|
2017-05-17 11:29:28 +02:00
|
|
|
class RoutingTestHandler : public TestHandler,
|
|
|
|
public CefMessageRouterBrowserSide::Handler {
|
2014-01-28 00:31:03 +01:00
|
|
|
public:
|
2021-05-21 03:42:58 +02:00
|
|
|
RoutingTestHandler(CompletionState* completion_state = nullptr);
|
2014-01-28 00:31:03 +01:00
|
|
|
|
2014-11-12 20:25:15 +01:00
|
|
|
void OnAfterCreated(CefRefPtr<CefBrowser> browser) override;
|
|
|
|
void OnBeforeClose(CefRefPtr<CefBrowser> browser) override;
|
2017-05-17 11:29:28 +02:00
|
|
|
void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
|
|
|
TerminationStatus status) override;
|
2014-01-28 00:31:03 +01:00
|
|
|
|
|
|
|
// Only call this method if the navigation isn't canceled.
|
2014-11-12 20:25:15 +01:00
|
|
|
bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefFrame> frame,
|
|
|
|
CefRefPtr<CefRequest> request,
|
2018-04-27 17:11:53 +02:00
|
|
|
bool user_gesture,
|
2017-05-17 11:29:28 +02:00
|
|
|
bool is_redirect) override;
|
2014-01-28 00:31:03 +01:00
|
|
|
|
|
|
|
// Returns true if the router handled the navigation.
|
2017-05-17 11:29:28 +02:00
|
|
|
bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
|
2019-05-24 22:23:43 +02:00
|
|
|
CefRefPtr<CefFrame> frame,
|
2017-05-17 11:29:28 +02:00
|
|
|
CefProcessId source_process,
|
|
|
|
CefRefPtr<CefProcessMessage> message) override;
|
2014-01-28 00:31:03 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
CefRefPtr<CefMessageRouterBrowserSide> message_router_;
|
|
|
|
};
|
|
|
|
|
2020-08-20 00:23:42 +02:00
|
|
|
#endif // CEF_TESTS_CEFTESTS_ROUTING_TEST_HANDLER_H_
|