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,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=aff3b781529dd68e4a26208c7ab116e8ecd8cca5$
// $hash=068f8e238672b955b7f648002c80e364e24a936a$
//
#include "libcef_dll/ctocpp/browser_host_ctocpp.h"
@ -20,6 +20,7 @@
#include "libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.h"
#include "libcef_dll/ctocpp/browser_ctocpp.h"
#include "libcef_dll/ctocpp/drag_data_ctocpp.h"
#include "libcef_dll/ctocpp/extension_ctocpp.h"
#include "libcef_dll/ctocpp/navigation_entry_ctocpp.h"
#include "libcef_dll/ctocpp/request_context_ctocpp.h"
#include "libcef_dll/transfer_util.h"
@ -820,6 +821,47 @@ void CefBrowserHostCToCpp::SetAccessibilityState(
_struct->set_accessibility_state(_struct, accessibility_state);
}
void CefBrowserHostCToCpp::SetAutoResizeEnabled(bool enabled,
const CefSize& min_size,
const CefSize& max_size) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_auto_resize_enabled))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_auto_resize_enabled(_struct, enabled, &min_size, &max_size);
}
CefRefPtr<CefExtension> CefBrowserHostCToCpp::GetExtension() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_extension))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_extension_t* _retval = _struct->get_extension(_struct);
// Return type: refptr_same
return CefExtensionCToCpp::Wrap(_retval);
}
bool CefBrowserHostCToCpp::IsBackgroundHost() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_background_host))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->is_background_host(_struct);
// Return type: bool
return _retval ? true : false;
}
// CONSTRUCTOR - Do not edit by hand.
CefBrowserHostCToCpp::CefBrowserHostCToCpp() {}

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=589466ca4bd3e901d903764a71a4e8b1ee10003f$
// $hash=2e9c65525e5d95bd4293d0529b0ff302cf96ed12$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_BROWSER_HOST_CTOCPP_H_
@ -120,6 +120,11 @@ class CefBrowserHostCToCpp : public CefCToCppRefCounted<CefBrowserHostCToCpp,
void DragSourceSystemDragEnded() OVERRIDE;
CefRefPtr<CefNavigationEntry> GetVisibleNavigationEntry() OVERRIDE;
void SetAccessibilityState(cef_state_t accessibility_state) OVERRIDE;
void SetAutoResizeEnabled(bool enabled,
const CefSize& min_size,
const CefSize& max_size) OVERRIDE;
CefRefPtr<CefExtension> GetExtension() OVERRIDE;
bool IsBackgroundHost() OVERRIDE;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_BROWSER_HOST_CTOCPP_H_

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=3326b8685ef95a87e31c06ed4b2b7c1072e8dda2$
// $hash=1948d2651fc5f7fd6aab7878da869b5d231b9cde$
//
#include "libcef_dll/ctocpp/display_handler_ctocpp.h"
@ -180,6 +180,27 @@ bool CefDisplayHandlerCToCpp::OnConsoleMessage(CefRefPtr<CefBrowser> browser,
return _retval ? true : false;
}
bool CefDisplayHandlerCToCpp::OnAutoResize(CefRefPtr<CefBrowser> browser,
const CefSize& new_size) {
cef_display_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_auto_resize))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return false;
// Execute
int _retval = _struct->on_auto_resize(
_struct, CefBrowserCppToC::Wrap(browser), &new_size);
// Return type: bool
return _retval ? true : false;
}
// CONSTRUCTOR - Do not edit by hand.
CefDisplayHandlerCToCpp::CefDisplayHandlerCToCpp() {}

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=309e3816e3daba60c7809230fdecb59d01e41847$
// $hash=6d8ab7f2086373de52eb178cc640d2d553d43c58$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_DISPLAY_HANDLER_CTOCPP_H_
@ -51,6 +51,8 @@ class CefDisplayHandlerCToCpp
const CefString& message,
const CefString& source,
int line) override;
bool OnAutoResize(CefRefPtr<CefBrowser> browser,
const CefSize& new_size) override;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_DISPLAY_HANDLER_CTOCPP_H_

View File

@ -0,0 +1,163 @@
// 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=03f1fdb03fe9164e965e62d3e703d1b5a548ffdd$
//
#include "libcef_dll/ctocpp/extension_ctocpp.h"
#include "libcef_dll/cpptoc/extension_handler_cpptoc.h"
#include "libcef_dll/ctocpp/dictionary_value_ctocpp.h"
#include "libcef_dll/ctocpp/request_context_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
CefString CefExtensionCToCpp::GetIdentifier() {
cef_extension_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_identifier))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = _struct->get_identifier(_struct);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefString CefExtensionCToCpp::GetPath() {
cef_extension_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_path))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = _struct->get_path(_struct);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefRefPtr<CefDictionaryValue> CefExtensionCToCpp::GetManifest() {
cef_extension_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_manifest))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_dictionary_value_t* _retval = _struct->get_manifest(_struct);
// Return type: refptr_same
return CefDictionaryValueCToCpp::Wrap(_retval);
}
bool CefExtensionCToCpp::IsSame(CefRefPtr<CefExtension> that) {
cef_extension_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_same))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: that; type: refptr_same
DCHECK(that.get());
if (!that.get())
return false;
// Execute
int _retval = _struct->is_same(_struct, CefExtensionCToCpp::Unwrap(that));
// Return type: bool
return _retval ? true : false;
}
CefRefPtr<CefExtensionHandler> CefExtensionCToCpp::GetHandler() {
cef_extension_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_handler))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_extension_handler_t* _retval = _struct->get_handler(_struct);
// Return type: refptr_diff
return CefExtensionHandlerCppToC::Unwrap(_retval);
}
CefRefPtr<CefRequestContext> CefExtensionCToCpp::GetLoaderContext() {
cef_extension_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_loader_context))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_request_context_t* _retval = _struct->get_loader_context(_struct);
// Return type: refptr_same
return CefRequestContextCToCpp::Wrap(_retval);
}
bool CefExtensionCToCpp::IsLoaded() {
cef_extension_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_loaded))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->is_loaded(_struct);
// Return type: bool
return _retval ? true : false;
}
void CefExtensionCToCpp::Unload() {
cef_extension_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, unload))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->unload(_struct);
}
// CONSTRUCTOR - Do not edit by hand.
CefExtensionCToCpp::CefExtensionCToCpp() {}
template <>
cef_extension_t*
CefCToCppRefCounted<CefExtensionCToCpp, CefExtension, cef_extension_t>::
UnwrapDerived(CefWrapperType type, CefExtension* c) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template <>
base::AtomicRefCount
CefCToCppRefCounted<CefExtensionCToCpp, CefExtension, cef_extension_t>::
DebugObjCt ATOMIC_DECLARATION;
#endif
template <>
CefWrapperType CefCToCppRefCounted<CefExtensionCToCpp,
CefExtension,
cef_extension_t>::kWrapperType =
WT_EXTENSION;

View File

@ -0,0 +1,50 @@
// 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=b130e6a0c2cc23cb6eaa06b46a6bdb2bebf550b4$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_EXTENSION_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_EXTENSION_CTOCPP_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-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/ctocpp/ctocpp_ref_counted.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefExtensionCToCpp : public CefCToCppRefCounted<CefExtensionCToCpp,
CefExtension,
cef_extension_t> {
public:
CefExtensionCToCpp();
// CefExtension methods.
CefString GetIdentifier() OVERRIDE;
CefString GetPath() OVERRIDE;
CefRefPtr<CefDictionaryValue> GetManifest() OVERRIDE;
bool IsSame(CefRefPtr<CefExtension> that) OVERRIDE;
CefRefPtr<CefExtensionHandler> GetHandler() OVERRIDE;
CefRefPtr<CefRequestContext> GetLoaderContext() OVERRIDE;
bool IsLoaded() OVERRIDE;
void Unload() OVERRIDE;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_EXTENSION_CTOCPP_H_

View File

@ -0,0 +1,238 @@
// 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=b8f2ada19624a72741d86b5d6ff5214a4b711dd6$
//
#include "libcef_dll/ctocpp/extension_handler_ctocpp.h"
#include "libcef_dll/cpptoc/browser_cpptoc.h"
#include "libcef_dll/cpptoc/extension_cpptoc.h"
#include "libcef_dll/cpptoc/get_extension_resource_callback_cpptoc.h"
#include "libcef_dll/ctocpp/client_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
void CefExtensionHandlerCToCpp::OnExtensionLoadFailed(cef_errorcode_t result) {
cef_extension_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_extension_load_failed))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->on_extension_load_failed(_struct, result);
}
void CefExtensionHandlerCToCpp::OnExtensionLoaded(
CefRefPtr<CefExtension> extension) {
cef_extension_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_extension_loaded))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: extension; type: refptr_diff
DCHECK(extension.get());
if (!extension.get())
return;
// Execute
_struct->on_extension_loaded(_struct, CefExtensionCppToC::Wrap(extension));
}
void CefExtensionHandlerCToCpp::OnExtensionUnloaded(
CefRefPtr<CefExtension> extension) {
cef_extension_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_extension_unloaded))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: extension; type: refptr_diff
DCHECK(extension.get());
if (!extension.get())
return;
// Execute
_struct->on_extension_unloaded(_struct, CefExtensionCppToC::Wrap(extension));
}
bool CefExtensionHandlerCToCpp::OnBeforeBackgroundBrowser(
CefRefPtr<CefExtension> extension,
const CefString& url,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings) {
cef_extension_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_before_background_browser))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: extension; type: refptr_diff
DCHECK(extension.get());
if (!extension.get())
return false;
// Verify param: url; type: string_byref_const
DCHECK(!url.empty());
if (url.empty())
return false;
// Translate param: client; type: refptr_same_byref
cef_client_t* clientStruct = NULL;
if (client.get())
clientStruct = CefClientCToCpp::Unwrap(client);
cef_client_t* clientOrig = clientStruct;
// Execute
int _retval = _struct->on_before_background_browser(
_struct, CefExtensionCppToC::Wrap(extension), url.GetStruct(),
&clientStruct, &settings);
// Restore param:client; type: refptr_same_byref
if (clientStruct) {
if (clientStruct != clientOrig) {
client = CefClientCToCpp::Wrap(clientStruct);
}
} else {
client = NULL;
}
// Return type: bool
return _retval ? true : false;
}
CefRefPtr<CefBrowser> CefExtensionHandlerCToCpp::GetActiveBrowser(
CefRefPtr<CefExtension> extension,
CefRefPtr<CefBrowser> browser,
bool include_incognito) {
cef_extension_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_active_browser))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: extension; type: refptr_diff
DCHECK(extension.get());
if (!extension.get())
return NULL;
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return NULL;
// Execute
cef_browser_t* _retval = _struct->get_active_browser(
_struct, CefExtensionCppToC::Wrap(extension),
CefBrowserCppToC::Wrap(browser), include_incognito);
// Return type: refptr_diff
return CefBrowserCppToC::Unwrap(_retval);
}
bool CefExtensionHandlerCToCpp::CanAccessBrowser(
CefRefPtr<CefExtension> extension,
CefRefPtr<CefBrowser> browser,
bool include_incognito,
CefRefPtr<CefBrowser> target_browser) {
cef_extension_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, can_access_browser))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: extension; type: refptr_diff
DCHECK(extension.get());
if (!extension.get())
return false;
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return false;
// Verify param: target_browser; type: refptr_diff
DCHECK(target_browser.get());
if (!target_browser.get())
return false;
// Execute
int _retval = _struct->can_access_browser(
_struct, CefExtensionCppToC::Wrap(extension),
CefBrowserCppToC::Wrap(browser), include_incognito,
CefBrowserCppToC::Wrap(target_browser));
// Return type: bool
return _retval ? true : false;
}
bool CefExtensionHandlerCToCpp::GetExtensionResource(
CefRefPtr<CefExtension> extension,
CefRefPtr<CefBrowser> browser,
const CefString& file,
CefRefPtr<CefGetExtensionResourceCallback> callback) {
cef_extension_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_extension_resource))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: extension; type: refptr_diff
DCHECK(extension.get());
if (!extension.get())
return false;
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return false;
// Verify param: file; type: string_byref_const
DCHECK(!file.empty());
if (file.empty())
return false;
// Verify param: callback; type: refptr_diff
DCHECK(callback.get());
if (!callback.get())
return false;
// Execute
int _retval = _struct->get_extension_resource(
_struct, CefExtensionCppToC::Wrap(extension),
CefBrowserCppToC::Wrap(browser), file.GetStruct(),
CefGetExtensionResourceCallbackCppToC::Wrap(callback));
// Return type: bool
return _retval ? true : false;
}
// CONSTRUCTOR - Do not edit by hand.
CefExtensionHandlerCToCpp::CefExtensionHandlerCToCpp() {}
template <>
cef_extension_handler_t* CefCToCppRefCounted<
CefExtensionHandlerCToCpp,
CefExtensionHandler,
cef_extension_handler_t>::UnwrapDerived(CefWrapperType type,
CefExtensionHandler* c) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template <>
base::AtomicRefCount CefCToCppRefCounted<CefExtensionHandlerCToCpp,
CefExtensionHandler,
cef_extension_handler_t>::DebugObjCt
ATOMIC_DECLARATION;
#endif
template <>
CefWrapperType CefCToCppRefCounted<CefExtensionHandlerCToCpp,
CefExtensionHandler,
cef_extension_handler_t>::kWrapperType =
WT_EXTENSION_HANDLER;

View File

@ -0,0 +1,60 @@
// 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=369179037f2f6abc4d30e25099b52acf2f71e1e2$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_EXTENSION_HANDLER_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_EXTENSION_HANDLER_CTOCPP_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/ctocpp/ctocpp_ref_counted.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed DLL-side only.
class CefExtensionHandlerCToCpp
: public CefCToCppRefCounted<CefExtensionHandlerCToCpp,
CefExtensionHandler,
cef_extension_handler_t> {
public:
CefExtensionHandlerCToCpp();
// CefExtensionHandler methods.
void OnExtensionLoadFailed(cef_errorcode_t result) override;
void OnExtensionLoaded(CefRefPtr<CefExtension> extension) override;
void OnExtensionUnloaded(CefRefPtr<CefExtension> extension) override;
bool OnBeforeBackgroundBrowser(CefRefPtr<CefExtension> extension,
const CefString& url,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings) override;
CefRefPtr<CefBrowser> GetActiveBrowser(CefRefPtr<CefExtension> extension,
CefRefPtr<CefBrowser> browser,
bool include_incognito) override;
bool CanAccessBrowser(CefRefPtr<CefExtension> extension,
CefRefPtr<CefBrowser> browser,
bool include_incognito,
CefRefPtr<CefBrowser> target_browser) override;
bool GetExtensionResource(
CefRefPtr<CefExtension> extension,
CefRefPtr<CefBrowser> browser,
const CefString& file,
CefRefPtr<CefGetExtensionResourceCallback> callback) override;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_EXTENSION_HANDLER_CTOCPP_H_

View File

@ -0,0 +1,73 @@
// 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=9ce6ac777c6afb7f0c015c3ad5c1e73c176af0d0$
//
#include "libcef_dll/ctocpp/get_extension_resource_callback_ctocpp.h"
#include "libcef_dll/ctocpp/stream_reader_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
void CefGetExtensionResourceCallbackCToCpp::Continue(
CefRefPtr<CefStreamReader> stream) {
cef_get_extension_resource_callback_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, cont))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: stream
// Execute
_struct->cont(_struct, CefStreamReaderCToCpp::Unwrap(stream));
}
void CefGetExtensionResourceCallbackCToCpp::Cancel() {
cef_get_extension_resource_callback_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, cancel))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->cancel(_struct);
}
// CONSTRUCTOR - Do not edit by hand.
CefGetExtensionResourceCallbackCToCpp::CefGetExtensionResourceCallbackCToCpp() {
}
template <>
cef_get_extension_resource_callback_t*
CefCToCppRefCounted<CefGetExtensionResourceCallbackCToCpp,
CefGetExtensionResourceCallback,
cef_get_extension_resource_callback_t>::
UnwrapDerived(CefWrapperType type, CefGetExtensionResourceCallback* c) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template <>
base::AtomicRefCount CefCToCppRefCounted<
CefGetExtensionResourceCallbackCToCpp,
CefGetExtensionResourceCallback,
cef_get_extension_resource_callback_t>::DebugObjCt ATOMIC_DECLARATION;
#endif
template <>
CefWrapperType
CefCToCppRefCounted<CefGetExtensionResourceCallbackCToCpp,
CefGetExtensionResourceCallback,
cef_get_extension_resource_callback_t>::kWrapperType =
WT_GET_EXTENSION_RESOURCE_CALLBACK;

View File

@ -0,0 +1,43 @@
// 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=a30c4e51250f312d20fff853063eb78fb23fc3c2$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_GET_EXTENSION_RESOURCE_CALLBACK_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_GET_EXTENSION_RESOURCE_CALLBACK_CTOCPP_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/ctocpp/ctocpp_ref_counted.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefGetExtensionResourceCallbackCToCpp
: public CefCToCppRefCounted<CefGetExtensionResourceCallbackCToCpp,
CefGetExtensionResourceCallback,
cef_get_extension_resource_callback_t> {
public:
CefGetExtensionResourceCallbackCToCpp();
// CefGetExtensionResourceCallback methods.
void Continue(CefRefPtr<CefStreamReader> stream) OVERRIDE;
void Cancel() OVERRIDE;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_GET_EXTENSION_RESOURCE_CALLBACK_CTOCPP_H_

View File

@ -9,16 +9,18 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=eb7605c00ee71d056306cd6b9d0e7eb55112927a$
// $hash=7199bc96d7ab4c07229d7d8cb078a9b64621042c$
//
#include "libcef_dll/ctocpp/request_context_ctocpp.h"
#include "libcef_dll/cpptoc/completion_callback_cpptoc.h"
#include "libcef_dll/cpptoc/extension_handler_cpptoc.h"
#include "libcef_dll/cpptoc/request_context_handler_cpptoc.h"
#include "libcef_dll/cpptoc/resolve_callback_cpptoc.h"
#include "libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h"
#include "libcef_dll/ctocpp/cookie_manager_ctocpp.h"
#include "libcef_dll/ctocpp/dictionary_value_ctocpp.h"
#include "libcef_dll/ctocpp/extension_ctocpp.h"
#include "libcef_dll/ctocpp/value_ctocpp.h"
#include "libcef_dll/transfer_util.h"
@ -410,6 +412,115 @@ cef_errorcode_t CefRequestContextCToCpp::ResolveHostCached(
return _retval;
}
void CefRequestContextCToCpp::LoadExtension(
const CefString& root_directory,
CefRefPtr<CefDictionaryValue> manifest,
CefRefPtr<CefExtensionHandler> handler) {
cef_request_context_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, load_extension))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: root_directory; type: string_byref_const
DCHECK(!root_directory.empty());
if (root_directory.empty())
return;
// Unverified params: manifest, handler
// Execute
_struct->load_extension(_struct, root_directory.GetStruct(),
CefDictionaryValueCToCpp::Unwrap(manifest),
CefExtensionHandlerCppToC::Wrap(handler));
}
bool CefRequestContextCToCpp::DidLoadExtension(const CefString& extension_id) {
cef_request_context_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, did_load_extension))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: extension_id; type: string_byref_const
DCHECK(!extension_id.empty());
if (extension_id.empty())
return false;
// Execute
int _retval = _struct->did_load_extension(_struct, extension_id.GetStruct());
// Return type: bool
return _retval ? true : false;
}
bool CefRequestContextCToCpp::HasExtension(const CefString& extension_id) {
cef_request_context_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, has_extension))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: extension_id; type: string_byref_const
DCHECK(!extension_id.empty());
if (extension_id.empty())
return false;
// Execute
int _retval = _struct->has_extension(_struct, extension_id.GetStruct());
// Return type: bool
return _retval ? true : false;
}
bool CefRequestContextCToCpp::GetExtensions(
std::vector<CefString>& extension_ids) {
cef_request_context_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_extensions))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Translate param: extension_ids; type: string_vec_byref
cef_string_list_t extension_idsList = cef_string_list_alloc();
DCHECK(extension_idsList);
if (extension_idsList)
transfer_string_list_contents(extension_ids, extension_idsList);
// Execute
int _retval = _struct->get_extensions(_struct, extension_idsList);
// Restore param:extension_ids; type: string_vec_byref
if (extension_idsList) {
extension_ids.clear();
transfer_string_list_contents(extension_idsList, extension_ids);
cef_string_list_free(extension_idsList);
}
// Return type: bool
return _retval ? true : false;
}
CefRefPtr<CefExtension> CefRequestContextCToCpp::GetExtension(
const CefString& extension_id) {
cef_request_context_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_extension))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: extension_id; type: string_byref_const
DCHECK(!extension_id.empty());
if (extension_id.empty())
return NULL;
// Execute
cef_extension_t* _retval =
_struct->get_extension(_struct, extension_id.GetStruct());
// Return type: refptr_same
return CefExtensionCToCpp::Wrap(_retval);
}
// CONSTRUCTOR - Do not edit by hand.
CefRequestContextCToCpp::CefRequestContextCToCpp() {}

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=007659e858fb2ce87b3974d8d304d850434bac8b$
// $hash=4e86aeaf1eea5a2357e094952219ec6dd8f956bb$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_REQUEST_CONTEXT_CTOCPP_H_
@ -66,6 +66,13 @@ class CefRequestContextCToCpp
cef_errorcode_t ResolveHostCached(
const CefString& origin,
std::vector<CefString>& resolved_ips) OVERRIDE;
void LoadExtension(const CefString& root_directory,
CefRefPtr<CefDictionaryValue> manifest,
CefRefPtr<CefExtensionHandler> handler) OVERRIDE;
bool DidLoadExtension(const CefString& extension_id) OVERRIDE;
bool HasExtension(const CefString& extension_id) OVERRIDE;
bool GetExtensions(std::vector<CefString>& extension_ids) OVERRIDE;
CefRefPtr<CefExtension> GetExtension(const CefString& extension_id) OVERRIDE;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_REQUEST_CONTEXT_CTOCPP_H_

View File

@ -9,15 +9,34 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=06dd198c1341ffa14ae98b3937df025322ed5510$
// $hash=aeb8be6019f69c4271ae0e35c4a6759dc46cc33d$
//
#include "libcef_dll/ctocpp/request_context_handler_ctocpp.h"
#include "libcef_dll/cpptoc/cookie_manager_cpptoc.h"
#include "libcef_dll/cpptoc/request_context_cpptoc.h"
#include "libcef_dll/cpptoc/web_plugin_info_cpptoc.h"
// VIRTUAL METHODS - Body may be edited by hand.
void CefRequestContextHandlerCToCpp::OnRequestContextInitialized(
CefRefPtr<CefRequestContext> request_context) {
cef_request_context_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_request_context_initialized))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: request_context; type: refptr_diff
DCHECK(request_context.get());
if (!request_context.get())
return;
// Execute
_struct->on_request_context_initialized(
_struct, CefRequestContextCppToC::Wrap(request_context));
}
CefRefPtr<CefCookieManager> CefRequestContextHandlerCToCpp::GetCookieManager() {
cef_request_context_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_cookie_manager))

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=f51e1ceef8535c2d81dd7a9918da5e3b9861376f$
// $hash=e2ff660c7baffdce4c00f6ae132a770e13bd9358$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_REQUEST_CONTEXT_HANDLER_CTOCPP_H_
@ -20,7 +20,9 @@
#error This file can be included DLL-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/ctocpp/ctocpp_ref_counted.h"
@ -34,6 +36,8 @@ class CefRequestContextHandlerCToCpp
CefRequestContextHandlerCToCpp();
// CefRequestContextHandler methods.
void OnRequestContextInitialized(
CefRefPtr<CefRequestContext> request_context) override;
CefRefPtr<CefCookieManager> GetCookieManager() override;
bool OnBeforePluginLoad(const CefString& mime_type,
const CefString& plugin_url,

View File

@ -9,19 +9,21 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=c1af150d3b847d4fda504d0f9c668d90fa348308$
// $hash=81cf9c1f1aff3557bd27f8751d2df517f2f73249$
//
#include "libcef_dll/ctocpp/views/menu_button_delegate_ctocpp.h"
#include "libcef_dll/cpptoc/views/button_cpptoc.h"
#include "libcef_dll/cpptoc/views/menu_button_cpptoc.h"
#include "libcef_dll/cpptoc/views/menu_button_pressed_lock_cpptoc.h"
#include "libcef_dll/cpptoc/views/view_cpptoc.h"
// VIRTUAL METHODS - Body may be edited by hand.
void CefMenuButtonDelegateCToCpp::OnMenuButtonPressed(
CefRefPtr<CefMenuButton> menu_button,
const CefPoint& screen_point) {
const CefPoint& screen_point,
CefRefPtr<CefMenuButtonPressedLock> button_pressed_lock) {
cef_menu_button_delegate_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_menu_button_pressed))
return;
@ -32,10 +34,15 @@ void CefMenuButtonDelegateCToCpp::OnMenuButtonPressed(
DCHECK(menu_button.get());
if (!menu_button.get())
return;
// Verify param: button_pressed_lock; type: refptr_diff
DCHECK(button_pressed_lock.get());
if (!button_pressed_lock.get())
return;
// Execute
_struct->on_menu_button_pressed(
_struct, CefMenuButtonCppToC::Wrap(menu_button), &screen_point);
_struct, CefMenuButtonCppToC::Wrap(menu_button), &screen_point,
CefMenuButtonPressedLockCppToC::Wrap(button_pressed_lock));
}
void CefMenuButtonDelegateCToCpp::OnButtonPressed(CefRefPtr<CefButton> button) {

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=71ef57288d2a5fc3a22b1f22385ac43303f37256$
// $hash=f9fc3392a980679bb9c2786f0f61ce1a12219c24$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_MENU_BUTTON_DELEGATE_CTOCPP_H_
@ -36,8 +36,10 @@ class CefMenuButtonDelegateCToCpp
CefMenuButtonDelegateCToCpp();
// CefMenuButtonDelegate methods.
void OnMenuButtonPressed(CefRefPtr<CefMenuButton> menu_button,
const CefPoint& screen_point) override;
void OnMenuButtonPressed(
CefRefPtr<CefMenuButton> menu_button,
const CefPoint& screen_point,
CefRefPtr<CefMenuButtonPressedLock> button_pressed_lock) override;
// CefButtonDelegate methods.
void OnButtonPressed(CefRefPtr<CefButton> button) override;

View File

@ -0,0 +1,45 @@
// 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=c43f3b09cdeca57178d011390a0b1aef581ead6a$
//
#include "libcef_dll/ctocpp/views/menu_button_pressed_lock_ctocpp.h"
// CONSTRUCTOR - Do not edit by hand.
CefMenuButtonPressedLockCToCpp::CefMenuButtonPressedLockCToCpp() {}
template <>
cef_menu_button_pressed_lock_t* CefCToCppRefCounted<
CefMenuButtonPressedLockCToCpp,
CefMenuButtonPressedLock,
cef_menu_button_pressed_lock_t>::UnwrapDerived(CefWrapperType type,
CefMenuButtonPressedLock*
c) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template <>
base::AtomicRefCount CefCToCppRefCounted<
CefMenuButtonPressedLockCToCpp,
CefMenuButtonPressedLock,
cef_menu_button_pressed_lock_t>::DebugObjCt ATOMIC_DECLARATION;
#endif
template <>
CefWrapperType
CefCToCppRefCounted<CefMenuButtonPressedLockCToCpp,
CefMenuButtonPressedLock,
cef_menu_button_pressed_lock_t>::kWrapperType =
WT_MENU_BUTTON_PRESSED_LOCK;

View File

@ -0,0 +1,41 @@
// 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=2a275bd4a57c74df08bef4a5a0d8e3f8d2b22305$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_MENU_BUTTON_PRESSED_LOCK_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_VIEWS_MENU_BUTTON_PRESSED_LOCK_CTOCPP_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-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/ctocpp/ctocpp_ref_counted.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefMenuButtonPressedLockCToCpp
: public CefCToCppRefCounted<CefMenuButtonPressedLockCToCpp,
CefMenuButtonPressedLock,
cef_menu_button_pressed_lock_t> {
public:
CefMenuButtonPressedLockCToCpp();
// CefMenuButtonPressedLock methods.
};
#endif // CEF_LIBCEF_DLL_CTOCPP_VIEWS_MENU_BUTTON_PRESSED_LOCK_CTOCPP_H_

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=c2256192e44464a7c89f2e43619a92049d1c080c$
// $hash=8c1a14a8634516a37f562c6b295c30fe3f30c179$
//
#include "libcef_dll/ctocpp/views/window_delegate_ctocpp.h"
@ -50,6 +50,50 @@ void CefWindowDelegateCToCpp::OnWindowDestroyed(CefRefPtr<CefWindow> window) {
_struct->on_window_destroyed(_struct, CefWindowCppToC::Wrap(window));
}
CefRefPtr<CefWindow> CefWindowDelegateCToCpp::GetParentWindow(
CefRefPtr<CefWindow> window,
bool* is_menu,
bool* can_activate_menu) {
cef_window_delegate_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_parent_window))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: window; type: refptr_diff
DCHECK(window.get());
if (!window.get())
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
int is_menuInt = is_menu ? *is_menu : 0;
// Translate param: can_activate_menu; type: bool_byaddr
int can_activate_menuInt = can_activate_menu ? *can_activate_menu : 0;
// Execute
cef_window_t* _retval =
_struct->get_parent_window(_struct, CefWindowCppToC::Wrap(window),
&is_menuInt, &can_activate_menuInt);
// Restore param:is_menu; type: bool_byaddr
if (is_menu)
*is_menu = is_menuInt ? true : false;
// Restore param:can_activate_menu; type: bool_byaddr
if (can_activate_menu)
*can_activate_menu = can_activate_menuInt ? true : false;
// Return type: refptr_diff
return CefWindowCppToC::Unwrap(_retval);
}
bool CefWindowDelegateCToCpp::IsFrameless(CefRefPtr<CefWindow> window) {
cef_window_delegate_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_frameless))

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=d6154885643d45eb81ecbd3a017776983a841651$
// $hash=9eb43c9bb618484946e6915808822b1af7ad2258$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_WINDOW_DELEGATE_CTOCPP_H_
@ -38,6 +38,9 @@ class CefWindowDelegateCToCpp
// CefWindowDelegate methods.
void OnWindowCreated(CefRefPtr<CefWindow> window) override;
void OnWindowDestroyed(CefRefPtr<CefWindow> window) override;
CefRefPtr<CefWindow> GetParentWindow(CefRefPtr<CefWindow> window,
bool* is_menu,
bool* can_activate_menu) override;
bool IsFrameless(CefRefPtr<CefWindow> window) override;
bool CanResize(CefRefPtr<CefWindow> window) override;
bool CanMaximize(CefRefPtr<CefWindow> window) override;