cef/libcef_dll/ctocpp/handler_ctocpp.h

98 lines
5.0 KiB
C
Raw Normal View History

// Copyright (c) 2009 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.
#ifndef _HANDLER_CTOCPP_H
#define _HANDLER_CTOCPP_H
#ifndef BUILDING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
#else // BUILDING_CEF_SHARED
#include "cef.h"
#include "cef_capi.h"
#include "ctocpp.h"
// Wrap a C handler structure with a C++ handler class.
// This class may be instantiated and accessed DLL-side only.
class CefHandlerCToCpp
: public CefCToCpp<CefHandlerCToCpp, CefHandler, cef_handler_t>
{
public:
CefHandlerCToCpp(cef_handler_t* str)
: CefCToCpp<CefHandlerCToCpp, CefHandler, cef_handler_t>(str) {}
virtual ~CefHandlerCToCpp() {}
// CefHandler methods
virtual RetVal HandleBeforeCreated(CefRefPtr<CefBrowser> parentBrowser,
CefWindowInfo& windowInfo, bool popup,
CefRefPtr<CefHandler>& handler,
std::wstring& url);
virtual RetVal HandleAfterCreated(CefRefPtr<CefBrowser> browser);
virtual RetVal HandleAddressChange(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const std::wstring& url);
virtual RetVal HandleTitleChange(CefRefPtr<CefBrowser> browser,
const std::wstring& title);
virtual RetVal HandleBeforeBrowse(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
NavType navType, bool isRedirect);
virtual RetVal HandleLoadStart(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame);
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame);
virtual RetVal HandleLoadError(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
ErrorCode errorCode,
const std::wstring& failedUrl,
std::wstring& errorText);
virtual RetVal HandleBeforeResourceLoad(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefRequest> request,
std::wstring& redirectUrl,
CefRefPtr<CefStreamReader>& resourceStream,
std::wstring& mimeType,
int loadFlags);
virtual RetVal HandleBeforeMenu(CefRefPtr<CefBrowser> browser,
const MenuInfo& menuInfo);
virtual RetVal HandleGetMenuLabel(CefRefPtr<CefBrowser> browser,
MenuId menuId, std::wstring& label);
virtual RetVal HandleMenuAction(CefRefPtr<CefBrowser> browser,
MenuId menuId);
virtual RetVal HandlePrintHeaderFooter(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefPrintInfo& printInfo,
const std::wstring& url,
const std::wstring& title,
int currentPage, int maxPages,
std::wstring& topLeft,
std::wstring& topCenter,
std::wstring& topRight,
std::wstring& bottomLeft,
std::wstring& bottomCenter,
std::wstring& bottomRight);
virtual RetVal HandleJSAlert(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const std::wstring& message);
virtual RetVal HandleJSConfirm(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const std::wstring& message, bool& retval);
virtual RetVal HandleJSPrompt(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const std::wstring& message,
const std::wstring& default_value,
bool& retval,
std::wstring& result);
virtual RetVal HandleBeforeWindowClose(CefRefPtr<CefBrowser> browser);
virtual RetVal HandleTakeFocus(CefRefPtr<CefBrowser> browser,
bool reverse);
virtual RetVal HandleJSBinding(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefV8Value> object);
};
#endif // BUILDING_CEF_SHARED
#endif // _HANDLER_CTOCPP_H