Compare commits

...

41 Commits
5993 ... 2840

Author SHA1 Message Date
Marshall Greenblatt
ffd843c47c Add option to enable/disable net security expiration (issue #1994)
- Net security (CT, HSTS) expiration based on build age is now
  disabled by default.
- Add new enable_net_security_expiration option to CefSettings and
  CefRequestContextSettings.
2016-11-18 16:22:05 -05:00
Marshall Greenblatt
d7afec5dbd Fix memory leak with IME on macOS (see http://crbug.com/654695) 2016-11-10 13:39:14 -05:00
Marshall Greenblatt
48e5f3d239 Update to Chromium version 54.0.2840.99 2016-11-10 13:38:11 -05:00
Marshall Greenblatt
1b7ab74bcf Add test for history navigation of pages containing dynamically created iframes (issue #2022) 2016-11-04 13:52:58 -04:00
Marshall Greenblatt
49678210ec Update to Chromium version 54.0.2840.90 2016-11-04 13:45:52 -04:00
Marshall Greenblatt
f7effc7aab Disable channel ID support (issue #1912) 2016-11-02 15:13:55 -04:00
Marshall Greenblatt
3f66e81a78 Avoid line number assertion in V8 2016-11-01 19:05:39 -04:00
Marshall Greenblatt
b34508375a Remove mention of automatic type conversion in cef_v8.h (issue #1089) 2016-10-28 20:53:46 -04:00
Marshall Greenblatt
e8462d6b01 Mac: Always set enable_dsyms=true (issue #2027) 2016-10-28 20:32:53 -04:00
Marshall Greenblatt
ab288d40f1 Remove unhelpful context debug checks (issue #1954) 2016-10-28 14:58:09 -04:00
Marshall Greenblatt
d0e0aaa382 Fix URL comparison errors in CefRequest (issue #1967) 2016-10-28 14:18:28 -04:00
Marshall Greenblatt
71c8a797f3 Fix CefMenuModelDelegate methods missing from the CAPI (issue #2006) 2016-10-28 13:17:32 -04:00
Marshall Greenblatt
7fd1fdae9e Fix crash when persisting user preferences (issue #2017) 2016-10-28 12:40:50 -04:00
Marshall Greenblatt
2d6e4cf9c6 Fix translator error with X509CertificateList (issue #1824) 2016-10-27 15:44:31 -04:00
Marshall Greenblatt
a9b41ef611 Minor fixes for output consistency 2016-10-27 14:28:01 -04:00
Marshall Greenblatt
4366a9b7b2 Add callback for custom certificate selection (issue #1824) 2016-10-27 13:57:12 -04:00
Marshall Greenblatt
21e54ba6cc Add V8 interceptor support (issue #1159) 2016-10-27 13:23:56 -04:00
Marshall Greenblatt
b53a2b0fcb Fix shutdown assertion with authentication whitelist preferences (issue #1150) 2016-10-27 13:22:34 -04:00
Marshall Greenblatt
7190ce8f68 Add authentication whitelist preferences (issue #1150) 2016-10-27 12:52:54 -04:00
Marshall Greenblatt
709fd2b485 Allow CefV8Context::Eval to bypass CSP (issue #2024) 2016-10-27 12:36:15 -04:00
Marshall Greenblatt
175be9a74b Windows: Fix crash when AVX instructions are not supported (issue #1999) 2016-10-27 12:04:25 -04:00
Marshall Greenblatt
6881f83630 Add patch tool enhancements (issue #2016) 2016-10-27 11:16:36 -04:00
Marshall Greenblatt
c956572b48 Fix PDF rendering with OSR (issue #1689) 2016-10-27 11:02:56 -04:00
Marshall Greenblatt
01ce16f127 Fix missing browser.enable_spellchecking pref registration (issue #1996) 2016-10-27 10:55:53 -04:00
Marshall Greenblatt
7fe3d037c4 Linux: Don't generate GN configs for missing sysroots 2016-10-17 14:06:01 -04:00
Marshall Greenblatt
4e029f4dc2 Update to Chromium version 54.0.2840.59 2016-10-17 11:35:40 -04:00
Marshall Greenblatt
bf6e3f5e98 Add CefRegisterWidevineCdm function and remove component updater support (issue #2009)
Mac: Check in widevinecdmadapter.plugin binary until Widevine GN build errors are resolved (https://crbug.com/626436).
2016-10-14 12:09:53 -04:00
Marshall Greenblatt
2be7dee3fa Mac: Remove registration of selector methods that were deleted in e7ddc933 2016-09-19 11:58:27 -04:00
Marshall Greenblatt
bd987e54f0 Add SSL certificate transparency support (issue #1994) 2016-09-16 12:49:22 -04:00
Marshall Greenblatt
356a488133 Update to Chromium version 54.0.2840.16 2016-09-12 19:16:19 -04:00
Marshall Greenblatt
c31696628a Linux: Add ARM build support (issue #1990) 2016-09-09 21:13:46 -04:00
Marshall Greenblatt
b2968a0a5e Add CefDOMNode::GetElementBounds() method 2016-09-09 14:04:48 -04:00
Marshall Greenblatt
be607a0ec9 Fix display of select popups with OSR (issue #1988) 2016-09-09 13:22:28 -04:00
Marshall Greenblatt
4e7013cbfe Windows: Add /LARGEADDRESSAWARE to CMake configuration (issue #1855) 2016-09-08 16:54:23 -04:00
Marshall Greenblatt
d3b835eb2b Create a PrefServiceSyncable as required by Chrome (issue #1947) 2016-09-08 16:37:49 -04:00
Marshall Greenblatt
4bb6c87876 List files in directories recursively (issue #1987) 2016-09-08 11:40:54 -04:00
Marshall Greenblatt
adda1d223c Mac: Set rpath instead of using install_name_tool from CMake (issue #1403) 2016-09-02 17:14:18 +03:00
Marshall Greenblatt
7e034c9d6b Mac: Fix typo in make_distrib.py 2016-09-02 17:14:11 +03:00
Marshall Greenblatt
02029b3689 Fix debug assertion on right-click context menu. 2016-09-02 13:32:42 +03:00
Marshall Greenblatt
c83b6a1bff Add API for SSL status and certificate retrieval (issue #1924) 2016-09-02 13:32:07 +03:00
Marshall Greenblatt
743d0419f0 Update to Chromium version 54.0.2840.6 2016-09-02 10:29:33 +03:00
182 changed files with 7225 additions and 1785 deletions

View File

@@ -29,3 +29,4 @@ Felix Bruns <felixbruns@spotify.com>
YuTeh Shen <shenyute@gmail.com>
Andrei Kurushin <ajax16384@gmail.com>
Gonzo Berman <gberman@factset.com>
Jakub Trzebiatowski <kuba.trzebiatowski@gmail.com>

View File

@@ -148,6 +148,12 @@ if (is_clang) {
# https://bitbucket.org/chromiumembedded/cef/issues/1617
assert(!is_component_build)
if (is_mac) {
# Always generate dSYM files. The make_distrib script will fail if
# enable_dsyms=true is not explicitly set when is_official_build=false.
assert(enable_dsyms)
}
#
# Local variables.
@@ -233,8 +239,6 @@ static_library("libcef_static") {
"libcef/browser/chrome_profile_manager_stub.h",
"libcef/browser/chrome_profile_stub.cc",
"libcef/browser/chrome_profile_stub.h",
"libcef/browser/component_updater/cef_component_updater_configurator.cc",
"libcef/browser/component_updater/cef_component_updater_configurator.h",
"libcef/browser/content_browser_client.cc",
"libcef/browser/content_browser_client.h",
"libcef/browser/context.cc",
@@ -380,12 +384,12 @@ static_library("libcef_static") {
"libcef/browser/scheme_impl.cc",
"libcef/browser/speech_recognition_manager_delegate.cc",
"libcef/browser/speech_recognition_manager_delegate.h",
"libcef/browser/ssl_cert_principal_impl.cc",
"libcef/browser/ssl_cert_principal_impl.h",
"libcef/browser/ssl_host_state_delegate.cc",
"libcef/browser/ssl_host_state_delegate.h",
"libcef/browser/ssl_info_impl.cc",
"libcef/browser/ssl_info_impl.h",
"libcef/browser/ssl_status_impl.cc",
"libcef/browser/ssl_status_impl.h",
"libcef/browser/storage_partition_proxy.cc",
"libcef/browser/storage_partition_proxy.h",
"libcef/browser/stream_impl.cc",
@@ -396,6 +400,10 @@ static_library("libcef_static") {
"libcef/browser/thread_util.h",
"libcef/browser/web_plugin_impl.cc",
"libcef/browser/web_plugin_impl.h",
"libcef/browser/x509_certificate_impl.cc",
"libcef/browser/x509_certificate_impl.h",
"libcef/browser/x509_cert_principal_impl.cc",
"libcef/browser/x509_cert_principal_impl.h",
"libcef/browser/xml_reader_impl.cc",
"libcef/browser/xml_reader_impl.h",
"libcef/browser/zip_reader_impl.cc",
@@ -464,6 +472,8 @@ static_library("libcef_static") {
"libcef/common/value_base.h",
"libcef/common/values_impl.cc",
"libcef/common/values_impl.h",
"libcef/common/widevine_loader.cc",
"libcef/common/widevine_loader.h",
"libcef/renderer/browser_impl.cc",
"libcef/renderer/browser_impl.h",
"libcef/renderer/content_renderer_client.cc",
@@ -560,7 +570,6 @@ static_library("libcef_static") {
"//chrome/common",
"//chrome/renderer",
"//components/cdm/renderer",
"//components/component_updater",
"//components/content_settings/core/browser",
"//components/content_settings/core/common",
"//components/crash/content/app:app_breakpad_mac_win_to_be_deleted",

View File

@@ -7,5 +7,5 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': '1ae106dbab4bddd85132d5b75c670794311f4c57',
'chromium_checkout': 'refs/tags/54.0.2840.99',
}

View File

@@ -61,6 +61,7 @@
'include/cef_response_filter.h',
'include/cef_scheme.h',
'include/cef_ssl_info.h',
'include/cef_ssl_status.h',
'include/cef_stream.h',
'include/cef_string_visitor.h',
'include/cef_task.h',
@@ -69,6 +70,7 @@
'include/cef_v8.h',
'include/cef_values.h',
'include/cef_web_plugin.h',
'include/cef_x509_certificate.h',
'include/cef_xml_reader.h',
'include/cef_zip_reader.h',
'include/test/cef_translator_test.h',
@@ -143,6 +145,7 @@
'include/capi/cef_response_filter_capi.h',
'include/capi/cef_scheme_capi.h',
'include/capi/cef_ssl_info_capi.h',
'include/capi/cef_ssl_status_capi.h',
'include/capi/cef_stream_capi.h',
'include/capi/cef_string_visitor_capi.h',
'include/capi/cef_task_capi.h',
@@ -151,6 +154,7 @@
'include/capi/cef_v8_capi.h',
'include/capi/cef_values_capi.h',
'include/capi/cef_web_plugin_capi.h',
'include/capi/cef_x509_certificate_capi.h',
'include/capi/cef_xml_reader_capi.h',
'include/capi/cef_zip_reader_capi.h',
'include/capi/test/cef_translator_test_capi.h',
@@ -314,6 +318,8 @@
'libcef_dll/cpptoc/process_message_cpptoc.h',
'libcef_dll/ctocpp/read_handler_ctocpp.cc',
'libcef_dll/ctocpp/read_handler_ctocpp.h',
'libcef_dll/ctocpp/register_cdm_callback_ctocpp.cc',
'libcef_dll/ctocpp/register_cdm_callback_ctocpp.h',
'libcef_dll/ctocpp/render_handler_ctocpp.cc',
'libcef_dll/ctocpp/render_handler_ctocpp.h',
'libcef_dll/ctocpp/render_process_handler_ctocpp.cc',
@@ -344,16 +350,18 @@
'libcef_dll/cpptoc/run_context_menu_callback_cpptoc.h',
'libcef_dll/ctocpp/run_file_dialog_callback_ctocpp.cc',
'libcef_dll/ctocpp/run_file_dialog_callback_ctocpp.h',
'libcef_dll/cpptoc/sslcert_principal_cpptoc.cc',
'libcef_dll/cpptoc/sslcert_principal_cpptoc.h',
'libcef_dll/cpptoc/sslinfo_cpptoc.cc',
'libcef_dll/cpptoc/sslinfo_cpptoc.h',
'libcef_dll/cpptoc/sslstatus_cpptoc.cc',
'libcef_dll/cpptoc/sslstatus_cpptoc.h',
'libcef_dll/ctocpp/scheme_handler_factory_ctocpp.cc',
'libcef_dll/ctocpp/scheme_handler_factory_ctocpp.h',
'libcef_dll/cpptoc/scheme_registrar_cpptoc.cc',
'libcef_dll/cpptoc/scheme_registrar_cpptoc.h',
'libcef_dll/cpptoc/views/scroll_view_cpptoc.cc',
'libcef_dll/cpptoc/views/scroll_view_cpptoc.h',
'libcef_dll/cpptoc/select_client_certificate_callback_cpptoc.cc',
'libcef_dll/cpptoc/select_client_certificate_callback_cpptoc.h',
'libcef_dll/ctocpp/set_cookie_callback_ctocpp.cc',
'libcef_dll/ctocpp/set_cookie_callback_ctocpp.h',
'libcef_dll/cpptoc/stream_reader_cpptoc.cc',
@@ -394,6 +402,8 @@
'libcef_dll/cpptoc/v8exception_cpptoc.h',
'libcef_dll/ctocpp/v8handler_ctocpp.cc',
'libcef_dll/ctocpp/v8handler_ctocpp.h',
'libcef_dll/ctocpp/v8interceptor_ctocpp.cc',
'libcef_dll/ctocpp/v8interceptor_ctocpp.h',
'libcef_dll/cpptoc/v8stack_frame_cpptoc.cc',
'libcef_dll/cpptoc/v8stack_frame_cpptoc.h',
'libcef_dll/cpptoc/v8stack_trace_cpptoc.cc',
@@ -418,6 +428,10 @@
'libcef_dll/ctocpp/views/window_delegate_ctocpp.h',
'libcef_dll/ctocpp/write_handler_ctocpp.cc',
'libcef_dll/ctocpp/write_handler_ctocpp.h',
'libcef_dll/cpptoc/x509cert_principal_cpptoc.cc',
'libcef_dll/cpptoc/x509cert_principal_cpptoc.h',
'libcef_dll/cpptoc/x509certificate_cpptoc.cc',
'libcef_dll/cpptoc/x509certificate_cpptoc.h',
'libcef_dll/cpptoc/xml_reader_cpptoc.cc',
'libcef_dll/cpptoc/xml_reader_cpptoc.h',
'libcef_dll/cpptoc/zip_reader_cpptoc.cc',
@@ -562,6 +576,8 @@
'libcef_dll/ctocpp/process_message_ctocpp.h',
'libcef_dll/cpptoc/read_handler_cpptoc.cc',
'libcef_dll/cpptoc/read_handler_cpptoc.h',
'libcef_dll/cpptoc/register_cdm_callback_cpptoc.cc',
'libcef_dll/cpptoc/register_cdm_callback_cpptoc.h',
'libcef_dll/cpptoc/render_handler_cpptoc.cc',
'libcef_dll/cpptoc/render_handler_cpptoc.h',
'libcef_dll/cpptoc/render_process_handler_cpptoc.cc',
@@ -592,16 +608,18 @@
'libcef_dll/ctocpp/run_context_menu_callback_ctocpp.h',
'libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.cc',
'libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.h',
'libcef_dll/ctocpp/sslcert_principal_ctocpp.cc',
'libcef_dll/ctocpp/sslcert_principal_ctocpp.h',
'libcef_dll/ctocpp/sslinfo_ctocpp.cc',
'libcef_dll/ctocpp/sslinfo_ctocpp.h',
'libcef_dll/ctocpp/sslstatus_ctocpp.cc',
'libcef_dll/ctocpp/sslstatus_ctocpp.h',
'libcef_dll/cpptoc/scheme_handler_factory_cpptoc.cc',
'libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h',
'libcef_dll/ctocpp/scheme_registrar_ctocpp.cc',
'libcef_dll/ctocpp/scheme_registrar_ctocpp.h',
'libcef_dll/ctocpp/views/scroll_view_ctocpp.cc',
'libcef_dll/ctocpp/views/scroll_view_ctocpp.h',
'libcef_dll/ctocpp/select_client_certificate_callback_ctocpp.cc',
'libcef_dll/ctocpp/select_client_certificate_callback_ctocpp.h',
'libcef_dll/cpptoc/set_cookie_callback_cpptoc.cc',
'libcef_dll/cpptoc/set_cookie_callback_cpptoc.h',
'libcef_dll/ctocpp/stream_reader_ctocpp.cc',
@@ -642,6 +660,8 @@
'libcef_dll/ctocpp/v8exception_ctocpp.h',
'libcef_dll/cpptoc/v8handler_cpptoc.cc',
'libcef_dll/cpptoc/v8handler_cpptoc.h',
'libcef_dll/cpptoc/v8interceptor_cpptoc.cc',
'libcef_dll/cpptoc/v8interceptor_cpptoc.h',
'libcef_dll/ctocpp/v8stack_frame_ctocpp.cc',
'libcef_dll/ctocpp/v8stack_frame_ctocpp.h',
'libcef_dll/ctocpp/v8stack_trace_ctocpp.cc',
@@ -666,6 +686,10 @@
'libcef_dll/cpptoc/views/window_delegate_cpptoc.h',
'libcef_dll/cpptoc/write_handler_cpptoc.cc',
'libcef_dll/cpptoc/write_handler_cpptoc.h',
'libcef_dll/ctocpp/x509cert_principal_ctocpp.cc',
'libcef_dll/ctocpp/x509cert_principal_ctocpp.h',
'libcef_dll/ctocpp/x509certificate_ctocpp.cc',
'libcef_dll/ctocpp/x509certificate_ctocpp.h',
'libcef_dll/ctocpp/xml_reader_ctocpp.cc',
'libcef_dll/ctocpp/xml_reader_ctocpp.h',
'libcef_dll/ctocpp/zip_reader_ctocpp.cc',

View File

@@ -81,6 +81,7 @@
],
'includes_linux': [
'include/base/internal/cef_atomicops_atomicword_compat.h',
'include/base/internal/cef_atomicops_arm_gcc.h',
'include/base/internal/cef_atomicops_x86_gcc.h',
'include/internal/cef_linux.h',
'include/internal/cef_types_linux.h',
@@ -149,6 +150,8 @@
'tests/cefclient/browser/client_types.h',
'tests/cefclient/browser/dialog_test.cc',
'tests/cefclient/browser/dialog_test.h',
'tests/cefclient/browser/drm_test.cc',
'tests/cefclient/browser/drm_test.h',
'tests/cefclient/browser/geometry_util.cc',
'tests/cefclient/browser/geometry_util.h',
'tests/cefclient/browser/main_context.cc',
@@ -214,6 +217,7 @@
'tests/cefclient/resources/binding.html',
'tests/cefclient/resources/dialogs.html',
'tests/cefclient/resources/draggable.html',
'tests/cefclient/resources/drm.html',
'tests/cefclient/resources/localstorage.html',
'tests/cefclient/resources/logo.png',
'tests/cefclient/resources/menu_icon.1x.png',

View File

@@ -185,26 +185,20 @@ endif(OS_LINUX)
if(OS_MACOSX)
# Fix the framework link in the helper executable.
macro(FIX_MACOSX_HELPER_FRAMEWORK_LINK target app_path)
add_custom_command(TARGET ${target}
POST_BUILD
COMMAND install_name_tool -change "@executable_path/Chromium Embedded Framework"
"@executable_path/../../../../Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework"
"${app_path}/Contents/MacOS/${target}"
VERBATIM
)
# Fix the framework rpath in the helper executable.
macro(FIX_MACOSX_HELPER_FRAMEWORK_RPATH target)
# The helper is in $app_name.app/Contents/Frameworks/$app_name Helper.app/Contents/MacOS/
# so set rpath up to Contents/ so that the loader can find Frameworks/.
set_target_properties(${target} PROPERTIES INSTALL_RPATH "@executable_path/../../../..")
set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
endmacro()
# Fix the framework link in the main executable.
macro(FIX_MACOSX_MAIN_FRAMEWORK_LINK target app_path)
add_custom_command(TARGET ${target}
POST_BUILD
COMMAND install_name_tool -change "@executable_path/Chromium Embedded Framework"
"@executable_path/../Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework"
"${app_path}/Contents/MacOS/${target}"
VERBATIM
)
# Fix the framework rpath in the main executable.
macro(FIX_MACOSX_MAIN_FRAMEWORK_RPATH target)
# The main app is at $app_name.app/Contents/MacOS/$app_name
# so set rpath up to Contents/ so that the loader can find Frameworks/.
set_target_properties(${target} PROPERTIES INSTALL_RPATH "@executable_path/..")
set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
endmacro()
# Manually process and copy over resource files.

View File

@@ -370,7 +370,8 @@ if(OS_WINDOWS)
/DEBUG # Generate debug information
)
list(APPEND CEF_EXE_LINKER_FLAGS
/MANIFEST:NO # No default manifest (see ADD_WINDOWS_MANIFEST macro usage)
/MANIFEST:NO # No default manifest (see ADD_WINDOWS_MANIFEST macro usage)
/LARGEADDRESSAWARE # Allow 32-bit processes to access 3GB of RAM
)
list(APPEND CEF_COMPILER_DEFINES
WIN32 _WIN32 _WINDOWS # Windows platform

View File

@@ -183,6 +183,8 @@ Atomic64 Release_Load(volatile const Atomic64* ptr);
#include "include/base/internal/cef_atomicops_mac.h"
#elif defined(COMPILER_GCC) && defined(ARCH_CPU_X86_FAMILY)
#include "include/base/internal/cef_atomicops_x86_gcc.h"
#elif defined(COMPILER_GCC) && defined(__ARM_ARCH)
#include "include/base/internal/cef_atomicops_arm_gcc.h"
#else
#error "Atomic operations are not supported on your platform"
#endif

View File

@@ -0,0 +1,320 @@
// Copyright (c) 2013 Google Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Do not include this header file directly. Use base/cef_atomicops.h
// instead.
//
// LinuxKernelCmpxchg and Barrier_AtomicIncrement are from Google Gears.
#ifndef CEF_INCLUDE_BASE_INTERNAL_CEF_ATOMICOPS_ARM_GCC_H_
#define CEF_INCLUDE_BASE_INTERNAL_CEF_ATOMICOPS_ARM_GCC_H_
#if defined(OS_QNX)
#include <sys/cpuinline.h>
#endif
namespace base {
namespace subtle {
// Memory barriers on ARM are funky, but the kernel is here to help:
//
// * ARMv5 didn't support SMP, there is no memory barrier instruction at
// all on this architecture, or when targeting its machine code.
//
// * Some ARMv6 CPUs support SMP. A full memory barrier can be produced by
// writing a random value to a very specific coprocessor register.
//
// * On ARMv7, the "dmb" instruction is used to perform a full memory
// barrier (though writing to the co-processor will still work).
// However, on single core devices (e.g. Nexus One, or Nexus S),
// this instruction will take up to 200 ns, which is huge, even though
// it's completely un-needed on these devices.
//
// * There is no easy way to determine at runtime if the device is
// single or multi-core. However, the kernel provides a useful helper
// function at a fixed memory address (0xffff0fa0), which will always
// perform a memory barrier in the most efficient way. I.e. on single
// core devices, this is an empty function that exits immediately.
// On multi-core devices, it implements a full memory barrier.
//
// * This source could be compiled to ARMv5 machine code that runs on a
// multi-core ARMv6 or ARMv7 device. In this case, memory barriers
// are needed for correct execution. Always call the kernel helper, even
// when targeting ARMv5TE.
//
inline void MemoryBarrier() {
#if defined(OS_LINUX) || defined(OS_ANDROID)
// Note: This is a function call, which is also an implicit compiler barrier.
typedef void (*KernelMemoryBarrierFunc)();
((KernelMemoryBarrierFunc)0xffff0fa0)();
#elif defined(OS_QNX)
__cpu_membarrier();
#else
#error MemoryBarrier() is not implemented on this platform.
#endif
}
// An ARM toolchain would only define one of these depending on which
// variant of the target architecture is being used. This tests against
// any known ARMv6 or ARMv7 variant, where it is possible to directly
// use ldrex/strex instructions to implement fast atomic operations.
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || \
defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || \
defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || \
defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || \
defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__)
inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
Atomic32 old_value,
Atomic32 new_value) {
Atomic32 prev_value;
int reloop;
do {
// The following is equivalent to:
//
// prev_value = LDREX(ptr)
// reloop = 0
// if (prev_value != old_value)
// reloop = STREX(ptr, new_value)
__asm__ __volatile__(" ldrex %0, [%3]\n"
" mov %1, #0\n"
" cmp %0, %4\n"
#ifdef __thumb2__
" it eq\n"
#endif
" strexeq %1, %5, [%3]\n"
: "=&r"(prev_value), "=&r"(reloop), "+m"(*ptr)
: "r"(ptr), "r"(old_value), "r"(new_value)
: "cc", "memory");
} while (reloop != 0);
return prev_value;
}
inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
Atomic32 old_value,
Atomic32 new_value) {
Atomic32 result = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
MemoryBarrier();
return result;
}
inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
Atomic32 old_value,
Atomic32 new_value) {
MemoryBarrier();
return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
}
inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
Atomic32 increment) {
Atomic32 value;
int reloop;
do {
// Equivalent to:
//
// value = LDREX(ptr)
// value += increment
// reloop = STREX(ptr, value)
//
__asm__ __volatile__(" ldrex %0, [%3]\n"
" add %0, %0, %4\n"
" strex %1, %0, [%3]\n"
: "=&r"(value), "=&r"(reloop), "+m"(*ptr)
: "r"(ptr), "r"(increment)
: "cc", "memory");
} while (reloop);
return value;
}
inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
Atomic32 increment) {
// TODO(digit): Investigate if it's possible to implement this with
// a single MemoryBarrier() operation between the LDREX and STREX.
// See http://crbug.com/246514
MemoryBarrier();
Atomic32 result = NoBarrier_AtomicIncrement(ptr, increment);
MemoryBarrier();
return result;
}
inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
Atomic32 new_value) {
Atomic32 old_value;
int reloop;
do {
// old_value = LDREX(ptr)
// reloop = STREX(ptr, new_value)
__asm__ __volatile__(" ldrex %0, [%3]\n"
" strex %1, %4, [%3]\n"
: "=&r"(old_value), "=&r"(reloop), "+m"(*ptr)
: "r"(ptr), "r"(new_value)
: "cc", "memory");
} while (reloop != 0);
return old_value;
}
// This tests against any known ARMv5 variant.
#elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) || \
defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_5TEJ__)
// The kernel also provides a helper function to perform an atomic
// compare-and-swap operation at the hard-wired address 0xffff0fc0.
// On ARMv5, this is implemented by a special code path that the kernel
// detects and treats specially when thread pre-emption happens.
// On ARMv6 and higher, it uses LDREX/STREX instructions instead.
//
// Note that this always perform a full memory barrier, there is no
// need to add calls MemoryBarrier() before or after it. It also
// returns 0 on success, and 1 on exit.
//
// Available and reliable since Linux 2.6.24. Both Android and ChromeOS
// use newer kernel revisions, so this should not be a concern.
namespace {
inline int LinuxKernelCmpxchg(Atomic32 old_value,
Atomic32 new_value,
volatile Atomic32* ptr) {
typedef int (*KernelCmpxchgFunc)(Atomic32, Atomic32, volatile Atomic32*);
return ((KernelCmpxchgFunc)0xffff0fc0)(old_value, new_value, ptr);
}
} // namespace
inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
Atomic32 old_value,
Atomic32 new_value) {
Atomic32 prev_value;
for (;;) {
prev_value = *ptr;
if (prev_value != old_value)
return prev_value;
if (!LinuxKernelCmpxchg(old_value, new_value, ptr))
return old_value;
}
}
inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
Atomic32 new_value) {
Atomic32 old_value;
do {
old_value = *ptr;
} while (LinuxKernelCmpxchg(old_value, new_value, ptr));
return old_value;
}
inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
Atomic32 increment) {
return Barrier_AtomicIncrement(ptr, increment);
}
inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
Atomic32 increment) {
for (;;) {
// Atomic exchange the old value with an incremented one.
Atomic32 old_value = *ptr;
Atomic32 new_value = old_value + increment;
if (!LinuxKernelCmpxchg(old_value, new_value, ptr)) {
// The exchange took place as expected.
return new_value;
}
// Otherwise, *ptr changed mid-loop and we need to retry.
}
}
inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
Atomic32 old_value,
Atomic32 new_value) {
Atomic32 prev_value;
for (;;) {
prev_value = *ptr;
if (prev_value != old_value) {
// Always ensure acquire semantics.
MemoryBarrier();
return prev_value;
}
if (!LinuxKernelCmpxchg(old_value, new_value, ptr))
return old_value;
}
}
inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
Atomic32 old_value,
Atomic32 new_value) {
// This could be implemented as:
// MemoryBarrier();
// return NoBarrier_CompareAndSwap();
//
// But would use 3 barriers per succesful CAS. To save performance,
// use Acquire_CompareAndSwap(). Its implementation guarantees that:
// - A succesful swap uses only 2 barriers (in the kernel helper).
// - An early return due to (prev_value != old_value) performs
// a memory barrier with no store, which is equivalent to the
// generic implementation above.
return Acquire_CompareAndSwap(ptr, old_value, new_value);
}
#else
# error "Your CPU's ARM architecture is not supported yet"
#endif
// NOTE: Atomicity of the following load and store operations is only
// guaranteed in case of 32-bit alignement of |ptr| values.
inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
*ptr = value;
}
inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
*ptr = value;
MemoryBarrier();
}
inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
MemoryBarrier();
*ptr = value;
}
inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) { return *ptr; }
inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
Atomic32 value = *ptr;
MemoryBarrier();
return value;
}
inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
MemoryBarrier();
return *ptr;
}
} // namespace base::subtle
} // namespace base
#endif // CEF_INCLUDE_BASE_INTERNAL_CEF_ATOMICOPS_ARM_GCC_H_

View File

@@ -700,6 +700,13 @@ typedef struct _cef_browser_host_t {
///
void (CEF_CALLBACK *drag_source_system_drag_ended)(
struct _cef_browser_host_t* self);
///
// Returns the current visible navigation entry for this browser. This
// function can only be called on the UI thread.
///
struct _cef_navigation_entry_t* (CEF_CALLBACK *get_visible_navigation_entry)(
struct _cef_browser_host_t* self);
} cef_browser_host_t;

View File

@@ -331,6 +331,11 @@ typedef struct _cef_domnode_t {
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_element_inner_text)(
struct _cef_domnode_t* self);
///
// Returns the bounds of the element.
///
cef_rect_t (CEF_CALLBACK *get_element_bounds)(struct _cef_domnode_t* self);
} cef_domnode_t;

View File

@@ -102,7 +102,7 @@ typedef struct _cef_life_span_handler_t {
// has been fired.
//
// An application should handle top-level owner window close notifications by
// calling cef_browser_host_t::Tryclose_browser() or
// calling cef_browser_host_t::try_close_browser() or
// cef_browser_host_t::CloseBrowser(false (0)) instead of allowing the window
// to close immediately (see the examples below). This gives CEF an
// opportunity to process the 'onbeforeunload' event and optionally cancel the
@@ -132,7 +132,7 @@ typedef struct _cef_life_span_handler_t {
// The below examples describe what should happen during window close when the
// browser is parented to an application-provided top-level window.
//
// Example 1: Using cef_browser_host_t::Tryclose_browser(). This is
// Example 1: Using cef_browser_host_t::try_close_browser(). This is
// recommended for clients using standard close handling and windows created
// on the browser process UI thread. 1. User clicks the window close button
// which sends a close notification to

View File

@@ -70,6 +70,19 @@ typedef struct _cef_menu_model_delegate_t {
///
void (CEF_CALLBACK *menu_will_show)(struct _cef_menu_model_delegate_t* self,
struct _cef_menu_model_t* menu_model);
///
// The menu has closed.
///
void (CEF_CALLBACK *menu_closed)(struct _cef_menu_model_delegate_t* self,
struct _cef_menu_model_t* menu_model);
///
// Optionally modify a menu item label. Return true (1) if |label| was
// modified.
///
int (CEF_CALLBACK *format_label)(struct _cef_menu_model_delegate_t* self,
struct _cef_menu_model_t* menu_model, cef_string_t* label);
} cef_menu_model_delegate_t;

View File

@@ -44,6 +44,7 @@
extern "C" {
#endif
struct _cef_sslstatus_t;
///
// Structure used to represent an entry in navigation history.
@@ -116,6 +117,12 @@ typedef struct _cef_navigation_entry_t {
///
int (CEF_CALLBACK *get_http_status_code)(
struct _cef_navigation_entry_t* self);
///
// Returns the SSL information for this navigation entry.
///
struct _cef_sslstatus_t* (CEF_CALLBACK *get_sslstatus)(
struct _cef_navigation_entry_t* self);
} cef_navigation_entry_t;

View File

@@ -47,6 +47,7 @@
#include "include/capi/cef_response_capi.h"
#include "include/capi/cef_response_filter_capi.h"
#include "include/capi/cef_ssl_info_capi.h"
#include "include/capi/cef_x509_certificate_capi.h"
#ifdef __cplusplus
extern "C" {
@@ -75,6 +76,25 @@ typedef struct _cef_request_callback_t {
} cef_request_callback_t;
///
// Callback structure used to select a client certificate for authentication.
///
typedef struct _cef_select_client_certificate_callback_t {
///
// Base structure.
///
cef_base_t base;
///
// Chooses the specified certificate for client certificate authentication.
// NULL value means that no client certificate should be used.
///
void (CEF_CALLBACK *select)(
struct _cef_select_client_certificate_callback_t* self,
struct _cef_x509certificate_t* cert);
} cef_select_client_certificate_callback_t;
///
// Implement this structure to handle events related to browser requests. The
// functions of this structure will be called on the thread indicated.
@@ -241,6 +261,26 @@ typedef struct _cef_request_handler_t {
const cef_string_t* request_url, struct _cef_sslinfo_t* ssl_info,
struct _cef_request_callback_t* callback);
///
// Called on the UI thread when a client certificate is being requested for
// authentication. Return false (0) to use the default behavior and
// automatically select the first certificate available. Return true (1) and
// call cef_select_client_certificate_callback_t::Select either in this
// function or at a later time to select a certificate. Do not call Select or
// call it with NULL to continue without using any certificate. |isProxy|
// indicates whether the host is an HTTPS proxy or the origin server. |host|
// and |port| contains the hostname and port of the SSL server. |certificates|
// is the list of certificates to choose from; this list has already been
// pruned by Chromium so that it only contains certificates from issuers that
// the server trusts.
///
int (CEF_CALLBACK *on_select_client_certificate)(
struct _cef_request_handler_t* self, struct _cef_browser_t* browser,
int isProxy, const cef_string_t* host, int port,
size_t certificatesCount,
struct _cef_x509certificate_t* const* certificates,
struct _cef_select_client_certificate_callback_t* callback);
///
// Called on the browser process UI thread when a plugin has crashed.
// |plugin_path| is the path of the plugin that crashed.

View File

@@ -40,83 +40,13 @@
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_values_capi.h"
#include "include/capi/cef_x509_certificate_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// Structure representing the issuer or subject field of an X.509 certificate.
///
typedef struct _cef_sslcert_principal_t {
///
// Base structure.
///
cef_base_t base;
///
// Returns a name that can be used to represent the issuer. It tries in this
// order: CN, O and OU and returns the first non-NULL one found.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_display_name)(
struct _cef_sslcert_principal_t* self);
///
// Returns the common name.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_common_name)(
struct _cef_sslcert_principal_t* self);
///
// Returns the locality name.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_locality_name)(
struct _cef_sslcert_principal_t* self);
///
// Returns the state or province name.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_state_or_province_name)(
struct _cef_sslcert_principal_t* self);
///
// Returns the country name.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_country_name)(
struct _cef_sslcert_principal_t* self);
///
// Retrieve the list of street addresses.
///
void (CEF_CALLBACK *get_street_addresses)(
struct _cef_sslcert_principal_t* self, cef_string_list_t addresses);
///
// Retrieve the list of organization names.
///
void (CEF_CALLBACK *get_organization_names)(
struct _cef_sslcert_principal_t* self, cef_string_list_t names);
///
// Retrieve the list of organization unit names.
///
void (CEF_CALLBACK *get_organization_unit_names)(
struct _cef_sslcert_principal_t* self, cef_string_list_t names);
///
// Retrieve the list of domain components.
///
void (CEF_CALLBACK *get_domain_components)(
struct _cef_sslcert_principal_t* self, cef_string_list_t components);
} cef_sslcert_principal_t;
///
// Structure representing SSL information.
///
@@ -134,85 +64,24 @@ typedef struct _cef_sslinfo_t {
struct _cef_sslinfo_t* self);
///
// Returns true (1) if the certificate status has any error, major or minor.
// Returns the X.509 certificate.
///
int (CEF_CALLBACK *is_cert_status_error)(struct _cef_sslinfo_t* self);
///
// Returns true (1) if the certificate status represents only minor errors
// (e.g. failure to verify certificate revocation).
///
int (CEF_CALLBACK *is_cert_status_minor_error)(struct _cef_sslinfo_t* self);
///
// Returns the subject of the X.509 certificate. For HTTPS server certificates
// this represents the web server. The common name of the subject should
// match the host name of the web server.
///
struct _cef_sslcert_principal_t* (CEF_CALLBACK *get_subject)(
struct _cef_x509certificate_t* (CEF_CALLBACK *get_x509certificate)(
struct _cef_sslinfo_t* self);
///
// Returns the issuer of the X.509 certificate.
///
struct _cef_sslcert_principal_t* (CEF_CALLBACK *get_issuer)(
struct _cef_sslinfo_t* self);
///
// Returns the DER encoded serial number for the X.509 certificate. The value
// possibly includes a leading 00 byte.
///
struct _cef_binary_value_t* (CEF_CALLBACK *get_serial_number)(
struct _cef_sslinfo_t* self);
///
// Returns the date before which the X.509 certificate is invalid.
// CefTime.GetTimeT() will return 0 if no date was specified.
///
cef_time_t (CEF_CALLBACK *get_valid_start)(struct _cef_sslinfo_t* self);
///
// Returns the date after which the X.509 certificate is invalid.
// CefTime.GetTimeT() will return 0 if no date was specified.
///
cef_time_t (CEF_CALLBACK *get_valid_expiry)(struct _cef_sslinfo_t* self);
///
// Returns the DER encoded data for the X.509 certificate.
///
struct _cef_binary_value_t* (CEF_CALLBACK *get_derencoded)(
struct _cef_sslinfo_t* self);
///
// Returns the PEM encoded data for the X.509 certificate.
///
struct _cef_binary_value_t* (CEF_CALLBACK *get_pemencoded)(
struct _cef_sslinfo_t* self);
///
// Returns the number of certificates in the issuer chain. If 0, the
// certificate is self-signed.
///
size_t (CEF_CALLBACK *get_issuer_chain_size)(struct _cef_sslinfo_t* self);
///
// Returns the DER encoded data for the certificate issuer chain. If we failed
// to encode a certificate in the chain it is still present in the array but
// is an NULL string.
///
void (CEF_CALLBACK *get_derencoded_issuer_chain)(struct _cef_sslinfo_t* self,
size_t* chainCount, struct _cef_binary_value_t** chain);
///
// Returns the PEM encoded data for the certificate issuer chain. If we failed
// to encode a certificate in the chain it is still present in the array but
// is an NULL string.
///
void (CEF_CALLBACK *get_pemencoded_issuer_chain)(struct _cef_sslinfo_t* self,
size_t* chainCount, struct _cef_binary_value_t** chain);
} cef_sslinfo_t;
///
// Returns true (1) if the certificate status has any error, major or minor.
///
CEF_EXPORT int cef_is_cert_status_error(cef_cert_status_t status);
///
// Returns true (1) if the certificate status represents only minor errors (e.g.
// failure to verify certificate revocation).
///
CEF_EXPORT int cef_is_cert_status_minor_error(cef_cert_status_t status);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,95 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_CEF_SSL_STATUS_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_SSL_STATUS_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_values_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _cef_x509certificate_t;
///
// Structure representing the SSL information for a navigation entry.
///
typedef struct _cef_sslstatus_t {
///
// Base structure.
///
cef_base_t base;
///
// Returns true (1) if the status is related to a secure SSL/TLS connection.
///
int (CEF_CALLBACK *is_secure_connection)(struct _cef_sslstatus_t* self);
///
// Returns a bitmask containing any and all problems verifying the server
// certificate.
///
cef_cert_status_t (CEF_CALLBACK *get_cert_status)(
struct _cef_sslstatus_t* self);
///
// Returns the SSL version used for the SSL connection.
///
cef_ssl_version_t (CEF_CALLBACK *get_sslversion)(
struct _cef_sslstatus_t* self);
///
// Returns a bitmask containing the page security content status.
///
cef_ssl_content_status_t (CEF_CALLBACK *get_content_status)(
struct _cef_sslstatus_t* self);
///
// Returns the X.509 certificate.
///
struct _cef_x509certificate_t* (CEF_CALLBACK *get_x509certificate)(
struct _cef_sslstatus_t* self);
} cef_sslstatus_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_SSL_STATUS_CAPI_H_

View File

@@ -123,14 +123,16 @@ typedef struct _cef_v8context_t {
struct _cef_v8context_t* that);
///
// Evaluates the specified JavaScript code using this context's global object.
// Execute a string of JavaScript code in this V8 context. The |script_url|
// parameter is the URL where the script in question can be found, if any. The
// |start_line| parameter is the base line number to use for error reporting.
// On success |retval| will be set to the return value, if any, and the
// function will return true (1). On failure |exception| will be set to the
// exception, if any, and the function will return false (0).
///
int (CEF_CALLBACK *eval)(struct _cef_v8context_t* self,
const cef_string_t* code, struct _cef_v8value_t** retval,
struct _cef_v8exception_t** exception);
const cef_string_t* code, const cef_string_t* script_url, int start_line,
struct _cef_v8value_t** retval, struct _cef_v8exception_t** exception);
} cef_v8context_t;
@@ -211,6 +213,70 @@ typedef struct _cef_v8accessor_t {
} cef_v8accessor_t;
///
// Structure that should be implemented to handle V8 interceptor calls. The
// functions of this structure will be called on the thread associated with the
// V8 interceptor. Interceptor's named property handlers (with first argument of
// type CefString) are called when object is indexed by string. Indexed property
// handlers (with first argument of type int) are called when object is indexed
// by integer.
///
typedef struct _cef_v8interceptor_t {
///
// Base structure.
///
cef_base_t base;
///
// Handle retrieval of the interceptor value identified by |name|. |object| is
// the receiver ('this' object) of the interceptor. If retrieval succeeds, set
// |retval| to the return value. If the requested value does not exist, don't
// set either |retval| or |exception|. If retrieval fails, set |exception| to
// the exception that will be thrown. If the property has an associated
// accessor, it will be called only if you don't set |retval|. Return true (1)
// if interceptor retrieval was handled, false (0) otherwise.
///
int (CEF_CALLBACK *get_byname)(struct _cef_v8interceptor_t* self,
const cef_string_t* name, struct _cef_v8value_t* object,
struct _cef_v8value_t** retval, cef_string_t* exception);
///
// Handle retrieval of the interceptor value identified by |index|. |object|
// is the receiver ('this' object) of the interceptor. If retrieval succeeds,
// set |retval| to the return value. If the requested value does not exist,
// don't set either |retval| or |exception|. If retrieval fails, set
// |exception| to the exception that will be thrown. Return true (1) if
// interceptor retrieval was handled, false (0) otherwise.
///
int (CEF_CALLBACK *get_byindex)(struct _cef_v8interceptor_t* self, int index,
struct _cef_v8value_t* object, struct _cef_v8value_t** retval,
cef_string_t* exception);
///
// Handle assignment of the interceptor value identified by |name|. |object|
// is the receiver ('this' object) of the interceptor. |value| is the new
// value being assigned to the interceptor. If assignment fails, set
// |exception| to the exception that will be thrown. This setter will always
// be called, even when the property has an associated accessor. Return true
// (1) if interceptor assignment was handled, false (0) otherwise.
///
int (CEF_CALLBACK *set_byname)(struct _cef_v8interceptor_t* self,
const cef_string_t* name, struct _cef_v8value_t* object,
struct _cef_v8value_t* value, cef_string_t* exception);
///
// Handle assignment of the interceptor value identified by |index|. |object|
// is the receiver ('this' object) of the interceptor. |value| is the new
// value being assigned to the interceptor. If assignment fails, set
// |exception| to the exception that will be thrown. Return true (1) if
// interceptor assignment was handled, false (0) otherwise.
///
int (CEF_CALLBACK *set_byindex)(struct _cef_v8interceptor_t* self, int index,
struct _cef_v8value_t* object, struct _cef_v8value_t* value,
cef_string_t* exception);
} cef_v8interceptor_t;
///
// Structure representing a V8 exception. The functions of this structure may be
// called on any render process thread.
@@ -358,38 +424,32 @@ typedef struct _cef_v8value_t {
struct _cef_v8value_t* that);
///
// Return a bool value. The underlying data will be converted to if
// necessary.
// Return a bool value.
///
int (CEF_CALLBACK *get_bool_value)(struct _cef_v8value_t* self);
///
// Return an int value. The underlying data will be converted to if
// necessary.
// Return an int value.
///
int32 (CEF_CALLBACK *get_int_value)(struct _cef_v8value_t* self);
///
// Return an unisgned int value. The underlying data will be converted to if
// necessary.
// Return an unsigned int value.
///
uint32 (CEF_CALLBACK *get_uint_value)(struct _cef_v8value_t* self);
///
// Return a double value. The underlying data will be converted to if
// necessary.
// Return a double value.
///
double (CEF_CALLBACK *get_double_value)(struct _cef_v8value_t* self);
///
// Return a Date value. The underlying data will be converted to if
// necessary.
// Return a Date value.
///
cef_time_t (CEF_CALLBACK *get_date_value)(struct _cef_v8value_t* self);
///
// Return a string value. The underlying data will be converted to if
// necessary.
// Return a string value.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_string_value)(
@@ -652,13 +712,14 @@ CEF_EXPORT cef_v8value_t* cef_v8value_create_date(const cef_time_t* date);
CEF_EXPORT cef_v8value_t* cef_v8value_create_string(const cef_string_t* value);
///
// Create a new cef_v8value_t object of type object with optional accessor. This
// function should only be called from within the scope of a
// cef_render_process_handler_t, cef_v8handler_t or cef_v8accessor_t callback,
// or in combination with calling enter() and exit() on a stored cef_v8context_t
// reference.
// Create a new cef_v8value_t object of type object with optional accessor
// and/or interceptor. This function should only be called from within the scope
// of a cef_render_process_handler_t, cef_v8handler_t or cef_v8accessor_t
// callback, or in combination with calling enter() and exit() on a stored
// cef_v8context_t reference.
///
CEF_EXPORT cef_v8value_t* cef_v8value_create_object(cef_v8accessor_t* accessor);
CEF_EXPORT cef_v8value_t* cef_v8value_create_object(cef_v8accessor_t* accessor,
cef_v8interceptor_t* interceptor);
///
// Create a new cef_v8value_t object of type array with the specified |length|.

View File

@@ -127,6 +127,29 @@ typedef struct _cef_web_plugin_unstable_callback_t {
} cef_web_plugin_unstable_callback_t;
///
// Implement this structure to receive notification when CDM registration is
// complete. The functions of this structure will be called on the browser
// process UI thread.
///
typedef struct _cef_register_cdm_callback_t {
///
// Base structure.
///
cef_base_t base;
///
// Method that will be called when CDM registration is complete. |result| will
// be CEF_CDM_REGISTRATION_ERROR_NONE if registration completed successfully.
// Otherwise, |result| and |error_message| will contain additional information
// about why registration failed.
///
void (CEF_CALLBACK *on_cdm_registration_complete)(
struct _cef_register_cdm_callback_t* self,
cef_cdm_registration_error_t result, const cef_string_t* error_message);
} cef_register_cdm_callback_t;
///
// Visit web plugin information. Can be called on any thread in the browser
// process.
@@ -161,6 +184,54 @@ CEF_EXPORT void cef_register_web_plugin_crash(const cef_string_t* path);
CEF_EXPORT void cef_is_web_plugin_unstable(const cef_string_t* path,
cef_web_plugin_unstable_callback_t* callback);
///
// Register the Widevine CDM plugin.
//
// The client application is responsible for downloading an appropriate
// platform-specific CDM binary distribution from Google, extracting the
// contents, and building the required directory structure on the local machine.
// The cef_browser_host_t::StartDownload function and CefZipArchive structure
// can be used to implement this functionality in CEF. Contact Google via
// https://www.widevine.com/contact.html for details on CDM download.
//
// |path| is a directory that must contain the following files:
// 1. manifest.json file from the CDM binary distribution (see below).
// 2. widevinecdm file from the CDM binary distribution (e.g.
// widevinecdm.dll on on Windows, libwidevinecdm.dylib on OS X,
// libwidevinecdm.so on Linux).
// 3. widevidecdmadapter file from the CEF binary distribution (e.g.
// widevinecdmadapter.dll on Windows, widevinecdmadapter.plugin on OS X,
// libwidevinecdmadapter.so on Linux).
//
// If any of these files are missing or if the manifest file has incorrect
// contents the registration will fail and |callback| will receive a |result|
// value of CEF_CDM_REGISTRATION_ERROR_INCORRECT_CONTENTS.
//
// The manifest.json file must contain the following keys:
// A. "os": Supported OS (e.g. "mac", "win" or "linux").
// B. "arch": Supported architecture (e.g. "ia32" or "x64").
// C. "x-cdm-module-versions": Module API version (e.g. "4").
// D. "x-cdm-interface-versions": Interface API version (e.g. "8").
// E. "x-cdm-host-versions": Host API version (e.g. "8").
// F. "version": CDM version (e.g. "1.4.8.903").
// G. "x-cdm-codecs": List of supported codecs (e.g. "vp8,vp9.0,avc1").
//
// A through E are used to verify compatibility with the current Chromium
// version. If the CDM is not compatible the registration will fail and
// |callback| will receive a |result| value of
// CEF_CDM_REGISTRATION_ERROR_INCOMPATIBLE.
//
// |callback| will be executed asynchronously once registration is complete.
//
// On Linux this function must be called before cef_initialize() and the
// registration cannot be changed during runtime. If registration is not
// supported at the time that cef_register_widevine_cdm() is called then
// |callback| will receive a |result| value of
// CEF_CDM_REGISTRATION_ERROR_NOT_SUPPORTED.
///
CEF_EXPORT void cef_register_widevine_cdm(const cef_string_t* path,
cef_register_cdm_callback_t* callback);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,208 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_CEF_X509_CERTIFICATE_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_X509_CERTIFICATE_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_values_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// Structure representing the issuer or subject field of an X.509 certificate.
///
typedef struct _cef_x509cert_principal_t {
///
// Base structure.
///
cef_base_t base;
///
// Returns a name that can be used to represent the issuer. It tries in this
// order: Common Name (CN), Organization Name (O) and Organizational Unit Name
// (OU) and returns the first non-NULL one found.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_display_name)(
struct _cef_x509cert_principal_t* self);
///
// Returns the common name.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_common_name)(
struct _cef_x509cert_principal_t* self);
///
// Returns the locality name.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_locality_name)(
struct _cef_x509cert_principal_t* self);
///
// Returns the state or province name.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_state_or_province_name)(
struct _cef_x509cert_principal_t* self);
///
// Returns the country name.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_country_name)(
struct _cef_x509cert_principal_t* self);
///
// Retrieve the list of street addresses.
///
void (CEF_CALLBACK *get_street_addresses)(
struct _cef_x509cert_principal_t* self, cef_string_list_t addresses);
///
// Retrieve the list of organization names.
///
void (CEF_CALLBACK *get_organization_names)(
struct _cef_x509cert_principal_t* self, cef_string_list_t names);
///
// Retrieve the list of organization unit names.
///
void (CEF_CALLBACK *get_organization_unit_names)(
struct _cef_x509cert_principal_t* self, cef_string_list_t names);
///
// Retrieve the list of domain components.
///
void (CEF_CALLBACK *get_domain_components)(
struct _cef_x509cert_principal_t* self, cef_string_list_t components);
} cef_x509cert_principal_t;
///
// Structure representing a X.509 certificate.
///
typedef struct _cef_x509certificate_t {
///
// Base structure.
///
cef_base_t base;
///
// Returns the subject of the X.509 certificate. For HTTPS server certificates
// this represents the web server. The common name of the subject should
// match the host name of the web server.
///
struct _cef_x509cert_principal_t* (CEF_CALLBACK *get_subject)(
struct _cef_x509certificate_t* self);
///
// Returns the issuer of the X.509 certificate.
///
struct _cef_x509cert_principal_t* (CEF_CALLBACK *get_issuer)(
struct _cef_x509certificate_t* self);
///
// Returns the DER encoded serial number for the X.509 certificate. The value
// possibly includes a leading 00 byte.
///
struct _cef_binary_value_t* (CEF_CALLBACK *get_serial_number)(
struct _cef_x509certificate_t* self);
///
// Returns the date before which the X.509 certificate is invalid.
// CefTime.GetTimeT() will return 0 if no date was specified.
///
cef_time_t (CEF_CALLBACK *get_valid_start)(
struct _cef_x509certificate_t* self);
///
// Returns the date after which the X.509 certificate is invalid.
// CefTime.GetTimeT() will return 0 if no date was specified.
///
cef_time_t (CEF_CALLBACK *get_valid_expiry)(
struct _cef_x509certificate_t* self);
///
// Returns the DER encoded data for the X.509 certificate.
///
struct _cef_binary_value_t* (CEF_CALLBACK *get_derencoded)(
struct _cef_x509certificate_t* self);
///
// Returns the PEM encoded data for the X.509 certificate.
///
struct _cef_binary_value_t* (CEF_CALLBACK *get_pemencoded)(
struct _cef_x509certificate_t* self);
///
// Returns the number of certificates in the issuer chain. If 0, the
// certificate is self-signed.
///
size_t (CEF_CALLBACK *get_issuer_chain_size)(
struct _cef_x509certificate_t* self);
///
// Returns the DER encoded data for the certificate issuer chain. If we failed
// to encode a certificate in the chain it is still present in the array but
// is an NULL string.
///
void (CEF_CALLBACK *get_derencoded_issuer_chain)(
struct _cef_x509certificate_t* self, size_t* chainCount,
struct _cef_binary_value_t** chain);
///
// Returns the PEM encoded data for the certificate issuer chain. If we failed
// to encode a certificate in the chain it is still present in the array but
// is an NULL string.
///
void (CEF_CALLBACK *get_pemencoded_issuer_chain)(
struct _cef_x509certificate_t* self, size_t* chainCount,
struct _cef_binary_value_t** chain);
} cef_x509certificate_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_X509_CERTIFICATE_CAPI_H_

View File

@@ -753,6 +753,13 @@ class CefBrowserHost : public virtual CefBase {
///
/*--cef()--*/
virtual void DragSourceSystemDragEnded() =0;
///
// Returns the current visible navigation entry for this browser. This method
// can only be called on the UI thread.
///
/*--cef()--*/
virtual CefRefPtr<CefNavigationEntry> GetVisibleNavigationEntry() =0;
};
#endif // CEF_INCLUDE_CEF_BROWSER_H_

View File

@@ -323,6 +323,12 @@ class CefDOMNode : public virtual CefBase {
///
/*--cef()--*/
virtual CefString GetElementInnerText() =0;
///
// Returns the bounds of the element.
///
/*--cef()--*/
virtual CefRect GetElementBounds() =0;
};
#endif // CEF_INCLUDE_CEF_DOM_H_

View File

@@ -63,20 +63,20 @@ class CefMenuModelDelegate : public virtual CefBase {
// The menu is about to show.
///
/*--cef()--*/
virtual void MenuWillShow(CefRefPtr<CefMenuModel> menu_model) {};
virtual void MenuWillShow(CefRefPtr<CefMenuModel> menu_model) {}
///
// The menu has closed.
///
/*--cef()--*/
virtual void MenuClosed(CefRefPtr<CefMenuModel> menu_model) {};
virtual void MenuClosed(CefRefPtr<CefMenuModel> menu_model) {}
///
// Optionally modify a menu item label. Return true if |label| was modified.
///
/*--cef()--*/
virtual bool FormatLabel(CefRefPtr<CefMenuModel> menu_model,
CefString& label) { return false; };
CefString& label) { return false; }
};
#endif // CEF_INCLUDE_VIEWS_CEF_MENU_MODEL_DELEGATE_H_

View File

@@ -40,6 +40,8 @@
#include "include/cef_base.h"
class CefSSLStatus;
///
// Class used to represent an entry in navigation history.
///
@@ -108,6 +110,12 @@ class CefNavigationEntry : public virtual CefBase {
///
/*--cef()--*/
virtual int GetHttpStatusCode() =0;
///
// Returns the SSL information for this navigation entry.
///
/*--cef()--*/
virtual CefRefPtr<CefSSLStatus> GetSSLStatus() =0;
};
#endif // CEF_INCLUDE_CEF_NAVIGATION_ENTRY_H_

View File

@@ -38,10 +38,11 @@
#define CEF_INCLUDE_CEF_RENDER_HANDLER_H_
#pragma once
#include <vector>
#include "include/cef_base.h"
#include "include/cef_browser.h"
#include "include/cef_drag_data.h"
#include <vector>
///
// Implement this interface to handle events when window rendering is disabled.

View File

@@ -38,6 +38,8 @@
#define CEF_INCLUDE_CEF_REQUEST_HANDLER_H_
#pragma once
#include <vector>
#include "include/cef_auth_callback.h"
#include "include/cef_base.h"
#include "include/cef_browser.h"
@@ -47,7 +49,7 @@
#include "include/cef_response_filter.h"
#include "include/cef_request.h"
#include "include/cef_ssl_info.h"
#include "include/cef_x509_certificate.h"
///
// Callback interface used for asynchronous continuation of url requests.
@@ -70,6 +72,21 @@ class CefRequestCallback : public virtual CefBase {
};
///
// Callback interface used to select a client certificate for authentication.
///
/*--cef(source=library)--*/
class CefSelectClientCertificateCallback : public virtual CefBase {
public:
///
// Chooses the specified certificate for client certificate authentication.
// NULL value means that no client certificate should be used.
///
/*--cef(optional_param=cert)--*/
virtual void Select(CefRefPtr<CefX509Certificate> cert) =0;
};
///
// Implement this interface to handle events related to browser requests. The
// methods of this class will be called on the thread indicated.
@@ -81,6 +98,7 @@ class CefRequestHandler : public virtual CefBase {
typedef cef_termination_status_t TerminationStatus;
typedef cef_urlrequest_status_t URLRequestStatus;
typedef cef_window_open_disposition_t WindowOpenDisposition;
typedef std::vector<CefRefPtr<CefX509Certificate> > X509CertificateList;
///
// Called on the UI thread before browser navigation. Return true to cancel
@@ -282,6 +300,29 @@ class CefRequestHandler : public virtual CefBase {
return false;
}
///
// Called on the UI thread when a client certificate is being requested for
// authentication. Return false to use the default behavior and automatically
// select the first certificate available. Return true and call
// CefSelectClientCertificateCallback::Select either in this method or at a
// later time to select a certificate. Do not call Select or call it with NULL
// to continue without using any certificate. |isProxy| indicates whether the
// host is an HTTPS proxy or the origin server. |host| and |port| contains the
// hostname and port of the SSL server. |certificates| is the list of
// certificates to choose from; this list has already been pruned by Chromium
// so that it only contains certificates from issuers that the server trusts.
///
/*--cef()--*/
virtual bool OnSelectClientCertificate(
CefRefPtr<CefBrowser> browser,
bool isProxy,
const CefString& host,
int port,
const X509CertificateList& certificates,
CefRefPtr<CefSelectClientCertificateCallback> callback) {
return false;
}
///
// Called on the browser process UI thread when a plugin has crashed.
// |plugin_path| is the path of the plugin that crashed.

View File

@@ -38,72 +38,10 @@
#define CEF_INCLUDE_CEF_SSL_INFO_H_
#pragma once
#include <vector>
#include "include/cef_base.h"
#include "include/cef_values.h"
///
// Class representing the issuer or subject field of an X.509 certificate.
///
/*--cef(source=library)--*/
class CefSSLCertPrincipal : public virtual CefBase {
public:
///
// Returns a name that can be used to represent the issuer. It tries in this
// order: CN, O and OU and returns the first non-empty one found.
///
/*--cef()--*/
virtual CefString GetDisplayName() =0;
///
// Returns the common name.
///
/*--cef()--*/
virtual CefString GetCommonName() =0;
///
// Returns the locality name.
///
/*--cef()--*/
virtual CefString GetLocalityName() =0;
///
// Returns the state or province name.
///
/*--cef()--*/
virtual CefString GetStateOrProvinceName() =0;
///
// Returns the country name.
///
/*--cef()--*/
virtual CefString GetCountryName() =0;
///
// Retrieve the list of street addresses.
///
/*--cef()--*/
virtual void GetStreetAddresses(std::vector<CefString>& addresses) =0;
///
// Retrieve the list of organization names.
///
/*--cef()--*/
virtual void GetOrganizationNames(std::vector<CefString>& names) =0;
///
// Retrieve the list of organization unit names.
///
/*--cef()--*/
virtual void GetOrganizationUnitNames(std::vector<CefString>& names) =0;
///
// Retrieve the list of domain components.
///
/*--cef()--*/
virtual void GetDomainComponents(std::vector<CefString>& components) =0;
};
#include "include/cef_x509_certificate.h"
///
// Class representing SSL information.
@@ -111,8 +49,6 @@ class CefSSLCertPrincipal : public virtual CefBase {
/*--cef(source=library)--*/
class CefSSLInfo : public virtual CefBase {
public:
typedef std::vector<CefRefPtr<CefBinaryValue> > IssuerChainBinaryList;
///
// Returns a bitmask containing any and all problems verifying the server
// certificate.
@@ -121,87 +57,24 @@ class CefSSLInfo : public virtual CefBase {
virtual cef_cert_status_t GetCertStatus() =0;
///
// Returns true if the certificate status has any error, major or minor.
// Returns the X.509 certificate.
///
/*--cef()--*/
virtual bool IsCertStatusError() =0;
///
// Returns true if the certificate status represents only minor errors
// (e.g. failure to verify certificate revocation).
///
/*--cef()--*/
virtual bool IsCertStatusMinorError() =0;
///
// Returns the subject of the X.509 certificate. For HTTPS server
// certificates this represents the web server. The common name of the
// subject should match the host name of the web server.
///
/*--cef()--*/
virtual CefRefPtr<CefSSLCertPrincipal> GetSubject() =0;
///
// Returns the issuer of the X.509 certificate.
///
/*--cef()--*/
virtual CefRefPtr<CefSSLCertPrincipal> GetIssuer() =0;
///
// Returns the DER encoded serial number for the X.509 certificate. The value
// possibly includes a leading 00 byte.
///
/*--cef()--*/
virtual CefRefPtr<CefBinaryValue> GetSerialNumber() =0;
///
// Returns the date before which the X.509 certificate is invalid.
// CefTime.GetTimeT() will return 0 if no date was specified.
///
/*--cef()--*/
virtual CefTime GetValidStart() =0;
///
// Returns the date after which the X.509 certificate is invalid.
// CefTime.GetTimeT() will return 0 if no date was specified.
///
/*--cef()--*/
virtual CefTime GetValidExpiry() =0;
///
// Returns the DER encoded data for the X.509 certificate.
///
/*--cef()--*/
virtual CefRefPtr<CefBinaryValue> GetDEREncoded() =0;
///
// Returns the PEM encoded data for the X.509 certificate.
///
/*--cef()--*/
virtual CefRefPtr<CefBinaryValue> GetPEMEncoded() =0;
///
// Returns the number of certificates in the issuer chain.
// If 0, the certificate is self-signed.
///
/*--cef()--*/
virtual size_t GetIssuerChainSize() =0;
///
// Returns the DER encoded data for the certificate issuer chain.
// If we failed to encode a certificate in the chain it is still
// present in the array but is an empty string.
///
/*--cef(count_func=chain:GetIssuerChainSize)--*/
virtual void GetDEREncodedIssuerChain(IssuerChainBinaryList& chain) =0;
///
// Returns the PEM encoded data for the certificate issuer chain.
// If we failed to encode a certificate in the chain it is still
// present in the array but is an empty string.
///
/*--cef(count_func=chain:GetIssuerChainSize)--*/
virtual void GetPEMEncodedIssuerChain(IssuerChainBinaryList& chain) =0;
virtual CefRefPtr<CefX509Certificate> GetX509Certificate() =0;
};
///
// Returns true if the certificate status has any error, major or minor.
///
/*--cef()--*/
bool CefIsCertStatusError(cef_cert_status_t status);
///
// Returns true if the certificate status represents only minor errors
// (e.g. failure to verify certificate revocation).
///
/*--cef()--*/
bool CefIsCertStatusMinorError(cef_cert_status_t status);
#endif // CEF_INCLUDE_CEF_SSL_INFO_H_

84
include/cef_ssl_status.h Normal file
View File

@@ -0,0 +1,84 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_CEF_SSL_STATUS_H_
#define CEF_INCLUDE_CEF_SSL_STATUS_H_
#pragma once
#include "include/cef_base.h"
#include "include/cef_values.h"
class CefX509Certificate;
///
// Class representing the SSL information for a navigation entry.
///
/*--cef(source=library)--*/
class CefSSLStatus : public virtual CefBase {
public:
///
// Returns true if the status is related to a secure SSL/TLS connection.
///
/*--cef()--*/
virtual bool IsSecureConnection() =0;
///
// Returns a bitmask containing any and all problems verifying the server
// certificate.
///
/*--cef(default_retval=CERT_STATUS_NONE)--*/
virtual cef_cert_status_t GetCertStatus() =0;
///
// Returns the SSL version used for the SSL connection.
///
/*--cef(default_retval=SSL_CONNECTION_VERSION_UNKNOWN)--*/
virtual cef_ssl_version_t GetSSLVersion() =0;
///
// Returns a bitmask containing the page security content status.
///
/*--cef(default_retval=SSL_CONTENT_NORMAL_CONTENT)--*/
virtual cef_ssl_content_status_t GetContentStatus() =0;
///
// Returns the X.509 certificate.
///
/*--cef()--*/
virtual CefRefPtr<CefX509Certificate> GetX509Certificate() =0;
};
#endif // CEF_INCLUDE_CEF_SSL_STATUS_H_

View File

@@ -206,13 +206,17 @@ class CefV8Context : public virtual CefBase {
virtual bool IsSame(CefRefPtr<CefV8Context> that) =0;
///
// Evaluates the specified JavaScript code using this context's global object.
// On success |retval| will be set to the return value, if any, and the
// function will return true. On failure |exception| will be set to the
// Execute a string of JavaScript code in this V8 context. The |script_url|
// parameter is the URL where the script in question can be found, if any.
// The |start_line| parameter is the base line number to use for error
// reporting. On success |retval| will be set to the return value, if any, and
// the function will return true. On failure |exception| will be set to the
// exception, if any, and the function will return false.
///
/*--cef()--*/
/*--cef(optional_param=script_url)--*/
virtual bool Eval(const CefString& code,
const CefString& script_url,
int start_line,
CefRefPtr<CefV8Value>& retval,
CefRefPtr<CefV8Exception>& exception) =0;
};
@@ -277,6 +281,74 @@ class CefV8Accessor : public virtual CefBase {
CefString& exception) =0;
};
///
// Interface that should be implemented to handle V8 interceptor calls. The
// methods of this class will be called on the thread associated with the V8
// interceptor. Interceptor's named property handlers (with first argument of
// type CefString) are called when object is indexed by string. Indexed property
// handlers (with first argument of type int) are called when object is indexed
// by integer.
///
/*--cef(source=client)--*/
class CefV8Interceptor : public virtual CefBase {
public:
///
// Handle retrieval of the interceptor value identified by |name|. |object| is
// the receiver ('this' object) of the interceptor. If retrieval succeeds, set
// |retval| to the return value. If the requested value does not exist, don't
// set either |retval| or |exception|. If retrieval fails, set |exception| to
// the exception that will be thrown. If the property has an associated
// accessor, it will be called only if you don't set |retval|.
// Return true if interceptor retrieval was handled, false otherwise.
///
/*--cef(capi_name=get_byname)--*/
virtual bool Get(const CefString& name,
const CefRefPtr<CefV8Value> object,
CefRefPtr<CefV8Value>& retval,
CefString& exception) =0;
///
// Handle retrieval of the interceptor value identified by |index|. |object|
// is the receiver ('this' object) of the interceptor. If retrieval succeeds,
// set |retval| to the return value. If the requested value does not exist,
// don't set either |retval| or |exception|. If retrieval fails, set
// |exception| to the exception that will be thrown.
// Return true if interceptor retrieval was handled, false otherwise.
///
/*--cef(capi_name=get_byindex,index_param=index)--*/
virtual bool Get(int index,
const CefRefPtr<CefV8Value> object,
CefRefPtr<CefV8Value>& retval,
CefString& exception) =0;
///
// Handle assignment of the interceptor value identified by |name|. |object|
// is the receiver ('this' object) of the interceptor. |value| is the new
// value being assigned to the interceptor. If assignment fails, set
// |exception| to the exception that will be thrown. This setter will always
// be called, even when the property has an associated accessor.
// Return true if interceptor assignment was handled, false otherwise.
///
/*--cef(capi_name=set_byname)--*/
virtual bool Set(const CefString& name,
const CefRefPtr<CefV8Value> object,
const CefRefPtr<CefV8Value> value,
CefString& exception) =0;
///
// Handle assignment of the interceptor value identified by |index|. |object|
// is the receiver ('this' object) of the interceptor. |value| is the new
// value being assigned to the interceptor. If assignment fails, set
// |exception| to the exception that will be thrown.
// Return true if interceptor assignment was handled, false otherwise.
///
/*--cef(capi_name=set_byindex,index_param=index)--*/
virtual bool Set(int index,
const CefRefPtr<CefV8Value> object,
const CefRefPtr<CefV8Value> value,
CefString& exception) =0;
};
///
// Class representing a V8 exception. The methods of this class may be called on
// any render process thread.
@@ -404,14 +476,16 @@ class CefV8Value : public virtual CefBase {
static CefRefPtr<CefV8Value> CreateString(const CefString& value);
///
// Create a new CefV8Value object of type object with optional accessor. This
// method should only be called from within the scope of a
// Create a new CefV8Value object of type object with optional accessor and/or
// interceptor. This method should only be called from within the scope of a
// CefRenderProcessHandler, CefV8Handler or CefV8Accessor callback, or in
// combination with calling Enter() and Exit() on a stored CefV8Context
// reference.
///
/*--cef(optional_param=accessor)--*/
static CefRefPtr<CefV8Value> CreateObject(CefRefPtr<CefV8Accessor> accessor);
/*--cef(optional_param=accessor, optional_param=interceptor)--*/
static CefRefPtr<CefV8Value> CreateObject(
CefRefPtr<CefV8Accessor> accessor,
CefRefPtr<CefV8Interceptor> interceptor);
///
// Create a new CefV8Value object of type array with the specified |length|.
@@ -515,43 +589,37 @@ class CefV8Value : public virtual CefBase {
virtual bool IsSame(CefRefPtr<CefV8Value> that) =0;
///
// Return a bool value. The underlying data will be converted to if
// necessary.
// Return a bool value.
///
/*--cef()--*/
virtual bool GetBoolValue() =0;
///
// Return an int value. The underlying data will be converted to if
// necessary.
// Return an int value.
///
/*--cef()--*/
virtual int32 GetIntValue() =0;
///
// Return an unisgned int value. The underlying data will be converted to if
// necessary.
// Return an unsigned int value.
///
/*--cef()--*/
virtual uint32 GetUIntValue() =0;
///
// Return a double value. The underlying data will be converted to if
// necessary.
// Return a double value.
///
/*--cef()--*/
virtual double GetDoubleValue() =0;
///
// Return a Date value. The underlying data will be converted to if
// necessary.
// Return a Date value.
///
/*--cef()--*/
virtual CefTime GetDateValue() =0;
///
// Return a string value. The underlying data will be converted to if
// necessary.
// Return a string value.
///
/*--cef()--*/
virtual CefString GetStringValue() =0;

View File

@@ -144,5 +144,71 @@ class CefWebPluginUnstableCallback : public virtual CefBase {
void CefIsWebPluginUnstable(const CefString& path,
CefRefPtr<CefWebPluginUnstableCallback> callback);
///
// Implement this interface to receive notification when CDM registration is
// complete. The methods of this class will be called on the browser process
// UI thread.
///
/*--cef(source=client)--*/
class CefRegisterCdmCallback : public virtual CefBase {
public:
///
// Method that will be called when CDM registration is complete. |result|
// will be CEF_CDM_REGISTRATION_ERROR_NONE if registration completed
// successfully. Otherwise, |result| and |error_message| will contain
// additional information about why registration failed.
///
/*--cef(optional_param=error_message)--*/
virtual void OnCdmRegistrationComplete(cef_cdm_registration_error_t result,
const CefString& error_message) =0;
};
///
// Register the Widevine CDM plugin.
//
// The client application is responsible for downloading an appropriate
// platform-specific CDM binary distribution from Google, extracting the
// contents, and building the required directory structure on the local machine.
// The CefBrowserHost::StartDownload method and CefZipArchive class can be used
// to implement this functionality in CEF. Contact Google via
// https://www.widevine.com/contact.html for details on CDM download.
//
// |path| is a directory that must contain the following files:
// 1. manifest.json file from the CDM binary distribution (see below).
// 2. widevinecdm file from the CDM binary distribution (e.g.
// widevinecdm.dll on on Windows, libwidevinecdm.dylib on OS X,
// libwidevinecdm.so on Linux).
// 3. widevidecdmadapter file from the CEF binary distribution (e.g.
// widevinecdmadapter.dll on Windows, widevinecdmadapter.plugin on OS X,
// libwidevinecdmadapter.so on Linux).
//
// If any of these files are missing or if the manifest file has incorrect
// contents the registration will fail and |callback| will receive a |result|
// value of CEF_CDM_REGISTRATION_ERROR_INCORRECT_CONTENTS.
//
// The manifest.json file must contain the following keys:
// A. "os": Supported OS (e.g. "mac", "win" or "linux").
// B. "arch": Supported architecture (e.g. "ia32" or "x64").
// C. "x-cdm-module-versions": Module API version (e.g. "4").
// D. "x-cdm-interface-versions": Interface API version (e.g. "8").
// E. "x-cdm-host-versions": Host API version (e.g. "8").
// F. "version": CDM version (e.g. "1.4.8.903").
// G. "x-cdm-codecs": List of supported codecs (e.g. "vp8,vp9.0,avc1").
//
// A through E are used to verify compatibility with the current Chromium
// version. If the CDM is not compatible the registration will fail and
// |callback| will receive a |result| value of
// CEF_CDM_REGISTRATION_ERROR_INCOMPATIBLE.
//
// |callback| will be executed asynchronously once registration is complete.
//
// On Linux this function must be called before CefInitialize() and the
// registration cannot be changed during runtime. If registration is not
// supported at the time that CefRegisterWidevineCdm() is called then |callback|
// will receive a |result| value of CEF_CDM_REGISTRATION_ERROR_NOT_SUPPORTED.
///
/*--cef(optional_param=callback)--*/
void CefRegisterWidevineCdm(const CefString& path,
CefRefPtr<CefRegisterCdmCallback> callback);
#endif // CEF_INCLUDE_CEF_WEB_PLUGIN_H_

View File

@@ -0,0 +1,188 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_CEF_X509_CERTIFICATE_H_
#define CEF_INCLUDE_CEF_X509_CERTIFICATE_H_
#pragma once
#include <vector>
#include "include/cef_base.h"
#include "include/cef_values.h"
///
// Class representing the issuer or subject field of an X.509 certificate.
///
/*--cef(source=library)--*/
class CefX509CertPrincipal : public virtual CefBase {
public:
///
// Returns a name that can be used to represent the issuer. It tries in this
// order: Common Name (CN), Organization Name (O) and Organizational Unit
// Name (OU) and returns the first non-empty one found.
///
/*--cef()--*/
virtual CefString GetDisplayName() =0;
///
// Returns the common name.
///
/*--cef()--*/
virtual CefString GetCommonName() =0;
///
// Returns the locality name.
///
/*--cef()--*/
virtual CefString GetLocalityName() =0;
///
// Returns the state or province name.
///
/*--cef()--*/
virtual CefString GetStateOrProvinceName() =0;
///
// Returns the country name.
///
/*--cef()--*/
virtual CefString GetCountryName() =0;
///
// Retrieve the list of street addresses.
///
/*--cef()--*/
virtual void GetStreetAddresses(std::vector<CefString>& addresses) =0;
///
// Retrieve the list of organization names.
///
/*--cef()--*/
virtual void GetOrganizationNames(std::vector<CefString>& names) =0;
///
// Retrieve the list of organization unit names.
///
/*--cef()--*/
virtual void GetOrganizationUnitNames(std::vector<CefString>& names) =0;
///
// Retrieve the list of domain components.
///
/*--cef()--*/
virtual void GetDomainComponents(std::vector<CefString>& components) =0;
};
///
// Class representing a X.509 certificate.
///
/*--cef(source=library)--*/
class CefX509Certificate : public virtual CefBase {
public:
typedef std::vector<CefRefPtr<CefBinaryValue> > IssuerChainBinaryList;
///
// Returns the subject of the X.509 certificate. For HTTPS server
// certificates this represents the web server. The common name of the
// subject should match the host name of the web server.
///
/*--cef()--*/
virtual CefRefPtr<CefX509CertPrincipal> GetSubject() =0;
///
// Returns the issuer of the X.509 certificate.
///
/*--cef()--*/
virtual CefRefPtr<CefX509CertPrincipal> GetIssuer() =0;
///
// Returns the DER encoded serial number for the X.509 certificate. The value
// possibly includes a leading 00 byte.
///
/*--cef()--*/
virtual CefRefPtr<CefBinaryValue> GetSerialNumber() =0;
///
// Returns the date before which the X.509 certificate is invalid.
// CefTime.GetTimeT() will return 0 if no date was specified.
///
/*--cef()--*/
virtual CefTime GetValidStart() =0;
///
// Returns the date after which the X.509 certificate is invalid.
// CefTime.GetTimeT() will return 0 if no date was specified.
///
/*--cef()--*/
virtual CefTime GetValidExpiry() =0;
///
// Returns the DER encoded data for the X.509 certificate.
///
/*--cef()--*/
virtual CefRefPtr<CefBinaryValue> GetDEREncoded() =0;
///
// Returns the PEM encoded data for the X.509 certificate.
///
/*--cef()--*/
virtual CefRefPtr<CefBinaryValue> GetPEMEncoded() =0;
///
// Returns the number of certificates in the issuer chain.
// If 0, the certificate is self-signed.
///
/*--cef()--*/
virtual size_t GetIssuerChainSize() =0;
///
// Returns the DER encoded data for the certificate issuer chain.
// If we failed to encode a certificate in the chain it is still
// present in the array but is an empty string.
///
/*--cef(count_func=chain:GetIssuerChainSize)--*/
virtual void GetDEREncodedIssuerChain(IssuerChainBinaryList& chain) =0;
///
// Returns the PEM encoded data for the certificate issuer chain.
// If we failed to encode a certificate in the chain it is still
// present in the array but is an empty string.
///
/*--cef(count_func=chain:GetIssuerChainSize)--*/
virtual void GetPEMEncodedIssuerChain(IssuerChainBinaryList& chain) =0;
};
#endif // CEF_INCLUDE_CEF_X509_CERTIFICATE_H_

View File

@@ -376,6 +376,19 @@ typedef struct _cef_settings_t {
///
int ignore_certificate_errors;
///
// Set to true (1) to enable date-based expiration of built in network
// security information (i.e. certificate transparency logs, HSTS preloading
// and pinning information). Enabling this option improves network security
// but may cause HTTPS load failures when using CEF binaries built more than
// 10 weeks in the past. See https://www.certificate-transparency.org/ and
// https://www.chromium.org/hsts for details. Also configurable using the
// "enable-net-security-expiration" command-line switch. Can be overridden for
// individual CefRequestContext instances via the
// CefRequestContextSettings.enable_net_security_expiration value.
///
int enable_net_security_expiration;
///
// Opaque background color used for accelerated content. By default the
// background color will be white. Only the RGB compontents of the specified
@@ -443,6 +456,17 @@ typedef struct _cef_request_context_settings_t {
///
int ignore_certificate_errors;
///
// Set to true (1) to enable date-based expiration of built in network
// security information (i.e. certificate transparency logs, HSTS preloading
// and pinning information). Enabling this option improves network security
// but may cause HTTPS load failures when using CEF binaries built more than
// 10 weeks in the past. See https://www.certificate-transparency.org/ and
// https://www.chromium.org/hsts for details. Can be set globally using the
// CefSettings.enable_net_security_expiration value.
///
int enable_net_security_expiration;
///
// Comma delimited ordered list of language codes without any whitespace that
// will be used in the "Accept-Language" HTTP header. Can be set globally
@@ -2636,6 +2660,52 @@ typedef enum {
CEF_MENU_ANCHOR_BOTTOMCENTER,
} cef_menu_anchor_position_t;
// Supported SSL version values. See net/ssl/ssl_connection_status_flags.h
// for more information.
typedef enum {
SSL_CONNECTION_VERSION_UNKNOWN = 0, // Unknown SSL version.
SSL_CONNECTION_VERSION_SSL2 = 1,
SSL_CONNECTION_VERSION_SSL3 = 2,
SSL_CONNECTION_VERSION_TLS1 = 3,
SSL_CONNECTION_VERSION_TLS1_1 = 4,
SSL_CONNECTION_VERSION_TLS1_2 = 5,
// Reserve 6 for TLS 1.3.
SSL_CONNECTION_VERSION_QUIC = 7,
} cef_ssl_version_t;
// Supported SSL content status flags. See content/public/common/ssl_status.h
// for more information.
typedef enum {
SSL_CONTENT_NORMAL_CONTENT = 0,
SSL_CONTENT_DISPLAYED_INSECURE_CONTENT = 1 << 0,
SSL_CONTENT_RAN_INSECURE_CONTENT = 1 << 1,
} cef_ssl_content_status_t;
///
// Error codes for CDM registration. See cef_web_plugin.h for details.
///
typedef enum {
///
// No error. Registration completed successfully.
///
CEF_CDM_REGISTRATION_ERROR_NONE,
///
// Required files or manifest contents are missing.
///
CEF_CDM_REGISTRATION_ERROR_INCORRECT_CONTENTS,
///
// The CDM is incompatible with the current Chromium version.
///
CEF_CDM_REGISTRATION_ERROR_INCOMPATIBLE,
///
// CDM registration is not supported at this time.
///
CEF_CDM_REGISTRATION_ERROR_NOT_SUPPORTED,
} cef_cdm_registration_error_t;
#ifdef __cplusplus
}
#endif

View File

@@ -607,6 +607,8 @@ struct CefSettingsTraits {
target->uncaught_exception_stack_size = src->uncaught_exception_stack_size;
target->context_safety_implementation = src->context_safety_implementation;
target->ignore_certificate_errors = src->ignore_certificate_errors;
target->enable_net_security_expiration =
src->enable_net_security_expiration;
target->background_color = src->background_color;
cef_string_set(src->accept_language_list.str,
@@ -639,6 +641,8 @@ struct CefRequestContextSettingsTraits {
target->persist_session_cookies = src->persist_session_cookies;
target->persist_user_preferences = src->persist_user_preferences;
target->ignore_certificate_errors = src->ignore_certificate_errors;
target->enable_net_security_expiration =
src->enable_net_security_expiration;
cef_string_set(src->accept_language_list.str,
src->accept_language_list.length, &target->accept_language_list, copy);
}

View File

@@ -893,6 +893,22 @@ void CefBrowserHostImpl::GetNavigationEntries(
}
}
CefRefPtr<CefNavigationEntry> CefBrowserHostImpl::GetVisibleNavigationEntry() {
if (!CEF_CURRENTLY_ON_UIT()) {
NOTREACHED() << "called on invalid thread";
return nullptr;
}
content::NavigationEntry* entry = nullptr;
if (web_contents())
entry = web_contents()->GetController().GetVisibleEntry();
if (!entry)
return nullptr;
return new CefNavigationEntryImpl(entry);
}
void CefBrowserHostImpl::SetMouseCursorChangeDisabled(bool disabled) {
base::AutoLock lock_scope(state_lock_);
mouse_cursor_change_disabled_ = disabled;

View File

@@ -218,6 +218,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
void DragTargetDrop(const CefMouseEvent& event) override;
void DragSourceSystemDragEnded() override;
void DragSourceEndedAt(int x, int y, DragOperationsMask op) override;
CefRefPtr<CefNavigationEntry> GetVisibleNavigationEntry() override;
// CefBrowser methods.
CefRefPtr<CefBrowserHost> GetHost() override;

View File

@@ -228,11 +228,6 @@ void CefBrowserMainParts::PostMainMessageLoopRun() {
}
global_browser_context_ = NULL;
#if DCHECK_IS_ON()
// No CefBrowserContext instances should exist at this point.
DCHECK_EQ(0, CefBrowserContext::DebugObjCt);
#endif
}
void CefBrowserMainParts::PostDestroyThreads() {
@@ -240,9 +235,4 @@ void CefBrowserMainParts::PostDestroyThreads() {
// Delete the DesktopTestViewsDelegate.
delete views::ViewsDelegate::GetInstance();
#endif
#if DCHECK_IS_ON()
// No CefURLRequestContext instances should exist at this point.
DCHECK_EQ(0, CefURLRequestContext::DebugObjCt);
#endif
}

View File

@@ -41,7 +41,9 @@ class CefURLFetcherDelegate : public net::URLFetcherDelegate {
// net::URLFetcherDelegate methods.
void OnURLFetchComplete(const net::URLFetcher* source) override;
void OnURLFetchDownloadProgress(const net::URLFetcher* source,
int64 current, int64 total) override;
int64_t current,
int64_t total,
int64_t current_network_bytes) override;
void OnURLFetchUploadProgress(const net::URLFetcher* source,
int64 current, int64 total) override;
@@ -402,7 +404,9 @@ void CefURLFetcherDelegate::OnURLFetchComplete(
void CefURLFetcherDelegate::OnURLFetchDownloadProgress(
const net::URLFetcher* source,
int64 current, int64 total) {
int64_t current,
int64_t total,
int64_t current_network_bytes) {
context_->OnDownloadProgress(current, total);
}

View File

@@ -7,33 +7,13 @@
#include "libcef/browser/browser_context_impl.h"
#include "libcef/browser/chrome_profile_manager_stub.h"
#include "libcef/browser/component_updater/cef_component_updater_configurator.h"
#include "libcef/browser/content_browser_client.h"
#include "libcef/browser/thread_util.h"
#include "libcef/common/cef_switches.h"
#include "base/command_line.h"
#include "base/threading/thread_restrictions.h"
#include "chrome/browser/component_updater/widevine_cdm_component_installer.h"
#include "chrome/browser/printing/print_job_manager.h"
#include "components/component_updater/component_updater_service.h"
#include "components/update_client/configurator.h"
#include "ui/message_center/message_center.h"
namespace {
void RegisterComponentsForUpdate(
component_updater::ComponentUpdateService* cus) {
base::ThreadRestrictions::ScopedAllowIO scoped_allow_io;
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableWidevineCdm)) {
RegisterWidevineCdmComponent(cus);
}
}
} // namespace
ChromeBrowserProcessStub::ChromeBrowserProcessStub()
: initialized_(false),
shutdown_(false),
@@ -57,19 +37,6 @@ void ChromeBrowserProcessStub::Initialize() {
profile_manager_.reset(new ChromeProfileManagerStub());
event_router_forwarder_ = new extensions::EventRouterForwarder();
// Creating the component updater does not do anything initially. Components
// need to be registered and Start() needs to be called.
scoped_refptr<CefBrowserContextImpl> browser_context =
CefContentBrowserClient::Get()->browser_context();
scoped_refptr<update_client::Configurator> configurator =
component_updater::MakeCefComponentUpdaterConfigurator(
base::CommandLine::ForCurrentProcess(),
browser_context->request_context().get(),
browser_context->GetPrefs());
component_updater_.reset(component_updater::ComponentUpdateServiceFactory(
configurator).release());
RegisterComponentsForUpdate(component_updater_.get());
initialized_ = true;
}
@@ -86,7 +53,6 @@ void ChromeBrowserProcessStub::Shutdown() {
profile_manager_.reset();
event_router_forwarder_ = nullptr;
component_updater_.reset();
shutdown_ = true;
}
@@ -299,7 +265,8 @@ net_log::ChromeNetLog* ChromeBrowserProcessStub::net_log() {
component_updater::ComponentUpdateService*
ChromeBrowserProcessStub::component_updater() {
return component_updater_.get();
NOTIMPLEMENTED();
return NULL;
}
CRLSetFetcher* ChromeBrowserProcessStub::crl_set_fetcher() {

View File

@@ -17,10 +17,6 @@
#include "chrome/browser/profiles/incognito_helpers.h"
#include "base/compiler_specific.h"
namespace component_updater {
class ComponentUpdateService;
}
class ChromeProfileManagerStub;
class BackgroundModeManager {
@@ -126,7 +122,6 @@ class ChromeBrowserProcessStub : public BrowserProcess,
std::unique_ptr<printing::PrintJobManager> print_job_manager_;
std::unique_ptr<ChromeProfileManagerStub> profile_manager_;
scoped_refptr<extensions::EventRouterForwarder> event_router_forwarder_;
std::unique_ptr<component_updater::ComponentUpdateService> component_updater_;
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserProcessStub);
};

View File

@@ -1,182 +0,0 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/component_updater/cef_component_updater_configurator.h"
#include "include/cef_version.h"
#include "base/version.h"
#include "chrome/common/pref_names.h"
#include "components/component_updater/configurator_impl.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "components/update_client/component_patcher_operation.h"
#include "content/public/browser/browser_thread.h"
namespace component_updater {
namespace {
class CefConfigurator : public update_client::Configurator {
public:
CefConfigurator(const base::CommandLine* cmdline,
net::URLRequestContextGetter* url_request_getter,
PrefService* pref_service);
int InitialDelay() const override;
int NextCheckDelay() const override;
int StepDelay() const override;
int OnDemandDelay() const override;
int UpdateDelay() const override;
std::vector<GURL> UpdateUrl() const override;
std::vector<GURL> PingUrl() const override;
base::Version GetBrowserVersion() const override;
std::string GetChannel() const override;
std::string GetBrand() const override;
std::string GetLang() const override;
std::string GetOSLongName() const override;
std::string ExtraRequestParams() const override;
std::string GetDownloadPreference() const override;
net::URLRequestContextGetter* RequestContext() const override;
scoped_refptr<update_client::OutOfProcessPatcher>
CreateOutOfProcessPatcher() const override;
bool EnabledDeltas() const override;
bool EnabledComponentUpdates() const override;
bool EnabledBackgroundDownloader() const override;
bool EnabledCupSigning() const override;
scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner()
const override;
PrefService* GetPrefService() const override;
private:
friend class base::RefCountedThreadSafe<CefConfigurator>;
~CefConfigurator() override {}
ConfiguratorImpl configurator_impl_;
PrefService* pref_service_;
};
CefConfigurator::CefConfigurator(
const base::CommandLine* cmdline,
net::URLRequestContextGetter* url_request_getter,
PrefService* pref_service)
: configurator_impl_(cmdline, url_request_getter, false),
pref_service_(pref_service) {
DCHECK(pref_service_);
}
int CefConfigurator::InitialDelay() const {
return configurator_impl_.InitialDelay();
}
int CefConfigurator::NextCheckDelay() const {
return configurator_impl_.NextCheckDelay();
}
int CefConfigurator::StepDelay() const {
return configurator_impl_.StepDelay();
}
int CefConfigurator::OnDemandDelay() const {
return configurator_impl_.OnDemandDelay();
}
int CefConfigurator::UpdateDelay() const {
return configurator_impl_.UpdateDelay();
}
std::vector<GURL> CefConfigurator::UpdateUrl() const {
return configurator_impl_.UpdateUrl();
}
std::vector<GURL> CefConfigurator::PingUrl() const {
return configurator_impl_.PingUrl();
}
base::Version CefConfigurator::GetBrowserVersion() const {
return configurator_impl_.GetBrowserVersion();
}
std::string CefConfigurator::GetChannel() const {
return std::string();
}
std::string CefConfigurator::GetBrand() const {
return std::string();
}
std::string CefConfigurator::GetLang() const {
return std::string();
}
std::string CefConfigurator::GetOSLongName() const {
return configurator_impl_.GetOSLongName();
}
std::string CefConfigurator::ExtraRequestParams() const {
return configurator_impl_.ExtraRequestParams();
}
std::string CefConfigurator::GetDownloadPreference() const {
return std::string();
}
net::URLRequestContextGetter* CefConfigurator::RequestContext() const {
return configurator_impl_.RequestContext();
}
scoped_refptr<update_client::OutOfProcessPatcher>
CefConfigurator::CreateOutOfProcessPatcher() const {
return nullptr;
}
bool CefConfigurator::EnabledDeltas() const {
return configurator_impl_.EnabledDeltas();
}
bool CefConfigurator::EnabledComponentUpdates() const {
return pref_service_->GetBoolean(prefs::kComponentUpdatesEnabled);
}
bool CefConfigurator::EnabledBackgroundDownloader() const {
return configurator_impl_.EnabledBackgroundDownloader();
}
bool CefConfigurator::EnabledCupSigning() const {
return configurator_impl_.EnabledCupSigning();
}
// Returns a task runner to run blocking tasks. The task runner continues to run
// after the browser shuts down, until the OS terminates the process. This
// imposes certain requirements for the code using the task runner, such as
// not accessing any global browser state while the code is running.
scoped_refptr<base::SequencedTaskRunner>
CefConfigurator::GetSequencedTaskRunner() const {
return content::BrowserThread::GetBlockingPool()
->GetSequencedTaskRunnerWithShutdownBehavior(
base::SequencedWorkerPool::GetSequenceToken(),
base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
}
PrefService* CefConfigurator::GetPrefService() const {
return pref_service_;
}
} // namespace
void RegisterPrefsForCefComponentUpdaterConfigurator(
PrefRegistrySimple* registry) {
// The component updates are enabled by default, if the preference is not set.
registry->RegisterBooleanPref(prefs::kComponentUpdatesEnabled, true);
}
scoped_refptr<update_client::Configurator>
MakeCefComponentUpdaterConfigurator(
const base::CommandLine* cmdline,
net::URLRequestContextGetter* context_getter,
PrefService* pref_service) {
return new CefConfigurator(cmdline, context_getter, pref_service);
}
} // namespace component_updater

View File

@@ -1,39 +0,0 @@
// Copyright 2014 The Chromium 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 LIBCEF_BROWSER_COMPONENT_UPDATER_CEF_COMPONENT_UPDATER_CONFIGURATOR_H_
#define LIBCEF_BROWSER_COMPONENT_UPDATER_CEF_COMPONENT_UPDATER_CONFIGURATOR_H_
#include "base/memory/ref_counted.h"
#include "components/update_client/configurator.h"
namespace base {
class CommandLine;
}
namespace net {
class URLRequestContextGetter;
}
class PrefRegistrySimple;
class PrefService;
namespace component_updater {
// Registers preferences associated with the component updater configurator
// for CEF. The preferences must be registered with the local pref store
// before they can be queried by the configurator instance.
// This function is called before MakeCefComponentUpdaterConfigurator.
void RegisterPrefsForCefComponentUpdaterConfigurator(
PrefRegistrySimple* registry);
scoped_refptr<update_client::Configurator>
MakeCefComponentUpdaterConfigurator(
const base::CommandLine* cmdline,
net::URLRequestContextGetter* context_getter,
PrefService* pref_service);
} // namespace component_updater
#endif // LIBCEF_BROWSER_COMPONENT_UPDATER_CEF_COMPONENT_UPDATER_CONFIGURATOR_H_

View File

@@ -27,6 +27,7 @@
#include "libcef/browser/speech_recognition_manager_delegate.h"
#include "libcef/browser/ssl_info_impl.h"
#include "libcef/browser/thread_util.h"
#include "libcef/browser/x509_certificate_impl.h"
#include "libcef/common/cef_messages.h"
#include "libcef/common/cef_switches.h"
#include "libcef/common/command_line_impl.h"
@@ -75,6 +76,10 @@
#include "ui/base/ui_base_switches.h"
#include "url/gurl.h"
#if defined(OS_LINUX)
#include "libcef/common/widevine_loader.h"
#endif
#if defined(OS_MACOSX)
#include "components/spellcheck/browser/spellcheck_message_filter_platform.h"
#endif
@@ -203,6 +208,58 @@ class CefAllowCertificateErrorCallbackImpl : public CefRequestCallback {
DISALLOW_COPY_AND_ASSIGN(CefAllowCertificateErrorCallbackImpl);
};
class CefSelectClientCertificateCallbackImpl :
public CefSelectClientCertificateCallback {
public:
explicit CefSelectClientCertificateCallbackImpl(
std::unique_ptr<content::ClientCertificateDelegate> delegate)
: delegate_(std::move(delegate)) {
}
~CefSelectClientCertificateCallbackImpl() {
// If Select has not been called, call it with NULL to continue without any
// client certificate.
if (delegate_)
DoSelect(NULL);
}
void Select(CefRefPtr<CefX509Certificate> cert) override {
if (delegate_)
DoSelect(cert);
}
private:
void DoSelect(CefRefPtr<CefX509Certificate> cert) {
if (CEF_CURRENTLY_ON_UIT()) {
RunNow(std::move(delegate_), cert);
} else {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefSelectClientCertificateCallbackImpl::RunNow,
base::Passed(std::move(delegate_)), cert));
}
}
static void RunNow(
std::unique_ptr<content::ClientCertificateDelegate> delegate,
CefRefPtr<CefX509Certificate> cert) {
CEF_REQUIRE_UIT();
scoped_refptr<net::X509Certificate> x509cert = NULL;
if (cert) {
CefX509CertificateImpl* certImpl =
static_cast<CefX509CertificateImpl*>(cert.get());
x509cert = certImpl->GetInternalCertObject();
}
delegate->ContinueWithCertificate(x509cert.get());
}
std::unique_ptr<content::ClientCertificateDelegate> delegate_;
IMPLEMENT_REFCOUNTING(CefSelectClientCertificateCallbackImpl);
DISALLOW_COPY_AND_ASSIGN(CefSelectClientCertificateCallbackImpl);
};
class CefQuotaPermissionContext : public content::QuotaPermissionContext {
public:
CefQuotaPermissionContext() {
@@ -574,8 +631,6 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
switches::kPpapiFlashPath,
switches::kPpapiFlashVersion,
switches::kUncaughtExceptionStackSize,
switches::kWidevineCdmPath,
switches::kWidevineCdmVersion,
};
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
arraysize(kSwitchNames));
@@ -597,17 +652,25 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
#if defined(OS_LINUX)
if (process_type == switches::kZygoteProcess) {
// Propagate the following switches to the zygone command line (along with
// Propagate the following switches to the zygote command line (along with
// any associated values) if present in the browser command line.
static const char* const kSwitchNames[] = {
switches::kPpapiFlashPath,
switches::kPpapiFlashVersion,
switches::kWidevineCdmPath,
switches::kWidevineCdmVersion,
};
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
arraysize(kSwitchNames));
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
if (!browser_cmd->HasSwitch(switches::kNoSandbox)) {
// Pass the Widevine CDM path to the Zygote process. See comments in
// CefWidevineLoader::AddPepperPlugins.
const base::FilePath& cdm_path = CefWidevineLoader::GetInstance()->path();
if (!cdm_path.empty())
command_line->AppendSwitchPath(switches::kWidevineCdmPath, cdm_path);
}
#endif
if (browser_cmd->HasSwitch(switches::kBrowserSubprocessPath)) {
// Force use of the sub-process executable path for the zygote process.
const base::FilePath& subprocess_path =
@@ -701,9 +764,40 @@ void CefContentBrowserClient::SelectClientCertificate(
content::WebContents* web_contents,
net::SSLCertRequestInfo* cert_request_info,
std::unique_ptr<content::ClientCertificateDelegate> delegate) {
if (!cert_request_info->client_certs.empty()) {
// Use the first certificate.
delegate->ContinueWithCertificate(cert_request_info->client_certs[0].get());
CEF_REQUIRE_UIT();
CefRefPtr<CefRequestHandler> handler;
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForContents(web_contents);
if (browser.get()) {
CefRefPtr<CefClient> client = browser->GetClient();
if (client.get())
handler = client->GetRequestHandler();
}
if (!handler.get()) {
delegate->ContinueWithCertificate(NULL);
return;
}
CefRequestHandler::X509CertificateList certs;
for (std::vector<scoped_refptr<net::X509Certificate> >::iterator iter =
cert_request_info->client_certs.begin();
iter != cert_request_info->client_certs.end(); iter++) {
certs.push_back(new CefX509CertificateImpl(*iter));
}
CefRefPtr<CefSelectClientCertificateCallbackImpl> callbackImpl(
new CefSelectClientCertificateCallbackImpl(std::move(delegate)));
bool proceed = handler->OnSelectClientCertificate(
browser.get(), cert_request_info->is_proxy,
cert_request_info->host_and_port.host(),
cert_request_info->host_and_port.port(),
certs, callbackImpl.get());
if (!proceed && !certs.empty()) {
callbackImpl->Select(certs[0]);
}
}

View File

@@ -13,6 +13,7 @@
#include "libcef/browser/trace_subscriber.h"
#include "libcef/common/cef_switches.h"
#include "libcef/common/main_delegate.h"
#include "libcef/common/widevine_loader.h"
#include "libcef/renderer/content_renderer_client.h"
#include "base/base_switches.h"
@@ -367,6 +368,9 @@ void CefContext::PopulateRequestContextSettings(
settings->ignore_certificate_errors =
settings_.ignore_certificate_errors ||
command_line->HasSwitch(switches::kIgnoreCertificateErrors);
settings->enable_net_security_expiration =
settings_.enable_net_security_expiration ||
command_line->HasSwitch(switches::kEnableNetSecurityExpiration);
CefString(&settings->accept_language_list) =
CefString(&settings_.accept_language_list);
}
@@ -376,6 +380,10 @@ void CefContext::OnContextInitialized() {
static_cast<ChromeBrowserProcessStub*>(g_browser_process)->Initialize();
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
CefWidevineLoader::GetInstance()->OnContextInitialized();
#endif
// Notify the handler.
CefRefPtr<CefApp> app = CefContentClient::Get()->application();
if (app.get()) {

View File

@@ -359,7 +359,7 @@ void CefFileDialogManager::OnRunFileChooserUploadFolderDelegateCallback(
} else {
lister_.reset(new net::DirectoryLister(
file_paths[0],
net::DirectoryLister::NO_SORT,
net::DirectoryLister::NO_SORT_RECURSIVE,
new UploadFolderHelper(
base::Bind(&CefFileDialogManager::OnRunFileChooserDelegateCallback,
weak_ptr_factory_.GetWeakPtr(), mode))));

View File

@@ -240,8 +240,12 @@ void CefFrameHostImpl::SendJavaScript(
int startLine) {
if (jsCode.empty())
return;
if (startLine < 0)
startLine = 0;
if (startLine <= 0) {
// A value of 0 is v8::Message::kNoLineNumberInfo in V8. There is code in
// V8 that will assert on that value (e.g. V8StackTraceImpl::Frame::Frame
// if a JS exception is thrown) so make sure |startLine| > 0.
startLine = 1;
}
CefRefPtr<CefBrowserHostImpl> browser;
int64 frame_id;

View File

@@ -70,18 +70,6 @@
browser_ = browser;
[window_ setDelegate:self];
// Register for application hide/unhide notifications.
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(applicationDidHide:)
name:NSApplicationDidHideNotification
object:nil];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(applicationDidUnhide:)
name:NSApplicationDidUnhideNotification
object:nil];
}
return self;
}

View File

@@ -4,6 +4,7 @@
#include "libcef/browser/navigation_entry_impl.h"
#include "libcef/browser/ssl_status_impl.h"
#include "libcef/common/time_util.h"
#include "content/public/browser/navigation_entry.h"
@@ -62,3 +63,9 @@ int CefNavigationEntryImpl::GetHttpStatusCode() {
CEF_VALUE_VERIFY_RETURN(false, 0);
return const_value().GetHttpStatusCode();
}
CefRefPtr<CefSSLStatus> CefNavigationEntryImpl::GetSSLStatus() {
CEF_VALUE_VERIFY_RETURN(false, nullptr);
return new CefSSLStatusImpl(const_value().GetSSL());
}

View File

@@ -29,6 +29,7 @@ class CefNavigationEntryImpl
bool HasPostData() override;
CefTime GetCompletionTime() override;
int GetHttpStatusCode() override;
CefRefPtr<CefSSLStatus> GetSSLStatus() override;
private:
DISALLOW_COPY_AND_ASSIGN(CefNavigationEntryImpl);

View File

@@ -34,6 +34,8 @@
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
#include "net/cert/cert_verifier.h"
#include "net/cert/ct_known_logs.h"
#include "net/cert/ct_log_verifier.h"
#include "net/cert/ct_policy_enforcer.h"
#include "net/cert/multi_log_ct_verifier.h"
#include "net/cookies/cookie_monster.h"
@@ -47,8 +49,6 @@
#include "net/http/http_util.h"
#include "net/http/transport_security_state.h"
#include "net/proxy/proxy_service.h"
#include "net/ssl/channel_id_service.h"
#include "net/ssl/default_channel_id_store.h"
#include "net/ssl/ssl_config_service_defaults.h"
#include "url/url_constants.h"
#include "net/url_request/http_user_agent_settings.h"
@@ -139,6 +139,18 @@ CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
#if defined(OS_POSIX) && !defined(OS_ANDROID)
gsapi_library_name_ = pref_service->GetString(prefs::kGSSAPILibraryName);
#endif
auth_server_whitelist_.Init(
prefs::kAuthServerWhitelist, pref_service,
base::Bind(&CefURLRequestContextGetterImpl::UpdateServerWhitelist,
base::Unretained(this)));
auth_server_whitelist_.MoveToThread(io_thread_proxy);
auth_negotiate_delegate_whitelist_.Init(
prefs::kAuthNegotiateDelegateWhitelist, pref_service,
base::Bind(&CefURLRequestContextGetterImpl::UpdateDelegateWhitelist,
base::Unretained(this)));
auth_negotiate_delegate_whitelist_.MoveToThread(io_thread_proxy);
}
CefURLRequestContextGetterImpl::~CefURLRequestContextGetterImpl() {
@@ -169,6 +181,8 @@ void CefURLRequestContextGetterImpl::ShutdownOnUIThread() {
quick_check_enabled_.Destroy();
pac_https_url_stripping_enabled_.Destroy();
force_google_safesearch_.Destroy();
auth_server_whitelist_.Destroy();
auth_negotiate_delegate_whitelist_.Destroy();
}
net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
@@ -194,11 +208,6 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
network_delegate->set_force_google_safesearch(&force_google_safesearch_);
storage_->set_network_delegate(std::move(network_delegate));
storage_->set_channel_id_service(base::WrapUnique(
new net::ChannelIDService(
new net::DefaultChannelIDStore(NULL),
base::WorkerPool::GetTaskRunner(true))));
const std::string& accept_language =
settings_.accept_language_list.length > 0 ?
CefString(&settings_.accept_language_list): "en-US,en";
@@ -207,12 +216,25 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
storage_->set_host_resolver(net::HostResolver::CreateDefaultResolver(NULL));
storage_->set_cert_verifier(net::CertVerifier::CreateDefault());
storage_->set_transport_security_state(
base::WrapUnique(new net::TransportSecurityState));
storage_->set_cert_transparency_verifier(
base::WrapUnique(new net::MultiLogCTVerifier));
storage_->set_ct_policy_enforcer(
base::WrapUnique(new net::CTPolicyEnforcer));
std::unique_ptr<net::TransportSecurityState> transport_security_state(
new net::TransportSecurityState);
transport_security_state->set_enforce_net_security_expiration(
settings_.enable_net_security_expiration ? true : false);
storage_->set_transport_security_state(std::move(transport_security_state));
std::vector<scoped_refptr<const net::CTLogVerifier>> ct_logs(
net::ct::CreateLogVerifiersForKnownLogs());
std::unique_ptr<net::MultiLogCTVerifier> ct_verifier(
new net::MultiLogCTVerifier());
ct_verifier->AddLogs(ct_logs);
storage_->set_cert_transparency_verifier(std::move(ct_verifier));
std::unique_ptr<net::CTPolicyEnforcer> ct_policy_enforcer(
new net::CTPolicyEnforcer);
ct_policy_enforcer->set_enforce_net_security_expiration(
settings_.enable_net_security_expiration ? true : false);
storage_->set_ct_policy_enforcer(std::move(ct_policy_enforcer));
std::unique_ptr<net::ProxyService> system_proxy_service =
ProxyServiceFactory::CreateProxyService(
@@ -250,6 +272,10 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
base::FilePath http_cache_path;
if (!cache_path.empty())
http_cache_path = cache_path.Append(FILE_PATH_LITERAL("Cache"));
UpdateServerWhitelist();
UpdateDelegateWhitelist();
std::unique_ptr<net::HttpCache::DefaultBackend> main_backend(
new net::HttpCache::DefaultBackend(
cache_path.empty() ? net::MEMORY_CACHE : net::DISK_CACHE,
@@ -270,8 +296,6 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
url_request_context_->cert_transparency_verifier();
network_session_params.ct_policy_enforcer =
url_request_context_->ct_policy_enforcer();
network_session_params.channel_id_service =
url_request_context_->channel_id_service();
network_session_params.proxy_service =
url_request_context_->proxy_service();
network_session_params.ssl_config_service =
@@ -433,3 +457,13 @@ void CefURLRequestContextGetterImpl::CreateProxyConfigService() {
net::ProxyService::CreateSystemProxyConfigService(
io_task_runner_, file_task_runner_);
}
void CefURLRequestContextGetterImpl::UpdateServerWhitelist() {
http_auth_preferences_->set_server_whitelist(
auth_server_whitelist_.GetValue());
}
void CefURLRequestContextGetterImpl::UpdateDelegateWhitelist() {
http_auth_preferences_->set_delegate_whitelist(
auth_negotiate_delegate_whitelist_.GetValue());
}

View File

@@ -86,6 +86,8 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
private:
void CreateProxyConfigService();
void UpdateServerWhitelist();
void UpdateDelegateWhitelist();
const CefRequestContextSettings settings_;
@@ -116,6 +118,9 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
// Member variables which are pointed to by the various context objects.
mutable BooleanPrefMember force_google_safesearch_;
StringPrefMember auth_server_whitelist_;
StringPrefMember auth_negotiate_delegate_whitelist_;
DISALLOW_COPY_AND_ASSIGN(CefURLRequestContextGetterImpl);
};

View File

@@ -23,6 +23,7 @@
#include "components/display_compositor/gl_helper.h"
#include "content/browser/bad_message.h"
#include "content/browser/compositor/image_transport_factory.h"
#include "content/browser/frame_host/render_widget_host_view_guest.h"
#include "content/browser/renderer_host/dip_util.h"
#include "content/browser/renderer_host/render_widget_host_delegate.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
@@ -474,6 +475,7 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
#endif
weak_ptr_factory_(this) {
DCHECK(render_widget_host_);
DCHECK(!render_widget_host_->GetView());
render_widget_host_->SetView(this);
// CefBrowserHostImpl might not be created at this time for popups.
@@ -1157,13 +1159,7 @@ void CefRenderWidgetHostViewOSR::Invalidate(
return;
}
const gfx::Rect& bounds_in_pixels = gfx::Rect(GetPhysicalBackingSize());
if (software_output_device_) {
software_output_device_->OnPaint(bounds_in_pixels);
} else if (copy_frame_generator_.get()) {
copy_frame_generator_->GenerateCopyFrame(true, bounds_in_pixels);
}
InvalidateInternal(gfx::Rect(GetPhysicalBackingSize()));
}
void CefRenderWidgetHostViewOSR::SendKeyEvent(
@@ -1317,6 +1313,14 @@ void CefRenderWidgetHostViewOSR::RemoveGuestHostView(
guest_host_views_.erase(guest_host);
}
void CefRenderWidgetHostViewOSR::RegisterGuestViewFrameSwappedCallback(
content::RenderWidgetHostViewGuest* guest_host_view) {
guest_host_view->RegisterFrameSwappedCallback(base::MakeUnique<base::Closure>(
base::Bind(&CefRenderWidgetHostViewOSR::OnGuestViewFrameSwapped,
weak_ptr_factory_.GetWeakPtr(),
base::Unretained(guest_host_view))));
}
#if !defined(OS_MACOSX)
ui::Compositor* CefRenderWidgetHostViewOSR::GetCompositor() const {
@@ -1501,3 +1505,20 @@ void CefRenderWidgetHostViewOSR::OnScrollOffsetChanged() {
}
is_scroll_offset_changed_pending_ = false;
}
void CefRenderWidgetHostViewOSR::OnGuestViewFrameSwapped(
content::RenderWidgetHostViewGuest* guest_host_view) {
InvalidateInternal(
gfx::ConvertRectToPixel(scale_factor_, guest_host_view->GetViewBounds()));
RegisterGuestViewFrameSwappedCallback(guest_host_view);
}
void CefRenderWidgetHostViewOSR::InvalidateInternal(
const gfx::Rect& bounds_in_pixels) {
if (software_output_device_) {
software_output_device_->OnPaint(bounds_in_pixels);
} else if (copy_frame_generator_.get()) {
copy_frame_generator_->GenerateCopyFrame(true, bounds_in_pixels);
}
}

View File

@@ -34,6 +34,7 @@
namespace content {
class RenderWidgetHost;
class RenderWidgetHostImpl;
class RenderWidgetHostViewGuest;
class BackingStore;
}
@@ -252,6 +253,11 @@ class CefRenderWidgetHostViewOSR
void AddGuestHostView(CefRenderWidgetHostViewOSR* guest_host);
void RemoveGuestHostView(CefRenderWidgetHostViewOSR* guest_host);
// Register a callback that will be executed when |guest_host_view| receives
// OnSwapCompositorFrame. The callback triggers repaint of the embedder view.
void RegisterGuestViewFrameSwappedCallback(
content::RenderWidgetHostViewGuest* guest_host_view);
CefRefPtr<CefBrowserHostImpl> browser_impl() const { return browser_impl_; }
void set_browser_impl(CefRefPtr<CefBrowserHostImpl> browser) {
browser_impl_ = browser;
@@ -285,6 +291,11 @@ class CefRenderWidgetHostViewOSR
void OnScrollOffsetChanged();
void OnGuestViewFrameSwapped(
content::RenderWidgetHostViewGuest* guest_host_view);
void InvalidateInternal(const gfx::Rect& bounds_in_pixels);
#if defined(OS_MACOSX)
friend class MacHelper;

View File

@@ -152,7 +152,7 @@ void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget() {
void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(const gfx::Size& size) {
DCHECK(window_);
SetWindowPos(window_->hwnd(), NULL, 0, 0, size.width(), size.height(),
SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW);
SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE);
}
void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() {

View File

@@ -82,6 +82,12 @@ extern "C" {
return validAttributesForMarkedText_.get();
}
- (NSRange)selectedRange {
if (selectedRange_.location == NSNotFound || selectedRange_.length == 0)
return NSMakeRange(NSNotFound, 0);
return selectedRange_;
}
- (NSRange)markedRange {
return hasMarkedText_ ?
renderWidgetHostView_->composition_range().ToNSRange() :
@@ -197,7 +203,14 @@ extern "C" {
- (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)range
actualRange:(NSRangePointer)actualRange {
if (actualRange)
*actualRange = range;
*actualRange = NSMakeRange(NSNotFound, 0);
// The caller of this method is allowed to pass nonsensical ranges. These
// can't even be converted into gfx::Ranges.
if (range.location == NSNotFound || range.length == 0)
return nil;
if (range.length >= std::numeric_limits<NSUInteger>::max() - range.location)
return nil;
const gfx::Range requested_range(range);
if (requested_range.is_reversed())
@@ -215,15 +228,16 @@ extern "C" {
expected_range = gfx::Range(offset, offset + expected_text->size());
}
if (!expected_range.Contains(requested_range))
gfx::Range actual_range = expected_range.Intersect(requested_range);
if (!actual_range.IsValid())
return nil;
// Gets the raw bytes to avoid unnecessary string copies for generating
// NSString.
const base::char16* bytes =
&(*expected_text)[requested_range.start() - expected_range.start()];
&(*expected_text)[actual_range.start() - expected_range.start()];
// Avoid integer overflow.
base::CheckedNumeric<size_t> requested_len = requested_range.length();
base::CheckedNumeric<size_t> requested_len = actual_range.length();
requested_len *= sizeof(base::char16);
NSUInteger bytes_len = base::strict_cast<NSUInteger, size_t>(
requested_len.ValueOrDefault(0));
@@ -231,6 +245,9 @@ extern "C" {
[[NSString alloc] initWithBytes:bytes
length:bytes_len
encoding:NSUTF16LittleEndianStringEncoding]);
if (actualRange)
*actualRange = actual_range.ToNSRange();
return [[[NSAttributedString alloc] initWithString:ns_string] autorelease];
}

View File

@@ -139,10 +139,13 @@ content::RenderWidgetHostViewBase* CefWebContentsViewOSR::CreateViewForWidget(
embedder_host_view);
embedder_host_view->AddGuestHostView(platform_widget);
return new content::RenderWidgetHostViewGuest(
render_widget_host,
guest_,
platform_widget->GetWeakPtr());
content::RenderWidgetHostViewGuest* guest_host_view =
new content::RenderWidgetHostViewGuest(
render_widget_host,
guest_,
platform_widget->GetWeakPtr());
embedder_host_view->RegisterGuestViewFrameSwappedCallback(guest_host_view);
return guest_host_view;
}
view_ = new CefRenderWidgetHostViewOSR(transparent_, render_widget_host,

View File

@@ -4,7 +4,6 @@
#include "libcef/browser/prefs/browser_prefs.h"
#include "libcef/browser/component_updater/cef_component_updater_configurator.h"
#include "libcef/browser/media_capture_devices_dispatcher.h"
#include "libcef/browser/net/url_request_context_getter_impl.h"
#include "libcef/browser/prefs/renderer_prefs.h"
@@ -28,12 +27,13 @@
#include "components/prefs/pref_filter.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/pref_service_factory.h"
#include "components/prefs/testing_pref_store.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
#include "components/proxy_config/proxy_config_dictionary.h"
#include "components/spellcheck/browser/pref_names.h"
#include "components/syncable_prefs/pref_service_syncable.h"
#include "components/syncable_prefs/pref_service_syncable_factory.h"
#include "components/update_client/update_client.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/extension_prefs.h"
@@ -99,7 +99,9 @@ std::unique_ptr<PrefService> CreatePrefService(
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
PrefServiceFactory factory;
// Use of PrefServiceSyncable is required by Chrome code such as
// HostContentSettingsMapFactory that calls PrefServiceSyncableFromProfile.
syncable_prefs::PrefServiceSyncableFactory factory;
// Used to store command-line preferences, most of which will be evaluated in
// the CommandLinePrefStore constructor. Preferences set in this manner cannot
@@ -143,7 +145,7 @@ std::unique_ptr<PrefService> CreatePrefService(
if (store_on_disk) {
supervised_user_settings->Init(
cache_path, sequenced_task_runner.get(), false);
cache_path, sequenced_task_runner.get(), true);
} else {
scoped_refptr<TestingPrefStore> testing_pref_store = new TestingPrefStore();
testing_pref_store->SetInitializationCompleted();
@@ -170,8 +172,6 @@ std::unique_ptr<PrefService> CreatePrefService(
renderer_prefs::RegisterProfilePrefs(registry.get());
update_client::RegisterPrefs(registry.get());
content_settings::CookieSettings::RegisterProfilePrefs(registry.get());
component_updater::RegisterPrefsForCefComponentUpdaterConfigurator(
registry.get());
// Print preferences.
registry->RegisterBooleanPref(prefs::kPrintingEnabled, true);
@@ -194,12 +194,19 @@ std::unique_ptr<PrefService> CreatePrefService(
registry->RegisterBooleanPref(
spellcheck::prefs::kSpellCheckUseSpellingService,
command_line->HasSwitch(switches::kEnableSpellingService));
registry->RegisterBooleanPref(
spellcheck::prefs::kEnableSpellcheck,
!command_line->HasSwitch(switches::kDisableSpellChecking));
// Pepper flash preferences.
// Based on DeviceIDFetcher::RegisterProfilePrefs.
registry->RegisterBooleanPref(prefs::kEnableDRM, false);
registry->RegisterStringPref(prefs::kDRMSalt, "");
// Authentication preferences.
registry->RegisterStringPref(prefs::kAuthServerWhitelist, "");
registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, "");
// Plugin preferences.
// Based on chrome::RegisterBrowserUserPrefs.
registry->RegisterBooleanPref(prefs::kPluginsAllowOutdated, false);
@@ -231,7 +238,7 @@ std::unique_ptr<PrefService> CreatePrefService(
}
// Build the PrefService that manages the PrefRegistry and PrefStores.
return factory.Create(registry.get());
return factory.CreateSyncable(registry.get());
}
} // namespace browser_prefs

View File

@@ -3,121 +3,30 @@
// can be found in the LICENSE file.
#include "libcef/browser/ssl_info_impl.h"
#include "libcef/browser/ssl_cert_principal_impl.h"
#include "libcef/common/time_util.h"
#include "libcef/browser/x509_certificate_impl.h"
#include "net/cert/cert_status_flags.h"
#include "net/cert/x509_certificate.h"
namespace {
void EncodeCertificate(
const net::X509Certificate::OSCertHandle& os_handle,
CefRefPtr<CefBinaryValue>& der_encoded,
CefRefPtr<CefBinaryValue>& pem_encoded) {
std::string encoded;
if (net::X509Certificate::GetDEREncoded(os_handle, &encoded)) {
der_encoded = CefBinaryValue::Create(encoded.c_str(),
encoded.size());
}
encoded.clear();
if (net::X509Certificate::GetPEMEncoded(os_handle, &encoded)) {
pem_encoded = CefBinaryValue::Create(encoded.c_str(),
encoded.size());
}
}
} // namespace
CefSSLInfoImpl::CefSSLInfoImpl(const net::SSLInfo& value)
: cert_status_(CERT_STATUS_NONE) {
cert_status_ = static_cast<cef_cert_status_t>(value.cert_status);
if (value.cert.get()) {
cert_status_ = static_cast<cef_cert_status_t>(value.cert_status);
subject_ = new CefSSLCertPrincipalImpl(value.cert->subject());
issuer_ = new CefSSLCertPrincipalImpl(value.cert->issuer());
const std::string& serial_number = value.cert->serial_number();
serial_number_ = CefBinaryValue::Create(serial_number.c_str(),
serial_number.size());
const base::Time& valid_start = value.cert->valid_start();
if (!valid_start.is_null())
cef_time_from_basetime(valid_start, valid_start_);
const base::Time& valid_expiry = value.cert->valid_expiry();
if (!valid_expiry.is_null())
cef_time_from_basetime(valid_expiry, valid_expiry_);
net::X509Certificate::OSCertHandle os_handle = value.cert->os_cert_handle();
if (os_handle)
EncodeCertificate(os_handle, der_encoded_, pem_encoded_);
const net::X509Certificate::OSCertHandles& issuer_chain =
value.cert->GetIntermediateCertificates();
for (net::X509Certificate::OSCertHandles::const_iterator it =
issuer_chain.begin(); it != issuer_chain.end(); it++) {
CefRefPtr<CefBinaryValue> der_encoded, pem_encoded;
EncodeCertificate(*it, der_encoded, pem_encoded);
// Add each to the chain, even if one conversion unexpectedly failed.
// GetIssuerChainSize depends on these being the same length.
der_encoded_issuer_chain_.push_back(der_encoded);
pem_encoded_issuer_chain_.push_back(pem_encoded);
}
cert_ = new CefX509CertificateImpl(value.cert);
}
}
cef_cert_status_t CefSSLInfoImpl::GetCertStatus() {
return cert_status_;
return cert_status_;
}
bool CefSSLInfoImpl::IsCertStatusError() {
return net::IsCertStatusError(cert_status_);
CefRefPtr<CefX509Certificate> CefSSLInfoImpl::GetX509Certificate() {
return cert_;
}
bool CefSSLInfoImpl::IsCertStatusMinorError() {
return net::IsCertStatusMinorError(cert_status_);
bool CefIsCertStatusError(cef_cert_status_t status) {
return net::IsCertStatusError(status);
}
CefRefPtr<CefSSLCertPrincipal> CefSSLInfoImpl::GetSubject() {
return subject_;
}
CefRefPtr<CefSSLCertPrincipal> CefSSLInfoImpl::GetIssuer() {
return issuer_;
}
CefRefPtr<CefBinaryValue> CefSSLInfoImpl::GetSerialNumber() {
return serial_number_;
}
CefTime CefSSLInfoImpl::GetValidStart() {
return valid_start_;
}
CefTime CefSSLInfoImpl::GetValidExpiry() {
return valid_expiry_;
}
CefRefPtr<CefBinaryValue> CefSSLInfoImpl::GetDEREncoded() {
return der_encoded_;
}
CefRefPtr<CefBinaryValue> CefSSLInfoImpl::GetPEMEncoded() {
return pem_encoded_;
}
size_t CefSSLInfoImpl::GetIssuerChainSize() {
return der_encoded_issuer_chain_.size();
}
void CefSSLInfoImpl::GetDEREncodedIssuerChain(
CefSSLInfo::IssuerChainBinaryList& chain) {
chain = der_encoded_issuer_chain_;
}
void CefSSLInfoImpl::GetPEMEncodedIssuerChain(
CefSSLInfo::IssuerChainBinaryList& chain) {
chain = pem_encoded_issuer_chain_;
bool CefIsCertStatusMinorError(cef_cert_status_t status) {
return net::IsCertStatusMinorError(status);
}

View File

@@ -17,30 +17,11 @@ class CefSSLInfoImpl : public CefSSLInfo {
// CefSSLInfo methods.
cef_cert_status_t GetCertStatus() override;
bool IsCertStatusError() override;
bool IsCertStatusMinorError() override;
CefRefPtr<CefSSLCertPrincipal> GetSubject() override;
CefRefPtr<CefSSLCertPrincipal> GetIssuer() override;
CefRefPtr<CefBinaryValue> GetSerialNumber() override;
CefTime GetValidStart() override;
CefTime GetValidExpiry() override;
CefRefPtr<CefBinaryValue> GetDEREncoded() override;
CefRefPtr<CefBinaryValue> GetPEMEncoded() override;
size_t GetIssuerChainSize() override;
void GetDEREncodedIssuerChain(IssuerChainBinaryList& chain) override;
void GetPEMEncodedIssuerChain(IssuerChainBinaryList& chain) override;
CefRefPtr<CefX509Certificate> GetX509Certificate() override;
private:
cef_cert_status_t cert_status_;
CefRefPtr<CefSSLCertPrincipal> subject_;
CefRefPtr<CefSSLCertPrincipal> issuer_;
CefRefPtr<CefBinaryValue> serial_number_;
CefTime valid_start_;
CefTime valid_expiry_;
CefRefPtr<CefBinaryValue> der_encoded_;
CefRefPtr<CefBinaryValue> pem_encoded_;
IssuerChainBinaryList der_encoded_issuer_chain_;
IssuerChainBinaryList pem_encoded_issuer_chain_;
CefRefPtr<CefX509Certificate> cert_;
IMPLEMENT_REFCOUNTING(CefSSLInfoImpl);
DISALLOW_COPY_AND_ASSIGN(CefSSLInfoImpl);

View File

@@ -0,0 +1,45 @@
// Copyright (c) 2016 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.
#include "libcef/browser/ssl_status_impl.h"
#include "libcef/browser/x509_certificate_impl.h"
#include "content/public/browser/cert_store.h"
#include "net/ssl/ssl_connection_status_flags.h"
CefSSLStatusImpl::CefSSLStatusImpl(const content::SSLStatus& value) {
cert_status_ = static_cast<cef_cert_status_t>(value.cert_status);
content_status_ = static_cast<cef_ssl_content_status_t>(value.content_status);
ssl_version_ = static_cast<cef_ssl_version_t>(
net::SSLConnectionStatusToVersion(value.connection_status));
cert_id_ = value.cert_id;
}
bool CefSSLStatusImpl::IsSecureConnection() {
// Secure connection if there was a certificate ID in SSLStatus.
return (cert_id_ != 0);
}
cef_cert_status_t CefSSLStatusImpl::GetCertStatus() {
return cert_status_;
}
cef_ssl_version_t CefSSLStatusImpl::GetSSLVersion() {
return ssl_version_;
}
cef_ssl_content_status_t CefSSLStatusImpl::GetContentStatus() {
return content_status_;
}
CefRefPtr<CefX509Certificate> CefSSLStatusImpl::GetX509Certificate() {
if (cert_id_) {
scoped_refptr<net::X509Certificate> cert;
content::CertStore::GetInstance()->RetrieveCert(cert_id_, &cert);
if (cert.get())
return new CefX509CertificateImpl(cert);
}
return nullptr;
}

View File

@@ -0,0 +1,35 @@
// Copyright (c) 2016 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 CEF_LIBCEF_BROWSER_SSL_STATUS_IMPL_H_
#define CEF_LIBCEF_BROWSER_SSL_STATUS_IMPL_H_
#pragma once
#include "include/cef_ssl_status.h"
#include "content/public/common/ssl_status.h"
// CefSSLStatus implementation
class CefSSLStatusImpl : public CefSSLStatus {
public:
explicit CefSSLStatusImpl(const content::SSLStatus& value);
// CefSSLStatus methods.
bool IsSecureConnection() override;
cef_cert_status_t GetCertStatus() override;
cef_ssl_version_t GetSSLVersion() override;
cef_ssl_content_status_t GetContentStatus() override;
CefRefPtr<CefX509Certificate> GetX509Certificate() override;
private:
cef_cert_status_t cert_status_;
cef_ssl_version_t ssl_version_;
cef_ssl_content_status_t content_status_;
int cert_id_;
IMPLEMENT_REFCOUNTING(CefSSLStatusImpl);
DISALLOW_COPY_AND_ASSIGN(CefSSLStatusImpl);
};
#endif // CEF_LIBCEF_BROWSER_SSL_STATUS_IMPL_H_

View File

@@ -3,8 +3,10 @@
// can be found in the LICENSE file.
#include "libcef/browser/web_plugin_impl.h"
#include "libcef/browser/context.h"
#include "libcef/browser/thread_util.h"
#include "libcef/common/widevine_loader.h"
#include "base/bind.h"
#include "base/files/file_path.h"
@@ -28,6 +30,22 @@ void PluginsCallbackImpl(
}
}
#if !(defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)) || \
defined(OS_LINUX)
void DeliverWidevineCdmError(const std::string& error_message,
CefRefPtr<CefRegisterCdmCallback> callback) {
LOG(ERROR) << error_message;
if (callback.get()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefRegisterCdmCallback::OnCdmRegistrationComplete,
callback.get(), CEF_CDM_REGISTRATION_ERROR_NOT_SUPPORTED,
error_message));
}
}
#endif
} // namespace
@@ -150,3 +168,24 @@ void CefIsWebPluginUnstable(
CEF_POST_TASK(CEF_IOT, base::Bind(CefIsWebPluginUnstable, path, callback));
}
}
void CefRegisterWidevineCdm(const CefString& path,
CefRefPtr<CefRegisterCdmCallback> callback) {
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
#if defined(OS_LINUX)
// Enforce the requirement that CefRegisterWidevineCdm() is called before
// CefInitialize() on Linux. See comments in
// CefWidevineLoader::AddPepperPlugins for details.
if (CONTEXT_STATE_VALID()) {
DeliverWidevineCdmError(
"Widevine registration is not supported after context initialization",
callback);
return;
}
#endif // defined(OS_LINUX)
CefWidevineLoader::GetInstance()->LoadWidevineCdm(path, callback);
#else
DeliverWidevineCdmError("Widevine registration is not supported", callback);
#endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
}

View File

@@ -1,8 +1,8 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// Copyright (c) 2016 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.
#include "libcef/browser/ssl_cert_principal_impl.h"
#include "libcef/browser/x509_cert_principal_impl.h"
namespace {
@@ -20,47 +20,47 @@ void TransferVector(const std::vector<std::string>& source,
} // namespace
CefSSLCertPrincipalImpl::CefSSLCertPrincipalImpl(
CefX509CertPrincipalImpl::CefX509CertPrincipalImpl(
const net::CertPrincipal& value)
: value_(value) {
}
CefString CefSSLCertPrincipalImpl::GetDisplayName() {
CefString CefX509CertPrincipalImpl::GetDisplayName() {
return value_.GetDisplayName();
}
CefString CefSSLCertPrincipalImpl::GetCommonName() {
CefString CefX509CertPrincipalImpl::GetCommonName() {
return value_.common_name;
}
CefString CefSSLCertPrincipalImpl::GetLocalityName() {
CefString CefX509CertPrincipalImpl::GetLocalityName() {
return value_.locality_name;
}
CefString CefSSLCertPrincipalImpl::GetStateOrProvinceName() {
CefString CefX509CertPrincipalImpl::GetStateOrProvinceName() {
return value_.state_or_province_name;
}
CefString CefSSLCertPrincipalImpl::GetCountryName() {
CefString CefX509CertPrincipalImpl::GetCountryName() {
return value_.country_name;
}
void CefSSLCertPrincipalImpl::GetStreetAddresses(
void CefX509CertPrincipalImpl::GetStreetAddresses(
std::vector<CefString>& addresses) {
TransferVector(value_.street_addresses, addresses);
}
void CefSSLCertPrincipalImpl::GetOrganizationNames(
void CefX509CertPrincipalImpl::GetOrganizationNames(
std::vector<CefString>& names) {
TransferVector(value_.organization_names, names);
}
void CefSSLCertPrincipalImpl::GetOrganizationUnitNames(
void CefX509CertPrincipalImpl::GetOrganizationUnitNames(
std::vector<CefString>& names) {
TransferVector(value_.organization_unit_names, names);
}
void CefSSLCertPrincipalImpl::GetDomainComponents(
void CefX509CertPrincipalImpl::GetDomainComponents(
std::vector<CefString>& components) {
TransferVector(value_.domain_components, components);
}

View File

@@ -1,21 +1,21 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// Copyright (c) 2016 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 CEF_LIBCEF_BROWSER_SSL_CERT_PRINCIPAL_IMPL_H_
#define CEF_LIBCEF_BROWSER_SSL_CERT_PRINCIPAL_IMPL_H_
#ifndef CEF_LIBCEF_BROWSER_X509_CERT_PRINCIPAL_IMPL_H_
#define CEF_LIBCEF_BROWSER_X509_CERT_PRINCIPAL_IMPL_H_
#pragma once
#include "include/cef_ssl_info.h"
#include "include/cef_x509_certificate.h"
#include "net/cert/x509_cert_types.h"
// CefSSLCertPrincipal implementation
class CefSSLCertPrincipalImpl : public CefSSLCertPrincipal {
// CefX509CertPrincipal implementation
class CefX509CertPrincipalImpl : public CefX509CertPrincipal {
public:
explicit CefSSLCertPrincipalImpl(const net::CertPrincipal& value);
explicit CefX509CertPrincipalImpl(const net::CertPrincipal& value);
// CefSSLCertPrincipal methods.
// CefX509CertPrincipal methods.
CefString GetDisplayName() override;
CefString GetCommonName() override;
CefString GetLocalityName() override;
@@ -29,8 +29,8 @@ class CefSSLCertPrincipalImpl : public CefSSLCertPrincipal {
private:
net::CertPrincipal value_;
IMPLEMENT_REFCOUNTING(CefSSLCertPrincipalImpl);
DISALLOW_COPY_AND_ASSIGN(CefSSLCertPrincipalImpl);
IMPLEMENT_REFCOUNTING(CefX509CertPrincipalImpl);
DISALLOW_COPY_AND_ASSIGN(CefX509CertPrincipalImpl);
};
#endif // CEF_LIBCEF_BROWSER_SSL_CERT_PRINCIPAL_IMPL_H_
#endif // CEF_LIBCEF_BROWSER_X509_CERT_PRINCIPAL_IMPL_H_

View File

@@ -0,0 +1,122 @@
// Copyright (c) 2016 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.
#include "libcef/browser/x509_certificate_impl.h"
#include "libcef/browser/x509_cert_principal_impl.h"
#include "libcef/common/time_util.h"
namespace {
CefRefPtr<CefBinaryValue> EncodeCertificate(
const net::X509Certificate::OSCertHandle& os_handle, bool der) {
CefRefPtr<CefBinaryValue> bin_encoded;
std::string encoded;
if (( der && net::X509Certificate::GetDEREncoded(os_handle, &encoded)) ||
(!der && net::X509Certificate::GetPEMEncoded(os_handle, &encoded))) {
bin_encoded = CefBinaryValue::Create(encoded.c_str(), encoded.size());
}
return bin_encoded;
}
} // namespace
CefX509CertificateImpl::CefX509CertificateImpl(
scoped_refptr<net::X509Certificate> cert)
:cert_(cert) {
}
CefRefPtr<CefX509CertPrincipal> CefX509CertificateImpl::GetSubject() {
if (cert_)
return new CefX509CertPrincipalImpl(cert_->subject());
return nullptr;
}
CefRefPtr<CefX509CertPrincipal> CefX509CertificateImpl::GetIssuer() {
if (cert_)
return new CefX509CertPrincipalImpl(cert_->issuer());
return nullptr;
}
CefRefPtr<CefBinaryValue> CefX509CertificateImpl::GetSerialNumber() {
if (cert_) {
const std::string& serial = cert_->serial_number();
return CefBinaryValue::Create(serial.c_str(), serial.size());
}
return nullptr;
}
CefTime CefX509CertificateImpl::GetValidStart() {
CefTime validity;
if (cert_) {
const base::Time& valid_time = cert_->valid_start();
if (!valid_time.is_null())
cef_time_from_basetime(valid_time, validity);
}
return validity;
}
CefTime CefX509CertificateImpl::GetValidExpiry() {
CefTime validity;
if (cert_) {
const base::Time& valid_time = cert_->valid_expiry();
if (!valid_time.is_null())
cef_time_from_basetime(valid_time, validity);
}
return validity;
}
CefRefPtr<CefBinaryValue> CefX509CertificateImpl::GetDEREncoded() {
if (cert_) {
net::X509Certificate::OSCertHandle os_handle = cert_->os_cert_handle();
if (os_handle)
return EncodeCertificate(os_handle, true);
}
return nullptr;
}
CefRefPtr<CefBinaryValue> CefX509CertificateImpl::GetPEMEncoded() {
if (cert_) {
net::X509Certificate::OSCertHandle os_handle = cert_->os_cert_handle();
if (os_handle)
return EncodeCertificate(os_handle, false);
}
return nullptr;
}
size_t CefX509CertificateImpl::GetIssuerChainSize() {
if (cert_)
return cert_->GetIntermediateCertificates().size();
return 0;
}
void CefX509CertificateImpl::GetEncodedIssuerChain(
CefX509Certificate::IssuerChainBinaryList& chain, bool der) {
chain.clear();
if (cert_) {
const net::X509Certificate::OSCertHandles& handles =
cert_->GetIntermediateCertificates();
for (net::X509Certificate::OSCertHandles::const_iterator it =
handles.begin(); it != handles.end(); it++) {
// Add each to the chain, even if one conversion unexpectedly failed.
// GetIssuerChainSize depends on these being the same length.
chain.push_back(EncodeCertificate(*it, der));
}
}
}
void CefX509CertificateImpl::GetDEREncodedIssuerChain(
CefX509Certificate::IssuerChainBinaryList& chain) {
if (der_encoded_issuer_chain_.empty())
GetEncodedIssuerChain(der_encoded_issuer_chain_, true);
chain = der_encoded_issuer_chain_;
}
void CefX509CertificateImpl::GetPEMEncodedIssuerChain(
CefX509Certificate::IssuerChainBinaryList& chain) {
if (pem_encoded_issuer_chain_.empty())
GetEncodedIssuerChain(pem_encoded_issuer_chain_, false);
chain = pem_encoded_issuer_chain_;
}

View File

@@ -0,0 +1,43 @@
// Copyright (c) 2016 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 CEF_LIBCEF_BROWSER_X509_CERTIFICATE_IMPL_H_
#define CEF_LIBCEF_BROWSER_X509_CERTIFICATE_IMPL_H_
#pragma once
#include "include/cef_x509_certificate.h"
#include "net/cert/x509_certificate.h"
// CefX509Certificate implementation
class CefX509CertificateImpl : public CefX509Certificate {
public:
explicit CefX509CertificateImpl(scoped_refptr<net::X509Certificate> cert);
// CefX509Certificate methods.
CefRefPtr<CefX509CertPrincipal> GetSubject() override;
CefRefPtr<CefX509CertPrincipal> GetIssuer() override;
CefRefPtr<CefBinaryValue> GetSerialNumber() override;
CefTime GetValidStart() override;
CefTime GetValidExpiry() override;
CefRefPtr<CefBinaryValue> GetDEREncoded() override;
CefRefPtr<CefBinaryValue> GetPEMEncoded() override;
size_t GetIssuerChainSize() override;
void GetDEREncodedIssuerChain(IssuerChainBinaryList& chain) override;
void GetPEMEncodedIssuerChain(IssuerChainBinaryList& chain) override;
scoped_refptr<net::X509Certificate> GetInternalCertObject() { return cert_; }
private:
void GetEncodedIssuerChain(IssuerChainBinaryList& chain, bool der);
scoped_refptr<net::X509Certificate> cert_;
IssuerChainBinaryList pem_encoded_issuer_chain_;
IssuerChainBinaryList der_encoded_issuer_chain_;
IMPLEMENT_REFCOUNTING(CefX509CertificateImpl);
DISALLOW_COPY_AND_ASSIGN(CefX509CertificateImpl);
};
#endif // CEF_LIBCEF_BROWSER_X509_CERTIFICATE_IMPL_H_

View File

@@ -106,15 +106,9 @@ const char kDisableScrollBounce[] = "disable-scroll-bounce";
// Disable the PDF extension.
const char kDisablePdfExtension[] = "disable-pdf-extension";
// Enable Widevine CDM.
const char kEnableWidevineCdm[] = "enable-widevine-cdm";
// Path to Widevine CDM binaries.
const char kWidevineCdmPath[] = "widevine-cdm-path";
// Widevine CDM version.
const char kWidevineCdmVersion[] = "widevine-cdm-version";
// Default plugin policy action.
const char kPluginPolicy[] = "plugin-policy";
// Allow the content. This is the default value.
@@ -128,4 +122,7 @@ const char kPluginPolicy_Block[] = "block";
// Expose preferences used only by unit tests.
const char kEnablePreferenceTesting[] = "enable-preference-testing";
// Enable date-based expiration of built in network security information.
const char kEnableNetSecurityExpiration[] = "enable-net-security-expiration";
} // namespace switches

View File

@@ -45,14 +45,13 @@ extern const char kOverrideSpellCheckLang[];
extern const char kEnableSystemFlash[];
extern const char kDisableScrollBounce[];
extern const char kDisablePdfExtension[];
extern const char kEnableWidevineCdm[];
extern const char kWidevineCdmPath[];
extern const char kWidevineCdmVersion[];
extern const char kPluginPolicy[];
extern const char kPluginPolicy_Allow[];
extern const char kPluginPolicy_Detect[];
extern const char kPluginPolicy_Block[];
extern const char kEnablePreferenceTesting[];
extern const char kEnableNetSecurityExpiration[];
} // namespace switches

View File

@@ -37,12 +37,8 @@
#include "ppapi/shared_impl/ppapi_permissions.h"
#include "ui/base/resource/resource_bundle.h"
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
// The following must be after widevine_cdm_version.h.
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \
!defined(WIDEVINE_CDM_IS_COMPONENT)
#include "chrome/common/widevine_cdm_constants.h"
#if defined(OS_LINUX)
#include "libcef/common/widevine_loader.h"
#endif
namespace {
@@ -182,67 +178,6 @@ bool GetSystemPepperFlash(content::PepperPluginInfo* plugin) {
return true;
}
void AddWidevineCdmFromCommandLine(
std::vector<content::PepperPluginInfo>* plugins) {
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \
!defined(WIDEVINE_CDM_IS_COMPONENT)
static bool skip_widevine_cdm_file_check = false;
base::FilePath widevine_cdm_path =
base::CommandLine::ForCurrentProcess()->GetSwitchValuePath(
switches::kWidevineCdmPath);
if (!widevine_cdm_path.empty()) {
widevine_cdm_path =
widevine_cdm_path.AppendASCII(kWidevineCdmAdapterFileName);
}
// Also get the version from the command-line. Should be something like
// 1.4.8.824.
const std::string& widevine_cdm_version =
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kWidevineCdmVersion);
if (!widevine_cdm_path.empty() && !widevine_cdm_version.empty()) {
if (skip_widevine_cdm_file_check || base::PathExists(widevine_cdm_path)) {
content::PepperPluginInfo widevine_cdm;
widevine_cdm.is_out_of_process = true;
widevine_cdm.path = widevine_cdm_path;
widevine_cdm.name = kWidevineCdmDisplayName;
widevine_cdm.description = kWidevineCdmDescription +
std::string(" (version: ") +
widevine_cdm_version + ")";
widevine_cdm.version = widevine_cdm_version;
content::WebPluginMimeType widevine_cdm_mime_type(
kWidevineCdmPluginMimeType,
kWidevineCdmPluginExtension,
kWidevineCdmPluginMimeTypeDescription);
// Add the supported codecs as if they came from the component manifest.
// This list must match the CDM that is being shipped with Chrome.
std::vector<std::string> codecs;
codecs.push_back(kCdmSupportedCodecVp8);
codecs.push_back(kCdmSupportedCodecVp9);
#if defined(USE_PROPRIETARY_CODECS)
codecs.push_back(kCdmSupportedCodecAvc1);
#endif // defined(USE_PROPRIETARY_CODECS)
std::string codec_string = base::JoinString(
codecs, std::string(1, kCdmSupportedCodecsValueDelimiter));
widevine_cdm_mime_type.additional_param_names.push_back(
base::ASCIIToUTF16(kCdmSupportedCodecsParamName));
widevine_cdm_mime_type.additional_param_values.push_back(
base::ASCIIToUTF16(codec_string));
widevine_cdm.mime_types.push_back(widevine_cdm_mime_type);
widevine_cdm.permissions = kWidevineCdmPluginPermissions;
plugins->push_back(widevine_cdm);
skip_widevine_cdm_file_check = true;
}
}
#endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) &&
// !defined(WIDEVINE_CDM_IS_COMPONENT)
}
} // namespace
const char CefContentClient::kPDFPluginPath[] = "internal-pdf-viewer";
@@ -269,7 +204,12 @@ void CefContentClient::AddPepperPlugins(
std::vector<content::PepperPluginInfo>* plugins) {
ComputeBuiltInPlugins(plugins);
AddPepperFlashFromCommandLine(plugins);
AddWidevineCdmFromCommandLine(plugins);
#if defined(OS_LINUX)
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
CefWidevineLoader::AddPepperPlugins(plugins);
#endif
#endif
content::PepperPluginInfo plugin;
if (GetSystemPepperFlash(&plugin))

View File

@@ -27,7 +27,6 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "components/component_updater/component_updater_paths.h"
#include "components/content_settings/core/common/content_settings_pattern.h"
#include "content/public/browser/browser_main_runner.h"
#include "content/public/browser/render_process_host.h"
@@ -41,8 +40,6 @@
#include "ui/base/ui_base_paths.h"
#include "ui/base/ui_base_switches.h"
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
#include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED.
#if defined(IPC_MESSAGE_LOG_ENABLED)
@@ -559,26 +556,6 @@ void CefMainDelegate::PreSandboxStartup() {
user_data_path.AppendASCII("Dictionaries"),
false, // May not be an absolute path.
true); // Create if necessary.
const base::FilePath& resources_path = GetResourcesFilePath();
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
const base::FilePath& widevine_plugin_path =
resources_path.AppendASCII(kWidevineCdmAdapterFileName);
if (base::PathExists(widevine_plugin_path)) {
PathService::Override(chrome::FILE_WIDEVINE_CDM_ADAPTER,
widevine_plugin_path);
}
#endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
// Paths to find pre-installed components.
PathService::Override(chrome::DIR_COMPONENTS, resources_path);
PathService::Override(chrome::DIR_INTERNAL_PLUGINS, resources_path);
// Register paths to be used by the component updater.
component_updater::RegisterPathProvider(chrome::DIR_COMPONENTS,
chrome::DIR_INTERNAL_PLUGINS,
chrome::DIR_USER_DATA);
}
if (command_line->HasSwitch(switches::kDisablePackLoading))

View File

@@ -126,14 +126,14 @@ net::URLRequest::ReferrerPolicy GetURLRequestReferrerPolicy(
return net_referrer_policy;
}
std::string GetURLRequestReferrer(const CefString& referrer_url) {
std::string GetURLRequestReferrer(const GURL& referrer_url) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (!GURL(referrer_url.ToString()).is_valid() ||
if (!referrer_url.is_valid() ||
command_line->HasSwitch(switches::kNoReferrers)) {
return std::string();
}
return referrer_url;
return referrer_url.spec();
}
blink::WebString FilePathStringToWebString(
@@ -167,12 +167,12 @@ void GetHeaderMap(const net::HttpRequestHeaders& headers,
// |referrer|.
void GetHeaderMap(const blink::WebURLRequest& request,
CefRequest::HeaderMap& map,
CefString& referrer) {
GURL& referrer) {
map.clear();
class HeaderVisitor : public blink::WebHTTPHeaderVisitor {
public:
HeaderVisitor(CefRequest::HeaderMap* map, CefString* referrer)
HeaderVisitor(CefRequest::HeaderMap* map, GURL* referrer)
: map_(map),
referrer_(referrer) {
}
@@ -182,14 +182,14 @@ void GetHeaderMap(const blink::WebURLRequest& request,
const base::string16& nameStr = name;
const base::string16& valueStr = value;
if (base::LowerCaseEqualsASCII(nameStr, kReferrerLowerCase))
*referrer_ = valueStr;
*referrer_ = GURL(valueStr);
else
map_->insert(std::make_pair(nameStr, valueStr));
}
private:
CefRequest::HeaderMap* map_;
CefString* referrer_;
GURL* referrer_;
};
HeaderVisitor visitor(&map, &referrer);
@@ -268,14 +268,15 @@ bool CefRequestImpl::IsReadOnly() {
CefString CefRequestImpl::GetURL() {
base::AutoLock lock_scope(lock_);
return url_;
return url_.spec();
}
void CefRequestImpl::SetURL(const CefString& url) {
base::AutoLock lock_scope(lock_);
CHECK_READONLY_RETURN_VOID();
if (url_ != url) {
url_ = url;
const GURL& new_url = GURL(url.ToString());
if (url_ != new_url) {
url_ = new_url;
Changed(kChangedUrl);
}
}
@@ -288,8 +289,9 @@ CefString CefRequestImpl::GetMethod() {
void CefRequestImpl::SetMethod(const CefString& method) {
base::AutoLock lock_scope(lock_);
CHECK_READONLY_RETURN_VOID();
if (method_ != method) {
method_ = method;
const std::string& new_method = method;
if (method_ != new_method) {
method_ = new_method;
Changed(kChangedMethod);
}
}
@@ -301,9 +303,9 @@ void CefRequestImpl::SetReferrer(const CefString& referrer_url,
// Call GetAsReferrer here for consistency since the same logic will later be
// applied by URLRequest::SetReferrer().
const GURL& gurl = GURL(referrer_url.ToString()).GetAsReferrer();
if (referrer_url_ != gurl.spec() || referrer_policy_ != policy) {
referrer_url_ = gurl.spec();
const GURL& new_referrer_url = GURL(referrer_url.ToString()).GetAsReferrer();
if (referrer_url_ != new_referrer_url || referrer_policy_ != policy) {
referrer_url_ = new_referrer_url;
referrer_policy_ = policy;
Changed(kChangedReferrer);
}
@@ -311,7 +313,7 @@ void CefRequestImpl::SetReferrer(const CefString& referrer_url,
CefString CefRequestImpl::GetReferrerURL() {
base::AutoLock lock_scope(lock_);
return referrer_url_;
return referrer_url_.spec();
}
CefRequestImpl::ReferrerPolicy CefRequestImpl::GetReferrerPolicy() {
@@ -349,12 +351,14 @@ void CefRequestImpl::Set(const CefString& url,
const HeaderMap& headerMap) {
base::AutoLock lock_scope(lock_);
CHECK_READONLY_RETURN_VOID();
if (url_ != url) {
url_ = url;
const GURL& new_url = GURL(url.ToString());
if (url_ != new_url) {
url_ = new_url;
Changed(kChangedUrl);
}
if (method_ != method) {
method_ = method;
const std::string& new_method = method;
if (method_ != new_method) {
method_ = new_method;
Changed(kChangedMethod);
}
postdata_ = postData;
@@ -378,14 +382,15 @@ void CefRequestImpl::SetFlags(int flags) {
CefString CefRequestImpl::GetFirstPartyForCookies() {
base::AutoLock lock_scope(lock_);
return first_party_for_cookies_;
return first_party_for_cookies_.spec();
}
void CefRequestImpl::SetFirstPartyForCookies(const CefString& url) {
base::AutoLock lock_scope(lock_);
CHECK_READONLY_RETURN_VOID();
if (first_party_for_cookies_ != url) {
first_party_for_cookies_ = url;
const GURL& new_url = GURL(url.ToString());
if (first_party_for_cookies_ != new_url) {
first_party_for_cookies_ = new_url;
Changed(kChangedFirstPartyForCookies);
}
}
@@ -411,7 +416,7 @@ void CefRequestImpl::Set(net::URLRequest* request) {
Reset();
url_ = request->url().spec();
url_ = request->url();
method_ = request->method();
identifier_ = request->identifier();
@@ -422,7 +427,7 @@ void CefRequestImpl::Set(net::URLRequest* request) {
// Our consumer should have made sure that this is a safe referrer. See for
// instance WebCore::FrameLoader::HideReferrer.
if (referrer.is_valid()) {
referrer_url_ = referrer.spec();
referrer_url_ = referrer;
switch (request->referrer_policy()) {
case net::URLRequest::
CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE:
@@ -459,7 +464,7 @@ void CefRequestImpl::Set(net::URLRequest* request) {
static_cast<CefPostDataImpl*>(postdata_.get())->Set(*data);
}
first_party_for_cookies_ = request->first_party_for_cookies().spec();
first_party_for_cookies_ = request->first_party_for_cookies();
const content::ResourceRequestInfo* info =
content::ResourceRequestInfo::ForRequest(request);
@@ -497,10 +502,9 @@ void CefRequestImpl::Get(net::URLRequest* request, bool changed_only) const {
}
}
if (!first_party_for_cookies_.empty() &&
if (!first_party_for_cookies_.is_empty() &&
ShouldSet(kChangedFirstPartyForCookies, changed_only)) {
request->set_first_party_for_cookies(
GURL(std::string(first_party_for_cookies_)));
request->set_first_party_for_cookies(first_party_for_cookies_);
}
}
@@ -512,12 +516,12 @@ void CefRequestImpl::Set(
Reset();
url_ = params.url().spec();
url_ = params.url();
method_ = params.is_post() ? "POST" : "GET";
const content::Referrer& sanitized_referrer =
content::Referrer::SanitizeForRequest(params.url(), params.referrer());
referrer_url_ = sanitized_referrer.url.spec();
referrer_url_ = sanitized_referrer.url;
referrer_policy_ =
static_cast<cef_referrer_policy_t>(sanitized_referrer.policy);
@@ -534,8 +538,8 @@ void CefRequestImpl::Set(const blink::WebURLRequest& request) {
Reset();
url_ = request.url().string();
method_ = request.httpMethod();
url_ = request.url();
method_ = request.httpMethod().utf8();
::GetHeaderMap(request, headermap_, referrer_url_);
referrer_policy_ =
@@ -547,7 +551,7 @@ void CefRequestImpl::Set(const blink::WebURLRequest& request) {
static_cast<CefPostDataImpl*>(postdata_.get())->Set(body);
}
first_party_for_cookies_ = request.firstPartyForCookies().string();
first_party_for_cookies_ = request.firstPartyForCookies();
if (request.getCachePolicy() == blink::WebCachePolicy::BypassingCache)
flags_ |= UR_FLAG_SKIP_CACHE;
@@ -561,15 +565,15 @@ void CefRequestImpl::Get(blink::WebURLRequest& request,
int64& upload_data_size) const {
base::AutoLock lock_scope(lock_);
request.setURL(GURL(url_.ToString()));
request.setHTTPMethod(blink::WebString::fromUTF8(method_.ToString()));
request.setURL(url_);
request.setHTTPMethod(blink::WebString::fromUTF8(method_));
if (!referrer_url_.empty()) {
if (!referrer_url_.is_empty()) {
const blink::WebString& referrer =
blink::WebSecurityPolicy::generateReferrerHeader(
static_cast<blink::WebReferrerPolicy>(referrer_policy_),
GURL(url_.ToString()),
blink::WebString::fromUTF8(referrer_url_));
url_,
blink::WebString::fromUTF8(referrer_url_.spec()));
if (!referrer.isEmpty()) {
request.setHTTPReferrer(
referrer,
@@ -597,8 +601,8 @@ void CefRequestImpl::Get(blink::WebURLRequest& request,
::SetHeaderMap(headermap_, request);
if (!first_party_for_cookies_.empty())
request.setFirstPartyForCookies(GURL(first_party_for_cookies_.ToString()));
if (!first_party_for_cookies_.is_empty())
request.setFirstPartyForCookies(first_party_for_cookies_);
request.setCachePolicy((flags_ & UR_FLAG_SKIP_CACHE) ?
blink::WebCachePolicy::BypassingCache :
@@ -693,11 +697,11 @@ void CefRequestImpl::Get(const CefMsg_LoadRequest_Params& params,
void CefRequestImpl::Get(CefNavigateParams& params) const {
base::AutoLock lock_scope(lock_);
params.url = GURL(url_.ToString());
params.url = url_;
params.method = method_;
// Referrer policy will be applied later in the request pipeline.
params.referrer.url = GURL(referrer_url_.ToString());
params.referrer.url = referrer_url_;
params.referrer.policy =
static_cast<blink::WebReferrerPolicy>(referrer_policy_);
@@ -710,7 +714,7 @@ void CefRequestImpl::Get(CefNavigateParams& params) const {
impl->Get(*params.upload_data.get());
}
params.first_party_for_cookies = GURL(first_party_for_cookies_.ToString());
params.first_party_for_cookies = first_party_for_cookies_;
params.load_flags = flags_;
}
@@ -718,7 +722,7 @@ void CefRequestImpl::Get(net::URLFetcher& fetcher,
int64& upload_data_size) const {
base::AutoLock lock_scope(lock_);
if (!referrer_url_.empty()) {
if (!referrer_url_.is_empty()) {
fetcher.SetReferrer(GetURLRequestReferrer(referrer_url_));
fetcher.SetReferrerPolicy(GetURLRequestReferrerPolicy(referrer_policy_));
}
@@ -781,8 +785,8 @@ void CefRequestImpl::Get(net::URLFetcher& fetcher,
}
}
if (!first_party_for_cookies_.empty())
fetcher.SetInitiatorURL(GURL(first_party_for_cookies_.ToString()));
if (!first_party_for_cookies_.is_empty())
fetcher.SetInitiatorURL(first_party_for_cookies_);
if (flags_ & UR_FLAG_NO_RETRY_ON_5XX)
fetcher.SetAutomaticallyRetryOn5xx(false);
@@ -873,9 +877,9 @@ void CefRequestImpl::Reset() {
lock_.AssertAcquired();
DCHECK(!read_only_);
url_.clear();
url_ = GURL();
method_ = "GET";
referrer_url_.clear();
referrer_url_ = GURL();
referrer_policy_ = REFERRER_POLICY_DEFAULT;
postdata_ = NULL;
headermap_.clear();
@@ -883,7 +887,7 @@ void CefRequestImpl::Reset() {
transition_type_ = TT_EXPLICIT;
identifier_ = 0U;
flags_ = UR_FLAG_NONE;
first_party_for_cookies_.clear();
first_party_for_cookies_ = GURL();
changes_ = kChangedNone;
}

View File

@@ -12,6 +12,7 @@
#include "base/synchronization/lock.h"
#include "third_party/WebKit/public/platform/WebHTTPBody.h"
#include "url/gurl.h"
namespace navigation_interception {
class NavigationParams;
@@ -121,9 +122,9 @@ class CefRequestImpl : public CefRequest {
void Reset();
CefString url_;
CefString method_;
CefString referrer_url_;
GURL url_;
std::string method_;
GURL referrer_url_;
ReferrerPolicy referrer_policy_;
CefRefPtr<CefPostData> postdata_;
HeaderMap headermap_;
@@ -133,7 +134,7 @@ class CefRequestImpl : public CefRequest {
// The below members are used by CefURLRequest.
int flags_;
CefString first_party_for_cookies_;
GURL first_party_for_cookies_;
// True if this object is read-only.
bool read_only_;

View File

@@ -0,0 +1,406 @@
// Copyright 2016 The Chromium Embedded Framework Authors. Portions copyright
// 2013 the Chromium Authors. All rights reserved. Use of this source code is
// governed by a BSD-style license that can be found in the LICENSE file.
#include "libcef/common/widevine_loader.h"
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
#include "libcef/browser/context.h"
#include "libcef/browser/thread_util.h"
#include "libcef/common/cef_switches.h"
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/json/json_string_value_serializer.h"
#include "base/memory/ptr_util.h"
#include "base/native_library.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/common/widevine_cdm_constants.h"
#include "content/browser/plugin_service_impl.h"
#include "content/public/browser/cdm_service.h"
#include "content/public/common/cdm_info.h"
#include "content/public/common/content_switches.h"
#include "media/cdm/supported_cdm_versions.h"
namespace {
base::LazyInstance<CefWidevineLoader>::Leaky g_widevine_loader =
LAZY_INSTANCE_INITIALIZER;
// Based on chrome/browser/component_updater/widevine_cdm_component_installer.cc
// Name of the Widevine CDM OS in the component manifest.
const char kWidevineCdmOs[] =
#if defined(OS_MACOSX)
"mac";
#elif defined(OS_WIN)
"win";
#else // OS_LINUX, etc. TODO(viettrungluu): Separate out Chrome OS and Android?
"linux";
#endif
// Name of the Widevine CDM architecture in the component manifest.
const char kWidevineCdmArch[] =
#if defined(ARCH_CPU_X86)
"ia32"; // This differs from the component updater which uses "x86".
#elif defined(ARCH_CPU_X86_64)
"x64";
#else // TODO(viettrungluu): Support an ARM check?
"???";
#endif
// The CDM OS and architecture.
const char kCdmOsName[] = "os";
const char kCdmArchName[] = "arch";
// The CDM version (e.g. "1.4.8.903").
const char kCdmVersionName[] = "version";
// The CDM manifest includes several custom values, all beginning with "x-cdm-".
// All values are strings.
// All values that are lists are delimited by commas. No trailing commas.
// For example, "1,2,4".
const char kCdmValueDelimiter = ',';
static_assert(kCdmValueDelimiter == kCdmSupportedCodecsValueDelimiter,
"cdm delimiters must match");
// The following entries are required.
// Interface versions are lists of integers (e.g. "1" or "1,2,4").
// These are checked in this file before registering the CDM.
// All match the interface versions from content_decryption_module.h that the
// CDM supports.
// Matches CDM_MODULE_VERSION.
const char kCdmModuleVersionsName[] = "x-cdm-module-versions";
// Matches supported ContentDecryptionModule_* version(s).
const char kCdmInterfaceVersionsName[] = "x-cdm-interface-versions";
// Matches supported Host_* version(s).
const char kCdmHostVersionsName[] = "x-cdm-host-versions";
// The codecs list is a list of simple codec names (e.g. "vp8,vorbis").
// The list is passed to other parts of Chrome.
const char kCdmCodecsListName[] = "x-cdm-codecs";
std::unique_ptr<base::DictionaryValue> ParseManifestFile(
const base::FilePath& manifest_path) {
CEF_REQUIRE_FILET();
// Manifest file should be < 1kb. Read at most 2kb.
std::string manifest_contents;
if (!base::ReadFileToStringWithMaxSize(manifest_path, &manifest_contents,
2048)) {
return nullptr;
}
JSONStringValueDeserializer deserializer(manifest_contents);
std::unique_ptr<base::Value> manifest(deserializer.Deserialize(NULL, NULL));
if (!manifest.get() || !manifest->IsType(base::Value::TYPE_DICTIONARY))
return nullptr;
// Transfer ownership to the caller.
return base::WrapUnique(
static_cast<base::DictionaryValue*>(manifest.release()));
}
std::string GetManifestValue(const base::DictionaryValue& manifest,
const std::string& key,
std::string* error_message) {
std::stringstream ss;
std::string value;
if (!manifest.GetString(key, &value)) {
ss << "Manifest missing " << key;
*error_message = ss.str();
} else if (value.empty()) {
ss << "Manifest has empty " << key;
*error_message = ss.str();
}
return value;
}
typedef bool (*VersionCheckFunc)(int version);
bool CheckForCompatibleVersion(const base::DictionaryValue& manifest,
const std::string version_name,
VersionCheckFunc version_check_func,
std::string* error_message) {
std::string versions_string =
GetManifestValue(manifest, version_name, error_message);
if (versions_string.empty())
return false;
for (const base::StringPiece& ver_str : base::SplitStringPiece(
versions_string, std::string(1, kCdmValueDelimiter),
base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
int version = 0;
if (base::StringToInt(ver_str, &version))
if (version_check_func(version))
return true;
}
std::stringstream ss;
ss << "Manifest has no supported " << version_name << " in '" <<
versions_string << "'";
*error_message = ss.str();
return false;
}
// Returns whether the CDM's OS/platform and module/interface/host API versions,
// as specified in the manifest, are compatible with this Chromium binary.
bool IsCompatibleWithChrome(const base::DictionaryValue& manifest,
std::string* error_message) {
return GetManifestValue(manifest, kCdmOsName, error_message) ==
kWidevineCdmOs &&
GetManifestValue(manifest, kCdmArchName, error_message) ==
kWidevineCdmArch &&
CheckForCompatibleVersion(manifest,
kCdmModuleVersionsName,
media::IsSupportedCdmModuleVersion,
error_message) &&
CheckForCompatibleVersion(manifest,
kCdmInterfaceVersionsName,
media::IsSupportedCdmInterfaceVersion,
error_message) &&
CheckForCompatibleVersion(manifest,
kCdmHostVersionsName,
media::IsSupportedCdmHostVersion,
error_message);
}
// Populate the PepperPluginInfo structure.
void GetPluginInfo(const base::FilePath& cdm_adapter_path,
const base::FilePath& cdm_path,
const std::string& cdm_version,
const std::string& cdm_codecs,
content::PepperPluginInfo* widevine_cdm) {
widevine_cdm->is_out_of_process = true;
widevine_cdm->path = cdm_adapter_path;
widevine_cdm->name = kWidevineCdmDisplayName;
widevine_cdm->description = kWidevineCdmDescription +
std::string(" (version: ") +
cdm_version + ")";
widevine_cdm->version = cdm_version;
content::WebPluginMimeType widevine_cdm_mime_type(
kWidevineCdmPluginMimeType,
kWidevineCdmPluginExtension,
kWidevineCdmPluginMimeTypeDescription);
widevine_cdm_mime_type.additional_param_names.push_back(
base::ASCIIToUTF16(kCdmSupportedCodecsParamName));
widevine_cdm_mime_type.additional_param_values.push_back(
base::ASCIIToUTF16(cdm_codecs));
widevine_cdm->mime_types.push_back(widevine_cdm_mime_type);
widevine_cdm->permissions = kWidevineCdmPluginPermissions;
}
// Verify and load the contents of |base_path|.
cef_cdm_registration_error_t LoadWidevineCdmInfo(
const base::FilePath& base_path,
base::FilePath* cdm_adapter_path,
base::FilePath* cdm_path,
std::string* cdm_version,
std::string* cdm_codecs,
std::string* error_message) {
std::stringstream ss;
*cdm_adapter_path = base_path.AppendASCII(kWidevineCdmAdapterFileName);
if (!base::PathExists(*cdm_adapter_path)) {
ss << "Missing adapter file " << cdm_adapter_path->value();
*error_message = ss.str();
return CEF_CDM_REGISTRATION_ERROR_INCORRECT_CONTENTS;
}
*cdm_path = base_path.AppendASCII(
base::GetNativeLibraryName(kWidevineCdmLibraryName));
if (!base::PathExists(*cdm_path)) {
ss << "Missing file " << cdm_path->value();
*error_message = ss.str();
return CEF_CDM_REGISTRATION_ERROR_INCORRECT_CONTENTS;
}
base::FilePath manifest_path = base_path.AppendASCII("manifest.json");
if (!base::PathExists(manifest_path)) {
ss << "Missing manifest file " << manifest_path.value();
*error_message = ss.str();
return CEF_CDM_REGISTRATION_ERROR_INCORRECT_CONTENTS;
}
std::unique_ptr<base::DictionaryValue> manifest =
ParseManifestFile(manifest_path);
if (!manifest) {
ss << "Failed to parse manifest file " << manifest_path.value();
*error_message = ss.str();
return CEF_CDM_REGISTRATION_ERROR_INCORRECT_CONTENTS;
}
if (!IsCompatibleWithChrome(*manifest, error_message))
return CEF_CDM_REGISTRATION_ERROR_INCOMPATIBLE;
*cdm_version = GetManifestValue(*manifest, kCdmVersionName, error_message);
if (cdm_version->empty())
return CEF_CDM_REGISTRATION_ERROR_INCORRECT_CONTENTS;
*cdm_codecs = GetManifestValue(*manifest, kCdmCodecsListName, error_message);
if (cdm_codecs->empty())
return CEF_CDM_REGISTRATION_ERROR_INCORRECT_CONTENTS;
return CEF_CDM_REGISTRATION_ERROR_NONE;
}
void DeliverWidevineCdmCallback(cef_cdm_registration_error_t result,
const std::string& error_message,
CefRefPtr<CefRegisterCdmCallback> callback) {
CEF_REQUIRE_UIT();
if (result != CEF_CDM_REGISTRATION_ERROR_NONE)
LOG(ERROR) << "Widevine CDM registration failed; " << error_message;
if (callback)
callback->OnCdmRegistrationComplete(result, error_message);
}
void RegisterWidevineCdmOnUIThread(
const base::FilePath& cdm_adapter_path,
const base::FilePath& cdm_path,
const std::string& cdm_version,
const std::string& cdm_codecs,
CefRefPtr<CefRegisterCdmCallback> callback) {
CEF_REQUIRE_UIT();
content::PepperPluginInfo widevine_cdm;
GetPluginInfo(cdm_adapter_path, cdm_path, cdm_version, cdm_codecs,
&widevine_cdm);
// true = Add to beginning of list to override any existing registrations.
content::PluginService::GetInstance()->RegisterInternalPlugin(
widevine_cdm.ToWebPluginInfo(), true);
// Tell the browser to refresh the plugin list. Then tell all renderers to
// update their plugin list caches.
content::PluginService::GetInstance()->RefreshPlugins();
content::PluginService::GetInstance()->PurgePluginListCache(NULL, false);
// Also register Widevine with the CdmService.
const std::vector<std::string> codecs = base::SplitString(
cdm_codecs, std::string(1, kCdmSupportedCodecsValueDelimiter),
base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
content::CdmService::GetInstance()->RegisterCdm(content::CdmInfo(
kWidevineCdmType, base::Version(cdm_version), cdm_path, codecs));
DeliverWidevineCdmCallback(CEF_CDM_REGISTRATION_ERROR_NONE, std::string(),
callback);
}
void LoadWidevineCdmInfoOnFileThread(
const base::FilePath& base_path,
CefRefPtr<CefRegisterCdmCallback> callback) {
CEF_REQUIRE_FILET();
base::FilePath cdm_adapter_path;
base::FilePath cdm_path;
std::string cdm_version;
std::string cdm_codecs;
std::string error_message;
cef_cdm_registration_error_t result =
LoadWidevineCdmInfo(base_path, &cdm_adapter_path, &cdm_path, &cdm_version,
&cdm_codecs, &error_message);
if (result != CEF_CDM_REGISTRATION_ERROR_NONE) {
CEF_POST_TASK(CEF_UIT, base::Bind(DeliverWidevineCdmCallback, result,
error_message, callback));
return;
}
// Continue execution on the UI thread.
CEF_POST_TASK(CEF_UIT,
base::Bind(RegisterWidevineCdmOnUIThread, cdm_adapter_path, cdm_path,
cdm_version, cdm_codecs, callback));
}
} // namespace
// static
CefWidevineLoader* CefWidevineLoader::GetInstance() {
return &g_widevine_loader.Get();
}
void CefWidevineLoader::LoadWidevineCdm(
const base::FilePath& path,
CefRefPtr<CefRegisterCdmCallback> callback) {
if (!CONTEXT_STATE_VALID()) {
// Loading will proceed from OnContextInitialized().
load_pending_ = true;
path_ = path;
callback_ = callback;
return;
}
// Continue execution on the FILE thread.
CEF_POST_TASK(CEF_FILET,
base::Bind(LoadWidevineCdmInfoOnFileThread, path, callback));
}
void CefWidevineLoader::OnContextInitialized() {
CEF_REQUIRE_UIT();
if (load_pending_) {
load_pending_ = false;
LoadWidevineCdm(path_, callback_);
callback_ = nullptr;
}
}
#if defined(OS_LINUX)
// static
void CefWidevineLoader::AddPepperPlugins(
std::vector<content::PepperPluginInfo>* plugins) {
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
// Perform early plugin registration in the zygote process when the sandbox is
// enabled to avoid "cannot open shared object file: Operation not permitted"
// errors during plugin loading. This is because the Zygote process must pre-
// load all plugins before initializing the sandbox.
if (command_line.GetSwitchValueASCII(switches::kProcessType) !=
switches::kZygoteProcess ||
command_line.HasSwitch(switches::kNoSandbox)) {
return;
}
// The Widevine CDM path is passed to the zygote process via
// CefContentBrowserClient::AppendExtraCommandLineSwitches.
const base::FilePath& base_path = command_line.GetSwitchValuePath(
switches::kWidevineCdmPath);
if (base_path.empty())
return;
// Load contents of the plugin directory synchronously. This only occurs once
// on zygote process startup so should not have a huge performance penalty.
base::FilePath cdm_adapter_path;
base::FilePath cdm_path;
std::string cdm_version;
std::string cdm_codecs;
std::string error_message;
cef_cdm_registration_error_t result =
LoadWidevineCdmInfo(base_path, &cdm_adapter_path, &cdm_path, &cdm_version,
&cdm_codecs, &error_message);
if (result != CEF_CDM_REGISTRATION_ERROR_NONE) {
LOG(ERROR) << "Widevine CDM registration failed; " << error_message;
return;
}
content::PepperPluginInfo widevine_cdm;
GetPluginInfo(cdm_adapter_path, cdm_path, cdm_version, cdm_codecs,
&widevine_cdm);
plugins->push_back(widevine_cdm);
}
#endif // defined(OS_LINUX)
CefWidevineLoader::CefWidevineLoader() {
}
CefWidevineLoader::~CefWidevineLoader() {
}
#endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)

View File

@@ -0,0 +1,64 @@
// Copyright 2016 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 CEF_LIBCEF_COMMON_WIDEVINE_LOADER_H_
#define CEF_LIBCEF_COMMON_WIDEVINE_LOADER_H_
#pragma once
#include "build/build_config.h"
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
#include <vector>
#include "include/cef_web_plugin.h"
#include "base/lazy_instance.h"
namespace content {
struct PepperPluginInfo;
}
class CefWidevineLoader {
public:
// Returns the singleton instance of this object.
static CefWidevineLoader* GetInstance();
// Load the Widevine CDM. May be called before or after context creation. See
// comments in cef_web_plugin.h.
void LoadWidevineCdm(const base::FilePath& path,
CefRefPtr<CefRegisterCdmCallback> callback);
// Plugin registration is triggered here if LoadWidevineCdm() was called
// before context creation.
void OnContextInitialized();
#if defined(OS_LINUX)
// The zygote process which is used when the sandbox is enabled on Linux
// requires early loading of pepper plugins. Other processes will receive
// load notification in the usual way.
// Called from CefContentClient::AddPepperPlugins.
static void AddPepperPlugins(std::vector<content::PepperPluginInfo>* plugins);
const base::FilePath& path() { return path_; }
#endif
private:
friend struct base::DefaultLazyInstanceTraits<CefWidevineLoader>;
// Members are only accessed before context initialization or on the UI
// thread.
bool load_pending_ = false;
base::FilePath path_;
CefRefPtr<CefRegisterCdmCallback> callback_;
CefWidevineLoader();
~CefWidevineLoader();
};
#endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
#endif // CEF_LIBCEF_COMMON_WIDEVINE_LOADER_H_

View File

@@ -378,6 +378,23 @@ CefString CefDOMNodeImpl::GetElementInnerText() {
return str;
}
CefRect CefDOMNodeImpl::GetElementBounds() {
CefRect rect;
if (!VerifyContext())
return rect;
if (!node_.isElementNode()) {
NOTREACHED();
return rect;
}
WebElement element = node_.to<blink::WebElement>();
blink::WebRect rc = element.boundsInViewport();
rect.Set(rc.x, rc.y, rc.width, rc.height);
return rect;
}
void CefDOMNodeImpl::Detach() {
document_ = NULL;
node_.assign(WebNode());

View File

@@ -44,6 +44,7 @@ class CefDOMNodeImpl : public CefDOMNode {
bool SetElementAttribute(const CefString& attrName,
const CefString& value) override;
CefString GetElementInnerText() override;
CefRect GetElementBounds() override;
// Will be called from CefDOMDocumentImpl::Detach().
void Detach();

View File

@@ -162,8 +162,8 @@ void CefFrameImpl::ExecuteJavaScript(const CefString& jsCode,
if (jsCode.empty())
return;
if (startLine < 0)
startLine = 0;
if (startLine < 1)
startLine = 1;
if (frame_) {
GURL gurl = GURL(scriptUrl.ToString());

View File

@@ -337,6 +337,14 @@ class V8TrackObject : public CefTrackNode {
return accessor_;
}
inline void SetInterceptor(CefRefPtr<CefV8Interceptor> interceptor) {
interceptor_ = interceptor;
}
inline CefRefPtr<CefV8Interceptor> GetInterceptor() {
return interceptor_;
}
inline void SetHandler(CefRefPtr<CefV8Handler> handler) {
handler_ = handler;
}
@@ -373,6 +381,7 @@ class V8TrackObject : public CefTrackNode {
private:
v8::Isolate* isolate_;
CefRefPtr<CefV8Accessor> accessor_;
CefRefPtr<CefV8Interceptor> interceptor_;
CefRefPtr<CefV8Handler> handler_;
CefRefPtr<CefBase> user_data_;
int external_memory_;
@@ -645,6 +654,77 @@ void AccessorNameSetterCallbackImpl(
}
}
// Two helper functions for V8 Interceptor callbacks.
CefString PropertyToIndex(v8::Local<v8::String> str) {
CefString name;
GetCefString(str, name);
return name;
}
int PropertyToIndex(uint32_t index) {
return static_cast<int>(index);
}
// V8 Interceptor callbacks.
// T == v8::Local<v8::String> for named property handlers and
// T == uint32_t for indexed property handlers
template<typename T>
void InterceptorGetterCallbackImpl(
T property,
const v8::PropertyCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
v8::Handle<v8::Object> obj = info.This();
CefRefPtr<CefV8Interceptor> interceptorPtr;
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
if (tracker)
interceptorPtr = tracker->GetInterceptor();
if (!interceptorPtr.get())
return;
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(isolate, context, obj);
CefRefPtr<CefV8Value> retval;
CefString exception;
interceptorPtr->Get(PropertyToIndex(property), object, retval, exception);
if (!exception.empty()) {
info.GetReturnValue().Set(isolate->ThrowException(
v8::Exception::Error(GetV8String(isolate, exception))));
} else {
CefV8ValueImpl* retval_impl = static_cast<CefV8ValueImpl*>(retval.get());
if (retval_impl && retval_impl->IsValid()) {
info.GetReturnValue().Set(retval_impl->GetV8Value(true));
}
}
}
template<typename T>
void InterceptorSetterCallbackImpl(
T property,
v8::Local<v8::Value> value,
const v8::PropertyCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
v8::Handle<v8::Object> obj = info.This();
CefRefPtr<CefV8Interceptor> interceptorPtr;
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
if (tracker)
interceptorPtr = tracker->GetInterceptor();
if (!interceptorPtr.get())
return;
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(isolate, context, obj);
CefRefPtr<CefV8Value> cefValue = new CefV8ValueImpl(isolate, context, value);
CefString exception;
interceptorPtr->Set(PropertyToIndex(property), object, cefValue, exception);
if (!exception.empty()) {
isolate->ThrowException(
v8::Exception::Error(GetV8String(isolate, exception)));
}
}
// V8 extension registration.
class ExtensionWrapper : public v8::Extension {
@@ -1014,8 +1094,13 @@ bool CefV8ContextImpl::IsSame(CefRefPtr<CefV8Context> that) {
}
bool CefV8ContextImpl::Eval(const CefString& code,
const CefString& script_url,
int start_line,
CefRefPtr<CefV8Value>& retval,
CefRefPtr<CefV8Exception>& exception) {
retval = NULL;
exception = NULL;
CEF_V8_REQUIRE_VALID_HANDLE_RETURN(false);
if (webkit_glue::IsScriptForbidden())
@@ -1030,33 +1115,28 @@ bool CefV8ContextImpl::Eval(const CefString& code,
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context = GetV8Context();
v8::Context::Scope context_scope(context);
v8::Local<v8::Object> obj = context->Global();
// Retrieve the eval function.
v8::Local<v8::Value> val = obj->Get(v8::String::NewFromUtf8(isolate, "eval"));
if (val.IsEmpty() || !val->IsFunction())
return false;
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(val);
v8::Local<v8::Value> code_val = GetV8String(isolate, code);
const blink::WebString& source = code.ToString16();
const blink::WebString& source_url = script_url.ToString16();
v8::TryCatch try_catch(isolate);
try_catch.SetVerbose(true);
retval = NULL;
exception = NULL;
v8::MaybeLocal<v8::Value> func_rv =
webkit_glue::CallV8Function(context, func, obj, 1, &code_val,
handle_->isolate());
webkit_glue::ExecuteV8ScriptAndReturnValue(source, source_url, start_line,
context, isolate, try_catch,
blink::AccessControlStatus::NotSharableCrossOrigin);
if (try_catch.HasCaught()) {
exception = new CefV8ExceptionImpl(context, try_catch.Message());
return false;
} else if (!func_rv.IsEmpty()) {
retval = new CefV8ValueImpl(isolate, context, func_rv.ToLocalChecked());
return true;
}
return true;
NOTREACHED();
return false;
}
v8::Local<v8::Context> CefV8ContextImpl::GetV8Context() {
@@ -1260,7 +1340,8 @@ CefRefPtr<CefV8Value> CefV8Value::CreateString(const CefString& value) {
// static
CefRefPtr<CefV8Value> CefV8Value::CreateObject(
CefRefPtr<CefV8Accessor> accessor) {
CefRefPtr<CefV8Accessor> accessor,
CefRefPtr<CefV8Interceptor> interceptor) {
CEF_V8_REQUIRE_ISOLATE_RETURN(NULL);
v8::Isolate* isolate = GetIsolateManager()->isolate();
@@ -1272,13 +1353,28 @@ CefRefPtr<CefV8Value> CefV8Value::CreateObject(
return NULL;
}
// Create the new V8 object.
v8::Local<v8::Object> obj = v8::Object::New(isolate);
// Create the new V8 object. If an interceptor is passed, create object from
// template and set property handlers.
v8::Local<v8::Object> obj;
if (interceptor.get()) {
v8::Local<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(isolate);
tmpl->SetNamedPropertyHandler(
InterceptorGetterCallbackImpl<v8::Local<v8::String>>,
InterceptorSetterCallbackImpl<v8::Local<v8::String>>);
tmpl->SetIndexedPropertyHandler(InterceptorGetterCallbackImpl<uint32_t>,
InterceptorSetterCallbackImpl<uint32_t>);
obj = tmpl->NewInstance();
} else {
obj = v8::Object::New(isolate);
}
// Create a tracker object that will cause the user data and/or accessor
// reference to be released when the V8 object is destroyed.
// and/or interceptor reference to be released when the V8 object is
// destroyed.
V8TrackObject* tracker = new V8TrackObject(isolate);
tracker->SetAccessor(accessor);
tracker->SetInterceptor(interceptor);
// Attach the tracker object.
tracker->AttachTo(context, obj);

View File

@@ -182,6 +182,8 @@ class CefV8ContextImpl : public CefV8Context {
bool Exit() override;
bool IsSame(CefRefPtr<CefV8Context> that) override;
bool Eval(const CefString& code,
const CefString& script_url,
int start_line,
CefRefPtr<CefV8Value>& retval,
CefRefPtr<CefV8Exception>& exception) override;

View File

@@ -25,12 +25,14 @@ MSVC_PUSH_WARNING_LEVEL(0);
#include "third_party/WebKit/public/web/WebViewClient.h"
#include "third_party/WebKit/Source/bindings/core/v8/ScriptController.h"
#include "third_party/WebKit/Source/bindings/core/v8/ScriptSourceCode.h"
#include "third_party/WebKit/Source/bindings/core/v8/V8Binding.h"
#include "third_party/WebKit/Source/core/dom/Document.h"
#include "third_party/WebKit/Source/core/dom/Element.h"
#include "third_party/WebKit/Source/core/dom/Node.h"
#include "third_party/WebKit/Source/core/editing/serializers/Serialization.h"
#include "third_party/WebKit/Source/core/frame/LocalFrame.h"
#include "third_party/WebKit/Source/core/frame/Settings.h"
#include "third_party/WebKit/Source/web/WebLocalFrameImpl.h"
#include "third_party/WebKit/Source/web/WebViewImpl.h"
MSVC_POP_WARNING();
@@ -184,6 +186,51 @@ v8::MaybeLocal<v8::Value> CallV8Function(v8::Local<v8::Context> context,
return func_rv;
}
v8::MaybeLocal<v8::Value> ExecuteV8ScriptAndReturnValue(
const blink::WebString& source,
const blink::WebString& source_url,
int start_line,
v8::Local<v8::Context> context,
v8::Isolate* isolate,
v8::TryCatch& tryCatch,
blink::AccessControlStatus accessControlStatus) {
// Based on ScriptController::executeScriptAndReturnValue
DCHECK(isolate);
if (start_line < 1)
start_line = 1;
const blink::KURL kurl = source_url.isEmpty() ?
blink::KURL() : blink::KURL(blink::ParsedURLString, source_url);
const blink::ScriptSourceCode ssc = blink::ScriptSourceCode(source, kurl,
WTF::TextPosition(WTF::OrdinalNumber::fromOneBasedInt(start_line),
WTF::OrdinalNumber::fromZeroBasedInt(0)));
v8::MaybeLocal<v8::Value> result;
blink::LocalFrame* frame =
toLocalFrame(blink::toFrameIfNotDetached(context));
DCHECK(frame);
if (frame) {
blink::V8CacheOptions v8CacheOptions(blink::V8CacheOptionsDefault);
if (frame && frame->settings())
v8CacheOptions = frame->settings()->v8CacheOptions();
v8::Local<v8::Script> script;
if (!blink::v8Call(blink::V8ScriptRunner::compileScript(ssc, isolate,
accessControlStatus, v8CacheOptions), script, tryCatch)) {
return result;
}
result = blink::V8ScriptRunner::runCompiledScript(isolate, script,
blink::toExecutionContext(context));
}
return result;
}
bool IsScriptForbidden() {
return blink::ScriptForbiddenScope::isScriptForbidden();
}

View File

@@ -11,6 +11,7 @@
#include <string>
#include "include/internal/cef_types.h"
#include "third_party/WebKit/Source/core/fetch/AccessControlStatus.h"
#include "v8/include/v8.h"
namespace blink {
@@ -52,6 +53,15 @@ v8::MaybeLocal<v8::Value> CallV8Function(v8::Local<v8::Context> context,
v8::Local<v8::Value> args[],
v8::Isolate* isolate);
v8::MaybeLocal<v8::Value> ExecuteV8ScriptAndReturnValue(
const blink::WebString& source,
const blink::WebString& source_url,
int start_line,
v8::Local<v8::Context> context,
v8::Isolate* isolate,
v8::TryCatch& tryCatch,
blink::AccessControlStatus accessControlStatus);
bool IsScriptForbidden();
} // webkit_glue

View File

@@ -13,6 +13,7 @@
#include "libcef_dll/cpptoc/browser_cpptoc.h"
#include "libcef_dll/cpptoc/browser_host_cpptoc.h"
#include "libcef_dll/cpptoc/drag_data_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"
#include "libcef_dll/ctocpp/download_image_callback_ctocpp.h"
@@ -938,6 +939,22 @@ void CEF_CALLBACK browser_host_drag_source_system_drag_ended(
CefBrowserHostCppToC::Get(self)->DragSourceSystemDragEnded();
}
struct _cef_navigation_entry_t* CEF_CALLBACK browser_host_get_visible_navigation_entry(
struct _cef_browser_host_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefNavigationEntry> _retval = CefBrowserHostCppToC::Get(
self)->GetVisibleNavigationEntry();
// Return type: refptr_same
return CefNavigationEntryCppToC::Wrap(_retval);
}
} // namespace
@@ -1003,6 +1020,8 @@ CefBrowserHostCppToC::CefBrowserHostCppToC() {
GetStruct()->drag_source_ended_at = browser_host_drag_source_ended_at;
GetStruct()->drag_source_system_drag_ended =
browser_host_drag_source_system_drag_ended;
GetStruct()->get_visible_navigation_entry =
browser_host_get_visible_navigation_entry;
}
template<> CefRefPtr<CefBrowserHost> CefCppToC<CefBrowserHostCppToC,

View File

@@ -429,6 +429,21 @@ cef_string_userfree_t CEF_CALLBACK domnode_get_element_inner_text(
return _retval.DetachToUserFree();
}
cef_rect_t CEF_CALLBACK domnode_get_element_bounds(
struct _cef_domnode_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefRect();
// Execute
cef_rect_t _retval = CefDOMNodeCppToC::Get(self)->GetElementBounds();
// Return type: simple
return _retval;
}
} // namespace
@@ -461,6 +476,7 @@ CefDOMNodeCppToC::CefDOMNodeCppToC() {
GetStruct()->get_element_attributes = domnode_get_element_attributes;
GetStruct()->set_element_attribute = domnode_set_element_attribute;
GetStruct()->get_element_inner_text = domnode_get_element_inner_text;
GetStruct()->get_element_bounds = domnode_get_element_bounds;
}
template<> CefRefPtr<CefDOMNode> CefCppToC<CefDOMNodeCppToC, CefDOMNode,

View File

@@ -55,6 +55,52 @@ void CEF_CALLBACK menu_model_delegate_menu_will_show(
CefMenuModelCToCpp::Wrap(menu_model));
}
void CEF_CALLBACK menu_model_delegate_menu_closed(
struct _cef_menu_model_delegate_t* self, cef_menu_model_t* menu_model) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: menu_model; type: refptr_diff
DCHECK(menu_model);
if (!menu_model)
return;
// Execute
CefMenuModelDelegateCppToC::Get(self)->MenuClosed(
CefMenuModelCToCpp::Wrap(menu_model));
}
int CEF_CALLBACK menu_model_delegate_format_label(
struct _cef_menu_model_delegate_t* self, cef_menu_model_t* menu_model,
cef_string_t* label) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: menu_model; type: refptr_diff
DCHECK(menu_model);
if (!menu_model)
return 0;
// Verify param: label; type: string_byref
DCHECK(label);
if (!label)
return 0;
// Translate param: label; type: string_byref
CefString labelStr(label);
// Execute
bool _retval = CefMenuModelDelegateCppToC::Get(self)->FormatLabel(
CefMenuModelCToCpp::Wrap(menu_model),
labelStr);
// Return type: bool
return _retval;
}
} // namespace
@@ -63,6 +109,8 @@ void CEF_CALLBACK menu_model_delegate_menu_will_show(
CefMenuModelDelegateCppToC::CefMenuModelDelegateCppToC() {
GetStruct()->execute_command = menu_model_delegate_execute_command;
GetStruct()->menu_will_show = menu_model_delegate_menu_will_show;
GetStruct()->menu_closed = menu_model_delegate_menu_closed;
GetStruct()->format_label = menu_model_delegate_format_label;
}
template<> CefRefPtr<CefMenuModelDelegate> CefCppToC<CefMenuModelDelegateCppToC,

View File

@@ -11,6 +11,7 @@
//
#include "libcef_dll/cpptoc/navigation_entry_cpptoc.h"
#include "libcef_dll/cpptoc/sslstatus_cpptoc.h"
namespace {
@@ -153,6 +154,22 @@ int CEF_CALLBACK navigation_entry_get_http_status_code(
return _retval;
}
struct _cef_sslstatus_t* CEF_CALLBACK navigation_entry_get_sslstatus(
struct _cef_navigation_entry_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefSSLStatus> _retval = CefNavigationEntryCppToC::Get(
self)->GetSSLStatus();
// Return type: refptr_same
return CefSSLStatusCppToC::Wrap(_retval);
}
} // namespace
@@ -168,6 +185,7 @@ CefNavigationEntryCppToC::CefNavigationEntryCppToC() {
GetStruct()->has_post_data = navigation_entry_has_post_data;
GetStruct()->get_completion_time = navigation_entry_get_completion_time;
GetStruct()->get_http_status_code = navigation_entry_get_http_status_code;
GetStruct()->get_sslstatus = navigation_entry_get_sslstatus;
}
template<> CefRefPtr<CefNavigationEntry> CefCppToC<CefNavigationEntryCppToC,

View File

@@ -20,6 +20,8 @@
#include "include/cef_navigation_entry.h"
#include "include/capi/cef_navigation_entry_capi.h"
#include "include/cef_ssl_status.h"
#include "include/capi/cef_ssl_status_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.

View File

@@ -0,0 +1,60 @@
// Copyright (c) 2016 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.
//
#include "libcef_dll/cpptoc/register_cdm_callback_cpptoc.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK register_cdm_callback_on_cdm_registration_complete(
struct _cef_register_cdm_callback_t* self,
cef_cdm_registration_error_t result, const cef_string_t* error_message) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Unverified params: error_message
// Execute
CefRegisterCdmCallbackCppToC::Get(self)->OnCdmRegistrationComplete(
result,
CefString(error_message));
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefRegisterCdmCallbackCppToC::CefRegisterCdmCallbackCppToC() {
GetStruct()->on_cdm_registration_complete =
register_cdm_callback_on_cdm_registration_complete;
}
template<> CefRefPtr<CefRegisterCdmCallback> CefCppToC<CefRegisterCdmCallbackCppToC,
CefRegisterCdmCallback, cef_register_cdm_callback_t>::UnwrapDerived(
CefWrapperType type, cef_register_cdm_callback_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToC<CefRegisterCdmCallbackCppToC,
CefRegisterCdmCallback, cef_register_cdm_callback_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToC<CefRegisterCdmCallbackCppToC,
CefRegisterCdmCallback, cef_register_cdm_callback_t>::kWrapperType =
WT_REGISTER_CDM_CALLBACK;

View File

@@ -0,0 +1,37 @@
// Copyright (c) 2016 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.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_REGISTER_CDM_CALLBACK_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_REGISTER_CDM_CALLBACK_CPPTOC_H_
#pragma once
#ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED
#include "include/cef_web_plugin.h"
#include "include/capi/cef_web_plugin_capi.h"
#include "include/cef_browser.h"
#include "include/capi/cef_browser_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed wrapper-side only.
class CefRegisterCdmCallbackCppToC
: public CefCppToC<CefRegisterCdmCallbackCppToC, CefRegisterCdmCallback,
cef_register_cdm_callback_t> {
public:
CefRegisterCdmCallbackCppToC();
};
#endif // USING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_REGISTER_CDM_CALLBACK_CPPTOC_H_

View File

@@ -20,6 +20,8 @@
#include "libcef_dll/ctocpp/request_callback_ctocpp.h"
#include "libcef_dll/ctocpp/response_ctocpp.h"
#include "libcef_dll/ctocpp/sslinfo_ctocpp.h"
#include "libcef_dll/ctocpp/select_client_certificate_callback_ctocpp.h"
#include "libcef_dll/ctocpp/x509certificate_ctocpp.h"
namespace {
@@ -466,6 +468,56 @@ int CEF_CALLBACK request_handler_on_certificate_error(
return _retval;
}
int CEF_CALLBACK request_handler_on_select_client_certificate(
struct _cef_request_handler_t* self, cef_browser_t* browser, int isProxy,
const cef_string_t* host, int port, size_t certificatesCount,
struct _cef_x509certificate_t* const* certificates,
cef_select_client_certificate_callback_t* callback) {
// 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: host; type: string_byref_const
DCHECK(host);
if (!host)
return 0;
// Verify param: certificates; type: refptr_vec_diff_byref_const
DCHECK(certificatesCount == 0 || certificates);
if (certificatesCount > 0 && !certificates)
return 0;
// Verify param: callback; type: refptr_diff
DCHECK(callback);
if (!callback)
return 0;
// Translate param: certificates; type: refptr_vec_diff_byref_const
std::vector<CefRefPtr<CefX509Certificate> > certificatesList;
if (certificatesCount > 0) {
for (size_t i = 0; i < certificatesCount; ++i) {
CefRefPtr<CefX509Certificate> certificatesVal =
CefX509CertificateCToCpp::Wrap(certificates[i]);
certificatesList.push_back(certificatesVal);
}
}
// Execute
bool _retval = CefRequestHandlerCppToC::Get(self)->OnSelectClientCertificate(
CefBrowserCToCpp::Wrap(browser),
isProxy?true:false,
CefString(host),
port,
certificatesList,
CefSelectClientCertificateCallbackCToCpp::Wrap(callback));
// Return type: bool
return _retval;
}
void CEF_CALLBACK request_handler_on_plugin_crashed(
struct _cef_request_handler_t* self, cef_browser_t* browser,
const cef_string_t* plugin_path) {
@@ -546,6 +598,8 @@ CefRequestHandlerCppToC::CefRequestHandlerCppToC() {
GetStruct()->on_quota_request = request_handler_on_quota_request;
GetStruct()->on_protocol_execution = request_handler_on_protocol_execution;
GetStruct()->on_certificate_error = request_handler_on_certificate_error;
GetStruct()->on_select_client_certificate =
request_handler_on_select_client_certificate;
GetStruct()->on_plugin_crashed = request_handler_on_plugin_crashed;
GetStruct()->on_render_view_ready = request_handler_on_render_view_ready;
GetStruct()->on_render_process_terminated =

View File

@@ -0,0 +1,63 @@
// Copyright (c) 2016 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.
//
#include "libcef_dll/cpptoc/select_client_certificate_callback_cpptoc.h"
#include "libcef_dll/cpptoc/x509certificate_cpptoc.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK select_client_certificate_callback_select(
struct _cef_select_client_certificate_callback_t* self,
struct _cef_x509certificate_t* cert) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Unverified params: cert
// Execute
CefSelectClientCertificateCallbackCppToC::Get(self)->Select(
CefX509CertificateCppToC::Unwrap(cert));
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefSelectClientCertificateCallbackCppToC::CefSelectClientCertificateCallbackCppToC(
) {
GetStruct()->select = select_client_certificate_callback_select;
}
template<> CefRefPtr<CefSelectClientCertificateCallback> CefCppToC<CefSelectClientCertificateCallbackCppToC,
CefSelectClientCertificateCallback,
cef_select_client_certificate_callback_t>::UnwrapDerived(
CefWrapperType type, cef_select_client_certificate_callback_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToC<CefSelectClientCertificateCallbackCppToC,
CefSelectClientCertificateCallback,
cef_select_client_certificate_callback_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToC<CefSelectClientCertificateCallbackCppToC,
CefSelectClientCertificateCallback,
cef_select_client_certificate_callback_t>::kWrapperType =
WT_SELECT_CLIENT_CERTIFICATE_CALLBACK;

View File

@@ -0,0 +1,36 @@
// Copyright (c) 2016 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.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_SELECT_CLIENT_CERTIFICATE_CALLBACK_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_SELECT_CLIENT_CERTIFICATE_CALLBACK_CPPTOC_H_
#pragma once
#ifndef BUILDING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
#else // BUILDING_CEF_SHARED
#include "include/cef_request_handler.h"
#include "include/capi/cef_request_handler_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefSelectClientCertificateCallbackCppToC
: public CefCppToC<CefSelectClientCertificateCallbackCppToC,
CefSelectClientCertificateCallback,
cef_select_client_certificate_callback_t> {
public:
CefSelectClientCertificateCallbackCppToC();
};
#endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_SELECT_CLIENT_CERTIFICATE_CALLBACK_CPPTOC_H_

View File

@@ -10,10 +10,8 @@
// for more information.
//
#include <algorithm>
#include "libcef_dll/cpptoc/binary_value_cpptoc.h"
#include "libcef_dll/cpptoc/sslcert_principal_cpptoc.h"
#include "libcef_dll/cpptoc/sslinfo_cpptoc.h"
#include "libcef_dll/cpptoc/x509certificate_cpptoc.h"
namespace {
@@ -35,36 +33,7 @@ cef_cert_status_t CEF_CALLBACK sslinfo_get_cert_status(
return _retval;
}
int CEF_CALLBACK sslinfo_is_cert_status_error(struct _cef_sslinfo_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefSSLInfoCppToC::Get(self)->IsCertStatusError();
// Return type: bool
return _retval;
}
int CEF_CALLBACK sslinfo_is_cert_status_minor_error(
struct _cef_sslinfo_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefSSLInfoCppToC::Get(self)->IsCertStatusMinorError();
// Return type: bool
return _retval;
}
cef_sslcert_principal_t* CEF_CALLBACK sslinfo_get_subject(
struct _cef_x509certificate_t* CEF_CALLBACK sslinfo_get_x509certificate(
struct _cef_sslinfo_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@@ -73,189 +42,11 @@ cef_sslcert_principal_t* CEF_CALLBACK sslinfo_get_subject(
return NULL;
// Execute
CefRefPtr<CefSSLCertPrincipal> _retval = CefSSLInfoCppToC::Get(
self)->GetSubject();
CefRefPtr<CefX509Certificate> _retval = CefSSLInfoCppToC::Get(
self)->GetX509Certificate();
// Return type: refptr_same
return CefSSLCertPrincipalCppToC::Wrap(_retval);
}
cef_sslcert_principal_t* CEF_CALLBACK sslinfo_get_issuer(
struct _cef_sslinfo_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefSSLCertPrincipal> _retval = CefSSLInfoCppToC::Get(
self)->GetIssuer();
// Return type: refptr_same
return CefSSLCertPrincipalCppToC::Wrap(_retval);
}
struct _cef_binary_value_t* CEF_CALLBACK sslinfo_get_serial_number(
struct _cef_sslinfo_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefBinaryValue> _retval = CefSSLInfoCppToC::Get(
self)->GetSerialNumber();
// Return type: refptr_same
return CefBinaryValueCppToC::Wrap(_retval);
}
cef_time_t CEF_CALLBACK sslinfo_get_valid_start(struct _cef_sslinfo_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefTime();
// Execute
cef_time_t _retval = CefSSLInfoCppToC::Get(self)->GetValidStart();
// Return type: simple
return _retval;
}
cef_time_t CEF_CALLBACK sslinfo_get_valid_expiry(struct _cef_sslinfo_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefTime();
// Execute
cef_time_t _retval = CefSSLInfoCppToC::Get(self)->GetValidExpiry();
// Return type: simple
return _retval;
}
struct _cef_binary_value_t* CEF_CALLBACK sslinfo_get_derencoded(
struct _cef_sslinfo_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefBinaryValue> _retval = CefSSLInfoCppToC::Get(
self)->GetDEREncoded();
// Return type: refptr_same
return CefBinaryValueCppToC::Wrap(_retval);
}
struct _cef_binary_value_t* CEF_CALLBACK sslinfo_get_pemencoded(
struct _cef_sslinfo_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefBinaryValue> _retval = CefSSLInfoCppToC::Get(
self)->GetPEMEncoded();
// Return type: refptr_same
return CefBinaryValueCppToC::Wrap(_retval);
}
size_t CEF_CALLBACK sslinfo_get_issuer_chain_size(struct _cef_sslinfo_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
size_t _retval = CefSSLInfoCppToC::Get(self)->GetIssuerChainSize();
// Return type: simple
return _retval;
}
void CEF_CALLBACK sslinfo_get_derencoded_issuer_chain(
struct _cef_sslinfo_t* self, size_t* chainCount,
struct _cef_binary_value_t** chain) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: chain; type: refptr_vec_same_byref
DCHECK(chainCount && (*chainCount == 0 || chain));
if (!chainCount || (*chainCount > 0 && !chain))
return;
// Translate param: chain; type: refptr_vec_same_byref
std::vector<CefRefPtr<CefBinaryValue> > chainList;
if (chainCount && *chainCount > 0 && chain) {
for (size_t i = 0; i < *chainCount; ++i) {
chainList.push_back(CefBinaryValueCppToC::Unwrap(chain[i]));
}
}
// Execute
CefSSLInfoCppToC::Get(self)->GetDEREncodedIssuerChain(
chainList);
// Restore param: chain; type: refptr_vec_same_byref
if (chainCount && chain) {
*chainCount = std::min(chainList.size(), *chainCount);
if (*chainCount > 0) {
for (size_t i = 0; i < *chainCount; ++i) {
chain[i] = CefBinaryValueCppToC::Wrap(chainList[i]);
}
}
}
}
void CEF_CALLBACK sslinfo_get_pemencoded_issuer_chain(
struct _cef_sslinfo_t* self, size_t* chainCount,
struct _cef_binary_value_t** chain) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: chain; type: refptr_vec_same_byref
DCHECK(chainCount && (*chainCount == 0 || chain));
if (!chainCount || (*chainCount > 0 && !chain))
return;
// Translate param: chain; type: refptr_vec_same_byref
std::vector<CefRefPtr<CefBinaryValue> > chainList;
if (chainCount && *chainCount > 0 && chain) {
for (size_t i = 0; i < *chainCount; ++i) {
chainList.push_back(CefBinaryValueCppToC::Unwrap(chain[i]));
}
}
// Execute
CefSSLInfoCppToC::Get(self)->GetPEMEncodedIssuerChain(
chainList);
// Restore param: chain; type: refptr_vec_same_byref
if (chainCount && chain) {
*chainCount = std::min(chainList.size(), *chainCount);
if (*chainCount > 0) {
for (size_t i = 0; i < *chainCount; ++i) {
chain[i] = CefBinaryValueCppToC::Wrap(chainList[i]);
}
}
}
return CefX509CertificateCppToC::Wrap(_retval);
}
} // namespace
@@ -265,20 +56,7 @@ void CEF_CALLBACK sslinfo_get_pemencoded_issuer_chain(
CefSSLInfoCppToC::CefSSLInfoCppToC() {
GetStruct()->get_cert_status = sslinfo_get_cert_status;
GetStruct()->is_cert_status_error = sslinfo_is_cert_status_error;
GetStruct()->is_cert_status_minor_error = sslinfo_is_cert_status_minor_error;
GetStruct()->get_subject = sslinfo_get_subject;
GetStruct()->get_issuer = sslinfo_get_issuer;
GetStruct()->get_serial_number = sslinfo_get_serial_number;
GetStruct()->get_valid_start = sslinfo_get_valid_start;
GetStruct()->get_valid_expiry = sslinfo_get_valid_expiry;
GetStruct()->get_derencoded = sslinfo_get_derencoded;
GetStruct()->get_pemencoded = sslinfo_get_pemencoded;
GetStruct()->get_issuer_chain_size = sslinfo_get_issuer_chain_size;
GetStruct()->get_derencoded_issuer_chain =
sslinfo_get_derencoded_issuer_chain;
GetStruct()->get_pemencoded_issuer_chain =
sslinfo_get_pemencoded_issuer_chain;
GetStruct()->get_x509certificate = sslinfo_get_x509certificate;
}
template<> CefRefPtr<CefSSLInfo> CefCppToC<CefSSLInfoCppToC, CefSSLInfo,

View File

@@ -0,0 +1,122 @@
// Copyright (c) 2016 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.
//
#include "libcef_dll/cpptoc/sslstatus_cpptoc.h"
#include "libcef_dll/cpptoc/x509certificate_cpptoc.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK sslstatus_is_secure_connection(struct _cef_sslstatus_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefSSLStatusCppToC::Get(self)->IsSecureConnection();
// Return type: bool
return _retval;
}
cef_cert_status_t CEF_CALLBACK sslstatus_get_cert_status(
struct _cef_sslstatus_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CERT_STATUS_NONE;
// Execute
cef_cert_status_t _retval = CefSSLStatusCppToC::Get(self)->GetCertStatus();
// Return type: simple
return _retval;
}
cef_ssl_version_t CEF_CALLBACK sslstatus_get_sslversion(
struct _cef_sslstatus_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return SSL_CONNECTION_VERSION_UNKNOWN;
// Execute
cef_ssl_version_t _retval = CefSSLStatusCppToC::Get(self)->GetSSLVersion();
// Return type: simple
return _retval;
}
cef_ssl_content_status_t CEF_CALLBACK sslstatus_get_content_status(
struct _cef_sslstatus_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return SSL_CONTENT_NORMAL_CONTENT;
// Execute
cef_ssl_content_status_t _retval = CefSSLStatusCppToC::Get(
self)->GetContentStatus();
// Return type: simple
return _retval;
}
struct _cef_x509certificate_t* CEF_CALLBACK sslstatus_get_x509certificate(
struct _cef_sslstatus_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefX509Certificate> _retval = CefSSLStatusCppToC::Get(
self)->GetX509Certificate();
// Return type: refptr_same
return CefX509CertificateCppToC::Wrap(_retval);
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefSSLStatusCppToC::CefSSLStatusCppToC() {
GetStruct()->is_secure_connection = sslstatus_is_secure_connection;
GetStruct()->get_cert_status = sslstatus_get_cert_status;
GetStruct()->get_sslversion = sslstatus_get_sslversion;
GetStruct()->get_content_status = sslstatus_get_content_status;
GetStruct()->get_x509certificate = sslstatus_get_x509certificate;
}
template<> CefRefPtr<CefSSLStatus> CefCppToC<CefSSLStatusCppToC, CefSSLStatus,
cef_sslstatus_t>::UnwrapDerived(CefWrapperType type, cef_sslstatus_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToC<CefSSLStatusCppToC, CefSSLStatus,
cef_sslstatus_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToC<CefSSLStatusCppToC, CefSSLStatus,
cef_sslstatus_t>::kWrapperType = WT_SSLSTATUS;

View File

@@ -0,0 +1,36 @@
// Copyright (c) 2016 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.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_SSLSTATUS_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_SSLSTATUS_CPPTOC_H_
#pragma once
#ifndef BUILDING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
#else // BUILDING_CEF_SHARED
#include "include/cef_ssl_status.h"
#include "include/capi/cef_ssl_status_capi.h"
#include "include/cef_x509_certificate.h"
#include "include/capi/cef_x509_certificate_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefSSLStatusCppToC
: public CefCppToC<CefSSLStatusCppToC, CefSSLStatus, cef_sslstatus_t> {
public:
CefSSLStatusCppToC();
};
#endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_SSLSTATUS_CPPTOC_H_

View File

@@ -178,8 +178,8 @@ int CEF_CALLBACK v8context_is_same(struct _cef_v8context_t* self,
}
int CEF_CALLBACK v8context_eval(struct _cef_v8context_t* self,
const cef_string_t* code, struct _cef_v8value_t** retval,
struct _cef_v8exception_t** exception) {
const cef_string_t* code, const cef_string_t* script_url, int start_line,
struct _cef_v8value_t** retval, struct _cef_v8exception_t** exception) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@@ -197,6 +197,7 @@ int CEF_CALLBACK v8context_eval(struct _cef_v8context_t* self,
DCHECK(exception);
if (!exception)
return 0;
// Unverified params: script_url
// Translate param: retval; type: refptr_same_byref
CefRefPtr<CefV8Value> retvalPtr;
@@ -212,6 +213,8 @@ int CEF_CALLBACK v8context_eval(struct _cef_v8context_t* self,
// Execute
bool _retval = CefV8ContextCppToC::Get(self)->Eval(
CefString(code),
CefString(script_url),
start_line,
retvalPtr,
exceptionPtr);

View File

@@ -0,0 +1,234 @@
// Copyright (c) 2016 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.
//
#include "libcef_dll/cpptoc/v8interceptor_cpptoc.h"
#include "libcef_dll/ctocpp/v8value_ctocpp.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK v8interceptor_get_byname(struct _cef_v8interceptor_t* self,
const cef_string_t* name, struct _cef_v8value_t* object,
struct _cef_v8value_t** retval, cef_string_t* exception) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: name; type: string_byref_const
DCHECK(name);
if (!name)
return 0;
// Verify param: object; type: refptr_diff
DCHECK(object);
if (!object)
return 0;
// Verify param: retval; type: refptr_diff_byref
DCHECK(retval);
if (!retval)
return 0;
// Verify param: exception; type: string_byref
DCHECK(exception);
if (!exception)
return 0;
// Translate param: retval; type: refptr_diff_byref
CefRefPtr<CefV8Value> retvalPtr;
if (retval && *retval)
retvalPtr = CefV8ValueCToCpp::Wrap(*retval);
CefV8Value* retvalOrig = retvalPtr.get();
// Translate param: exception; type: string_byref
CefString exceptionStr(exception);
// Execute
bool _retval = CefV8InterceptorCppToC::Get(self)->Get(
CefString(name),
CefV8ValueCToCpp::Wrap(object),
retvalPtr,
exceptionStr);
// Restore param: retval; type: refptr_diff_byref
if (retval) {
if (retvalPtr.get()) {
if (retvalPtr.get() != retvalOrig) {
*retval = CefV8ValueCToCpp::Unwrap(retvalPtr);
}
} else {
*retval = NULL;
}
}
// Return type: bool
return _retval;
}
int CEF_CALLBACK v8interceptor_get_byindex(struct _cef_v8interceptor_t* self,
int index, struct _cef_v8value_t* object, struct _cef_v8value_t** retval,
cef_string_t* exception) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: index; type: simple_byval
DCHECK_GE(index, 0);
if (index < 0)
return 0;
// Verify param: object; type: refptr_diff
DCHECK(object);
if (!object)
return 0;
// Verify param: retval; type: refptr_diff_byref
DCHECK(retval);
if (!retval)
return 0;
// Verify param: exception; type: string_byref
DCHECK(exception);
if (!exception)
return 0;
// Translate param: retval; type: refptr_diff_byref
CefRefPtr<CefV8Value> retvalPtr;
if (retval && *retval)
retvalPtr = CefV8ValueCToCpp::Wrap(*retval);
CefV8Value* retvalOrig = retvalPtr.get();
// Translate param: exception; type: string_byref
CefString exceptionStr(exception);
// Execute
bool _retval = CefV8InterceptorCppToC::Get(self)->Get(
index,
CefV8ValueCToCpp::Wrap(object),
retvalPtr,
exceptionStr);
// Restore param: retval; type: refptr_diff_byref
if (retval) {
if (retvalPtr.get()) {
if (retvalPtr.get() != retvalOrig) {
*retval = CefV8ValueCToCpp::Unwrap(retvalPtr);
}
} else {
*retval = NULL;
}
}
// Return type: bool
return _retval;
}
int CEF_CALLBACK v8interceptor_set_byname(struct _cef_v8interceptor_t* self,
const cef_string_t* name, struct _cef_v8value_t* object,
struct _cef_v8value_t* value, cef_string_t* exception) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: name; type: string_byref_const
DCHECK(name);
if (!name)
return 0;
// Verify param: object; type: refptr_diff
DCHECK(object);
if (!object)
return 0;
// Verify param: value; type: refptr_diff
DCHECK(value);
if (!value)
return 0;
// Verify param: exception; type: string_byref
DCHECK(exception);
if (!exception)
return 0;
// Translate param: exception; type: string_byref
CefString exceptionStr(exception);
// Execute
bool _retval = CefV8InterceptorCppToC::Get(self)->Set(
CefString(name),
CefV8ValueCToCpp::Wrap(object),
CefV8ValueCToCpp::Wrap(value),
exceptionStr);
// Return type: bool
return _retval;
}
int CEF_CALLBACK v8interceptor_set_byindex(struct _cef_v8interceptor_t* self,
int index, struct _cef_v8value_t* object, struct _cef_v8value_t* value,
cef_string_t* exception) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: index; type: simple_byval
DCHECK_GE(index, 0);
if (index < 0)
return 0;
// Verify param: object; type: refptr_diff
DCHECK(object);
if (!object)
return 0;
// Verify param: value; type: refptr_diff
DCHECK(value);
if (!value)
return 0;
// Verify param: exception; type: string_byref
DCHECK(exception);
if (!exception)
return 0;
// Translate param: exception; type: string_byref
CefString exceptionStr(exception);
// Execute
bool _retval = CefV8InterceptorCppToC::Get(self)->Set(
index,
CefV8ValueCToCpp::Wrap(object),
CefV8ValueCToCpp::Wrap(value),
exceptionStr);
// Return type: bool
return _retval;
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefV8InterceptorCppToC::CefV8InterceptorCppToC() {
GetStruct()->get_byname = v8interceptor_get_byname;
GetStruct()->get_byindex = v8interceptor_get_byindex;
GetStruct()->set_byname = v8interceptor_set_byname;
GetStruct()->set_byindex = v8interceptor_set_byindex;
}
template<> CefRefPtr<CefV8Interceptor> CefCppToC<CefV8InterceptorCppToC,
CefV8Interceptor, cef_v8interceptor_t>::UnwrapDerived(CefWrapperType type,
cef_v8interceptor_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToC<CefV8InterceptorCppToC,
CefV8Interceptor, cef_v8interceptor_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToC<CefV8InterceptorCppToC, CefV8Interceptor,
cef_v8interceptor_t>::kWrapperType = WT_V8INTERCEPTOR;

View File

@@ -0,0 +1,35 @@
// Copyright (c) 2016 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.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_V8INTERCEPTOR_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_V8INTERCEPTOR_CPPTOC_H_
#pragma once
#ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED
#include "include/cef_v8.h"
#include "include/capi/cef_v8_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed wrapper-side only.
class CefV8InterceptorCppToC
: public CefCppToC<CefV8InterceptorCppToC, CefV8Interceptor,
cef_v8interceptor_t> {
public:
CefV8InterceptorCppToC();
};
#endif // USING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_V8INTERCEPTOR_CPPTOC_H_

View File

@@ -16,6 +16,7 @@
#include "libcef_dll/ctocpp/base_ctocpp.h"
#include "libcef_dll/ctocpp/v8accessor_ctocpp.h"
#include "libcef_dll/ctocpp/v8handler_ctocpp.h"
#include "libcef_dll/ctocpp/v8interceptor_ctocpp.h"
#include "libcef_dll/transfer_util.h"
@@ -117,15 +118,16 @@ CEF_EXPORT cef_v8value_t* cef_v8value_create_string(const cef_string_t* value) {
return CefV8ValueCppToC::Wrap(_retval);
}
CEF_EXPORT cef_v8value_t* cef_v8value_create_object(
cef_v8accessor_t* accessor) {
CEF_EXPORT cef_v8value_t* cef_v8value_create_object(cef_v8accessor_t* accessor,
cef_v8interceptor_t* interceptor) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: accessor
// Unverified params: accessor, interceptor
// Execute
CefRefPtr<CefV8Value> _retval = CefV8Value::CreateObject(
CefV8AccessorCToCpp::Wrap(accessor));
CefV8AccessorCToCpp::Wrap(accessor),
CefV8InterceptorCToCpp::Wrap(interceptor));
// Return type: refptr_same
return CefV8ValueCppToC::Wrap(_retval);

View File

@@ -10,7 +10,7 @@
// for more information.
//
#include "libcef_dll/cpptoc/sslcert_principal_cpptoc.h"
#include "libcef_dll/cpptoc/x509cert_principal_cpptoc.h"
#include "libcef_dll/transfer_util.h"
@@ -18,8 +18,8 @@ namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_display_name(
struct _cef_sslcert_principal_t* self) {
cef_string_userfree_t CEF_CALLBACK x509cert_principal_get_display_name(
struct _cef_x509cert_principal_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@@ -27,14 +27,14 @@ cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_display_name(
return NULL;
// Execute
CefString _retval = CefSSLCertPrincipalCppToC::Get(self)->GetDisplayName();
CefString _retval = CefX509CertPrincipalCppToC::Get(self)->GetDisplayName();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_common_name(
struct _cef_sslcert_principal_t* self) {
cef_string_userfree_t CEF_CALLBACK x509cert_principal_get_common_name(
struct _cef_x509cert_principal_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@@ -42,14 +42,14 @@ cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_common_name(
return NULL;
// Execute
CefString _retval = CefSSLCertPrincipalCppToC::Get(self)->GetCommonName();
CefString _retval = CefX509CertPrincipalCppToC::Get(self)->GetCommonName();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_locality_name(
struct _cef_sslcert_principal_t* self) {
cef_string_userfree_t CEF_CALLBACK x509cert_principal_get_locality_name(
struct _cef_x509cert_principal_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@@ -57,14 +57,14 @@ cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_locality_name(
return NULL;
// Execute
CefString _retval = CefSSLCertPrincipalCppToC::Get(self)->GetLocalityName();
CefString _retval = CefX509CertPrincipalCppToC::Get(self)->GetLocalityName();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_state_or_province_name(
struct _cef_sslcert_principal_t* self) {
cef_string_userfree_t CEF_CALLBACK x509cert_principal_get_state_or_province_name(
struct _cef_x509cert_principal_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@@ -72,15 +72,15 @@ cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_state_or_province_name(
return NULL;
// Execute
CefString _retval = CefSSLCertPrincipalCppToC::Get(
CefString _retval = CefX509CertPrincipalCppToC::Get(
self)->GetStateOrProvinceName();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_country_name(
struct _cef_sslcert_principal_t* self) {
cef_string_userfree_t CEF_CALLBACK x509cert_principal_get_country_name(
struct _cef_x509cert_principal_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@@ -88,14 +88,14 @@ cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_country_name(
return NULL;
// Execute
CefString _retval = CefSSLCertPrincipalCppToC::Get(self)->GetCountryName();
CefString _retval = CefX509CertPrincipalCppToC::Get(self)->GetCountryName();
// Return type: string
return _retval.DetachToUserFree();
}
void CEF_CALLBACK sslcert_principal_get_street_addresses(
struct _cef_sslcert_principal_t* self, cef_string_list_t addresses) {
void CEF_CALLBACK x509cert_principal_get_street_addresses(
struct _cef_x509cert_principal_t* self, cef_string_list_t addresses) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@@ -111,7 +111,7 @@ void CEF_CALLBACK sslcert_principal_get_street_addresses(
transfer_string_list_contents(addresses, addressesList);
// Execute
CefSSLCertPrincipalCppToC::Get(self)->GetStreetAddresses(
CefX509CertPrincipalCppToC::Get(self)->GetStreetAddresses(
addressesList);
// Restore param: addresses; type: string_vec_byref
@@ -119,8 +119,8 @@ void CEF_CALLBACK sslcert_principal_get_street_addresses(
transfer_string_list_contents(addressesList, addresses);
}
void CEF_CALLBACK sslcert_principal_get_organization_names(
struct _cef_sslcert_principal_t* self, cef_string_list_t names) {
void CEF_CALLBACK x509cert_principal_get_organization_names(
struct _cef_x509cert_principal_t* self, cef_string_list_t names) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@@ -136,7 +136,7 @@ void CEF_CALLBACK sslcert_principal_get_organization_names(
transfer_string_list_contents(names, namesList);
// Execute
CefSSLCertPrincipalCppToC::Get(self)->GetOrganizationNames(
CefX509CertPrincipalCppToC::Get(self)->GetOrganizationNames(
namesList);
// Restore param: names; type: string_vec_byref
@@ -144,8 +144,8 @@ void CEF_CALLBACK sslcert_principal_get_organization_names(
transfer_string_list_contents(namesList, names);
}
void CEF_CALLBACK sslcert_principal_get_organization_unit_names(
struct _cef_sslcert_principal_t* self, cef_string_list_t names) {
void CEF_CALLBACK x509cert_principal_get_organization_unit_names(
struct _cef_x509cert_principal_t* self, cef_string_list_t names) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@@ -161,7 +161,7 @@ void CEF_CALLBACK sslcert_principal_get_organization_unit_names(
transfer_string_list_contents(names, namesList);
// Execute
CefSSLCertPrincipalCppToC::Get(self)->GetOrganizationUnitNames(
CefX509CertPrincipalCppToC::Get(self)->GetOrganizationUnitNames(
namesList);
// Restore param: names; type: string_vec_byref
@@ -169,8 +169,8 @@ void CEF_CALLBACK sslcert_principal_get_organization_unit_names(
transfer_string_list_contents(namesList, names);
}
void CEF_CALLBACK sslcert_principal_get_domain_components(
struct _cef_sslcert_principal_t* self, cef_string_list_t components) {
void CEF_CALLBACK x509cert_principal_get_domain_components(
struct _cef_x509cert_principal_t* self, cef_string_list_t components) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@@ -186,7 +186,7 @@ void CEF_CALLBACK sslcert_principal_get_domain_components(
transfer_string_list_contents(components, componentsList);
// Execute
CefSSLCertPrincipalCppToC::Get(self)->GetDomainComponents(
CefX509CertPrincipalCppToC::Get(self)->GetDomainComponents(
componentsList);
// Restore param: components; type: string_vec_byref
@@ -199,33 +199,33 @@ void CEF_CALLBACK sslcert_principal_get_domain_components(
// CONSTRUCTOR - Do not edit by hand.
CefSSLCertPrincipalCppToC::CefSSLCertPrincipalCppToC() {
GetStruct()->get_display_name = sslcert_principal_get_display_name;
GetStruct()->get_common_name = sslcert_principal_get_common_name;
GetStruct()->get_locality_name = sslcert_principal_get_locality_name;
CefX509CertPrincipalCppToC::CefX509CertPrincipalCppToC() {
GetStruct()->get_display_name = x509cert_principal_get_display_name;
GetStruct()->get_common_name = x509cert_principal_get_common_name;
GetStruct()->get_locality_name = x509cert_principal_get_locality_name;
GetStruct()->get_state_or_province_name =
sslcert_principal_get_state_or_province_name;
GetStruct()->get_country_name = sslcert_principal_get_country_name;
GetStruct()->get_street_addresses = sslcert_principal_get_street_addresses;
x509cert_principal_get_state_or_province_name;
GetStruct()->get_country_name = x509cert_principal_get_country_name;
GetStruct()->get_street_addresses = x509cert_principal_get_street_addresses;
GetStruct()->get_organization_names =
sslcert_principal_get_organization_names;
x509cert_principal_get_organization_names;
GetStruct()->get_organization_unit_names =
sslcert_principal_get_organization_unit_names;
GetStruct()->get_domain_components = sslcert_principal_get_domain_components;
x509cert_principal_get_organization_unit_names;
GetStruct()->get_domain_components = x509cert_principal_get_domain_components;
}
template<> CefRefPtr<CefSSLCertPrincipal> CefCppToC<CefSSLCertPrincipalCppToC,
CefSSLCertPrincipal, cef_sslcert_principal_t>::UnwrapDerived(
CefWrapperType type, cef_sslcert_principal_t* s) {
template<> CefRefPtr<CefX509CertPrincipal> CefCppToC<CefX509CertPrincipalCppToC,
CefX509CertPrincipal, cef_x509cert_principal_t>::UnwrapDerived(
CefWrapperType type, cef_x509cert_principal_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToC<CefSSLCertPrincipalCppToC,
CefSSLCertPrincipal, cef_sslcert_principal_t>::DebugObjCt = 0;
template<> base::AtomicRefCount CefCppToC<CefX509CertPrincipalCppToC,
CefX509CertPrincipal, cef_x509cert_principal_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToC<CefSSLCertPrincipalCppToC,
CefSSLCertPrincipal, cef_sslcert_principal_t>::kWrapperType =
WT_SSLCERT_PRINCIPAL;
template<> CefWrapperType CefCppToC<CefX509CertPrincipalCppToC,
CefX509CertPrincipal, cef_x509cert_principal_t>::kWrapperType =
WT_X509CERT_PRINCIPAL;

View File

@@ -0,0 +1,35 @@
// Copyright (c) 2016 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.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_X509CERT_PRINCIPAL_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_X509CERT_PRINCIPAL_CPPTOC_H_
#pragma once
#ifndef BUILDING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
#else // BUILDING_CEF_SHARED
#include "include/cef_x509_certificate.h"
#include "include/capi/cef_x509_certificate_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefX509CertPrincipalCppToC
: public CefCppToC<CefX509CertPrincipalCppToC, CefX509CertPrincipal,
cef_x509cert_principal_t> {
public:
CefX509CertPrincipalCppToC();
};
#endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_X509CERT_PRINCIPAL_CPPTOC_H_

View File

@@ -0,0 +1,254 @@
// Copyright (c) 2016 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.
//
#include <algorithm>
#include "libcef_dll/cpptoc/binary_value_cpptoc.h"
#include "libcef_dll/cpptoc/x509cert_principal_cpptoc.h"
#include "libcef_dll/cpptoc/x509certificate_cpptoc.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
cef_x509cert_principal_t* CEF_CALLBACK x509certificate_get_subject(
struct _cef_x509certificate_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefX509CertPrincipal> _retval = CefX509CertificateCppToC::Get(
self)->GetSubject();
// Return type: refptr_same
return CefX509CertPrincipalCppToC::Wrap(_retval);
}
cef_x509cert_principal_t* CEF_CALLBACK x509certificate_get_issuer(
struct _cef_x509certificate_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefX509CertPrincipal> _retval = CefX509CertificateCppToC::Get(
self)->GetIssuer();
// Return type: refptr_same
return CefX509CertPrincipalCppToC::Wrap(_retval);
}
cef_binary_value_t* CEF_CALLBACK x509certificate_get_serial_number(
struct _cef_x509certificate_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefBinaryValue> _retval = CefX509CertificateCppToC::Get(
self)->GetSerialNumber();
// Return type: refptr_same
return CefBinaryValueCppToC::Wrap(_retval);
}
cef_time_t CEF_CALLBACK x509certificate_get_valid_start(
struct _cef_x509certificate_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefTime();
// Execute
cef_time_t _retval = CefX509CertificateCppToC::Get(self)->GetValidStart();
// Return type: simple
return _retval;
}
cef_time_t CEF_CALLBACK x509certificate_get_valid_expiry(
struct _cef_x509certificate_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefTime();
// Execute
cef_time_t _retval = CefX509CertificateCppToC::Get(self)->GetValidExpiry();
// Return type: simple
return _retval;
}
cef_binary_value_t* CEF_CALLBACK x509certificate_get_derencoded(
struct _cef_x509certificate_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefBinaryValue> _retval = CefX509CertificateCppToC::Get(
self)->GetDEREncoded();
// Return type: refptr_same
return CefBinaryValueCppToC::Wrap(_retval);
}
cef_binary_value_t* CEF_CALLBACK x509certificate_get_pemencoded(
struct _cef_x509certificate_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefBinaryValue> _retval = CefX509CertificateCppToC::Get(
self)->GetPEMEncoded();
// Return type: refptr_same
return CefBinaryValueCppToC::Wrap(_retval);
}
size_t CEF_CALLBACK x509certificate_get_issuer_chain_size(
struct _cef_x509certificate_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
size_t _retval = CefX509CertificateCppToC::Get(self)->GetIssuerChainSize();
// Return type: simple
return _retval;
}
void CEF_CALLBACK x509certificate_get_derencoded_issuer_chain(
struct _cef_x509certificate_t* self, size_t* chainCount,
cef_binary_value_t** chain) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: chain; type: refptr_vec_same_byref
DCHECK(chainCount && (*chainCount == 0 || chain));
if (!chainCount || (*chainCount > 0 && !chain))
return;
// Translate param: chain; type: refptr_vec_same_byref
std::vector<CefRefPtr<CefBinaryValue> > chainList;
if (chainCount && *chainCount > 0 && chain) {
for (size_t i = 0; i < *chainCount; ++i) {
chainList.push_back(CefBinaryValueCppToC::Unwrap(chain[i]));
}
}
// Execute
CefX509CertificateCppToC::Get(self)->GetDEREncodedIssuerChain(
chainList);
// Restore param: chain; type: refptr_vec_same_byref
if (chainCount && chain) {
*chainCount = std::min(chainList.size(), *chainCount);
if (*chainCount > 0) {
for (size_t i = 0; i < *chainCount; ++i) {
chain[i] = CefBinaryValueCppToC::Wrap(chainList[i]);
}
}
}
}
void CEF_CALLBACK x509certificate_get_pemencoded_issuer_chain(
struct _cef_x509certificate_t* self, size_t* chainCount,
cef_binary_value_t** chain) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: chain; type: refptr_vec_same_byref
DCHECK(chainCount && (*chainCount == 0 || chain));
if (!chainCount || (*chainCount > 0 && !chain))
return;
// Translate param: chain; type: refptr_vec_same_byref
std::vector<CefRefPtr<CefBinaryValue> > chainList;
if (chainCount && *chainCount > 0 && chain) {
for (size_t i = 0; i < *chainCount; ++i) {
chainList.push_back(CefBinaryValueCppToC::Unwrap(chain[i]));
}
}
// Execute
CefX509CertificateCppToC::Get(self)->GetPEMEncodedIssuerChain(
chainList);
// Restore param: chain; type: refptr_vec_same_byref
if (chainCount && chain) {
*chainCount = std::min(chainList.size(), *chainCount);
if (*chainCount > 0) {
for (size_t i = 0; i < *chainCount; ++i) {
chain[i] = CefBinaryValueCppToC::Wrap(chainList[i]);
}
}
}
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefX509CertificateCppToC::CefX509CertificateCppToC() {
GetStruct()->get_subject = x509certificate_get_subject;
GetStruct()->get_issuer = x509certificate_get_issuer;
GetStruct()->get_serial_number = x509certificate_get_serial_number;
GetStruct()->get_valid_start = x509certificate_get_valid_start;
GetStruct()->get_valid_expiry = x509certificate_get_valid_expiry;
GetStruct()->get_derencoded = x509certificate_get_derencoded;
GetStruct()->get_pemencoded = x509certificate_get_pemencoded;
GetStruct()->get_issuer_chain_size = x509certificate_get_issuer_chain_size;
GetStruct()->get_derencoded_issuer_chain =
x509certificate_get_derencoded_issuer_chain;
GetStruct()->get_pemencoded_issuer_chain =
x509certificate_get_pemencoded_issuer_chain;
}
template<> CefRefPtr<CefX509Certificate> CefCppToC<CefX509CertificateCppToC,
CefX509Certificate, cef_x509certificate_t>::UnwrapDerived(
CefWrapperType type, cef_x509certificate_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToC<CefX509CertificateCppToC,
CefX509Certificate, cef_x509certificate_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToC<CefX509CertificateCppToC,
CefX509Certificate, cef_x509certificate_t>::kWrapperType =
WT_X509CERTIFICATE;

Some files were not shown because too many files have changed in this diff Show More