mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2024-12-11 09:08:06 +01:00
e411b513be
See the new cef_frame_handler.h for complete usage documentation. This change includes the following related enhancements: - The newly added CefBrowser::IsValid method will return false (in the browser process) after CefLifeSpanHandler::OnBeforeClose is called. - CefBrowser::GetMainFrame will return a valid object (in the browser process) until after CefLifeSpanHandler::OnBeforeClose is called. - The main frame object will change during cross-origin navigation or re-navigation after renderer process termination. During that time, GetMainFrame will return the new/pending frame (in the browser process) and any messages that arrive for the new/pending frame will be correctly attributed in OnProcessMessageReceived. - Commands to be executed in the renderer process that may fail during early frame initialization (ExecuteJavaScript, LoadRequest, etc.) will now be queued until after the JavaScript context for the frame has been created. - Logging has been added for any commands that are dropped because they arrived after frame detachment.
146 lines
4.6 KiB
C++
146 lines
4.6 KiB
C++
// Copyright (c) 2021 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.
|
|
//
|
|
// ---------------------------------------------------------------------------
|
|
//
|
|
// This file was generated by the CEF translator tool. If making changes by
|
|
// hand only do so within the body of existing method and function
|
|
// implementations. See the translator.README.txt file in the tools directory
|
|
// for more information.
|
|
//
|
|
// $hash=1b752686dc1743bed6957503b1cd6999f9a2a4f1$
|
|
//
|
|
|
|
#include "libcef_dll/ctocpp/frame_handler_ctocpp.h"
|
|
#include "libcef_dll/cpptoc/browser_cpptoc.h"
|
|
#include "libcef_dll/cpptoc/frame_cpptoc.h"
|
|
#include "libcef_dll/shutdown_checker.h"
|
|
|
|
// VIRTUAL METHODS - Body may be edited by hand.
|
|
|
|
NO_SANITIZE("cfi-icall")
|
|
void CefFrameHandlerCToCpp::OnFrameCreated(CefRefPtr<CefBrowser> browser,
|
|
CefRefPtr<CefFrame> frame) {
|
|
shutdown_checker::AssertNotShutdown();
|
|
|
|
cef_frame_handler_t* _struct = GetStruct();
|
|
if (CEF_MEMBER_MISSING(_struct, on_frame_created))
|
|
return;
|
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
// Verify param: browser; type: refptr_diff
|
|
DCHECK(browser.get());
|
|
if (!browser.get())
|
|
return;
|
|
// Verify param: frame; type: refptr_diff
|
|
DCHECK(frame.get());
|
|
if (!frame.get())
|
|
return;
|
|
|
|
// Execute
|
|
_struct->on_frame_created(_struct, CefBrowserCppToC::Wrap(browser),
|
|
CefFrameCppToC::Wrap(frame));
|
|
}
|
|
|
|
NO_SANITIZE("cfi-icall")
|
|
void CefFrameHandlerCToCpp::OnFrameAttached(CefRefPtr<CefBrowser> browser,
|
|
CefRefPtr<CefFrame> frame) {
|
|
shutdown_checker::AssertNotShutdown();
|
|
|
|
cef_frame_handler_t* _struct = GetStruct();
|
|
if (CEF_MEMBER_MISSING(_struct, on_frame_attached))
|
|
return;
|
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
// Verify param: browser; type: refptr_diff
|
|
DCHECK(browser.get());
|
|
if (!browser.get())
|
|
return;
|
|
// Verify param: frame; type: refptr_diff
|
|
DCHECK(frame.get());
|
|
if (!frame.get())
|
|
return;
|
|
|
|
// Execute
|
|
_struct->on_frame_attached(_struct, CefBrowserCppToC::Wrap(browser),
|
|
CefFrameCppToC::Wrap(frame));
|
|
}
|
|
|
|
NO_SANITIZE("cfi-icall")
|
|
void CefFrameHandlerCToCpp::OnFrameDetached(CefRefPtr<CefBrowser> browser,
|
|
CefRefPtr<CefFrame> frame) {
|
|
shutdown_checker::AssertNotShutdown();
|
|
|
|
cef_frame_handler_t* _struct = GetStruct();
|
|
if (CEF_MEMBER_MISSING(_struct, on_frame_detached))
|
|
return;
|
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
// Verify param: browser; type: refptr_diff
|
|
DCHECK(browser.get());
|
|
if (!browser.get())
|
|
return;
|
|
// Verify param: frame; type: refptr_diff
|
|
DCHECK(frame.get());
|
|
if (!frame.get())
|
|
return;
|
|
|
|
// Execute
|
|
_struct->on_frame_detached(_struct, CefBrowserCppToC::Wrap(browser),
|
|
CefFrameCppToC::Wrap(frame));
|
|
}
|
|
|
|
NO_SANITIZE("cfi-icall")
|
|
void CefFrameHandlerCToCpp::OnMainFrameChanged(CefRefPtr<CefBrowser> browser,
|
|
CefRefPtr<CefFrame> old_frame,
|
|
CefRefPtr<CefFrame> new_frame) {
|
|
shutdown_checker::AssertNotShutdown();
|
|
|
|
cef_frame_handler_t* _struct = GetStruct();
|
|
if (CEF_MEMBER_MISSING(_struct, on_main_frame_changed))
|
|
return;
|
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
// Verify param: browser; type: refptr_diff
|
|
DCHECK(browser.get());
|
|
if (!browser.get())
|
|
return;
|
|
// Unverified params: old_frame, new_frame
|
|
|
|
// Execute
|
|
_struct->on_main_frame_changed(_struct, CefBrowserCppToC::Wrap(browser),
|
|
CefFrameCppToC::Wrap(old_frame),
|
|
CefFrameCppToC::Wrap(new_frame));
|
|
}
|
|
|
|
// CONSTRUCTOR - Do not edit by hand.
|
|
|
|
CefFrameHandlerCToCpp::CefFrameHandlerCToCpp() {}
|
|
|
|
// DESTRUCTOR - Do not edit by hand.
|
|
|
|
CefFrameHandlerCToCpp::~CefFrameHandlerCToCpp() {
|
|
shutdown_checker::AssertNotShutdown();
|
|
}
|
|
|
|
template <>
|
|
cef_frame_handler_t*
|
|
CefCToCppRefCounted<CefFrameHandlerCToCpp,
|
|
CefFrameHandler,
|
|
cef_frame_handler_t>::UnwrapDerived(CefWrapperType type,
|
|
CefFrameHandler* c) {
|
|
NOTREACHED() << "Unexpected class type: " << type;
|
|
return nullptr;
|
|
}
|
|
|
|
template <>
|
|
CefWrapperType CefCToCppRefCounted<CefFrameHandlerCToCpp,
|
|
CefFrameHandler,
|
|
cef_frame_handler_t>::kWrapperType =
|
|
WT_FRAME_HANDLER;
|