Add support for loading extensions (issue #1947)

- Add CefRequestContext::LoadExtension, CefExtension, CefExtensionHandler and
  related methods/interfaces.
- Add chrome://extensions-support that lists supported Chrome APIs.
- Add CefBrowserHost::SetAutoResizeEnabled and CefDisplayHandler::OnAutoResize
  to support browser resize based on preferred web contents size.
- views: Add support for custom CefMenuButton popups.
- cefclient: Run with `--load-extension=set_page_color` command-line flag for
  an extension loading example. Add `--use-views` on Windows and Linux for an
  even better example.
This commit is contained in:
Marshall Greenblatt
2017-08-03 18:55:19 -04:00
parent 5b12134a45
commit 9cff99dc4e
178 changed files with 10360 additions and 650 deletions

View File

@ -9,12 +9,13 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=1c14ea52e06cca6ef0ad5e82797b9b1cda7141b4$
// $hash=e2d8f32f84e5995d892da25cf13e09c194d5b6a5$
//
#include "libcef_dll/cpptoc/browser_host_cpptoc.h"
#include "libcef_dll/cpptoc/browser_cpptoc.h"
#include "libcef_dll/cpptoc/drag_data_cpptoc.h"
#include "libcef_dll/cpptoc/extension_cpptoc.h"
#include "libcef_dll/cpptoc/navigation_entry_cpptoc.h"
#include "libcef_dll/cpptoc/request_context_cpptoc.h"
#include "libcef_dll/ctocpp/client_ctocpp.h"
@ -1010,6 +1011,66 @@ browser_host_set_accessibility_state(struct _cef_browser_host_t* self,
CefBrowserHostCppToC::Get(self)->SetAccessibilityState(accessibility_state);
}
void CEF_CALLBACK
browser_host_set_auto_resize_enabled(struct _cef_browser_host_t* self,
int enabled,
const cef_size_t* min_size,
const cef_size_t* max_size) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: min_size; type: simple_byref_const
DCHECK(min_size);
if (!min_size)
return;
// Verify param: max_size; type: simple_byref_const
DCHECK(max_size);
if (!max_size)
return;
// Translate param: min_size; type: simple_byref_const
CefSize min_sizeVal = min_size ? *min_size : CefSize();
// Translate param: max_size; type: simple_byref_const
CefSize max_sizeVal = max_size ? *max_size : CefSize();
// Execute
CefBrowserHostCppToC::Get(self)->SetAutoResizeEnabled(
enabled ? true : false, min_sizeVal, max_sizeVal);
}
struct _cef_extension_t* CEF_CALLBACK
browser_host_get_extension(struct _cef_browser_host_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefExtension> _retval =
CefBrowserHostCppToC::Get(self)->GetExtension();
// Return type: refptr_same
return CefExtensionCppToC::Wrap(_retval);
}
int CEF_CALLBACK
browser_host_is_background_host(struct _cef_browser_host_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefBrowserHostCppToC::Get(self)->IsBackgroundHost();
// Return type: bool
return _retval;
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
@ -1077,6 +1138,9 @@ CefBrowserHostCppToC::CefBrowserHostCppToC() {
GetStruct()->get_visible_navigation_entry =
browser_host_get_visible_navigation_entry;
GetStruct()->set_accessibility_state = browser_host_set_accessibility_state;
GetStruct()->set_auto_resize_enabled = browser_host_set_auto_resize_enabled;
GetStruct()->get_extension = browser_host_get_extension;
GetStruct()->is_background_host = browser_host_is_background_host;
}
template <>

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=ae4395cea3553abdea6394d37325c40454505477$
// $hash=b52f437f558356645aaf45ee20cf4f3983e03891$
//
#include "libcef_dll/cpptoc/display_handler_cpptoc.h"
@ -184,6 +184,35 @@ display_handler_on_console_message(struct _cef_display_handler_t* self,
return _retval;
}
int CEF_CALLBACK
display_handler_on_auto_resize(struct _cef_display_handler_t* self,
cef_browser_t* browser,
const cef_size_t* new_size) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return 0;
// Verify param: new_size; type: simple_byref_const
DCHECK(new_size);
if (!new_size)
return 0;
// Translate param: new_size; type: simple_byref_const
CefSize new_sizeVal = new_size ? *new_size : CefSize();
// Execute
bool _retval = CefDisplayHandlerCppToC::Get(self)->OnAutoResize(
CefBrowserCToCpp::Wrap(browser), new_sizeVal);
// Return type: bool
return _retval;
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
@ -197,6 +226,7 @@ CefDisplayHandlerCppToC::CefDisplayHandlerCppToC() {
GetStruct()->on_tooltip = display_handler_on_tooltip;
GetStruct()->on_status_message = display_handler_on_status_message;
GetStruct()->on_console_message = display_handler_on_console_message;
GetStruct()->on_auto_resize = display_handler_on_auto_resize;
}
template <>

View File

@ -0,0 +1,181 @@
// Copyright (c) 2017 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=59b3e055a5cdd19a3af4b3e313f2d7095bd578e5$
//
#include "libcef_dll/cpptoc/extension_cpptoc.h"
#include "libcef_dll/cpptoc/dictionary_value_cpptoc.h"
#include "libcef_dll/cpptoc/request_context_cpptoc.h"
#include "libcef_dll/ctocpp/extension_handler_ctocpp.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
cef_string_userfree_t CEF_CALLBACK
extension_get_identifier(struct _cef_extension_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefExtensionCppToC::Get(self)->GetIdentifier();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK
extension_get_path(struct _cef_extension_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefExtensionCppToC::Get(self)->GetPath();
// Return type: string
return _retval.DetachToUserFree();
}
struct _cef_dictionary_value_t* CEF_CALLBACK
extension_get_manifest(struct _cef_extension_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefDictionaryValue> _retval =
CefExtensionCppToC::Get(self)->GetManifest();
// Return type: refptr_same
return CefDictionaryValueCppToC::Wrap(_retval);
}
int CEF_CALLBACK extension_is_same(struct _cef_extension_t* self,
struct _cef_extension_t* that) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: that; type: refptr_same
DCHECK(that);
if (!that)
return 0;
// Execute
bool _retval =
CefExtensionCppToC::Get(self)->IsSame(CefExtensionCppToC::Unwrap(that));
// Return type: bool
return _retval;
}
struct _cef_extension_handler_t* CEF_CALLBACK
extension_get_handler(struct _cef_extension_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefExtensionHandler> _retval =
CefExtensionCppToC::Get(self)->GetHandler();
// Return type: refptr_diff
return CefExtensionHandlerCToCpp::Unwrap(_retval);
}
struct _cef_request_context_t* CEF_CALLBACK
extension_get_loader_context(struct _cef_extension_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefRequestContext> _retval =
CefExtensionCppToC::Get(self)->GetLoaderContext();
// Return type: refptr_same
return CefRequestContextCppToC::Wrap(_retval);
}
int CEF_CALLBACK extension_is_loaded(struct _cef_extension_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefExtensionCppToC::Get(self)->IsLoaded();
// Return type: bool
return _retval;
}
void CEF_CALLBACK extension_unload(struct _cef_extension_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefExtensionCppToC::Get(self)->Unload();
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefExtensionCppToC::CefExtensionCppToC() {
GetStruct()->get_identifier = extension_get_identifier;
GetStruct()->get_path = extension_get_path;
GetStruct()->get_manifest = extension_get_manifest;
GetStruct()->is_same = extension_is_same;
GetStruct()->get_handler = extension_get_handler;
GetStruct()->get_loader_context = extension_get_loader_context;
GetStruct()->is_loaded = extension_is_loaded;
GetStruct()->unload = extension_unload;
}
template <>
CefRefPtr<CefExtension>
CefCppToCRefCounted<CefExtensionCppToC, CefExtension, cef_extension_t>::
UnwrapDerived(CefWrapperType type, cef_extension_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template <>
base::AtomicRefCount
CefCppToCRefCounted<CefExtensionCppToC, CefExtension, cef_extension_t>::
DebugObjCt ATOMIC_DECLARATION;
#endif
template <>
CefWrapperType CefCppToCRefCounted<CefExtensionCppToC,
CefExtension,
cef_extension_t>::kWrapperType =
WT_EXTENSION;

View File

@ -0,0 +1,40 @@
// Copyright (c) 2017 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=a3c31e0a1f6ee88b5d5f908f95bc326a08baecf1$
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_EXTENSION_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_EXTENSION_CPPTOC_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
#error This file can be included DLL-side only
#endif
#include "include/capi/cef_extension_capi.h"
#include "include/capi/cef_extension_handler_capi.h"
#include "include/capi/cef_request_context_capi.h"
#include "include/cef_extension.h"
#include "include/cef_extension_handler.h"
#include "include/cef_request_context.h"
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefExtensionCppToC : public CefCppToCRefCounted<CefExtensionCppToC,
CefExtension,
cef_extension_t> {
public:
CefExtensionCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_EXTENSION_CPPTOC_H_

View File

@ -0,0 +1,274 @@
// Copyright (c) 2017 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=a4c5733b13d0513946314faf2ac0745c86419df7$
//
#include "libcef_dll/cpptoc/extension_handler_cpptoc.h"
#include "libcef_dll/cpptoc/client_cpptoc.h"
#include "libcef_dll/ctocpp/browser_ctocpp.h"
#include "libcef_dll/ctocpp/extension_ctocpp.h"
#include "libcef_dll/ctocpp/get_extension_resource_callback_ctocpp.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK extension_handler_on_extension_load_failed(
struct _cef_extension_handler_t* self,
cef_errorcode_t result) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefExtensionHandlerCppToC::Get(self)->OnExtensionLoadFailed(result);
}
void CEF_CALLBACK
extension_handler_on_extension_loaded(struct _cef_extension_handler_t* self,
cef_extension_t* extension) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: extension; type: refptr_diff
DCHECK(extension);
if (!extension)
return;
// Execute
CefExtensionHandlerCppToC::Get(self)->OnExtensionLoaded(
CefExtensionCToCpp::Wrap(extension));
}
void CEF_CALLBACK
extension_handler_on_extension_unloaded(struct _cef_extension_handler_t* self,
cef_extension_t* extension) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: extension; type: refptr_diff
DCHECK(extension);
if (!extension)
return;
// Execute
CefExtensionHandlerCppToC::Get(self)->OnExtensionUnloaded(
CefExtensionCToCpp::Wrap(extension));
}
int CEF_CALLBACK extension_handler_on_before_background_browser(
struct _cef_extension_handler_t* self,
cef_extension_t* extension,
const cef_string_t* url,
cef_client_t** client,
struct _cef_browser_settings_t* settings) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: extension; type: refptr_diff
DCHECK(extension);
if (!extension)
return 0;
// Verify param: url; type: string_byref_const
DCHECK(url);
if (!url)
return 0;
// Verify param: client; type: refptr_same_byref
DCHECK(client);
if (!client)
return 0;
// Verify param: settings; type: struct_byref
DCHECK(settings);
if (!settings)
return 0;
// Translate param: client; type: refptr_same_byref
CefRefPtr<CefClient> clientPtr;
if (client && *client)
clientPtr = CefClientCppToC::Unwrap(*client);
CefClient* clientOrig = clientPtr.get();
// Translate param: settings; type: struct_byref
CefBrowserSettings settingsObj;
if (settings)
settingsObj.AttachTo(*settings);
// Execute
bool _retval =
CefExtensionHandlerCppToC::Get(self)->OnBeforeBackgroundBrowser(
CefExtensionCToCpp::Wrap(extension), CefString(url), clientPtr,
settingsObj);
// Restore param: client; type: refptr_same_byref
if (client) {
if (clientPtr.get()) {
if (clientPtr.get() != clientOrig) {
*client = CefClientCppToC::Wrap(clientPtr);
}
} else {
*client = NULL;
}
}
// Restore param: settings; type: struct_byref
if (settings)
settingsObj.DetachTo(*settings);
// Return type: bool
return _retval;
}
cef_browser_t* CEF_CALLBACK
extension_handler_get_active_browser(struct _cef_extension_handler_t* self,
cef_extension_t* extension,
cef_browser_t* browser,
int include_incognito) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Verify param: extension; type: refptr_diff
DCHECK(extension);
if (!extension)
return NULL;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return NULL;
// Execute
CefRefPtr<CefBrowser> _retval =
CefExtensionHandlerCppToC::Get(self)->GetActiveBrowser(
CefExtensionCToCpp::Wrap(extension), CefBrowserCToCpp::Wrap(browser),
include_incognito ? true : false);
// Return type: refptr_diff
return CefBrowserCToCpp::Unwrap(_retval);
}
int CEF_CALLBACK
extension_handler_can_access_browser(struct _cef_extension_handler_t* self,
cef_extension_t* extension,
cef_browser_t* browser,
int include_incognito,
cef_browser_t* target_browser) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: extension; type: refptr_diff
DCHECK(extension);
if (!extension)
return 0;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return 0;
// Verify param: target_browser; type: refptr_diff
DCHECK(target_browser);
if (!target_browser)
return 0;
// Execute
bool _retval = CefExtensionHandlerCppToC::Get(self)->CanAccessBrowser(
CefExtensionCToCpp::Wrap(extension), CefBrowserCToCpp::Wrap(browser),
include_incognito ? true : false, CefBrowserCToCpp::Wrap(target_browser));
// Return type: bool
return _retval;
}
int CEF_CALLBACK extension_handler_get_extension_resource(
struct _cef_extension_handler_t* self,
cef_extension_t* extension,
cef_browser_t* browser,
const cef_string_t* file,
cef_get_extension_resource_callback_t* callback) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: extension; type: refptr_diff
DCHECK(extension);
if (!extension)
return 0;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return 0;
// Verify param: file; type: string_byref_const
DCHECK(file);
if (!file)
return 0;
// Verify param: callback; type: refptr_diff
DCHECK(callback);
if (!callback)
return 0;
// Execute
bool _retval = CefExtensionHandlerCppToC::Get(self)->GetExtensionResource(
CefExtensionCToCpp::Wrap(extension), CefBrowserCToCpp::Wrap(browser),
CefString(file), CefGetExtensionResourceCallbackCToCpp::Wrap(callback));
// Return type: bool
return _retval;
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefExtensionHandlerCppToC::CefExtensionHandlerCppToC() {
GetStruct()->on_extension_load_failed =
extension_handler_on_extension_load_failed;
GetStruct()->on_extension_loaded = extension_handler_on_extension_loaded;
GetStruct()->on_extension_unloaded = extension_handler_on_extension_unloaded;
GetStruct()->on_before_background_browser =
extension_handler_on_before_background_browser;
GetStruct()->get_active_browser = extension_handler_get_active_browser;
GetStruct()->can_access_browser = extension_handler_can_access_browser;
GetStruct()->get_extension_resource =
extension_handler_get_extension_resource;
}
template <>
CefRefPtr<CefExtensionHandler> CefCppToCRefCounted<
CefExtensionHandlerCppToC,
CefExtensionHandler,
cef_extension_handler_t>::UnwrapDerived(CefWrapperType type,
cef_extension_handler_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template <>
base::AtomicRefCount CefCppToCRefCounted<CefExtensionHandlerCppToC,
CefExtensionHandler,
cef_extension_handler_t>::DebugObjCt
ATOMIC_DECLARATION;
#endif
template <>
CefWrapperType CefCppToCRefCounted<CefExtensionHandlerCppToC,
CefExtensionHandler,
cef_extension_handler_t>::kWrapperType =
WT_EXTENSION_HANDLER;

View File

@ -0,0 +1,39 @@
// Copyright (c) 2017 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=a366d32d99f319bec553d0f3cee2c98fd6ab4501$
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_EXTENSION_HANDLER_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_EXTENSION_HANDLER_CPPTOC_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-side only
#endif
#include "include/capi/cef_client_capi.h"
#include "include/capi/cef_extension_handler_capi.h"
#include "include/cef_client.h"
#include "include/cef_extension_handler.h"
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed wrapper-side only.
class CefExtensionHandlerCppToC
: public CefCppToCRefCounted<CefExtensionHandlerCppToC,
CefExtensionHandler,
cef_extension_handler_t> {
public:
CefExtensionHandlerCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_EXTENSION_HANDLER_CPPTOC_H_

View File

@ -0,0 +1,82 @@
// Copyright (c) 2017 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=a14686b53e028382d8dc537009d7a18263f753d6$
//
#include "libcef_dll/cpptoc/get_extension_resource_callback_cpptoc.h"
#include "libcef_dll/cpptoc/stream_reader_cpptoc.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK get_extension_resource_callback_cont(
struct _cef_get_extension_resource_callback_t* self,
struct _cef_stream_reader_t* stream) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Unverified params: stream
// Execute
CefGetExtensionResourceCallbackCppToC::Get(self)->Continue(
CefStreamReaderCppToC::Unwrap(stream));
}
void CEF_CALLBACK get_extension_resource_callback_cancel(
struct _cef_get_extension_resource_callback_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefGetExtensionResourceCallbackCppToC::Get(self)->Cancel();
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefGetExtensionResourceCallbackCppToC::CefGetExtensionResourceCallbackCppToC() {
GetStruct()->cont = get_extension_resource_callback_cont;
GetStruct()->cancel = get_extension_resource_callback_cancel;
}
template <>
CefRefPtr<CefGetExtensionResourceCallback>
CefCppToCRefCounted<CefGetExtensionResourceCallbackCppToC,
CefGetExtensionResourceCallback,
cef_get_extension_resource_callback_t>::
UnwrapDerived(CefWrapperType type,
cef_get_extension_resource_callback_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template <>
base::AtomicRefCount CefCppToCRefCounted<
CefGetExtensionResourceCallbackCppToC,
CefGetExtensionResourceCallback,
cef_get_extension_resource_callback_t>::DebugObjCt ATOMIC_DECLARATION;
#endif
template <>
CefWrapperType
CefCppToCRefCounted<CefGetExtensionResourceCallbackCppToC,
CefGetExtensionResourceCallback,
cef_get_extension_resource_callback_t>::kWrapperType =
WT_GET_EXTENSION_RESOURCE_CALLBACK;

View File

@ -0,0 +1,39 @@
// Copyright (c) 2017 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=f8084e34f58eafa157202cfa06d946b09b18e289$
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_GET_EXTENSION_RESOURCE_CALLBACK_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_GET_EXTENSION_RESOURCE_CALLBACK_CPPTOC_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
#error This file can be included DLL-side only
#endif
#include "include/capi/cef_client_capi.h"
#include "include/capi/cef_extension_handler_capi.h"
#include "include/cef_client.h"
#include "include/cef_extension_handler.h"
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefGetExtensionResourceCallbackCppToC
: public CefCppToCRefCounted<CefGetExtensionResourceCallbackCppToC,
CefGetExtensionResourceCallback,
cef_get_extension_resource_callback_t> {
public:
CefGetExtensionResourceCallbackCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_GET_EXTENSION_RESOURCE_CALLBACK_CPPTOC_H_

View File

@ -9,14 +9,16 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=12152d9a0c2f7acf5c7ac9d0eb2facc83c00d688$
// $hash=a36935b62972aa8bf8d9132a86a3c5f1c37f1d57$
//
#include "libcef_dll/cpptoc/request_context_cpptoc.h"
#include "libcef_dll/cpptoc/cookie_manager_cpptoc.h"
#include "libcef_dll/cpptoc/dictionary_value_cpptoc.h"
#include "libcef_dll/cpptoc/extension_cpptoc.h"
#include "libcef_dll/cpptoc/value_cpptoc.h"
#include "libcef_dll/ctocpp/completion_callback_ctocpp.h"
#include "libcef_dll/ctocpp/extension_handler_ctocpp.h"
#include "libcef_dll/ctocpp/request_context_handler_ctocpp.h"
#include "libcef_dll/ctocpp/resolve_callback_ctocpp.h"
#include "libcef_dll/ctocpp/scheme_handler_factory_ctocpp.h"
@ -444,6 +446,120 @@ request_context_resolve_host_cached(struct _cef_request_context_t* self,
return _retval;
}
void CEF_CALLBACK
request_context_load_extension(struct _cef_request_context_t* self,
const cef_string_t* root_directory,
struct _cef_dictionary_value_t* manifest,
cef_extension_handler_t* handler) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: root_directory; type: string_byref_const
DCHECK(root_directory);
if (!root_directory)
return;
// Unverified params: manifest, handler
// Execute
CefRequestContextCppToC::Get(self)->LoadExtension(
CefString(root_directory), CefDictionaryValueCppToC::Unwrap(manifest),
CefExtensionHandlerCToCpp::Wrap(handler));
}
int CEF_CALLBACK
request_context_did_load_extension(struct _cef_request_context_t* self,
const cef_string_t* extension_id) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: extension_id; type: string_byref_const
DCHECK(extension_id);
if (!extension_id)
return 0;
// Execute
bool _retval = CefRequestContextCppToC::Get(self)->DidLoadExtension(
CefString(extension_id));
// Return type: bool
return _retval;
}
int CEF_CALLBACK
request_context_has_extension(struct _cef_request_context_t* self,
const cef_string_t* extension_id) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: extension_id; type: string_byref_const
DCHECK(extension_id);
if (!extension_id)
return 0;
// Execute
bool _retval =
CefRequestContextCppToC::Get(self)->HasExtension(CefString(extension_id));
// Return type: bool
return _retval;
}
int CEF_CALLBACK
request_context_get_extensions(struct _cef_request_context_t* self,
cef_string_list_t extension_ids) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: extension_ids; type: string_vec_byref
DCHECK(extension_ids);
if (!extension_ids)
return 0;
// Translate param: extension_ids; type: string_vec_byref
std::vector<CefString> extension_idsList;
transfer_string_list_contents(extension_ids, extension_idsList);
// Execute
bool _retval =
CefRequestContextCppToC::Get(self)->GetExtensions(extension_idsList);
// Restore param: extension_ids; type: string_vec_byref
cef_string_list_clear(extension_ids);
transfer_string_list_contents(extension_idsList, extension_ids);
// Return type: bool
return _retval;
}
cef_extension_t* CEF_CALLBACK
request_context_get_extension(struct _cef_request_context_t* self,
const cef_string_t* extension_id) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Verify param: extension_id; type: string_byref_const
DCHECK(extension_id);
if (!extension_id)
return NULL;
// Execute
CefRefPtr<CefExtension> _retval =
CefRequestContextCppToC::Get(self)->GetExtension(CefString(extension_id));
// Return type: refptr_same
return CefExtensionCppToC::Wrap(_retval);
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
@ -472,6 +588,11 @@ CefRequestContextCppToC::CefRequestContextCppToC() {
GetStruct()->close_all_connections = request_context_close_all_connections;
GetStruct()->resolve_host = request_context_resolve_host;
GetStruct()->resolve_host_cached = request_context_resolve_host_cached;
GetStruct()->load_extension = request_context_load_extension;
GetStruct()->did_load_extension = request_context_did_load_extension;
GetStruct()->has_extension = request_context_has_extension;
GetStruct()->get_extensions = request_context_get_extensions;
GetStruct()->get_extension = request_context_get_extension;
}
template <>

View File

@ -9,17 +9,36 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=9f8701b130114d4d36b9df1045dc65b899f7141c$
// $hash=fef1959b9f8b96573de134769406f9eed4eeefc5$
//
#include "libcef_dll/cpptoc/request_context_handler_cpptoc.h"
#include "libcef_dll/ctocpp/cookie_manager_ctocpp.h"
#include "libcef_dll/ctocpp/request_context_ctocpp.h"
#include "libcef_dll/ctocpp/web_plugin_info_ctocpp.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK request_context_handler_on_request_context_initialized(
struct _cef_request_context_handler_t* self,
cef_request_context_t* request_context) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: request_context; type: refptr_diff
DCHECK(request_context);
if (!request_context)
return;
// Execute
CefRequestContextHandlerCppToC::Get(self)->OnRequestContextInitialized(
CefRequestContextCToCpp::Wrap(request_context));
}
cef_cookie_manager_t* CEF_CALLBACK request_context_handler_get_cookie_manager(
struct _cef_request_context_handler_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -78,6 +97,8 @@ int CEF_CALLBACK request_context_handler_on_before_plugin_load(
// CONSTRUCTOR - Do not edit by hand.
CefRequestContextHandlerCppToC::CefRequestContextHandlerCppToC() {
GetStruct()->on_request_context_initialized =
request_context_handler_on_request_context_initialized;
GetStruct()->get_cookie_manager = request_context_handler_get_cookie_manager;
GetStruct()->on_before_plugin_load =
request_context_handler_on_before_plugin_load;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=2ccdc811cf83c44925c3600c0dda1e98b869690f$
// $hash=265d7e41e1c27a09d82000c236e264bad092eabd$
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_REQUEST_CONTEXT_HANDLER_CPPTOC_H_
@ -20,7 +20,9 @@
#error This file can be included wrapper-side only
#endif
#include "include/capi/cef_request_context_capi.h"
#include "include/capi/cef_request_context_handler_capi.h"
#include "include/cef_request_context.h"
#include "include/cef_request_context_handler.h"
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"

View File

@ -9,12 +9,13 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=782642e65456b32ab0fab59db2b9442783b7f574$
// $hash=ce23c8ba14803b0a15b9b2899632f2c03d6b3a97$
//
#include "libcef_dll/cpptoc/views/menu_button_delegate_cpptoc.h"
#include "libcef_dll/ctocpp/views/button_ctocpp.h"
#include "libcef_dll/ctocpp/views/menu_button_ctocpp.h"
#include "libcef_dll/ctocpp/views/menu_button_pressed_lock_ctocpp.h"
#include "libcef_dll/ctocpp/views/view_ctocpp.h"
namespace {
@ -24,7 +25,8 @@ namespace {
void CEF_CALLBACK menu_button_delegate_on_menu_button_pressed(
struct _cef_menu_button_delegate_t* self,
cef_menu_button_t* menu_button,
const cef_point_t* screen_point) {
const cef_point_t* screen_point,
cef_menu_button_pressed_lock_t* button_pressed_lock) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -38,13 +40,18 @@ void CEF_CALLBACK menu_button_delegate_on_menu_button_pressed(
DCHECK(screen_point);
if (!screen_point)
return;
// Verify param: button_pressed_lock; type: refptr_diff
DCHECK(button_pressed_lock);
if (!button_pressed_lock)
return;
// Translate param: screen_point; type: simple_byref_const
CefPoint screen_pointVal = screen_point ? *screen_point : CefPoint();
// Execute
CefMenuButtonDelegateCppToC::Get(self)->OnMenuButtonPressed(
CefMenuButtonCToCpp::Wrap(menu_button), screen_pointVal);
CefMenuButtonCToCpp::Wrap(menu_button), screen_pointVal,
CefMenuButtonPressedLockCToCpp::Wrap(button_pressed_lock));
}
void CEF_CALLBACK

View File

@ -0,0 +1,44 @@
// Copyright (c) 2017 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=dffd7542aef11aa1adb55bd8c5dd6c29081f5caf$
//
#include "libcef_dll/cpptoc/views/menu_button_pressed_lock_cpptoc.h"
// CONSTRUCTOR - Do not edit by hand.
CefMenuButtonPressedLockCppToC::CefMenuButtonPressedLockCppToC() {}
template <>
CefRefPtr<CefMenuButtonPressedLock>
CefCppToCRefCounted<CefMenuButtonPressedLockCppToC,
CefMenuButtonPressedLock,
cef_menu_button_pressed_lock_t>::
UnwrapDerived(CefWrapperType type, cef_menu_button_pressed_lock_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template <>
base::AtomicRefCount CefCppToCRefCounted<
CefMenuButtonPressedLockCppToC,
CefMenuButtonPressedLock,
cef_menu_button_pressed_lock_t>::DebugObjCt ATOMIC_DECLARATION;
#endif
template <>
CefWrapperType
CefCppToCRefCounted<CefMenuButtonPressedLockCppToC,
CefMenuButtonPressedLock,
cef_menu_button_pressed_lock_t>::kWrapperType =
WT_MENU_BUTTON_PRESSED_LOCK;

View File

@ -0,0 +1,39 @@
// Copyright (c) 2017 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=5b9354b2db247aaa4a3a6623ebdcb97aef98d0b7$
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_VIEWS_MENU_BUTTON_PRESSED_LOCK_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_VIEWS_MENU_BUTTON_PRESSED_LOCK_CPPTOC_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
#error This file can be included DLL-side only
#endif
#include "include/capi/views/cef_menu_button_capi.h"
#include "include/capi/views/cef_menu_button_delegate_capi.h"
#include "include/views/cef_menu_button.h"
#include "include/views/cef_menu_button_delegate.h"
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefMenuButtonPressedLockCppToC
: public CefCppToCRefCounted<CefMenuButtonPressedLockCppToC,
CefMenuButtonPressedLock,
cef_menu_button_pressed_lock_t> {
public:
CefMenuButtonPressedLockCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_VIEWS_MENU_BUTTON_PRESSED_LOCK_CPPTOC_H_

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=9cf5d66da05ef9e423995bc8f527ef1315812134$
// $hash=80a92fb23bc01d46903ea4e2076950a4ffe07b18$
//
#include "libcef_dll/cpptoc/views/window_delegate_cpptoc.h"
@ -56,6 +56,51 @@ window_delegate_on_window_destroyed(struct _cef_window_delegate_t* self,
CefWindowCToCpp::Wrap(window));
}
cef_window_t* CEF_CALLBACK
window_delegate_get_parent_window(struct _cef_window_delegate_t* self,
cef_window_t* window,
int* is_menu,
int* can_activate_menu) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Verify param: window; type: refptr_diff
DCHECK(window);
if (!window)
return NULL;
// Verify param: is_menu; type: bool_byaddr
DCHECK(is_menu);
if (!is_menu)
return NULL;
// Verify param: can_activate_menu; type: bool_byaddr
DCHECK(can_activate_menu);
if (!can_activate_menu)
return NULL;
// Translate param: is_menu; type: bool_byaddr
bool is_menuBool = (is_menu && *is_menu) ? true : false;
// Translate param: can_activate_menu; type: bool_byaddr
bool can_activate_menuBool =
(can_activate_menu && *can_activate_menu) ? true : false;
// Execute
CefRefPtr<CefWindow> _retval =
CefWindowDelegateCppToC::Get(self)->GetParentWindow(
CefWindowCToCpp::Wrap(window), &is_menuBool, &can_activate_menuBool);
// Restore param: is_menu; type: bool_byaddr
if (is_menu)
*is_menu = is_menuBool ? true : false;
// Restore param: can_activate_menu; type: bool_byaddr
if (can_activate_menu)
*can_activate_menu = can_activate_menuBool ? true : false;
// Return type: refptr_diff
return CefWindowCToCpp::Unwrap(_retval);
}
int CEF_CALLBACK
window_delegate_is_frameless(struct _cef_window_delegate_t* self,
cef_window_t* window) {
@ -392,6 +437,7 @@ void CEF_CALLBACK window_delegate_on_blur(struct _cef_view_delegate_t* self,
CefWindowDelegateCppToC::CefWindowDelegateCppToC() {
GetStruct()->on_window_created = window_delegate_on_window_created;
GetStruct()->on_window_destroyed = window_delegate_on_window_destroyed;
GetStruct()->get_parent_window = window_delegate_get_parent_window;
GetStruct()->is_frameless = window_delegate_is_frameless;
GetStruct()->can_resize = window_delegate_can_resize;
GetStruct()->can_maximize = window_delegate_can_maximize;