Compare commits

...

35 Commits
3440 ... 2704

Author SHA1 Message Date
Marshall Greenblatt
ec3e9ed7fe Fix crash in CefResourceDispatcherHostDelegate::HandleExternalProtocol when destroying a browser during redirect (issue #1941) 2016-07-08 15:33:18 -04:00
Marshall Greenblatt
9d8b8dd8c6 CefBrowserHost::Invalidate should call OnPaint unconditionally (issue #1871) 2016-07-08 13:55:25 -04:00
Marshall Greenblatt
60b3718650 Update to Chromium version 51.0.2704.103 2016-06-17 10:32:04 -04:00
Marshall Greenblatt
e7ddb8a9a9 Fix crash in CefTaskRunnerImpl::GetTaskRunner when CEF is not initialized (issue #1925) 2016-06-15 14:14:05 -04:00
Marshall Greenblatt
4988f3f43e Mac: Fix file dialog behavior (issue #1919) 2016-06-15 14:13:59 -04:00
Marshall Greenblatt
11ec9b678b Improve binary distribution CMake macros (issue #1923) 2016-06-14 18:31:44 -04:00
Marshall Greenblatt
42d83175b2 Linux: Don't add version script in Debug build (issue #1765) 2016-06-14 13:49:14 -04:00
Marshall Greenblatt
95055fe5c3 cefclient: Don't create multiple DevTools windows (issue #1920) 2016-06-10 14:34:58 -04:00
Marshall Greenblatt
9d28e60884 ShowDevTools should inspect element in existing window (issue #1487) 2016-06-10 13:01:23 -04:00
Marshall Greenblatt
af7a122be5 Mac: Fix window sharing type (issue #1884) 2016-06-09 15:00:02 -04:00
Marshall Greenblatt
c3f0a5b197 Linux: Don't add version script when using ASAN build (issue #1765) 2016-06-07 15:24:30 -04:00
Marshall Greenblatt
8a258afa7d Add Google SafeSearch support (issue #1917) 2016-06-07 15:13:39 -04:00
Marshall Greenblatt
107d4799c4 Update to Chromium version 51.0.2704.84 2016-06-07 11:53:59 -04:00
Marshall Greenblatt
d7148e7cba Linux: Include cefsimple instead of cefclient in client distribution (issue #1916) 2016-06-06 18:25:06 -04:00
Marshall Greenblatt
4420440a44 Windows: Remove wow_helper.exe which is no longer required (issue #1915) 2016-06-06 12:49:21 -04:00
Marshall Greenblatt
dae161f78e Linux: Add version script to restrict exported symbols (issue #1765) 2016-06-06 12:33:33 -04:00
Marshall Greenblatt
08819a571f Update to Chromium version 51.0.2704.79 2016-06-03 13:33:53 -04:00
Marshall Greenblatt
f3af4c8d15 Linux: Fix warn_unused_result error (issue #1911) 2016-06-03 11:38:00 -04:00
Marshall Greenblatt
654931637c Windows: Set CEF_VCVARS=none when using a custom VS install location 2016-05-28 22:05:29 -04:00
Marshall Greenblatt
90c8571f73 Update to Chromium version 51.0.2704.63 2016-05-27 13:53:25 -04:00
Marshall Greenblatt
185cd6c507 Add new CEF_ARCHIVE_FORMAT env var to support different built-in compression formats (issue #1067) 2016-05-18 18:17:03 -04:00
Marshall Greenblatt
6062803d81 Add new CEF_COMMAND_7ZIP_FORMAT env var to support different compression formats (issue #1067) 2016-05-17 13:55:00 -04:00
Marshall Greenblatt
180f18e417 Update msvs_env.bat to respect platform architecture 2016-05-17 12:52:10 -04:00
Marshall Greenblatt
f75afa35ed Add cmake, include and libcef_dll directories to minimal binary distribution (issue #1897) 2016-05-16 14:50:31 -04:00
Marshall Greenblatt
666fa77584 Modernize binary distribution CMake configuration (issue #1897)
- Load CEF configuration using `find_package(CEF)`.
- Use per-target configuration via a new SET_EXECUTABLE_TARGET_PROPERTIES
  macro instead of setting global CMAKE_* variables.
- Support building projects more easily with an external binary
  distribution directory.
- Improve related documentation.
2016-05-16 14:50:22 -04:00
Marshall Greenblatt
f0356b9456 Update to Chromium version 51.0.2704.47 2016-05-13 18:10:04 -04:00
Marshall Greenblatt
1b60aae1bb Add error code to CefResponse (issue #1845) 2016-05-11 15:37:55 -04:00
Marshall Greenblatt
1f6aa71703 Call RenderProcessHost::Send from correct thread (issue #1881) 2016-05-11 12:28:47 -04:00
Marshall Greenblatt
1c7c7563ce Fix incorrect initialization of WebCursor object (issue #1894) 2016-05-11 11:02:37 -04:00
Marshall Greenblatt
a1d5ab2c73 Fix assertion when only video or audio capture is selected (issue #1802) 2016-05-09 16:19:28 -04:00
Marshall Greenblatt
b7a107e712 Fix Win 64-bit conversion from 'size_t' to 'int' error (issue #1887) 2016-05-09 15:08:17 -04:00
Marshall Greenblatt
271787abc2 Enable unified text checker to match Chrome spellcheck behavior (issue #1891) 2016-05-09 14:12:55 -04:00
Marshall Greenblatt
6ab51a4e55 Fix heap-use-after-free during CefCookieManagerImpl destruction (issue #1882) 2016-04-29 14:09:35 -07:00
Marshall Greenblatt
2a3aff4966 Update platform and build requirements.
- Mac: Require 10.7+ deployment target and 10.9+ system version
  (see https://codereview.chromium.org/1615823003/).
- Windows: Changes references from VS2013 to VS2015.
2016-04-29 13:15:31 -04:00
Marshall Greenblatt
5e0fafb8bf Update to Chromium version 51.0.2704.29 2016-04-28 17:17:06 -04:00
94 changed files with 1913 additions and 1226 deletions

View File

@@ -7,5 +7,5 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': '6e53600def8f60d8c632fadc70d7c1939ccea347',
'chromium_checkout': 'refs/tags/51.0.2704.103',
}

View File

@@ -24,17 +24,14 @@
#
# This CEF binary distribution includes the following CMake files:
#
# CMakeLists.txt Bootstrap that sets up the CMake environment and
# loads the other CMake files.
# macros.cmake Helper macros for building a generic CEF-based
# application.
# CMakeLists.txt Bootstrap that sets up the CMake environment.
# cmake/*.cmake CEF configuration files shared by all targets.
# libcef_dll/CMakeLists.txt Defines the libcef_dll_wrapper target.
# cefclient/CMakeLists.txt Defines the cefclient target.
# cefsimple/CMakeLists.txt Defines the cefsimple target.
#
# Existing CMake projects that use this binary distribution without changing the
# directory structure can include the existing "libcef_dll/CMakeLists.txt" file
# with minimal or no changes.
# See the "TODO:" comments below for guidance on how to integrate this CEF
# binary distribution into a new or existing CMake project.
#
# BUILD REQUIREMENTS
#
@@ -44,19 +41,21 @@
#
# - Linux requirements:
# Currently supported distributions include Debian Wheezy, Ubuntu Precise, and
# related. Newer versions will likely also work but may not have been tested.
# related. Ubuntu 14.04 64-bit is recommended. Newer versions will likely also
# work but may not have been tested.
# Required packages include:
# build-essential
# libgtk2.0-dev (required by the cefclient target only)
# libgtkglext1-dev (required by the cefclient target only)
#
# - Mac OS X requirements:
# Xcode 5 or newer building on Mac OS X 10.7 (Lion) or newer. The Xcode
# command-line tools must also be installed.
# Xcode 5 or newer building on Mac OS X 10.9 (Mavericks) or newer. Xcode 7.2
# and OS X 10.11 are recommended. The Xcode command-line tools must also be
# installed. Only 64-bit builds are supported on OS X.
#
# - Windows requirements:
# Visual Studio 2010 or newer building on Windows XP SP3 or newer. 64-bit
# version of Windows 7 or newer recommended.
# Visual Studio 2010 or newer building on Windows 7 or newer. Visual Studio
# 2015 Update 2 and Windows 10 64-bit are recommended.
#
# BUILD EXAMPLES
#
@@ -77,15 +76,6 @@
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
# > ninja cefclient cefsimple
#
# To perform a Mac OS X build using a 32-bit CEF binary distribution:
# Using the Xcode IDE:
# > cmake -G "Xcode" -DPROJECT_ARCH="i386" ..
# Open build\cef.xcodeproj in Xcode and select Product > Build.
#
# Using Ninja:
# > cmake -G "Ninja" -DPROJECT_ARCH="i386" -DCMAKE_BUILD_TYPE=Debug ..
# > ninja cefclient cefsimple
#
# To perform a Mac OS X build using a 64-bit CEF binary distribution:
# Using the Xcode IDE:
# > cmake -G "Xcode" -DPROJECT_ARCH="x86_64" ..
@@ -96,29 +86,29 @@
# > ninja cefclient cefsimple
#
# To perform a Windows build using a 32-bit CEF binary distribution:
# Using the Visual Studio 2013 IDE:
# > cmake -G "Visual Studio 12" ..
# Using the Visual Studio 2015 IDE:
# > cmake -G "Visual Studio 14" ..
# Open build\cef.sln in Visual Studio and select Build > Build Solution.
#
# Using Ninja with Visual Studio 2013 command-line tools:
# Using Ninja with Visual Studio 2015 command-line tools:
# (this path may be different depending on your Visual Studio installation)
# > "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"
# > "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat"
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
# > ninja cefclient cefsimple
#
# To perform a Windows build using a 64-bit CEF binary distribution:
# Using the Visual Studio 2013 IDE:
# > cmake -G "Visual Studio 12 Win64" ..
# Using the Visual Studio 2015 IDE:
# > cmake -G "Visual Studio 14 Win64" ..
# Open build\cef.sln in Visual Studio and select Build > Build Solution.
#
# Using Ninja with Visual Studio 2013 command-line tools:
# Using Ninja with Visual Studio 2015 command-line tools:
# (this path may be different depending on your Visual Studio installation)
# > "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\vcvars64.bat"
# > "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
# > ninja cefclient cefsimple
#
# Shared configuration.
# Global setup.
#
cmake_minimum_required(VERSION 2.8.12.1)
@@ -127,458 +117,91 @@ cmake_minimum_required(VERSION 2.8.12.1)
set(CMAKE_CONFIGURATION_TYPES Debug Release)
# Project name.
# TODO: Change this line to match your project name when you copy this file.
project(cef)
# Use folders in the resulting project files.
set_property(GLOBAL PROPERTY OS_FOLDERS ON)
# Determine the platform.
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
set(OS_MACOSX 1)
set(OS_POSIX 1)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
set(OS_LINUX 1)
set(OS_POSIX 1)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
set(OS_WINDOWS 1)
endif()
# Determine the project architecture.
if(NOT DEFINED PROJECT_ARCH)
if(CMAKE_SIZEOF_VOID_P MATCHES 8)
set(PROJECT_ARCH "x86_64")
else()
set(PROJECT_ARCH "x86")
endif()
#
# CEF_ROOT setup.
# This variable must be set to locate the binary distribution.
# TODO: Choose one of the below examples and comment out the rest.
#
if(OS_MACOSX)
# PROJECT_ARCH should be specified on Mac OS X.
message(WARNING "No PROJECT_ARCH value specified, using ${PROJECT_ARCH}")
endif()
endif()
# Example 1: The current directory contains both the complete binary
# distribution and your project.
# A. Comment in these lines:
#
set(CEF_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CEF_ROOT}/cmake")
if(NOT CMAKE_BUILD_TYPE AND
(${CMAKE_GENERATOR} STREQUAL "Ninja" OR ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles"))
# CMAKE_BUILD_TYPE should be specified when using Ninja or Unix Makefiles.
set(CMAKE_BUILD_TYPE Release)
message(WARNING "No CMAKE_BUILD_TYPE value selected, using ${CMAKE_BUILD_TYPE}")
endif()
# Example 2: The binary distribution is in a separate directory from your
# project. Locate the binary distribution using the CEF_ROOT CMake
# variable.
# A. Create a directory structure for your project like the following:
# myproject/
# CMakeLists.txt <= top-level CMake configuration
# mytarget/
# CMakeLists.txt <= CMake configuration for `mytarget`
# ... other `mytarget` source files
# B. Copy this file to "myproject/CMakeLists.txt" as the top-level CMake
# configuration.
# C. Create the target-specific "myproject/mytarget/CMakeLists.txt" file for
# your application. See the included cefclient and cefsimple CMakeLists.txt
# files as an example.
# D. Comment in these lines:
#
# set(CEF_ROOT "c:/path/to/cef_binary_3.2704.xxxx.gyyyyyyy_windows32")
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CEF_ROOT}/cmake")
# Include cmake macros.
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}")
include("macros")
# Source include directory.
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
# Allow C++ programs to use stdint.h macros specified in the C99 standard that
# aren't in the C++ standard (e.g. UINT8_MAX, INT64_MIN, etc).
add_definitions(-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS)
# Example 3: The binary distribution is in a separate directory from your
# project. Locate the binary distribution using the CEF_ROOT
# environment variable.
# A. Create a directory structure for your project like the following:
# myproject/
# CMakeLists.txt <= top-level CMake configuration
# cmake/
# FindCEF.cmake <= CEF CMake configuration entry point
# mytarget/
# CMakeLists.txt <= CMake configuration for `mytarget`
# ... other `mytarget` source files
# B. Copy this file to "myproject/CMakeLists.txt" as the top-level CMake
# configuration.
# C. Copy the cmake/FindCEF.cmake file to "myproject/cmake/FindCEF.cmake".
# D. Create the target-specific "myproject/mytarget/CMakeLists.txt" file for
# your application. See the included cefclient and cefsimple CMakeLists.txt
# files as an example.
# E. Set the CEF_ROOT environment variable before executing CMake. For example:
# > set CEF_ROOT=c:\path\to\cef_binary_3.2704.xxxx.gyyyyyyy_windows32
# F. Comment in these lines:
#
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
#
# Linux configuration.
# Load the CEF configuration.
#
if(OS_LINUX)
# Platform-specific compiler/linker flags.
set(CEF_LIBTYPE SHARED)
# -fno-strict-aliasing = Avoid assumptions regarding non-aliasing of objects of different types
# -fPIC = Generate position-independent code for shared libraries
# -fstack-protector = Protect some vulnerable functions from stack-smashing (security feature)
# -funwind-tables = Support stack unwinding for backtrace()
# -fvisibility=hidden = Give hidden visibility to declarations that are not explicitly marked as visible
# --param=ssp-buffer-size=4 = Set the minimum buffer size protected by SSP (security feature, related to stack-protector)
# -pipe = Use pipes rather than temporary files for communication between build stages
# -pthread = Use the pthread library
# -Wall = Enable all warnings
# -Werror = Treat warnings as errors
# -Wno-missing-field-initializers = Don't warn about missing field initializers
# -Wno-unused-parameter = Don't warn about unused parameters
set(CEF_COMPILER_FLAGS "-fno-strict-aliasing -fPIC -fstack-protector -funwind-tables -fvisibility=hidden --param=ssp-buffer-size=4 -pipe -pthread -Wall -Werror -Wno-missing-field-initializers -Wno-unused-parameter")
# -std=c99 = Use the C99 language standard
set(CEF_C_COMPILER_FLAGS "-std=c99")
# -fno-exceptions = Disable exceptions
# -fno-rtti = Disable real-time type information
# -fno-threadsafe-statics = Don't generate thread-safe statics
# -fvisibility-inlines-hidden = Give hidden visibility to inlined class member functions
# -std=gnu++11 = Use the C++11 language standard including GNU extensions
# -Wsign-compare = Warn about mixed signed/unsigned type comparisons
set(CEF_CXX_COMPILER_FLAGS "-fno-exceptions -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden -std=gnu++11 -Wsign-compare")
# -O0 = Disable optimizations
# -g = Generate debug information
set(CEF_COMPILER_FLAGS_DEBUG "-O0 -g")
# -O2 = Optimize for maximum speed
# -fdata-sections = Enable linker optimizations to improve locality of reference for data sections
# -ffunction-sections = Enable linker optimizations to improve locality of reference for function sections
# -fno-ident = Ignore the #ident directive
# -DNDEBUG = Not a debug build
# -U_FORTIFY_SOURCE = Undefine _FORTIFY_SOURCE in case it was previously defined
# -D_FORTIFY_SOURCE=2 = Add memory and string function protection (security feature, related to stack-protector)
set(CEF_COMPILER_FLAGS_RELEASE "-O2 -fdata-sections -ffunction-sections -fno-ident -DNDEBUG -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2")
# -Wl,--disable-new-dtags = Don't generate new-style dynamic tags in ELF
# -Wl,--fatal-warnings = Treat warnings as errors
# -Wl,-rpath,. = Set rpath so that libraries can be placed next to the executable
# -Wl,-z,noexecstack = Mark the stack as non-executable (security feature)
# -Wl,-z,now = Resolve symbols on program start instead of on first use (security feature)
# -Wl,-z,relro = Mark relocation sections as read-only (security feature)
set(CEF_LINKER_FLAGS "-fPIC -pthread -Wl,--disable-new-dtags -Wl,--fatal-warnings -Wl,-rpath,. -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro")
# -Wl,-O1 = Enable linker optimizations
# -Wl,--as-needed = Only link libraries that export symbols used by the binary
# -Wl,--gc-sections = Remove unused code resulting from -fdata-sections and -function-sections
set(CEF_LINKER_FLAGS_RELEASE "-Wl,-O1 -Wl,--as-needed -Wl,--gc-sections")
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
# -Wno-unused-local-typedefs = Don't warn about unused local typedefs
CHECK_C_COMPILER_FLAG(-Wno-unused-local-typedefs COMPILER_SUPPORTS_NO_UNUSED_LOCAL_TYPEDEFS)
if(COMPILER_SUPPORTS_NO_UNUSED_LOCAL_TYPEDEFS)
set(CEF_C_COMPILER_FLAGS "${CEF_C_COMPILER_FLAGS} -Wno-unused-local-typedefs")
endif()
# -Wno-literal-suffix = Don't warn about invalid suffixes on literals
CHECK_CXX_COMPILER_FLAG(-Wno-literal-suffix COMPILER_SUPPORTS_NO_LITERAL_SUFFIX)
if(COMPILER_SUPPORTS_NO_LITERAL_SUFFIX)
set(CEF_CXX_COMPILER_FLAGS "${CEF_CXX_COMPILER_FLAGS} -Wno-literal-suffix")
endif()
# -Wno-narrowing = Don't warn about type narrowing
CHECK_CXX_COMPILER_FLAG(-Wno-narrowing COMPILER_SUPPORTS_NO_NARROWING)
if(COMPILER_SUPPORTS_NO_NARROWING)
set(CEF_CXX_COMPILER_FLAGS "${CEF_CXX_COMPILER_FLAGS} -Wno-narrowing")
endif()
if(PROJECT_ARCH STREQUAL "x86_64")
# 64-bit architecture.
set(CEF_COMPILER_FLAGS "${CEF_COMPILER_FLAGS} -m64 -march=x86-64")
set(CEF_LINKER_FLAGS "${CEF_LINKER_FLAGS} -m64")
elseif(PROJECT_ARCH STREQUAL "x86")
# 32-bit architecture.
set(CEF_COMPILER_FLAGS "${CEF_COMPILER_FLAGS} -msse2 -mfpmath=sse -mmmx -m32")
set(CEF_LINKER_FLAGS "${CEF_LINKER_FLAGS} -m32")
endif()
# Allow the Large File Support (LFS) interface to replace the old interface.
add_definitions(-D_FILE_OFFSET_BITS=64)
# Standard libraries.
set(CEF_STANDARD_LIBS "X11")
# CEF directory paths.
set(CEF_RESOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Resources")
set(CEF_BINARY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_BUILD_TYPE}")
set(CEF_BINARY_DIR_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/Debug")
set(CEF_BINARY_DIR_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/Release")
# CEF library paths.
set(CEF_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/libcef.so")
set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/libcef.so")
# List of CEF binary files.
set(CEF_BINARY_FILES
chrome-sandbox
libcef.so
natives_blob.bin
snapshot_blob.bin
)
# List of CEF resource files.
set(CEF_RESOURCE_FILES
cef.pak
cef_100_percent.pak
cef_200_percent.pak
cef_extensions.pak
devtools_resources.pak
icudtl.dat
locales
)
endif()
# Execute FindCEF.cmake which must exist in CMAKE_MODULE_PATH.
find_package(CEF REQUIRED)
#
# Mac OS X configuration.
# Define CEF-based targets.
#
if(OS_MACOSX)
# Platform-specific compiler/linker flags.
# See also SET_XCODE_TARGET_PROPERTIES in macros.cmake.
set(CEF_LIBTYPE SHARED)
# -fno-strict-aliasing = Avoid assumptions regarding non-aliasing of objects of different types
# -fstack-protector = Protect some vulnerable functions from stack-smashing (security feature)
# -funwind-tables = Support stack unwinding for backtrace()
# -fvisibility=hidden = Give hidden visibility to declarations that are not explicitly marked as visible
# -Wall = Enable all warnings
# -Wendif-labels = Warn whenever an #else or an #endif is followed by text
# -Werror = Treat warnings as errors
# -Wextra = Enable additional warnings
# -Wnewline-eof = Warn about no newline at end of file
# -Wno-missing-field-initializers = Don't warn about missing field initializers
# -Wno-unused-parameter = Don't warn about unused parameters
set(CEF_COMPILER_FLAGS "-fno-strict-aliasing -fstack-protector -funwind-tables -fvisibility=hidden -Wall -Wendif-labels -Werror -Wextra -Wnewline-eof -Wno-missing-field-initializers -Wno-unused-parameter")
# -std=c99 = Use the C99 language standard
set(CEF_C_COMPILER_FLAGS "-std=c99")
# -fno-exceptions = Disable exceptions
# -fno-rtti = Disable real-time type information
# -fno-threadsafe-statics = Don't generate thread-safe statics
# -fobjc-call-cxx-cdtors = Call the constructor/destructor of C++ instance variables in ObjC objects
# -fvisibility-inlines-hidden = Give hidden visibility to inlined class member functions
# -std=gnu++11 = Use the C++11 language standard including GNU extensions
# -Wno-narrowing = Don't warn about type narrowing
# -Wsign-compare = Warn about mixed signed/unsigned type comparisons
set(CEF_CXX_COMPILER_FLAGS "-fno-exceptions -fno-rtti -fno-threadsafe-statics -fobjc-call-cxx-cdtors -fvisibility-inlines-hidden -std=gnu++11 -Wno-narrowing -Wsign-compare")
# -O0 = Disable optimizations
# -g = Generate debug information
set(CEF_COMPILER_FLAGS_DEBUG "-O0 -g")
# -O3 = Optimize for maximum speed plus a few extras
set(CEF_COMPILER_FLAGS_RELEASE "-O3")
# -Wl,-search_paths_first = Search for static or shared library versions in the same pass
# -Wl,-ObjC = Support creation of creation of ObjC static libraries
# -Wl,-pie = Generate position-independent code suitable for executables only
set(CEF_LINKER_FLAGS "-Wl,-search_paths_first -Wl,-ObjC -Wl,-pie")
# -Wl,-dead_strip = Strip dead code
set(CEF_LINKER_FLAGS_RELEASE "-Wl,-dead_strip")
# Include the libcef_dll_wrapper target.
# Comes from the libcef_dll/CMakeLists.txt file in the binary distribution
# directory.
add_subdirectory(${CEF_LIBCEF_DLL_WRAPPER_PATH} libcef_dll_wrapper)
# Standard libraries.
set(CEF_STANDARD_LIBS "-lpthread" "-framework Cocoa" "-framework AppKit")
# Find the newest available base SDK.
execute_process(COMMAND xcode-select --print-path OUTPUT_VARIABLE XCODE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
foreach(OS_VERSION 10.10 10.9 10.8 10.7)
set(SDK "${XCODE_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${OS_VERSION}.sdk")
if(NOT "${CMAKE_OSX_SYSROOT}" AND EXISTS "${SDK}" AND IS_DIRECTORY "${SDK}")
set(CMAKE_OSX_SYSROOT ${SDK})
endif()
endforeach()
# Target SDK.
set(CEF_TARGET_SDK "10.6")
set(CEF_COMPILER_FLAGS "${CEF_COMPILER_FLAGS} -mmacosx-version-min=${CEF_TARGET_SDK}")
set(CMAKE_OSX_DEPLOYMENT_TARGET ${CEF_TARGET_SDK})
# Target architecture.
if(PROJECT_ARCH STREQUAL "x86_64")
set(CMAKE_OSX_ARCHITECTURES "x86_64")
else()
set(CMAKE_OSX_ARCHITECTURES "i386")
endif()
# CEF directory paths.
set(CEF_BINARY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/$<CONFIGURATION>")
set(CEF_BINARY_DIR_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/Debug")
set(CEF_BINARY_DIR_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/Release")
# CEF library paths.
set(CEF_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/Chromium Embedded Framework.framework/Chromium Embedded Framework")
set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/Chromium Embedded Framework.framework/Chromium Embedded Framework")
endif()
#
# Windows configuration.
#
if(OS_WINDOWS)
# Consumers who run into LNK4099 warnings can pass /Z7 instead (see issue #385).
set(CEF_DEBUG_INFO_FLAG "/Zi" CACHE STRING "Optional flag specifying specific /Z flag to use")
# Platform-specific compiler/linker flags.
set(CEF_LIBTYPE STATIC)
# /MP = Multiprocess compilation
# /Gy = Enable function-level linking
# /GR- = Disable run-time type information
# /W4 = Warning level 4
# /WX = Treat warnings as errors
# /wd"4100" = Ignore "unreferenced formal parameter" warning
# /wd"4127" = Ignore "conditional expression is constant" warning
# /wd"4244" = Ignore "conversion possible loss of data" warning
# /wd"4481" = Ignore "nonstandard extension used: override" warning
# /wd"4512" = Ignore "assignment operator could not be generated" warning
# /wd"4701" = Ignore "potentially uninitialized local variable" warning
# /wd"4702" = Ignore "unreachable code" warning
# /wd"4996" = Ignore "function or variable may be unsafe" warning
set(CEF_COMPILER_FLAGS "/MP /Gy /GR- /W4 /WX /wd\"4100\" /wd\"4127\" /wd\"4244\" /wd\"4481\" /wd\"4512\" /wd\"4701\" /wd\"4702\" /wd\"4996\" ${CEF_DEBUG_INFO_FLAG}")
# /MTd = Multithreaded debug runtime
# /Od = Disable optimizations
# /RTC1 = Enable basic run-time checks
set(CEF_COMPILER_FLAGS_DEBUG "/MTd /RTC1 /Od")
# /MT = Multithreaded release runtime
# /O2 = Optimize for maximum speed
# /Ob2 = Inline any suitable function
# /GF = Enable string pooling
# /D NDEBUG /D _NDEBUG = Not a debug build
set(CEF_COMPILER_FLAGS_RELEASE "/MT /O2 /Ob2 /GF /D NDEBUG /D _NDEBUG")
# /DEBUG = Generate debug information
set(CEF_LINKER_FLAGS_DEBUG "/DEBUG")
# /MANIFEST:NO = No default manifest (see ADD_WINDOWS_MANIFEST macro usage)
set(CEF_EXE_LINKER_FLAGS "/MANIFEST:NO")
# Standard definitions
# -DWIN32 -D_WIN32 -D_WINDOWS = Windows platform
# -DUNICODE -D_UNICODE = Unicode build
# -DWINVER=0x0602 -D_WIN32_WINNT=0x602 = Targeting Windows 8
# -DNOMINMAX = Use the standard's templated min/max
# -DWIN32_LEAN_AND_MEAN = Exclude less common API declarations
# -D_HAS_EXCEPTIONS=0 = Disable exceptions
add_definitions(-DWIN32 -D_WIN32 -D_WINDOWS -DUNICODE -D_UNICODE -DWINVER=0x0602
-D_WIN32_WINNT=0x602 -DNOMINMAX -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0)
# Standard libraries.
set(CEF_STANDARD_LIBS "comctl32.lib" "rpcrt4.lib" "shlwapi.lib" "ws2_32.lib")
# CEF directory paths.
set(CEF_RESOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Resources")
set(CEF_BINARY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/$<CONFIGURATION>")
set(CEF_BINARY_DIR_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/Debug")
set(CEF_BINARY_DIR_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/Release")
# CEF library paths.
set(CEF_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/libcef.lib")
set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/libcef.lib")
# List of CEF binary files.
set(CEF_BINARY_FILES
d3dcompiler_43.dll
d3dcompiler_47.dll
libcef.dll
libEGL.dll
libGLESv2.dll
natives_blob.bin
snapshot_blob.bin
)
if(PROJECT_ARCH STREQUAL "x86")
# Only used on 32-bit platforms.
set(CEF_BINARY_FILES
${CEF_BINARY_FILES}
wow_helper.exe
)
endif()
# List of CEF resource files.
set(CEF_RESOURCE_FILES
cef.pak
cef_100_percent.pak
cef_200_percent.pak
cef_extensions.pak
devtools_resources.pak
icudtl.dat
locales
)
# Configure use of the sandbox.
option(USE_SANDBOX "Enable or disable use of the sandbox." ON)
if(USE_SANDBOX AND NOT MSVC_VERSION EQUAL 1800)
# The cef_sandbox.lib static library is currently built with VS2013. It will
# not link successfully with other VS versions.
set(USE_SANDBOX OFF)
endif()
if(USE_SANDBOX)
# Definition required by cef_sandbox.lib.
add_definitions(-DPSAPI_VERSION=1)
# Definition used by apps to test if the sandbox is enabled.
add_definitions(-DCEF_USE_SANDBOX)
# Libraries required by cef_sandbox.lib.
set(CEF_SANDBOX_STANDARD_LIBS "dbghelp.lib" "psapi.lib")
# CEF sandbox library paths.
set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.lib")
set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.lib")
endif()
# Configure use of ATL.
option(USE_ATL "Enable or disable use of ATL." ON)
if(USE_ATL)
# Determine if the Visual Studio install supports ATL.
get_filename_component(VC_BIN_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
get_filename_component(VC_DIR ${VC_BIN_DIR} DIRECTORY)
if(NOT IS_DIRECTORY "${VC_DIR}/atlmfc")
set(USE_ATL OFF)
endif()
endif()
if(USE_ATL)
# Definition used by apps to test if ATL support is enabled.
add_definitions(-DCEF_USE_ATL)
endif()
endif()
#
# Post-configuration actions.
#
# Merge compiler/linker flags.
set(CMAKE_C_FLAGS "${CEF_COMPILER_FLAGS} ${CEF_C_COMPILER_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "${CEF_COMPILER_FLAGS_DEBUG} ${CEF_C_COMPILER_FLAGS_DEBUG}")
set(CMAKE_C_FLAGS_RELEASE "${CEF_COMPILER_FLAGS_RELEASE} ${CEF_C_COMPILER_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS "${CEF_COMPILER_FLAGS} ${CEF_CXX_COMPILER_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CEF_COMPILER_FLAGS_DEBUG} ${CEF_CXX_COMPILER_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_RELEASE "${CEF_COMPILER_FLAGS_RELEASE} ${CEF_CXX_COMPILER_FLAGS_RELEASE}")
set(CMAKE_EXE_LINKER_FLAGS "${CEF_LINKER_FLAGS} ${CEF_EXE_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CEF_LINKER_FLAGS_DEBUG} ${CEF_EXE_LINKER_FLAGS_DEBUG}")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CEF_LINKER_FLAGS_RELEASE} ${CEF_EXE_LINKER_FLAGS_RELEASE}")
set(CMAKE_SHARED_LINKER_FLAGS "${CEF_LINKER_FLAGS} ${CEF_SHARED_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CEF_LINKER_FLAGS_DEBUG} ${CEF_SHARED_LINKER_FLAGS_DEBUG}")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CEF_LINKER_FLAGS_RELEASE} ${CEF_SHARED_LINKER_FLAGS_RELEASE}")
#
# Include target subdirectories.
#
add_subdirectory(libcef_dll)
# Include application targets.
# Comes from the <target>/CMakeLists.txt file in the current directory.
# TODO: Change these lines to match your project target when you copy this file.
add_subdirectory(cefclient)
add_subdirectory(cefsimple)
#
# Display configuration settings.
#
message(STATUS "*** CONFIGURATION SETTINGS ***")
message(STATUS "Generator: ${CMAKE_GENERATOR}")
message(STATUS "Platform: ${CMAKE_SYSTEM_NAME}")
message(STATUS "Project architecture: ${PROJECT_ARCH}")
if(${CMAKE_GENERATOR} STREQUAL "Ninja" OR ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
endif()
if(OS_MACOSX)
message(STATUS "Base SDK: ${CMAKE_OSX_SYSROOT}")
message(STATUS "Target SDK: ${CEF_TARGET_SDK}")
endif()
if(OS_WINDOWS)
message(STATUS "CEF Windows sandbox: ${USE_SANDBOX}")
message(STATUS "Visual Studio ATL support: ${USE_ATL}")
endif()
set(LIBRARIES ${CEF_STANDARD_LIBS})
if(OS_WINDOWS AND USE_SANDBOX)
set(LIBRARIES ${LIBRARIES} ${CEF_SANDBOX_STANDARD_LIBS})
endif()
message(STATUS "Standard libraries: ${LIBRARIES}")
get_directory_property(DEFINITIONS COMPILE_DEFINITIONS)
message(STATUS "Compiler definitions: ${DEFINITIONS}")
message(STATUS "C_FLAGS: ${CMAKE_C_FLAGS}")
message(STATUS "C_FLAGS_DEBUG: ${CMAKE_C_FLAGS_DEBUG}")
message(STATUS "C_FLAGS_RELEASE: ${CMAKE_C_FLAGS_RELEASE}")
message(STATUS "CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
message(STATUS "CXX_FLAGS_DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}")
message(STATUS "CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
message(STATUS "EXE_LINKER_FLAGS: ${CMAKE_EXE_LINKER_FLAGS}")
message(STATUS "EXE_LINKER_FLAGS_DEBUG: ${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
message(STATUS "EXE_LINKER_FLAGS_RELEASE: ${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
message(STATUS "SHARED_LINKER_FLAGS: ${CMAKE_SHARED_LINKER_FLAGS}")
message(STATUS "SHARED_LINKER_FLAGS_DEBUG: ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
message(STATUS "SHARED_LINKER_FLAGS_RELEASE: ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
if(OS_LINUX OR OS_WINDOWS)
message(STATUS "CEF Binary files: ${CEF_BINARY_FILES}")
message(STATUS "CEF Resource files: ${CEF_RESOURCE_FILES}")
endif()
PRINT_CEF_CONFIG()

17
cef.gyp
View File

@@ -953,6 +953,7 @@
'<(DEPTH)/components/components.gyp:data_use_measurement_core',
'<(DEPTH)/components/components.gyp:devtools_discovery',
'<(DEPTH)/components/components.gyp:devtools_http_handler',
'<(DEPTH)/components/components.gyp:google_core_browser',
'<(DEPTH)/components/components.gyp:keyed_service_content',
'<(DEPTH)/components/components.gyp:keyed_service_core',
'<(DEPTH)/components/components.gyp:navigation_interception',
@@ -1489,6 +1490,9 @@
# Include sources for permissions support.
'<(DEPTH)/chrome/browser/permissions/permission_request_id.h',
'<(DEPTH)/chrome/browser/permissions/permission_request_id.cc',
# Include sources for SafeSearch support.
'<(DEPTH)/chrome/browser/net/safe_search_util.cc',
'<(DEPTH)/chrome/browser/net/safe_search_util.h',
],
'conditions': [
['OS=="win"', {
@@ -2077,6 +2081,19 @@
},
},
}],
[ '(OS=="linux" or OS=="freebsd" or OS=="openbsd") and asan==0 and use_allocator=="none"', {
'link_settings': {
'configurations': {
'Release': {
'ldflags': [
# Only export necessary symbols from libcef.so.
# Don't do this in Debug builds because it causes the resulting application to crash.
'-Wl,--version-script=<!(cd <(DEPTH) && pwd -P)/cef/libcef_dll/libcef.lst',
],
},
},
},
}],
],
}],
}], # OS!="mac"

39
cmake/FindCEF.cmake.in Normal file
View File

@@ -0,0 +1,39 @@
# 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 is the CEF CMake configuration entry point and should be loaded
# using `find_package(CEF REQUIRED)`. See the top-level CMakeLists.txt file
# included with the CEF binary distribution for usage information.
#
# Find the CEF binary distribution root directory.
set(_CEF_ROOT "")
if(CEF_ROOT AND IS_DIRECTORY "${CEF_ROOT}")
set(_CEF_ROOT "${CEF_ROOT}")
set(_CEF_ROOT_EXPLICIT 1)
else()
set(_ENV_CEF_ROOT "")
if(DEFINED ENV{CEF_ROOT})
file(TO_CMAKE_PATH "$ENV{CEF_ROOT}" _ENV_CEF_ROOT)
endif()
if(_ENV_CEF_ROOT AND IS_DIRECTORY "${_ENV_CEF_ROOT}")
set(_CEF_ROOT "${_ENV_CEF_ROOT}")
set(_CEF_ROOT_EXPLICIT 1)
endif()
unset(_ENV_CEF_ROOT)
endif()
if(NOT DEFINED _CEF_ROOT_EXPLICIT)
message(FATAL_ERROR "Must specify a CEF_ROOT value via CMake or environment variable.")
endif()
if(NOT IS_DIRECTORY "${_CEF_ROOT}/cmake")
message(FATAL_ERROR "No CMake bootstrap found for CEF binary distribution at: ${CEF_ROOT}.")
endif()
# Execute additional cmake files from the CEF binary distribution.
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${_CEF_ROOT}/cmake")
include("cef_variables")
include("cef_macros")

387
cmake/cef_macros.cmake.in Normal file
View File

@@ -0,0 +1,387 @@
# 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.
# Must be loaded via FindCEF.cmake.
if(NOT DEFINED _CEF_ROOT_EXPLICIT)
message(FATAL_ERROR "Use find_package(CEF) to load this file.")
endif()
#
# Shared macros.
#
# Print the current CEF configuration.
macro(PRINT_CEF_CONFIG)
message(STATUS "*** CEF CONFIGURATION SETTINGS ***")
message(STATUS "Generator: ${CMAKE_GENERATOR}")
message(STATUS "Platform: ${CMAKE_SYSTEM_NAME}")
message(STATUS "Project architecture: ${PROJECT_ARCH}")
if(${CMAKE_GENERATOR} STREQUAL "Ninja" OR ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
endif()
message(STATUS "Binary distribution root: ${_CEF_ROOT}")
if(OS_MACOSX)
message(STATUS "Base SDK: ${CMAKE_OSX_SYSROOT}")
message(STATUS "Target SDK: ${CEF_TARGET_SDK}")
endif()
if(OS_WINDOWS)
message(STATUS "CEF Windows sandbox: ${USE_SANDBOX}")
message(STATUS "Visual Studio ATL support: ${USE_ATL}")
endif()
set(_libraries ${CEF_STANDARD_LIBS})
if(OS_WINDOWS AND USE_SANDBOX)
list(APPEND _libraries ${CEF_SANDBOX_STANDARD_LIBS})
endif()
message(STATUS "Standard libraries: ${_libraries}")
message(STATUS "Compile defines: ${CEF_COMPILER_DEFINES}")
message(STATUS "Compile defines (Debug): ${CEF_COMPILER_DEFINES_DEBUG}")
message(STATUS "Compile defines (Release): ${CEF_COMPILER_DEFINES_RELEASE}")
message(STATUS "C compile flags: ${CEF_COMPILER_FLAGS} ${CEF_C_COMPILER_FLAGS}")
message(STATUS "C compile flags (Debug): ${CEF_COMPILER_FLAGS_DEBUG} ${CEF_C_COMPILER_FLAGS_DEBUG}")
message(STATUS "C compile flags (Release): ${CEF_COMPILER_FLAGS_RELEASE} ${CEF_C_COMPILER_FLAGS_RELEASE}")
message(STATUS "C++ compile flags: ${CEF_COMPILER_FLAGS} ${CEF_CXX_COMPILER_FLAGS}")
message(STATUS "C++ compile flags (Debug): ${CEF_COMPILER_FLAGS_DEBUG} ${CEF_CXX_COMPILER_FLAGS_DEBUG}")
message(STATUS "C++ compile flags (Release): ${CEF_COMPILER_FLAGS_RELEASE} ${CEF_CXX_COMPILER_FLAGS_RELEASE}")
message(STATUS "Exe link flags: ${CEF_LINKER_FLAGS} ${CEF_EXE_LINKER_FLAGS}")
message(STATUS "Exe link flags (Debug): ${CEF_LINKER_FLAGS_DEBUG} ${CEF_EXE_LINKER_FLAGS_DEBUG}")
message(STATUS "Exe link flags (Release): ${CEF_LINKER_FLAGS_RELEASE} ${CEF_EXE_LINKER_FLAGS_RELEASE}")
message(STATUS "Shared link flags: ${CEF_LINKER_FLAGS} ${CEF_SHARED_LINKER_FLAGS}")
message(STATUS "Shared link flags (Debug): ${CEF_LINKER_FLAGS_DEBUG} ${CEF_SHARED_LINKER_FLAGS_DEBUG}")
message(STATUS "Shared link flags (Release): ${CEF_LINKER_FLAGS_RELEASE} ${CEF_SHARED_LINKER_FLAGS_RELEASE}")
if(OS_LINUX OR OS_WINDOWS)
message(STATUS "CEF Binary files: ${CEF_BINARY_FILES}")
message(STATUS "CEF Resource files: ${CEF_RESOURCE_FILES}")
endif()
endmacro()
# Append platform specific sources to a list of sources.
macro(APPEND_PLATFORM_SOURCES name_of_list)
if(OS_LINUX AND ${name_of_list}_LINUX)
list(APPEND ${name_of_list} ${${name_of_list}_LINUX})
endif()
if(OS_POSIX AND ${name_of_list}_POSIX)
list(APPEND ${name_of_list} ${${name_of_list}_POSIX})
endif()
if(OS_WINDOWS AND ${name_of_list}_WINDOWS)
list(APPEND ${name_of_list} ${${name_of_list}_WINDOWS})
endif()
if(OS_MACOSX AND ${name_of_list}_MACOSX)
list(APPEND ${name_of_list} ${${name_of_list}_MACOSX})
endif()
endmacro()
# Determine the target output directory based on platform and generator.
macro(SET_CEF_TARGET_OUT_DIR)
if(${CMAKE_GENERATOR} STREQUAL "Ninja" OR
${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
# By default Ninja and Make builds don't create a subdirectory named after
# the configuration.
set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}")
# Output binaries (executables, libraries) to the correct directory.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CEF_TARGET_OUT_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CEF_TARGET_OUT_DIR})
else()
set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
endif()
endmacro()
# Copy a list of files from one directory to another. Relative files paths are maintained.
macro(COPY_FILES target file_list source_dir target_dir)
foreach(FILENAME ${file_list})
set(source_file ${source_dir}/${FILENAME})
set(target_file ${target_dir}/${FILENAME})
if(IS_DIRECTORY ${source_file})
add_custom_command(
TARGET ${target}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory "${source_file}" "${target_file}"
VERBATIM
)
else()
add_custom_command(
TARGET ${target}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${source_file}" "${target_file}"
VERBATIM
)
endif()
endforeach()
endmacro()
# Rename a directory replacing the target if it already exists.
macro(RENAME_DIRECTORY target source_dir target_dir)
add_custom_command(
TARGET ${target}
POST_BUILD
# Remove the target directory if it already exists.
COMMAND ${CMAKE_COMMAND} -E remove_directory "${target_dir}"
# Rename the source directory to target directory.
COMMAND ${CMAKE_COMMAND} -E rename "${source_dir}" "${target_dir}"
VERBATIM
)
endmacro()
#
# Linux macros.
#
if(OS_LINUX)
# Use pkg-config to find Linux libraries and update compiler/linker variables.
macro(FIND_LINUX_LIBRARIES libraries)
# Read pkg-config info into variables.
execute_process(COMMAND pkg-config --cflags ${libraries} OUTPUT_VARIABLE FLL_CFLAGS)
execute_process(COMMAND pkg-config --libs-only-L --libs-only-other ${libraries} OUTPUT_VARIABLE FLL_LDFLAGS)
execute_process(COMMAND pkg-config --libs-only-l ${libraries} OUTPUT_VARIABLE FLL_LIBS)
# Strip leading and trailing whitepspace.
STRING(STRIP "${FLL_CFLAGS}" FLL_CFLAGS)
STRING(STRIP "${FLL_LDFLAGS}" FLL_LDFLAGS)
STRING(STRIP "${FLL_LIBS}" FLL_LIBS)
# Convert to a list.
separate_arguments(FLL_CFLAGS)
separate_arguments(FLL_LDFLAGS)
separate_arguments(FLL_LIBS)
# Update build variables.
list(APPEND CEF_C_COMPILER_FLAGS ${FLL_CFLAGS})
list(APPEND CEF_CXX_COMPILER_FLAGS ${FLL_CFLAGS})
list(APPEND CEF_EXE_LINKER_FLAGS ${FLL_LDFLAGS})
list(APPEND CEF_SHARED_LINKER_FLAGS ${FLL_LDFLAGS})
list(APPEND CEF_STANDARD_LIBS ${FLL_LIBS})
endmacro()
# Set SUID permissions on the specified executable.
macro(SET_LINUX_SUID_PERMISSIONS target executable)
add_custom_command(
TARGET ${target}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo ""
COMMAND ${CMAKE_COMMAND} -E echo "*** Run the following command manually to set SUID permissions ***"
COMMAND ${CMAKE_COMMAND} -E echo "EXE=\"${executable}\" && sudo -- chown root:root $EXE && sudo -- chmod 4755 $EXE"
COMMAND ${CMAKE_COMMAND} -E echo ""
VERBATIM
)
endmacro()
endif(OS_LINUX)
#
# Mac OS X macros.
#
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
)
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
)
endmacro()
# Manually process and copy over resource files.
macro(COPY_MACOSX_RESOURCES resource_list prefix_list target source_dir app_path)
foreach(FILENAME ${resource_list})
# Remove one or more prefixes from the source paths.
set(TARGET_FILENAME "${FILENAME}")
foreach(PREFIX ${prefix_list})
string(REGEX REPLACE "^.*${PREFIX}" "" TARGET_FILENAME ${TARGET_FILENAME})
endforeach()
# Determine the absolute source and target paths.
set(TARGET_PATH "${app_path}/Contents/Resources/${TARGET_FILENAME}")
if(IS_ABSOLUTE ${FILENAME})
set(SOURCE_PATH ${FILENAME})
else()
set(SOURCE_PATH "${source_dir}/${FILENAME}")
endif()
if(${FILENAME} MATCHES ".xib$")
# Change the target file extension.
string(REGEX REPLACE ".xib$" ".nib" TARGET_PATH ${TARGET_PATH})
get_filename_component(TARGET_DIRECTORY ${TARGET_PATH} PATH)
add_custom_command(
TARGET ${target}
POST_BUILD
# Create the target directory.
COMMAND ${CMAKE_COMMAND} -E make_directory "${TARGET_DIRECTORY}"
# Compile the XIB file to a NIB.
COMMAND /usr/bin/ibtool --output-format binary1 --compile "${TARGET_PATH}" "${SOURCE_PATH}"
VERBATIM
)
elseif(NOT ${TARGET_FILENAME} STREQUAL "Info.plist")
# Copy the file as-is.
add_custom_command(
TARGET ${target}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_PATH}" "${TARGET_PATH}"
VERBATIM
)
endif()
endforeach()
endmacro()
endif(OS_MACOSX)
#
# Windows macros.
#
if(OS_WINDOWS)
# Add custom manifest files to an executable target.
macro(ADD_WINDOWS_MANIFEST manifest_path target extension)
add_custom_command(
TARGET ${target}
POST_BUILD
COMMAND "mt.exe" -nologo
-manifest \"${manifest_path}/${target}.${extension}.manifest\" \"${manifest_path}/compatibility.manifest\"
-outputresource:"${CEF_TARGET_OUT_DIR}/${target}.${extension}"\;\#1
COMMENT "Adding manifest..."
)
endmacro()
endif(OS_WINDOWS)
#
# Target configuration macros.
#
# Add a logical target that can be used to link the specified libraries into an
# executable target.
macro(ADD_LOGICAL_TARGET target debug_lib release_lib)
add_library(${target} ${CEF_LIBTYPE} IMPORTED)
set_target_properties(${target} PROPERTIES
IMPORTED_LOCATION "${release_lib}"
IMPORTED_LOCATION_DEBUG "${debug_lib}"
IMPORTED_LOCATION_RELEASE "${release_lib}"
)
endmacro()
# Set common target properties. Use SET_LIBRARY_TARGET_PROPERTIES() or
# SET_EXECUTABLE_TARGET_PROPERTIES() instead of calling this macro directly.
macro(SET_COMMON_TARGET_PROPERTIES target)
# Compile flags.
target_compile_options(${target} PUBLIC ${CEF_COMPILER_FLAGS} ${CEF_CXX_COMPILER_FLAGS})
target_compile_options(${target} PUBLIC $<$<CONFIG:Debug>:${CEF_COMPILER_FLAGS_DEBUG} ${CEF_CXX_COMPILER_FLAGS_DEBUG}>)
target_compile_options(${target} PUBLIC $<$<CONFIG:Release>:${CEF_COMPILER_FLAGS_RELEASE} ${CEF_CXX_COMPILER_FLAGS_RELEASE}>)
# Compile definitions.
target_compile_definitions(${target} PUBLIC ${CEF_COMPILER_DEFINES})
target_compile_definitions(${target} PUBLIC $<$<CONFIG:Debug>:${CEF_COMPILER_DEFINES_DEBUG}>)
target_compile_definitions(${target} PUBLIC $<$<CONFIG:Release>:${CEF_COMPILER_DEFINES_RELEASE}>)
# Include directories.
target_include_directories(${target} PUBLIC ${CEF_INCLUDE_PATH})
# Linker flags.
if(CEF_LINKER_FLAGS)
string(REPLACE ";" " " _flags_str "${CEF_LINKER_FLAGS}")
set_property(TARGET ${target} PROPERTY LINK_FLAGS ${_flags_str})
endif()
if(CEF_LINKER_FLAGS_DEBUG)
string(REPLACE ";" " " _flags_str "${CEF_LINKER_FLAGS_DEBUG}")
set_property(TARGET ${target} PROPERTY LINK_FLAGS_DEBUG ${_flags_str})
endif()
if(CEF_LINKER_FLAGS_RELEASE)
string(REPLACE ";" " " _flags_str "${CEF_LINKER_FLAGS_RELEASE}")
set_property(TARGET ${target} PROPERTY LINK_FLAGS_RELEASE ${_flags_str})
endif()
if(OS_MACOSX)
# Set Xcode target properties.
set_target_properties(${target} PROPERTIES
XCODE_ATTRIBUTE_ALWAYS_SEARCH_USER_PATHS NO
XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "gnu++11" # -std=gnu++11
XCODE_ATTRIBUTE_CLANG_LINK_OBJC_RUNTIME NO # -fno-objc-link-runtime
XCODE_ATTRIBUTE_CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS YES # -Wobjc-missing-property-synthesis
XCODE_ATTRIBUTE_COPY_PHASE_STRIP NO
XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING[variant=Release] YES # -Wl,-dead_strip
XCODE_ATTRIBUTE_GCC_C_LANGUAGE_STANDARD "c99" # -std=c99
XCODE_ATTRIBUTE_GCC_CW_ASM_SYNTAX NO # No -fasm-blocks
XCODE_ATTRIBUTE_GCC_DYNAMIC_NO_PIC NO
XCODE_ATTRIBUTE_GCC_ENABLE_CPP_EXCEPTIONS NO # -fno-exceptions
XCODE_ATTRIBUTE_GCC_ENABLE_CPP_RTTI NO # -fno-rtti
XCODE_ATTRIBUTE_GCC_ENABLE_PASCAL_STRINGS NO # No -mpascal-strings
XCODE_ATTRIBUTE_GCC_INLINES_ARE_PRIVATE_EXTERN YES # -fvisibility-inlines-hidden
XCODE_ATTRIBUTE_GCC_OBJC_CALL_CXX_CDTORS YES # -fobjc-call-cxx-cdtors
XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES # -fvisibility=hidden
XCODE_ATTRIBUTE_GCC_THREADSAFE_STATICS NO # -fno-threadsafe-statics
XCODE_ATTRIBUTE_GCC_TREAT_WARNINGS_AS_ERRORS YES # -Werror
XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvm.clang.1_0"
XCODE_ATTRIBUTE_GCC_WARN_ABOUT_MISSING_NEWLINE YES # -Wnewline-eof
XCODE_ATTRIBUTE_USE_HEADERMAP NO
OSX_ARCHITECTURES_DEBUG "${CMAKE_OSX_ARCHITECTURES}"
OSX_ARCHITECTURES_RELEASE "${CMAKE_OSX_ARCHITECTURES}"
)
endif()
endmacro()
# Set library-specific properties.
macro(SET_LIBRARY_TARGET_PROPERTIES target)
SET_COMMON_TARGET_PROPERTIES(${target})
# Shared library linker flags.
if(CEF_SHARED_LINKER_FLAGS)
string(REPLACE ";" " " _flags_str "${CEF_SHARED_LINKER_FLAGS}")
set_property(TARGET ${target} PROPERTY LINK_FLAGS ${_flags_str})
endif()
if(CEF_SHARED_LINKER_FLAGS_DEBUG)
string(REPLACE ";" " " _flags_str "${CEF_SHARED_LINKER_FLAGS_DEBUG}")
set_property(TARGET ${target} PROPERTY LINK_FLAGS_DEBUG ${_flags_str})
endif()
if(CEF_SHARED_LINKER_FLAGS_RELEASE)
string(REPLACE ";" " " _flags_str "${CEF_SHARED_LINKER_FLAGS_RELEASE}")
set_property(TARGET ${target} PROPERTY LINK_FLAGS_RELEASE ${_flags_str})
endif()
endmacro()
# Set executable-specific properties.
macro(SET_EXECUTABLE_TARGET_PROPERTIES target)
SET_COMMON_TARGET_PROPERTIES(${target})
# Executable linker flags.
if(CEF_EXE_LINKER_FLAGS)
string(REPLACE ";" " " _flags_str "${CEF_EXE_LINKER_FLAGS}")
set_property(TARGET ${target} PROPERTY LINK_FLAGS ${_flags_str})
endif()
if(CEF_EXE_LINKER_FLAGS_DEBUG)
string(REPLACE ";" " " _flags_str "${CEF_EXE_LINKER_FLAGS_DEBUG}")
set_property(TARGET ${target} PROPERTY LINK_FLAGS_DEBUG ${_flags_str})
endif()
if(CEF_EXE_LINKER_FLAGS_RELEASE)
string(REPLACE ";" " " _flags_str "${CEF_EXE_LINKER_FLAGS_RELEASE}")
set_property(TARGET ${target} PROPERTY LINK_FLAGS_RELEASE ${_flags_str})
endif()
endmacro()

View File

@@ -0,0 +1,441 @@
# 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.
# Must be loaded via FindCEF.cmake.
if(NOT DEFINED _CEF_ROOT_EXPLICIT)
message(FATAL_ERROR "Use find_package(CEF) to load this file.")
endif()
#
# Shared configuration.
#
# Determine the platform.
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
set(OS_MACOSX 1)
set(OS_POSIX 1)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
set(OS_LINUX 1)
set(OS_POSIX 1)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
set(OS_WINDOWS 1)
endif()
# Determine the project architecture.
if(NOT DEFINED PROJECT_ARCH)
if(CMAKE_SIZEOF_VOID_P MATCHES 8)
set(PROJECT_ARCH "x86_64")
else()
set(PROJECT_ARCH "x86")
endif()
if(OS_MACOSX)
# PROJECT_ARCH should be specified on Mac OS X.
message(WARNING "No PROJECT_ARCH value specified, using ${PROJECT_ARCH}")
endif()
endif()
# Determine the build type.
if(NOT CMAKE_BUILD_TYPE AND
(${CMAKE_GENERATOR} STREQUAL "Ninja" OR ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles"))
# CMAKE_BUILD_TYPE should be specified when using Ninja or Unix Makefiles.
set(CMAKE_BUILD_TYPE Release)
message(WARNING "No CMAKE_BUILD_TYPE value selected, using ${CMAKE_BUILD_TYPE}")
endif()
# Path to the include directory.
set(CEF_INCLUDE_PATH "${_CEF_ROOT}")
# Path to the libcef_dll_wrapper target.
set(CEF_LIBCEF_DLL_WRAPPER_PATH "${_CEF_ROOT}/libcef_dll")
# Shared compiler/linker flags.
list(APPEND CEF_COMPILER_DEFINES
# Allow C++ programs to use stdint.h macros specified in the C99 standard that aren't
# in the C++ standard (e.g. UINT8_MAX, INT64_MIN, etc)
__STDC_CONSTANT_MACROS __STDC_FORMAT_MACROS
)
#
# Linux configuration.
#
if(OS_LINUX)
# Platform-specific compiler/linker flags.
set(CEF_LIBTYPE SHARED)
list(APPEND CEF_COMPILER_FLAGS
-fno-strict-aliasing # Avoid assumptions regarding non-aliasing of objects of different types
-fPIC # Generate position-independent code for shared libraries
-fstack-protector # Protect some vulnerable functions from stack-smashing (security feature)
-funwind-tables # Support stack unwinding for backtrace()
-fvisibility=hidden # Give hidden visibility to declarations that are not explicitly marked as visible
--param=ssp-buffer-size=4 # Set the minimum buffer size protected by SSP (security feature, related to stack-protector)
-pipe # Use pipes rather than temporary files for communication between build stages
-pthread # Use the pthread library
-Wall # Enable all warnings
-Werror # Treat warnings as errors
-Wno-missing-field-initializers # Don't warn about missing field initializers
-Wno-unused-parameter # Don't warn about unused parameters
)
list(APPEND CEF_C_COMPILER_FLAGS
-std=c99 # Use the C99 language standard
)
list(APPEND CEF_CXX_COMPILER_FLAGS
-fno-exceptions # Disable exceptions
-fno-rtti # Disable real-time type information
-fno-threadsafe-statics # Don't generate thread-safe statics
-fvisibility-inlines-hidden # Give hidden visibility to inlined class member functions
-std=gnu++11 # Use the C++11 language standard including GNU extensions
-Wsign-compare # Warn about mixed signed/unsigned type comparisons
)
list(APPEND CEF_COMPILER_FLAGS_DEBUG
-O0 # Disable optimizations
-g # Generate debug information
)
list(APPEND CEF_COMPILER_FLAGS_RELEASE
-O2 # Optimize for maximum speed
-fdata-sections # Enable linker optimizations to improve locality of reference for data sections
-ffunction-sections # Enable linker optimizations to improve locality of reference for function sections
-fno-ident # Ignore the #ident directive
-U_FORTIFY_SOURCE # Undefine _FORTIFY_SOURCE in case it was previously defined
-D_FORTIFY_SOURCE=2 # Add memory and string function protection (security feature, related to stack-protector)
)
list(APPEND CEF_LINKER_FLAGS
-fPIC # Generate position-independent code for shared libraries
-pthread # Use the pthread library
-Wl,--disable-new-dtags # Don't generate new-style dynamic tags in ELF
-Wl,--fatal-warnings # Treat warnings as errors
-Wl,-rpath,. # Set rpath so that libraries can be placed next to the executable
-Wl,-z,noexecstack # Mark the stack as non-executable (security feature)
-Wl,-z,now # Resolve symbols on program start instead of on first use (security feature)
-Wl,-z,relro # Mark relocation sections as read-only (security feature)
)
list(APPEND CEF_LINKER_FLAGS_RELEASE
-Wl,-O1 # Enable linker optimizations
-Wl,--as-needed # Only link libraries that export symbols used by the binary
-Wl,--gc-sections # Remove unused code resulting from -fdata-sections and -function-sections
)
list(APPEND CEF_COMPILER_DEFINES
_FILE_OFFSET_BITS=64 # Allow the Large File Support (LFS) interface to replace the old interface
)
list(APPEND CEF_COMPILER_DEFINES_RELEASE
NDEBUG # Not a debug build
)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
CHECK_C_COMPILER_FLAG(-Wno-unused-local-typedefs COMPILER_SUPPORTS_NO_UNUSED_LOCAL_TYPEDEFS)
if(COMPILER_SUPPORTS_NO_UNUSED_LOCAL_TYPEDEFS)
list(APPEND CEF_C_COMPILER_FLAGS
-Wno-unused-local-typedefs # Don't warn about unused local typedefs
)
endif()
CHECK_CXX_COMPILER_FLAG(-Wno-literal-suffix COMPILER_SUPPORTS_NO_LITERAL_SUFFIX)
if(COMPILER_SUPPORTS_NO_LITERAL_SUFFIX)
list(APPEND CEF_CXX_COMPILER_FLAGS
-Wno-literal-suffix # Don't warn about invalid suffixes on literals
)
endif()
CHECK_CXX_COMPILER_FLAG(-Wno-narrowing COMPILER_SUPPORTS_NO_NARROWING)
if(COMPILER_SUPPORTS_NO_NARROWING)
list(APPEND CEF_CXX_COMPILER_FLAGS
-Wno-narrowing # Don't warn about type narrowing
)
endif()
if(PROJECT_ARCH STREQUAL "x86_64")
# 64-bit architecture.
list(APPEND CEF_COMPILER_FLAGS
-m64
-march=x86-64
)
list(APPEND CEF_LINKER_FLAGS
-m64
)
elseif(PROJECT_ARCH STREQUAL "x86")
# 32-bit architecture.
list(APPEND CEF_COMPILER_FLAGS
-msse2
-mfpmath=sse
-mmmx
-m32
)
list(APPEND CEF_LINKER_FLAGS
-m32
)
endif()
# Standard libraries.
set(CEF_STANDARD_LIBS
X11
)
# CEF directory paths.
set(CEF_RESOURCE_DIR "${_CEF_ROOT}/Resources")
set(CEF_BINARY_DIR "${_CEF_ROOT}/${CMAKE_BUILD_TYPE}")
set(CEF_BINARY_DIR_DEBUG "${_CEF_ROOT}/Debug")
set(CEF_BINARY_DIR_RELEASE "${_CEF_ROOT}/Release")
# CEF library paths.
set(CEF_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/libcef.so")
set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/libcef.so")
# List of CEF binary files.
set(CEF_BINARY_FILES
chrome-sandbox
libcef.so
natives_blob.bin
snapshot_blob.bin
)
# List of CEF resource files.
set(CEF_RESOURCE_FILES
cef.pak
cef_100_percent.pak
cef_200_percent.pak
cef_extensions.pak
devtools_resources.pak
icudtl.dat
locales
)
endif()
#
# Mac OS X configuration.
#
if(OS_MACOSX)
# Platform-specific compiler/linker flags.
# See also Xcode target properties in macros.cmake.
set(CEF_LIBTYPE SHARED)
list(APPEND CEF_COMPILER_FLAGS
-fno-strict-aliasing # Avoid assumptions regarding non-aliasing of objects of different types
-fstack-protector # Protect some vulnerable functions from stack-smashing (security feature)
-funwind-tables # Support stack unwinding for backtrace()
-fvisibility=hidden # Give hidden visibility to declarations that are not explicitly marked as visible
-Wall # Enable all warnings
-Werror # Treat warnings as errors
-Wextra # Enable additional warnings
-Wendif-labels # Warn whenever an #else or an #endif is followed by text
-Wnewline-eof # Warn about no newline at end of file
-Wno-missing-field-initializers # Don't warn about missing field initializers
-Wno-unused-parameter # Don't warn about unused parameters
)
list(APPEND CEF_C_COMPILER_FLAGS
-std=c99 # Use the C99 language standard
)
list(APPEND CEF_CXX_COMPILER_FLAGS
-fno-exceptions # Disable exceptions
-fno-rtti # Disable real-time type information
-fno-threadsafe-statics # Don't generate thread-safe statics
-fobjc-call-cxx-cdtors # Call the constructor/destructor of C++ instance variables in ObjC objects
-fvisibility-inlines-hidden # Give hidden visibility to inlined class member functions
-std=gnu++11 # Use the C++11 language standard including GNU extensions
-Wno-narrowing # Don't warn about type narrowing
-Wsign-compare # Warn about mixed signed/unsigned type comparisons
)
list(APPEND CEF_COMPILER_FLAGS_DEBUG
-O0 # Disable optimizations
-g # Generate debug information
)
list(APPEND CEF_COMPILER_FLAGS_RELEASE
-O3 # Optimize for maximum speed plus a few extras
)
list(APPEND CEF_LINKER_FLAGS
-Wl,-search_paths_first # Search for static or shared library versions in the same pass
-Wl,-ObjC # Support creation of ObjC static libraries
-Wl,-pie # Generate position-independent code suitable for executables only
)
list(APPEND CEF_LINKER_FLAGS_RELEASE
-Wl,-dead_strip # Strip dead code
)
# Standard libraries.
set(CEF_STANDARD_LIBS
-lpthread
"-framework Cocoa"
"-framework AppKit"
)
# Find the newest available base SDK.
execute_process(COMMAND xcode-select --print-path OUTPUT_VARIABLE XCODE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
foreach(OS_VERSION 10.10 10.9 10.8 10.7)
set(SDK "${XCODE_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${OS_VERSION}.sdk")
if(NOT "${CMAKE_OSX_SYSROOT}" AND EXISTS "${SDK}" AND IS_DIRECTORY "${SDK}")
set(CMAKE_OSX_SYSROOT ${SDK})
endif()
endforeach()
# Target SDK.
set(CEF_TARGET_SDK "10.7")
list(APPEND CEF_COMPILER_FLAGS
-mmacosx-version-min=${CEF_TARGET_SDK}
)
set(CMAKE_OSX_DEPLOYMENT_TARGET ${CEF_TARGET_SDK})
# Target architecture.
if(PROJECT_ARCH STREQUAL "x86_64")
set(CMAKE_OSX_ARCHITECTURES "x86_64")
else()
set(CMAKE_OSX_ARCHITECTURES "i386")
endif()
# CEF directory paths.
set(CEF_BINARY_DIR "${_CEF_ROOT}/$<CONFIGURATION>")
set(CEF_BINARY_DIR_DEBUG "${_CEF_ROOT}/Debug")
set(CEF_BINARY_DIR_RELEASE "${_CEF_ROOT}/Release")
# CEF library paths.
set(CEF_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/Chromium Embedded Framework.framework/Chromium Embedded Framework")
set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/Chromium Embedded Framework.framework/Chromium Embedded Framework")
endif()
#
# Windows configuration.
#
if(OS_WINDOWS)
# Consumers who run into LNK4099 warnings can pass /Z7 instead (see issue #385).
set(CEF_DEBUG_INFO_FLAG "/Zi" CACHE STRING "Optional flag specifying specific /Z flag to use")
# Platform-specific compiler/linker flags.
set(CEF_LIBTYPE STATIC)
list(APPEND CEF_COMPILER_FLAGS
/MP # Multiprocess compilation
/Gy # Enable function-level linking
/GR- # Disable run-time type information
/W4 # Warning level 4
/WX # Treat warnings as errors
/wd4100 # Ignore "unreferenced formal parameter" warning
/wd4127 # Ignore "conditional expression is constant" warning
/wd4244 # Ignore "conversion possible loss of data" warning
/wd4481 # Ignore "nonstandard extension used: override" warning
/wd4512 # Ignore "assignment operator could not be generated" warning
/wd4701 # Ignore "potentially uninitialized local variable" warning
/wd4702 # Ignore "unreachable code" warning
/wd4996 # Ignore "function or variable may be unsafe" warning
${CEF_DEBUG_INFO_FLAG}
)
list(APPEND CEF_COMPILER_FLAGS_DEBUG
/MTd # Multithreaded debug runtime
/RTC1 # Disable optimizations
/Od # Enable basic run-time checks
)
list(APPEND CEF_COMPILER_FLAGS_RELEASE
/MT # Multithreaded release runtime
/O2 # Optimize for maximum speed
/Ob2 # Inline any suitable function
/GF # Enable string pooling
)
list(APPEND CEF_LINKER_FLAGS_DEBUG
/DEBUG # Generate debug information
)
list(APPEND CEF_EXE_LINKER_FLAGS
/MANIFEST:NO # No default manifest (see ADD_WINDOWS_MANIFEST macro usage)
)
list(APPEND CEF_COMPILER_DEFINES
WIN32 _WIN32 _WINDOWS # Windows platform
UNICODE _UNICODE # Unicode build
WINVER=0x0602 _WIN32_WINNT=0x602 # Targeting Windows 8
NOMINMAX # Use the standard's templated min/max
WIN32_LEAN_AND_MEAN # Exclude less common API declarations
_HAS_EXCEPTIONS=0 # Disable exceptions
)
list(APPEND CEF_COMPILER_DEFINES_RELEASE
NDEBUG _NDEBUG # Not a debug build
)
# Standard libraries.
set(CEF_STANDARD_LIBS
comctl32.lib
rpcrt4.lib
shlwapi.lib
ws2_32.lib
)
# CEF directory paths.
set(CEF_RESOURCE_DIR "${_CEF_ROOT}/Resources")
set(CEF_BINARY_DIR "${_CEF_ROOT}/$<CONFIGURATION>")
set(CEF_BINARY_DIR_DEBUG "${_CEF_ROOT}/Debug")
set(CEF_BINARY_DIR_RELEASE "${_CEF_ROOT}/Release")
# CEF library paths.
set(CEF_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/libcef.lib")
set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/libcef.lib")
# List of CEF binary files.
set(CEF_BINARY_FILES
d3dcompiler_43.dll
d3dcompiler_47.dll
libcef.dll
libEGL.dll
libGLESv2.dll
natives_blob.bin
snapshot_blob.bin
)
# List of CEF resource files.
set(CEF_RESOURCE_FILES
cef.pak
cef_100_percent.pak
cef_200_percent.pak
cef_extensions.pak
devtools_resources.pak
icudtl.dat
locales
)
# Configure use of the sandbox.
option(USE_SANDBOX "Enable or disable use of the sandbox." ON)
if(USE_SANDBOX AND NOT MSVC_VERSION EQUAL 1900)
# The cef_sandbox.lib static library is currently built with VS2015. It will
# not link successfully with other VS versions.
set(USE_SANDBOX OFF)
endif()
if(USE_SANDBOX)
list(APPEND CEF_COMPILER_DEFINES
PSAPI_VERSION=1 # Required by cef_sandbox.lib
CEF_USE_SANDBOX # Used by apps to test if the sandbox is enabled
)
# Libraries required by cef_sandbox.lib.
set(CEF_SANDBOX_STANDARD_LIBS
dbghelp.lib
psapi.lib
version.lib
winmm.lib
)
# CEF sandbox library paths.
set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.lib")
set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.lib")
endif()
# Configure use of ATL.
option(USE_ATL "Enable or disable use of ATL." ON)
if(USE_ATL)
# Determine if the Visual Studio install supports ATL.
get_filename_component(VC_BIN_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
get_filename_component(VC_DIR ${VC_BIN_DIR} DIRECTORY)
if(NOT IS_DIRECTORY "${VC_DIR}/atlmfc")
set(USE_ATL OFF)
endif()
endif()
if(USE_ATL)
list(APPEND CEF_COMPILER_DEFINES
CEF_USE_ATL # Used by apps to test if ATL support is enabled
)
endif()
endif()

View File

@@ -448,10 +448,13 @@ typedef struct _cef_browser_host_t {
int clearSelection);
///
// Open developer tools in its own window. If |inspect_element_at| is non-
// NULL the element at the specified (x,y) location will be inspected. The
// |windowInfo| parameter will be ignored if this browser is wrapped in a
// cef_browser_view_t.
// Open developer tools (DevTools) in its own browser. The DevTools browser
// will remain associated with this browser. If the DevTools browser is
// already open then it will be focused, in which case the |windowInfo|,
// |client| and |settings| parameters will be ignored. If |inspect_element_at|
// is non-NULL then the element at the specified (x,y) location will be
// inspected. The |windowInfo| parameter will be ignored if this browser is
// wrapped in a cef_browser_view_t.
///
void (CEF_CALLBACK *show_dev_tools)(struct _cef_browser_host_t* self,
const struct _cef_window_info_t* windowInfo,
@@ -460,11 +463,16 @@ typedef struct _cef_browser_host_t {
const cef_point_t* inspect_element_at);
///
// Explicitly close the developer tools window if one exists for this browser
// instance.
// Explicitly close the associated DevTools browser, if any.
///
void (CEF_CALLBACK *close_dev_tools)(struct _cef_browser_host_t* self);
///
// Returns true (1) if this browser currently has an associated DevTools
// browser. Must be called on the browser process UI thread.
///
int (CEF_CALLBACK *has_dev_tools)(struct _cef_browser_host_t* self);
///
// Retrieve a snapshot of current navigation entries as values sent to the
// specified visitor. If |current_only| is true (1) only the current

View File

@@ -279,7 +279,7 @@ CEF_EXPORT cef_request_context_t* cef_request_context_create_context(
// Creates a new context object that shares storage with |other| and uses an
// optional |handler|.
///
CEF_EXPORT cef_request_context_t* create_context_shared(
CEF_EXPORT cef_request_context_t* cef_create_context_shared(
cef_request_context_t* other,
struct _cef_request_context_handler_t* handler);

View File

@@ -78,7 +78,8 @@ typedef struct _cef_resource_handler_t {
// (0) or the specified number of bytes have been read. Use the |response|
// object to set the mime type, http status code and other optional header
// values. To redirect the request to a new URL set |redirectUrl| to the new
// URL.
// URL. If an error occured while setting up the request you can call
// set_error() on |response| to indicate the error condition.
///
void (CEF_CALLBACK *get_response_headers)(
struct _cef_resource_handler_t* self, struct _cef_response_t* response,

View File

@@ -60,6 +60,18 @@ typedef struct _cef_response_t {
///
int (CEF_CALLBACK *is_read_only)(struct _cef_response_t* self);
///
// Get the response error code. Returns ERR_NONE if there was no error.
///
cef_errorcode_t (CEF_CALLBACK *get_error)(struct _cef_response_t* self);
///
// Set the response error code. This can be used by custom scheme handlers to
// return errors during initial request processing.
///
void (CEF_CALLBACK *set_error)(struct _cef_response_t* self,
cef_errorcode_t error);
///
// Get the response status code.
///

View File

@@ -75,102 +75,8 @@
@interface UnderlayOpenGLHostingWindow : NSWindow
@end
// Copy of definitions from base/mac/sdk_forward_declarations.h.
// Forward declarations for APIs that are part of the 10.7 SDK. This will allow
// using them when building with the 10.6 SDK.
#if !defined(MAC_OS_X_VERSION_10_7) || \
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
enum {
NSEventPhaseNone = 0, // event not associated with a phase.
NSEventPhaseBegan = 0x1 << 0,
NSEventPhaseStationary = 0x1 << 1,
NSEventPhaseChanged = 0x1 << 2,
NSEventPhaseEnded = 0x1 << 3,
NSEventPhaseCancelled = 0x1 << 4,
};
typedef NSUInteger NSEventPhase;
@interface NSEvent (LionSDK)
+ (BOOL)isSwipeTrackingFromScrollEventsEnabled;
- (NSEventPhase)phase;
- (CGFloat)scrollingDeltaX;
- (CGFloat)scrollingDeltaY;
- (BOOL)isDirectionInvertedFromDevice;
@end
@interface NSScreen (LionSDK)
- (CGFloat)backingScaleFactor;
- (NSRect)convertRectToBacking:(NSRect)aRect;
@end
@interface NSWindow (LionSDK)
- (CGFloat)backingScaleFactor;
@end
#endif // MAC_OS_X_VERSION_10_7
// The Mac OS X 10.6 SDK introduced new protocols used for delegates. These
// protocol defintions were not present in earlier releases of the Mac OS X
// SDK. In order to support building against the new SDK, which requires
// delegates to conform to these protocols, and earlier SDKs, which do not
// define these protocols at all, this file will provide empty protocol
// definitions when used with earlier SDK versions.
#if !defined(MAC_OS_X_VERSION_10_6) || \
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
#define DEFINE_EMPTY_PROTOCOL(p) \
@protocol p \
@end
DEFINE_EMPTY_PROTOCOL(NSAlertDelegate)
DEFINE_EMPTY_PROTOCOL(NSApplicationDelegate)
DEFINE_EMPTY_PROTOCOL(NSControlTextEditingDelegate)
DEFINE_EMPTY_PROTOCOL(NSMatrixDelegate)
DEFINE_EMPTY_PROTOCOL(NSMenuDelegate)
DEFINE_EMPTY_PROTOCOL(NSOpenSavePanelDelegate)
DEFINE_EMPTY_PROTOCOL(NSOutlineViewDataSource)
DEFINE_EMPTY_PROTOCOL(NSOutlineViewDelegate)
DEFINE_EMPTY_PROTOCOL(NSSpeechSynthesizerDelegate)
DEFINE_EMPTY_PROTOCOL(NSSplitViewDelegate)
DEFINE_EMPTY_PROTOCOL(NSTableViewDataSource)
DEFINE_EMPTY_PROTOCOL(NSTableViewDelegate)
DEFINE_EMPTY_PROTOCOL(NSTextFieldDelegate)
DEFINE_EMPTY_PROTOCOL(NSTextViewDelegate)
DEFINE_EMPTY_PROTOCOL(NSWindowDelegate)
#undef DEFINE_EMPTY_PROTOCOL
#endif
#endif // USING_CHROMIUM_INCLUDES
// Forward declarations for APIs that are part of the 10.7 SDK. This will allow
// using them when building with the 10.6 SDK.
#if !defined(MAC_OS_X_VERSION_10_7) || \
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
@interface NSView (NSOpenGLSurfaceResolutionLionAPI)
- (void)setWantsBestResolutionOpenGLSurface:(BOOL)flag;
@end
@interface NSView (LionAPI)
- (NSSize)convertSizeToBacking:(NSSize)aSize;
- (NSRect)convertRectToBacking:(NSRect)aRect;
- (NSRect)convertRectFromBacking:(NSRect)aRect;
@end
static NSString* const NSWindowDidChangeBackingPropertiesNotification =
@"NSWindowDidChangeBackingPropertiesNotification";
static NSString* const NSBackingPropertyOldScaleFactorKey =
@"NSBackingPropertyOldScaleFactorKey";
#endif // MAC_OS_X_VERSION_10_7
// All CEF client applications must subclass NSApplication and implement this
// protocol.
@protocol CefAppProtocol<CrAppControlProtocol>

View File

@@ -490,24 +490,34 @@ class CefBrowserHost : public virtual CefBase {
virtual void StopFinding(bool clearSelection) =0;
///
// Open developer tools in its own window. If |inspect_element_at| is non-
// empty the element at the specified (x,y) location will be inspected. The
// |windowInfo| parameter will be ignored if this browser is wrapped in a
// CefBrowserView.
// Open developer tools (DevTools) in its own browser. The DevTools browser
// will remain associated with this browser. If the DevTools browser is
// already open then it will be focused, in which case the |windowInfo|,
// |client| and |settings| parameters will be ignored. If |inspect_element_at|
// is non-empty then the element at the specified (x,y) location will be
// inspected. The |windowInfo| parameter will be ignored if this browser is
// wrapped in a CefBrowserView.
///
/*--cef(optional_param=inspect_element_at)--*/
/*--cef(optional_param=windowInfo,optional_param=client,
optional_param=settings,optional_param=inspect_element_at)--*/
virtual void ShowDevTools(const CefWindowInfo& windowInfo,
CefRefPtr<CefClient> client,
const CefBrowserSettings& settings,
const CefPoint& inspect_element_at) =0;
///
// Explicitly close the developer tools window if one exists for this browser
// instance.
// Explicitly close the associated DevTools browser, if any.
///
/*--cef()--*/
virtual void CloseDevTools() =0;
///
// Returns true if this browser currently has an associated DevTools browser.
// Must be called on the browser process UI thread.
///
/*--cef()--*/
virtual bool HasDevTools() =0;
///
// Retrieve a snapshot of current navigation entries as values sent to the
// specified visitor. If |current_only| is true only the current navigation

View File

@@ -104,7 +104,7 @@ class CefRequestContext : public virtual CefBase {
// Creates a new context object that shares storage with |other| and uses an
// optional |handler|.
///
/*--cef(capi_name=create_context_shared,optional_param=handler)--*/
/*--cef(capi_name=cef_create_context_shared,optional_param=handler)--*/
static CefRefPtr<CefRequestContext> CreateContext(
CefRefPtr<CefRequestContext> other,
CefRefPtr<CefRequestContextHandler> handler);

View File

@@ -71,7 +71,8 @@ class CefResourceHandler : public virtual CefBase {
// false or the specified number of bytes have been read. Use the |response|
// object to set the mime type, http status code and other optional header
// values. To redirect the request to a new URL set |redirectUrl| to the new
// URL.
// URL. If an error occured while setting up the request you can call
// SetError() on |response| to indicate the error condition.
///
/*--cef()--*/
virtual void GetResponseHeaders(CefRefPtr<CefResponse> response,

View File

@@ -62,6 +62,19 @@ class CefResponse : public virtual CefBase {
/*--cef()--*/
virtual bool IsReadOnly() =0;
///
// Get the response error code. Returns ERR_NONE if there was no error.
///
/*--cef(default_retval=ERR_NONE)--*/
virtual cef_errorcode_t GetError() = 0;
///
// Set the response error code. This can be used by custom scheme handlers
// to return errors during initial request processing.
///
/*--cef()--*/
virtual void SetError(cef_errorcode_t error) = 0;
///
// Get the response status code.
///

View File

@@ -209,12 +209,14 @@ CefBrowserContextImpl::~CefBrowserContextImpl() {
pref_proxy_config_tracker_->DetachFromPrefService();
if (host_content_settings_map_.get())
if (url_request_getter_)
url_request_getter_->ShutdownOnUIThread();
if (host_content_settings_map_)
host_content_settings_map_->ShutdownOnUIThread();
// Delete the download manager delegate here because otherwise we'll crash
// when it's accessed from the content::BrowserContext destructor.
if (download_manager_delegate_.get())
if (download_manager_delegate_)
download_manager_delegate_.reset(NULL);
g_manager.Get().RemoveImpl(this, cache_path_);

View File

@@ -805,6 +805,10 @@ void CefBrowserHostImpl::ShowDevTools(
return;
if (devtools_frontend_) {
if (!inspect_element_at.IsEmpty()) {
devtools_frontend_->InspectElementAt(inspect_element_at.x,
inspect_element_at.y);
}
devtools_frontend_->Focus();
return;
}
@@ -832,6 +836,15 @@ void CefBrowserHostImpl::CloseDevTools() {
}
}
bool CefBrowserHostImpl::HasDevTools() {
if (!CEF_CURRENTLY_ON_UIT()) {
NOTREACHED() << "called on invalid thread";
return false;
}
return (devtools_frontend_ != nullptr);
}
void CefBrowserHostImpl::GetNavigationEntries(
CefRefPtr<CefNavigationEntryVisitor> visitor,
bool current_only) {
@@ -2286,17 +2299,20 @@ void CefBrowserHostImpl::RequestMediaAccessPermission(
case content::MEDIA_ENUMERATE_DEVICES:
// Pick the desired device or fall back to the first available of the
// given type.
CefMediaCaptureDevicesDispatcher::GetInstance()->GetRequestedDevice(
request.requested_audio_device_id,
microphone_requested,
false,
&devices);
CefMediaCaptureDevicesDispatcher::GetInstance()->GetRequestedDevice(
request.requested_video_device_id,
false,
webcam_requested,
&devices);
if (microphone_requested) {
CefMediaCaptureDevicesDispatcher::GetInstance()->GetRequestedDevice(
request.requested_audio_device_id,
true,
false,
&devices);
}
if (webcam_requested) {
CefMediaCaptureDevicesDispatcher::GetInstance()->GetRequestedDevice(
request.requested_video_device_id,
false,
true,
&devices);
}
break;
}
}

View File

@@ -180,6 +180,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
const CefBrowserSettings& settings,
const CefPoint& inspect_element_at) override;
void CloseDevTools() override;
bool HasDevTools() override;
void GetNavigationEntries(
CefRefPtr<CefNavigationEntryVisitor> visitor,
bool current_only) override;

View File

@@ -18,6 +18,7 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/child_process_host.h"
#include "content/common/view_messages.h"
namespace {
@@ -102,16 +103,16 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreatePopupBrowserInfo(
// that happens re-visit the implementation of this class.
DCHECK_EQ(host, main_frame_host->GetProcess());
const int render_process_routing_id = host->GetID();
const int render_process_id = host->GetID();
const int render_view_routing_id = view_host->GetRoutingID();
const int render_frame_routing_id = main_frame_host->GetRoutingID();
scoped_refptr<CefBrowserInfo> browser_info =
new CefBrowserInfo(++next_browser_id_, true);
browser_info->render_id_manager()->add_render_view_id(
render_process_routing_id, render_view_routing_id);
render_process_id, render_view_routing_id);
browser_info->render_id_manager()->add_render_frame_id(
render_process_routing_id, render_frame_routing_id);
render_process_id, render_frame_routing_id);
browser_info_list_.push_back(browser_info);
if (is_windowless)
@@ -122,11 +123,11 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreatePopupBrowserInfo(
pending_new_browser_info_list_.begin();
for (; it != pending_new_browser_info_list_.end(); ++it) {
PendingNewBrowserInfo* info = *it;
if (info->host == host &&
if (info->render_process_id == render_process_id &&
info->render_view_routing_id == render_view_routing_id &&
info->render_frame_routing_id == render_frame_routing_id) {
SendNewBrowserInfoResponse(host, browser_info.get(), false,
info->reply_msg);
SendNewBrowserInfoResponse(render_process_id, browser_info.get(),
false, info->reply_msg);
pending_new_browser_info_list_.erase(it);
break;
@@ -137,15 +138,16 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreatePopupBrowserInfo(
}
void CefBrowserInfoManager::OnCreateWindow(
content::RenderProcessHost* host,
int render_process_id,
const ViewHostMsg_CreateWindow_Params& params) {
DCHECK_NE(render_process_id, content::ChildProcessHost::kInvalidUniqueID);
DCHECK_GT(params.opener_id, 0);
DCHECK_GT(params.opener_render_frame_id, 0);
std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup(
new CefBrowserInfoManager::PendingPopup);
pending_popup->step = CefBrowserInfoManager::PendingPopup::ON_CREATE_WINDOW;
pending_popup->opener_process_id = host->GetID();
pending_popup->opener_process_id = render_process_id;
pending_popup->opener_view_id = params.opener_id;
pending_popup->opener_frame_id = params.opener_render_frame_id;
pending_popup->target_url = params.target_url;
@@ -320,29 +322,28 @@ void CefBrowserInfoManager::WebContentsCreated(
}
void CefBrowserInfoManager::OnGetNewBrowserInfo(
content::RenderProcessHost* host,
int render_process_id,
int render_view_routing_id,
int render_frame_routing_id,
IPC::Message* reply_msg) {
DCHECK(host);
DCHECK_NE(render_process_id, content::ChildProcessHost::kInvalidUniqueID);
DCHECK_GT(render_view_routing_id, 0);
DCHECK_GT(render_frame_routing_id, 0);
DCHECK(reply_msg);
base::AutoLock lock_scope(browser_info_lock_);
const int render_process_routing_id = host->GetID();
bool is_guest_view = false;
scoped_refptr<CefBrowserInfo> browser_info = GetBrowserInfo(
render_process_routing_id, render_view_routing_id,
render_process_routing_id, render_frame_routing_id,
render_process_id, render_view_routing_id,
render_process_id, render_frame_routing_id,
&is_guest_view);
if (browser_info.get()) {
// Send the response immediately.
SendNewBrowserInfoResponse(host, browser_info.get(), is_guest_view,
reply_msg);
SendNewBrowserInfoResponse(render_process_id, browser_info.get(),
is_guest_view, reply_msg);
return;
}
@@ -353,7 +354,7 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(
pending_new_browser_info_list_.begin();
for (; it != pending_new_browser_info_list_.end(); ++it) {
PendingNewBrowserInfo* info = *it;
if (info->host == host &&
if (info->render_process_id == render_process_id &&
info->render_view_routing_id == render_view_routing_id &&
info->render_frame_routing_id == render_frame_routing_id) {
NOTREACHED();
@@ -364,7 +365,7 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(
// Queue the request.
std::unique_ptr<PendingNewBrowserInfo> pending(new PendingNewBrowserInfo());
pending->host = host;
pending->render_process_id = render_process_id;
pending->render_view_routing_id = render_view_routing_id;
pending->render_frame_routing_id = render_frame_routing_id;
pending->reply_msg = reply_msg;
@@ -438,12 +439,14 @@ void CefBrowserInfoManager::RenderProcessHostDestroyed(
content::RenderProcessHost* host) {
base::AutoLock lock_scope(browser_info_lock_);
const int render_process_id = host->GetID();
// Remove all pending requests that reference the destroyed host.
PendingNewBrowserInfoList::iterator it =
pending_new_browser_info_list_.begin();
while (it != pending_new_browser_info_list_.end()) {
PendingNewBrowserInfo* info = *it;
if (info->host == host)
if (info->render_process_id == render_process_id)
it = pending_new_browser_info_list_.erase(it);
else
++it;
@@ -453,10 +456,10 @@ void CefBrowserInfoManager::RenderProcessHostDestroyed(
void CefBrowserInfoManager::FilterPendingPopupURL(
int render_process_id,
std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup) {
content::RenderProcessHost* rph =
content::RenderProcessHost* host =
content::RenderProcessHost::FromID(render_process_id);
DCHECK(rph);
rph->FilterURL(false, &pending_popup->target_url);
DCHECK(host);
host->FilterURL(false, &pending_popup->target_url);
GetInstance()->PushPendingPopup(std::move(pending_popup));
}
@@ -549,10 +552,24 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfo(
// static
void CefBrowserInfoManager::SendNewBrowserInfoResponse(
content::RenderProcessHost* host,
int render_process_id,
CefBrowserInfo* browser_info,
bool is_guest_view,
IPC::Message* reply_msg) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserInfoManager::SendNewBrowserInfoResponse,
render_process_id, browser_info, is_guest_view, reply_msg));
return;
}
content::RenderProcessHost* host =
content::RenderProcessHost::FromID(render_process_id);
if (!host) {
delete reply_msg;
return;
}
CefProcessHostMsg_GetNewBrowserInfo_Params params;
params.browser_id = browser_info->browser_id();
params.is_windowless = browser_info->is_windowless();

View File

@@ -60,7 +60,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
// Called from CefBrowserMessageFilter::OnCreateWindow. See comments on
// PendingPopup for more information.
void OnCreateWindow(content::RenderProcessHost* host,
void OnCreateWindow(int render_process_id,
const ViewHostMsg_CreateWindow_Params& params);
// Called from CefContentBrowserClient::CanCreateWindow. See comments on
@@ -103,7 +103,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
// already exist for traditional popup browsers depending on timing. See
// comments on PendingPopup for more information.
void OnGetNewBrowserInfo(
content::RenderProcessHost* host,
int render_process_id,
int render_view_routing_id,
int render_frame_routing_id,
IPC::Message* reply_msg);
@@ -203,14 +203,14 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
// Send the response for a pending OnGetNewBrowserInfo request.
static void SendNewBrowserInfoResponse(
content::RenderProcessHost* host,
int render_process_id,
CefBrowserInfo* browser_info,
bool is_guest_view,
IPC::Message* reply_msg);
// Pending request for OnGetNewBrowserInfo.
struct PendingNewBrowserInfo {
content::RenderProcessHost* host;
int render_process_id;
int render_view_routing_id;
int render_frame_routing_id;
IPC::Message* reply_msg;

View File

@@ -1,4 +1,4 @@
/// Copyright (c) 2012 The Chromium Embedded Framework Authors.
// Copyright (c) 2012 The Chromium Embedded Framework Authors.
// Portions (c) 2011 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.
@@ -19,10 +19,10 @@
#include "content/common/frame_messages.h"
#include "content/common/view_messages.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/child_process_host.h"
CefBrowserMessageFilter::CefBrowserMessageFilter(
content::RenderProcessHost* host)
: host_(host),
CefBrowserMessageFilter::CefBrowserMessageFilter(int render_process_id)
: render_process_id_(render_process_id),
sender_(NULL) {
}
@@ -34,7 +34,7 @@ void CefBrowserMessageFilter::OnFilterAdded(IPC::Sender* sender) {
}
void CefBrowserMessageFilter::OnFilterRemoved() {
host_ = NULL;
render_process_id_ = content::ChildProcessHost::kInvalidUniqueID;
sender_ = NULL;
}
@@ -63,7 +63,21 @@ bool CefBrowserMessageFilter::OnMessageReceived(const IPC::Message& message) {
}
bool CefBrowserMessageFilter::Send(IPC::Message* message) {
return host_->Send(message);
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(base::IgnoreResult(&CefBrowserMessageFilter::Send), this,
message));
return true;
}
content::RenderProcessHost* host =
content::RenderProcessHost::FromID(render_process_id_);
if (!host) {
delete message;
return false;
}
return host->Send(message);
}
void CefBrowserMessageFilter::OnGetNewRenderThreadInfo(
@@ -87,17 +101,24 @@ void CefBrowserMessageFilter::OnGetNewBrowserInfo(
int render_view_routing_id,
int render_frame_routing_id,
IPC::Message* reply_msg) {
CefBrowserInfoManager::GetInstance()->OnGetNewBrowserInfo(
host_,
render_view_routing_id,
render_frame_routing_id,
reply_msg);
if (render_process_id_ != content::ChildProcessHost::kInvalidUniqueID) {
CefBrowserInfoManager::GetInstance()->OnGetNewBrowserInfo(
render_process_id_,
render_view_routing_id,
render_frame_routing_id,
reply_msg);
} else {
delete reply_msg;
}
}
void CefBrowserMessageFilter::OnCreateWindow(
const ViewHostMsg_CreateWindow_Params& params,
IPC::Message* reply_msg) {
CefBrowserInfoManager::GetInstance()->OnCreateWindow(host_, params);
if (render_process_id_ != content::ChildProcessHost::kInvalidUniqueID) {
CefBrowserInfoManager::GetInstance()->OnCreateWindow(render_process_id_,
params);
}
// Reply message is not used.
delete reply_msg;
@@ -111,11 +132,11 @@ void CefBrowserMessageFilter::OnFrameFocused(int32_t render_frame_routing_id) {
return;
}
if (!host_)
if (render_process_id_ == content::ChildProcessHost::kInvalidUniqueID)
return;
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForFrame(host_->GetID(),
CefBrowserHostImpl::GetBrowserForFrame(render_process_id_,
render_frame_routing_id);
if (browser.get())
browser->SetFocusedFrame(render_frame_routing_id);

View File

@@ -24,7 +24,7 @@ struct ViewHostMsg_CreateWindow_Params;
// This class sends and receives control messages on the browser process.
class CefBrowserMessageFilter : public IPC::MessageFilter {
public:
explicit CefBrowserMessageFilter(content::RenderProcessHost* host);
explicit CefBrowserMessageFilter(int render_process_id);
~CefBrowserMessageFilter() override;
// IPC::ChannelProxy::MessageFilter implementation.
@@ -46,7 +46,7 @@ class CefBrowserMessageFilter : public IPC::MessageFilter {
IPC::Message* reply_msg);
void OnFrameFocused(int32_t render_frame_routing_id);
content::RenderProcessHost* host_;
int render_process_id_;
IPC::Sender* sender_;
DISALLOW_COPY_AND_ASSIGN(CefBrowserMessageFilter);

View File

@@ -92,7 +92,8 @@ std::string GetSwitchArgument(const std::vector<std::string>& vec,
class CefConfigurator : public Configurator {
public:
CefConfigurator(const base::CommandLine* cmdline,
net::URLRequestContextGetter* url_request_getter);
net::URLRequestContextGetter* url_request_getter,
PrefService* pref_service);
int InitialDelay() const override;
int NextCheckDelay() const override;
@@ -116,6 +117,7 @@ class CefConfigurator : public Configurator {
bool UseCupSigning() const override;
scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner()
const override;
PrefService* GetPrefService() const override;
private:
friend class base::RefCountedThreadSafe<CefConfigurator>;
@@ -123,6 +125,7 @@ class CefConfigurator : public Configurator {
~CefConfigurator() override {}
net::URLRequestContextGetter* url_request_getter_;
PrefService* pref_service_;
std::string extra_info_;
GURL url_source_override_;
bool fast_update_;
@@ -133,8 +136,10 @@ class CefConfigurator : public Configurator {
CefConfigurator::CefConfigurator(
const base::CommandLine* cmdline,
net::URLRequestContextGetter* url_request_getter)
net::URLRequestContextGetter* url_request_getter,
PrefService* pref_service)
: url_request_getter_(url_request_getter),
pref_service_(pref_service),
fast_update_(false),
pings_enabled_(false),
deltas_enabled_(false),
@@ -282,13 +287,18 @@ CefConfigurator::GetSequencedTaskRunner() const {
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
}
PrefService* CefConfigurator::GetPrefService() const {
return pref_service_;
}
} // namespace
scoped_refptr<update_client::Configurator>
MakeCefComponentUpdaterConfigurator(
const base::CommandLine* cmdline,
net::URLRequestContextGetter* context_getter) {
return new CefConfigurator(cmdline, context_getter);
net::URLRequestContextGetter* context_getter,
PrefService* pref_service) {
return new CefConfigurator(cmdline, context_getter, pref_service);
}
} // namespace component_updater

View File

@@ -16,12 +16,15 @@ namespace net {
class URLRequestContextGetter;
}
class PrefService;
namespace component_updater {
scoped_refptr<update_client::Configurator>
MakeCefComponentUpdaterConfigurator(
const base::CommandLine* cmdline,
net::URLRequestContextGetter* context_getter);
net::URLRequestContextGetter* context_getter,
PrefService* pref_service);
} // namespace component_updater

View File

@@ -425,7 +425,7 @@ void CefContentBrowserClient::RenderProcessWillLaunch(
base::CommandLine::ForCurrentProcess();
const int id = host->GetID();
host->GetChannel()->AddFilter(new CefBrowserMessageFilter(host));
host->GetChannel()->AddFilter(new CefBrowserMessageFilter(id));
host->AddFilter(new printing::PrintingMessageFilter(id));
if (!command_line->HasSwitch(switches::kDisableSpellChecking)) {

View File

@@ -363,11 +363,13 @@ component_updater::ComponentUpdateService*
CefContext::component_updater() {
if (!component_updater_.get()) {
CEF_REQUIRE_UIT_RETURN(NULL);
scoped_refptr<CefBrowserContextImpl> browser_context =
CefContentBrowserClient::Get()->browser_context();
scoped_refptr<update_client::Configurator> configurator =
component_updater::MakeCefComponentUpdaterConfigurator(
base::CommandLine::ForCurrentProcess(),
CefContentBrowserClient::Get()->browser_context()->
request_context().get());
browser_context->request_context().get(),
browser_context->GetPrefs());
// Creating the component updater does not do anything, components
// need to be registered and Start() needs to be called.
component_updater_.reset(component_updater::ComponentUpdateServiceFactory(

View File

@@ -113,10 +113,18 @@ void SetCookieCallbackImpl(CefRefPtr<CefSetCookieCallback> callback,
base::Bind(&CefSetCookieCallback::OnComplete, callback.get(), success));
}
net::CookieStore* GetExistingCookieStoreHelper(
base::WeakPtr<CefCookieManagerImpl> cookie_manager) {
if (cookie_manager.get())
return cookie_manager->GetExistingCookieStore();
return nullptr;
}
} // namespace
CefCookieManagerImpl::CefCookieManagerImpl() {
CefCookieManagerImpl::CefCookieManagerImpl()
: weak_ptr_factory_(this) {
}
CefCookieManagerImpl::~CefCookieManagerImpl() {
@@ -160,8 +168,16 @@ void CefCookieManagerImpl::GetCookieStore(
DCHECK(cookie_store_.get());
// Binding ref-counted |this| to CookieStoreGetter may result in
// heap-use-after-free if (a) the CookieStoreGetter contains the last
// CefCookieManagerImpl reference and (b) that reference is released during
// execution of a CookieMonster callback (which then results in the
// CookieManager being deleted). Use WeakPtr instead of |this| so that, in
// that case, the CookieStoreGetter will return nullptr instead of keeping
// the CefCookieManagerImpl alive (see issue #1882).
const CookieStoreGetter& cookie_store_getter =
base::Bind(&CefCookieManagerImpl::GetExistingCookieStore, this);
base::Bind(GetExistingCookieStoreHelper,
weak_ptr_factory_.GetWeakPtr());
if (task_runner->BelongsToCurrentThread()) {
// Execute the callback immediately.

View File

@@ -12,6 +12,7 @@
#include "libcef/browser/thread_util.h"
#include "base/files/file_path.h"
#include "base/memory/weak_ptr.h"
#include "net/cookies/cookie_monster.h"
// Implementation of the CefCookieManager interface.
@@ -126,6 +127,9 @@ class CefCookieManagerImpl : public CefCookieManager {
std::vector<std::string> supported_schemes_;
std::unique_ptr<net::CookieMonster> cookie_store_;
// Must be the last member.
base::WeakPtrFactory<CefCookieManagerImpl> weak_ptr_factory_;
IMPLEMENT_REFCOUNTING_DELETE_ON_IOT(CefCookieManagerImpl);
};

View File

@@ -121,38 +121,28 @@ CefDevToolsFrontend* CefDevToolsFrontend::Show(
CefBrowserHostImpl::Create(create_params);
content::WebContents* inspected_contents = inspected_browser->web_contents();
if (!inspect_element_at.IsEmpty()) {
scoped_refptr<content::DevToolsAgentHost> agent_host =
content::DevToolsAgentHost::GetOrCreateFor(inspected_contents);
agent_host->InspectElement(inspect_element_at.x, inspect_element_at.y);
}
// CefDevToolsFrontend will delete itself when the frontend WebContents is
// destroyed.
CefDevToolsFrontend* devtools_frontend = new CefDevToolsFrontend(
static_cast<CefBrowserHostImpl*>(frontend_browser.get()),
inspected_contents);
inspected_contents, inspect_element_at);
// Need to load the URL after creating the DevTools objects.
CefDevToolsDelegate* delegate =
CefContentBrowserClient::Get()->devtools_delegate();
frontend_browser->GetMainFrame()->LoadURL(delegate->GetChromeDevToolsURL());
devtools_frontend->Activate();
devtools_frontend->Focus();
return devtools_frontend;
}
void CefDevToolsFrontend::Activate() {
frontend_browser_->ActivateContents(web_contents());
}
void CefDevToolsFrontend::Focus() {
web_contents()->Focus();
frontend_browser_->SetFocus(true);
}
void CefDevToolsFrontend::InspectElementAt(int x, int y) {
if (inspect_element_at_.x != x || inspect_element_at_.y != y)
inspect_element_at_.Set(x, y);
if (agent_host_)
agent_host_->InspectElement(x, y);
}
@@ -172,10 +162,12 @@ void CefDevToolsFrontend::DisconnectFromTarget() {
CefDevToolsFrontend::CefDevToolsFrontend(
CefRefPtr<CefBrowserHostImpl> frontend_browser,
content::WebContents* inspected_contents)
content::WebContents* inspected_contents,
const CefPoint& inspect_element_at)
: WebContentsObserver(frontend_browser->web_contents()),
frontend_browser_(frontend_browser),
inspected_contents_(inspected_contents),
inspect_element_at_(inspect_element_at),
weak_factory_(this) {
}
@@ -204,6 +196,9 @@ void CefDevToolsFrontend::DocumentAvailableInMainFrame() {
if (agent_host != agent_host_) {
agent_host_ = agent_host;
agent_host_->AttachClient(this);
if (!inspect_element_at_.IsEmpty())
InspectElementAt(inspect_element_at_.x, inspect_element_at_.y);
}
}

View File

@@ -36,7 +36,6 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
const CefBrowserSettings& settings,
const CefPoint& inspect_element_at);
void Activate();
void Focus();
void InspectElementAt(int x, int y);
void Close();
@@ -54,7 +53,8 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
private:
CefDevToolsFrontend(CefRefPtr<CefBrowserHostImpl> frontend_browser,
content::WebContents* inspected_contents);
content::WebContents* inspected_contents,
const CefPoint& inspect_element_at);
~CefDevToolsFrontend() override;
// content::DevToolsAgentHostClient implementation.
@@ -79,6 +79,7 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
CefRefPtr<CefBrowserHostImpl> frontend_browser_;
content::WebContents* inspected_contents_;
CefPoint inspect_element_at_;
scoped_refptr<content::DevToolsAgentHost> agent_host_;
std::unique_ptr<content::DevToolsFrontendHost> frontend_host_;
using PendingRequestsMap = std::map<const net::URLFetcher*, int>;

View File

@@ -232,7 +232,8 @@ void CefBrowserPlatformDelegateNativeLinux::ViewText(const std::string& text) {
std::string openCommand("xdg-open ");
openCommand += newName;
system(openCommand.c_str());
int result = system(openCommand.c_str());
ALLOW_UNUSED_LOCAL(result);
}
void CefBrowserPlatformDelegateNativeLinux::HandleKeyboardEvent(

View File

@@ -216,12 +216,12 @@ bool CefBrowserPlatformDelegateNativeMac::CreateHostWindow() {
parentView = [newWnd contentView];
window_info_.parent_view = parentView;
}
// Make the content view for the window have a layer. This will make all
// sub-views have layers. This is necessary to ensure correct layer
// ordering of all child views and their layers.
[[[parentView window] contentView] setWantsLayer:YES];
// Make the content view for the window have a layer. This will make all
// sub-views have layers. This is necessary to ensure correct layer
// ordering of all child views and their layers.
[parentView setWantsLayer:YES];
}
host_window_created_ = true;

View File

@@ -235,8 +235,8 @@ namespace {
void RunOpenFileDialog(
const CefFileDialogRunner::FileChooserParams& params,
NSView* view,
int* filter_index,
std::vector<base::FilePath>* files) {
int filter_index,
CefFileDialogRunner::RunFileChooserCallback callback) {
NSOpenPanel* openPanel = [NSOpenPanel openPanel];
base::string16 title;
@@ -277,8 +277,8 @@ void RunOpenFileDialog(
// Add the file filter control.
filter_delegate =
[[CefFilterDelegate alloc] initWithPanel:openPanel
andAcceptFilters:params.accept_types
andFilterIndex:*filter_index];
andAcceptFilters:params.accept_types
andFilterIndex:filter_index];
}
// Further panel configuration.
@@ -294,28 +294,27 @@ void RunOpenFileDialog(
// Show panel.
[openPanel beginSheetModalForWindow:[view window]
completionHandler:^(NSInteger returnCode) {
[NSApp stopModalWithCode:returnCode];
}];
NSInteger result = [NSApp runModalForWindow:[view window]];
if (result == NSFileHandlingPanelOKButton) {
NSArray *urls = [openPanel URLs];
int i, count = [urls count];
for (i=0; i<count; i++) {
NSURL* url = [urls objectAtIndex:i];
if ([url isFileURL])
files->push_back(base::FilePath(base::SysNSStringToUTF8([url path])));
int filter_index_to_use =
(filter_delegate != nil) ? [filter_delegate filter] : filter_index;
if (returnCode == NSFileHandlingPanelOKButton) {
std::vector<base::FilePath> files;
files.reserve(openPanel.URLs.count);
for (NSURL* url in openPanel.URLs) {
if (url.isFileURL)
files.push_back(base::FilePath(url.path.UTF8String));
}
callback.Run(filter_index_to_use, files);
} else {
callback.Run(filter_index_to_use, std::vector<base::FilePath>());
}
}
if (filter_delegate != nil)
*filter_index = [filter_delegate filter];
}];
}
bool RunSaveFileDialog(
void RunSaveFileDialog(
const CefFileDialogRunner::FileChooserParams& params,
NSView* view,
int* filter_index,
base::FilePath* file) {
int filter_index,
CefFileDialogRunner::RunFileChooserCallback callback) {
NSSavePanel* savePanel = [NSSavePanel savePanel];
base::string16 title;
@@ -349,32 +348,27 @@ bool RunSaveFileDialog(
// Add the file filter control.
filter_delegate =
[[CefFilterDelegate alloc] initWithPanel:savePanel
andAcceptFilters:params.accept_types
andFilterIndex:*filter_index];
andAcceptFilters:params.accept_types
andFilterIndex:filter_index];
}
[savePanel setAllowsOtherFileTypes:YES];
[savePanel setShowsHiddenFiles:!params.hidereadonly];
bool success = false;
// Show panel.
[savePanel beginSheetModalForWindow:[view window]
[savePanel beginSheetModalForWindow:view.window
completionHandler:^(NSInteger resultCode) {
[NSApp stopModalWithCode:resultCode];
int filter_index_to_use =
(filter_delegate != nil) ? [filter_delegate filter] : filter_index;
if (resultCode == NSFileHandlingPanelOKButton) {
NSURL* url = savePanel.URL;
const char* path = url.path.UTF8String;
std::vector<base::FilePath> files(1, base::FilePath(path));
callback.Run(filter_index_to_use, files);
} else {
callback.Run(filter_index_to_use, std::vector<base::FilePath>());
}
}];
NSInteger result = [NSApp runModalForWindow:[view window]];
if (result == NSFileHandlingPanelOKButton) {
NSURL* url = [savePanel URL];
NSString* path = [url path];
*file = base::FilePath([path UTF8String]);
success = true;
}
if (filter_delegate != nil)
*filter_index = [filter_delegate filter];
return success;
}
} // namespace
@@ -385,22 +379,16 @@ CefFileDialogRunnerMac::CefFileDialogRunnerMac() {
void CefFileDialogRunnerMac::Run(CefBrowserHostImpl* browser,
const FileChooserParams& params,
RunFileChooserCallback callback) {
std::vector<base::FilePath> files;
int filter_index = params.selected_accept_filter;
NSView* owner = browser->GetWindowHandle();
if (params.mode == content::FileChooserParams::Open ||
params.mode == content::FileChooserParams::OpenMultiple ||
params.mode == content::FileChooserParams::UploadFolder) {
RunOpenFileDialog(params, owner, &filter_index, &files);
RunOpenFileDialog(params, owner, filter_index, callback);
} else if (params.mode == content::FileChooserParams::Save) {
base::FilePath file;
if (RunSaveFileDialog(params, owner, &filter_index, &file)) {
files.push_back(file);
}
RunSaveFileDialog(params, owner, filter_index, callback);
} else {
NOTIMPLEMENTED();
}
callback.Run(filter_index, files);
}

View File

@@ -18,6 +18,9 @@
#include "base/command_line.h"
#include "base/metrics/field_trial.h"
#include "base/strings/string_util.h"
#include "chrome/browser/net/safe_search_util.h"
#include "components/prefs/pref_member.h"
#include "components/prefs/pref_service.h"
#include "content/public/common/content_switches.h"
#include "net/base/net_errors.h"
#include "net/filter/filter.h"
@@ -38,10 +41,12 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
CefRefPtr<CefRequestImpl> cef_request,
GURL* new_url,
net::URLRequest* url_request,
bool force_google_safesearch,
const CallbackType& callback)
: cef_request_(cef_request),
new_url_(new_url),
url_request_(url_request),
force_google_safesearch_(force_google_safesearch),
callback_(callback) {
DCHECK(new_url);
DCHECK(url_request_);
@@ -54,11 +59,13 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
if (!callback_.is_null()) {
// The callback is still pending. Cancel it now.
if (CEF_CURRENTLY_ON_IOT()) {
RunNow(cef_request_, new_url_, url_request_, callback_, false);
RunNow(cef_request_, new_url_, url_request_, callback_,
force_google_safesearch_, false);
} else {
CEF_POST_TASK(CEF_IOT,
base::Bind(&CefBeforeResourceLoadCallbackImpl::RunNow,
cef_request_, new_url_, url_request_, callback_, false));
cef_request_, new_url_, url_request_, callback_,
force_google_safesearch_, false));
}
}
}
@@ -77,7 +84,8 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
void ContinueNow(bool allow) {
CEF_REQUIRE_IOT();
if (!callback_.is_null()) {
RunNow(cef_request_, new_url_, url_request_, callback_, allow);
RunNow(cef_request_, new_url_, url_request_, callback_,
force_google_safesearch_, allow);
Disconnect();
}
}
@@ -115,6 +123,7 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
GURL* new_url,
net::URLRequest* request,
const CallbackType& callback,
bool force_google_safesearch,
bool allow) {
CEF_REQUIRE_IOT();
@@ -139,8 +148,12 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
request->RemoveUserData(UserDataKey());
// Only execute the callback if the request has not been canceled.
if (request->status().status() != net::URLRequestStatus::CANCELED)
if (request->status().status() != net::URLRequestStatus::CANCELED) {
if (force_google_safesearch && allow && new_url->is_empty())
safe_search_util::ForceGoogleSafeSearch(request, new_url);
callback.Run(allow ? net::OK : net::ERR_ABORTED);
}
}
static inline void* UserDataKey() {
@@ -151,6 +164,7 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
const GURL old_url_;
GURL* new_url_;
net::URLRequest* url_request_;
bool force_google_safesearch_;
CallbackType callback_;
// The user data key.
@@ -224,7 +238,8 @@ class CefAuthCallbackImpl : public CefAuthCallback {
} // namespace
CefNetworkDelegate::CefNetworkDelegate() {
CefNetworkDelegate::CefNetworkDelegate()
: force_google_safesearch_(nullptr) {
}
CefNetworkDelegate::~CefNetworkDelegate() {
@@ -255,6 +270,9 @@ int CefNetworkDelegate::OnBeforeURLRequest(
net::URLRequest* request,
const net::CompletionCallback& callback,
GURL* new_url) {
const bool force_google_safesearch =
(force_google_safesearch_ && force_google_safesearch_->GetValue());
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForRequest(request);
if (browser.get()) {
@@ -279,6 +297,7 @@ int CefNetworkDelegate::OnBeforeURLRequest(
CefRefPtr<CefBeforeResourceLoadCallbackImpl> callbackImpl(
new CefBeforeResourceLoadCallbackImpl(requestPtr, new_url, request,
force_google_safesearch,
callback));
// Give the client an opportunity to evaluate the request.
@@ -298,6 +317,9 @@ int CefNetworkDelegate::OnBeforeURLRequest(
}
}
if (force_google_safesearch && new_url->is_empty())
safe_search_util::ForceGoogleSafeSearch(request, new_url);
// Continue the request immediately.
return net::OK;
}

View File

@@ -9,6 +9,9 @@
#include "base/macros.h"
#include "net/base/network_delegate_impl.h"
template<class T> class PrefMember;
typedef PrefMember<bool> BooleanPrefMember;
// Used for intercepting resource requests, redirects and responses. The single
// instance of this class is managed by CefURLRequestContextGetter.
class CefNetworkDelegate : public net::NetworkDelegateImpl {
@@ -21,6 +24,11 @@ class CefNetworkDelegate : public net::NetworkDelegateImpl {
static bool AreExperimentalCookieFeaturesEnabled();
static bool AreStrictSecureCookiesEnabled();
void set_force_google_safesearch(
BooleanPrefMember* force_google_safesearch) {
force_google_safesearch_ = force_google_safesearch;
}
private:
// net::NetworkDelegate methods.
int OnBeforeURLRequest(net::URLRequest* request,
@@ -39,6 +47,9 @@ class CefNetworkDelegate : public net::NetworkDelegateImpl {
net::Filter* SetupFilter(net::URLRequest* request,
net::Filter* filter_list) override;
// Weak, owned by our owner (CefURLRequestContextGetterImpl).
BooleanPrefMember* force_google_safesearch_;
DISALLOW_COPY_AND_ASSIGN(CefNetworkDelegate);
};

View File

@@ -366,6 +366,17 @@ void CefResourceRequestJob::SendHeaders() {
// Get header information from the handler.
handler_->GetResponseHeaders(response_, remaining_bytes_, redirectUrl);
receive_headers_end_ = base::TimeTicks::Now();
if (response_->GetError() != ERR_NONE) {
const URLRequestStatus& status =
URLRequestStatus::FromError(response_->GetError());
if (status.status() == URLRequestStatus::CANCELED ||
status.status() == URLRequestStatus::FAILED) {
NotifyStartError(status);
return;
}
}
if (!redirectUrl.empty()) {
std::string redirectUrlStr = redirectUrl;
redirect_url_ = GURL(redirectUrlStr);

View File

@@ -120,6 +120,10 @@ CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
std::swap(protocol_handlers_, *protocol_handlers);
force_google_safesearch_.Init(prefs::kForceGoogleSafeSearch, pref_service);
force_google_safesearch_.MoveToThread(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
#if defined(OS_POSIX) && !defined(OS_ANDROID)
gsapi_library_name_ = pref_service->GetString(prefs::kGSSAPILibraryName);
#endif
@@ -134,6 +138,11 @@ CefURLRequestContextGetterImpl::~CefURLRequestContextGetterImpl() {
storage_->set_proxy_service(NULL);
}
void CefURLRequestContextGetterImpl::ShutdownOnUIThread() {
CEF_REQUIRE_UIT();
force_google_safesearch_.Destroy();
}
net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
CEF_REQUIRE_IOT();
@@ -152,7 +161,10 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
SetCookieStoragePath(cache_path,
settings_.persist_session_cookies ? true : false);
storage_->set_network_delegate(base::WrapUnique(new CefNetworkDelegate));
std::unique_ptr<CefNetworkDelegate> network_delegate(
new CefNetworkDelegate());
network_delegate->set_force_google_safesearch(&force_google_safesearch_);
storage_->set_network_delegate(std::move(network_delegate));
storage_->set_channel_id_service(make_scoped_ptr(
new net::ChannelIDService(

View File

@@ -17,6 +17,7 @@
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "components/prefs/pref_member.h"
#include "content/public/browser/browser_context.h"
#include "net/url_request/url_request_job_factory.h"
@@ -52,6 +53,9 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
content::URLRequestInterceptorScopedVector request_interceptors);
~CefURLRequestContextGetterImpl() override;
// Called when the BrowserContextImpl is destroyed.
void ShutdownOnUIThread();
// net::URLRequestContextGetter implementation.
net::URLRequestContext* GetURLRequestContext() override;
scoped_refptr<base::SingleThreadTaskRunner>
@@ -102,6 +106,9 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
std::vector<CefRefPtr<CefRequestContextHandler> > handler_list_;
// Member variables which are pointed to by the various context objects.
mutable BooleanPrefMember force_google_safesearch_;
DISALLOW_COPY_AND_ASSIGN(CefURLRequestContextGetterImpl);
};

View File

@@ -24,6 +24,7 @@
#include "content/browser/compositor/gl_helper.h"
#include "content/browser/compositor/image_transport_factory.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"
#include "content/browser/renderer_host/resize_lock.h"
#include "content/common/view_messages.h"
@@ -788,8 +789,8 @@ void CefRenderWidgetHostViewOSR::SetIsLoading(bool is_loading) {
}
#if !defined(OS_MACOSX)
void CefRenderWidgetHostViewOSR::UpdateInputMethodIfNecessary(
bool text_input_state_changed) {
void CefRenderWidgetHostViewOSR::TextInputStateChanged(
const ViewHostMsg_TextInputState_Params& params) {
}
void CefRenderWidgetHostViewOSR::ImeCancelComposition() {
@@ -1017,6 +1018,19 @@ bool CefRenderWidgetHostViewOSR::DelegatedFrameHostIsVisible() const {
return !render_widget_host_->is_hidden();
}
SkColor CefRenderWidgetHostViewOSR::DelegatedFrameHostGetGutterColor(
SkColor color) const {
// When making an element on the page fullscreen the element's background
// may not match the page's, so use black as the gutter color to avoid
// flashes of brighter colors during the transition.
if (render_widget_host_->delegate() &&
render_widget_host_->delegate()->IsFullscreenForCurrentTab(
render_widget_host_)) {
return SK_ColorBLACK;
}
return color;
}
gfx::Size
CefRenderWidgetHostViewOSR::DelegatedFrameHostDesiredSizeInDIP() const {
return root_layer_->bounds().size();
@@ -1120,13 +1134,7 @@ void CefRenderWidgetHostViewOSR::Invalidate(
const gfx::Rect& bounds_in_pixels = gfx::Rect(GetPhysicalBackingSize());
if (software_output_device_) {
if (IsFramePending()) {
// Include the invalidated region in the next frame generated.
software_output_device_->Invalidate(bounds_in_pixels);
} else {
// Call OnPaint immediately.
software_output_device_->OnPaint(bounds_in_pixels);
}
software_output_device_->OnPaint(bounds_in_pixels);
} else if (copy_frame_generator_.get()) {
copy_frame_generator_->GenerateCopyFrame(true, bounds_in_pixels);
}
@@ -1362,18 +1370,6 @@ void CefRenderWidgetHostViewOSR::ResizeRootLayer() {
compositor_->SetScaleAndSize(scale_factor_, size_in_pixels);
}
bool CefRenderWidgetHostViewOSR::IsFramePending() {
if (!IsShowing())
return false;
if (begin_frame_timer_.get())
return begin_frame_timer_->IsActive();
else if (copy_frame_generator_.get())
return copy_frame_generator_->frame_pending();
return false;
}
void CefRenderWidgetHostViewOSR::OnBeginFrameTimerTick() {
const base::TimeTicks frame_time = base::TimeTicks::Now();
const base::TimeDelta vsync_period =

View File

@@ -130,7 +130,8 @@ class CefRenderWidgetHostViewOSR
content::RenderWidgetHostView* reference_host_view) override;
void UpdateCursor(const content::WebCursor& cursor) override;
void SetIsLoading(bool is_loading) override;
void UpdateInputMethodIfNecessary(bool text_input_state_changed) override;
void TextInputStateChanged(
const ViewHostMsg_TextInputState_Params& params) override;
void ImeCancelComposition() override;
void RenderProcessGone(base::TerminationStatus status,
int error_code) override;
@@ -203,8 +204,9 @@ class CefRenderWidgetHostViewOSR
// DelegatedFrameHostClient implementation.
ui::Layer* DelegatedFrameHostGetLayer() const override;
bool DelegatedFrameHostIsVisible() const override;
SkColor DelegatedFrameHostGetGutterColor(SkColor color) const override;
gfx::Size DelegatedFrameHostDesiredSizeInDIP() const override;
bool DelegatedFrameCanCreateResizeLock() const override;
bool DelegatedFrameCanCreateResizeLock() const override;
std::unique_ptr<content::ResizeLock> DelegatedFrameHostCreateResizeLock(
bool defer_compositor_lock) override;
void DelegatedFrameHostResizeLockWasReleased() override;
@@ -280,9 +282,6 @@ class CefRenderWidgetHostViewOSR
void SetDeviceScaleFactor();
void ResizeRootLayer();
// Returns a best guess whether a frame is currently pending.
bool IsFramePending();
// Called by CefBeginFrameTimer to send a BeginFrame request.
void OnBeginFrameTimerTick();
void SendBeginFrame(base::TimeTicks frame_time,

View File

@@ -50,8 +50,8 @@ bool CefRenderWidgetHostViewOSR::IsSpeaking() const {
void CefRenderWidgetHostViewOSR::StopSpeaking() {
}
void CefRenderWidgetHostViewOSR::UpdateInputMethodIfNecessary(
bool text_input_state_changed) {
void CefRenderWidgetHostViewOSR::TextInputStateChanged(
const ViewHostMsg_TextInputState_Params& params) {
[NSApp updateWindows];
}

View File

@@ -25,6 +25,7 @@
#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/update_client/update_client.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/extension_prefs.h"
#include "grit/cef_strings.h"
@@ -126,6 +127,7 @@ std::unique_ptr<PrefService> CreatePrefService(const base::FilePath& pref_path)
extensions::ExtensionPrefs::RegisterProfilePrefs(registry.get());
HostContentSettingsMap::RegisterProfilePrefs(registry.get());
renderer_prefs::RegisterProfilePrefs(registry.get());
update_client::RegisterPrefs(registry.get());
// Print preferences.
registry->RegisterBooleanPref(prefs::kPrintingEnabled, true);
@@ -159,6 +161,8 @@ std::unique_ptr<PrefService> CreatePrefService(const base::FilePath& pref_path)
registry->RegisterBooleanPref(prefs::kPluginsAlwaysAuthorize, false);
// Network preferences.
// Based on ProfileImpl::RegisterProfilePrefs.
registry->RegisterBooleanPref(prefs::kForceGoogleSafeSearch, false);
// Based on IOThread::RegisterPrefs.
#if defined(OS_POSIX) && !defined(OS_ANDROID)
registry->RegisterStringPref(prefs::kGSSAPILibraryName, std::string());

View File

@@ -126,6 +126,8 @@ void SetChromePrefs(CefBrowserContext* profile,
web.password_echo_enabled = browser_defaults::kPasswordEchoEnabled;
web.unified_textchecker_enabled = true;
web.uses_universal_detector =
prefs->GetBoolean(prefs::kWebKitUsesUniversalDetector);
web.text_areas_are_resizable =

View File

@@ -86,10 +86,12 @@ bool CefResourceDispatcherHostDelegate::HandleExternalProtocol(
bool has_user_gesture) {
if (CEF_CURRENTLY_ON_UIT()) {
content::WebContents* web_contents = web_contents_getter.Run();
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForContents(web_contents);
if (browser.get())
browser->HandleExternalProtocol(url);
if (web_contents) {
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForContents(web_contents);
if (browser.get())
browser->HandleExternalProtocol(url);
}
} else {
CEF_POST_TASK(CEF_UIT,
base::Bind(base::IgnoreResult(&CefResourceDispatcherHostDelegate::

View File

@@ -35,7 +35,8 @@ CefRefPtr<CefResponse> CefResponse::Create() {
// CefResponseImpl ------------------------------------------------------------
CefResponseImpl::CefResponseImpl()
: status_code_(0),
: error_code_(ERR_NONE),
status_code_(0),
read_only_(false) {
}
@@ -44,6 +45,17 @@ bool CefResponseImpl::IsReadOnly() {
return read_only_;
}
cef_errorcode_t CefResponseImpl::GetError() {
base::AutoLock lock_scope(lock_);
return error_code_;
}
void CefResponseImpl::SetError(cef_errorcode_t error) {
base::AutoLock lock_scope(lock_);
CHECK_READONLY_RETURN_VOID();
error_code_ = error;
}
int CefResponseImpl::GetStatus() {
base::AutoLock lock_scope(lock_);
return status_code_;

View File

@@ -26,6 +26,8 @@ class CefResponseImpl : public CefResponse {
// CefResponse methods.
bool IsReadOnly() override;
cef_errorcode_t GetError() override;
void SetError(cef_errorcode_t error) override;
int GetStatus() override;
void SetStatus(int status) override;
CefString GetStatusText() override;
@@ -45,6 +47,7 @@ class CefResponseImpl : public CefResponse {
void SetReadOnly(bool read_only);
protected:
cef_errorcode_t error_code_;
int status_code_;
CefString status_text_;
CefString mime_type_;

View File

@@ -85,7 +85,8 @@ scoped_refptr<base::SequencedTaskRunner>
break;
};
if (id >= 0 && CefContentClient::Get()->browser() &&
if (id >= 0 && CefContentClient::Get() &&
CefContentClient::Get()->browser() &&
BrowserThread::IsMessageLoopValid(static_cast<BrowserThread::ID>(id))) {
// Don't use BrowserThread::GetMessageLoopProxyForThread because it returns
// a new MessageLoopProxy object for each call and makes pointer equality

View File

@@ -35,6 +35,7 @@ endmacro()
'autogen_client_side',
],
}}
SET_LIBRARY_TARGET_PROPERTIES(libcef_dll_wrapper)
# Remove the default "lib" prefix from the resulting library.
set_target_properties(libcef_dll_wrapper PROPERTIES PREFIX "")

View File

@@ -425,19 +425,7 @@ void CEF_CALLBACK browser_host_show_dev_tools(struct _cef_browser_host_t* self,
DCHECK(self);
if (!self)
return;
// Verify param: windowInfo; type: struct_byref_const
DCHECK(windowInfo);
if (!windowInfo)
return;
// Verify param: client; type: refptr_diff
DCHECK(client);
if (!client)
return;
// Verify param: settings; type: struct_byref_const
DCHECK(settings);
if (!settings)
return;
// Unverified params: inspect_element_at
// Unverified params: windowInfo, client, settings, inspect_element_at
// Translate param: windowInfo; type: struct_byref_const
CefWindowInfo windowInfoObj;
@@ -471,6 +459,20 @@ void CEF_CALLBACK browser_host_close_dev_tools(
CefBrowserHostCppToC::Get(self)->CloseDevTools();
}
int CEF_CALLBACK browser_host_has_dev_tools(struct _cef_browser_host_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefBrowserHostCppToC::Get(self)->HasDevTools();
// Return type: bool
return _retval;
}
void CEF_CALLBACK browser_host_get_navigation_entries(
struct _cef_browser_host_t* self, cef_navigation_entry_visitor_t* visitor,
int current_only) {
@@ -962,6 +964,7 @@ CefBrowserHostCppToC::CefBrowserHostCppToC() {
GetStruct()->stop_finding = browser_host_stop_finding;
GetStruct()->show_dev_tools = browser_host_show_dev_tools;
GetStruct()->close_dev_tools = browser_host_close_dev_tools;
GetStruct()->has_dev_tools = browser_host_has_dev_tools;
GetStruct()->get_navigation_entries = browser_host_get_navigation_entries;
GetStruct()->set_mouse_cursor_change_disabled =
browser_host_set_mouse_cursor_change_disabled;

View File

@@ -58,7 +58,7 @@ CEF_EXPORT cef_request_context_t* cef_request_context_create_context(
return CefRequestContextCppToC::Wrap(_retval);
}
CEF_EXPORT cef_request_context_t* create_context_shared(
CEF_EXPORT cef_request_context_t* cef_create_context_shared(
cef_request_context_t* other,
struct _cef_request_context_handler_t* handler) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

View File

@@ -45,6 +45,33 @@ int CEF_CALLBACK response_is_read_only(struct _cef_response_t* self) {
return _retval;
}
cef_errorcode_t CEF_CALLBACK response_get_error(struct _cef_response_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return ERR_NONE;
// Execute
cef_errorcode_t _retval = CefResponseCppToC::Get(self)->GetError();
// Return type: simple
return _retval;
}
void CEF_CALLBACK response_set_error(struct _cef_response_t* self,
cef_errorcode_t error) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefResponseCppToC::Get(self)->SetError(
error);
}
int CEF_CALLBACK response_get_status(struct _cef_response_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@@ -209,6 +236,8 @@ void CEF_CALLBACK response_set_header_map(struct _cef_response_t* self,
CefResponseCppToC::CefResponseCppToC() {
GetStruct()->is_read_only = response_is_read_only;
GetStruct()->get_error = response_get_error;
GetStruct()->set_error = response_set_error;
GetStruct()->get_status = response_get_status;
GetStruct()->set_status = response_set_status;
GetStruct()->get_status_text = response_get_status_text;

View File

@@ -375,11 +375,7 @@ void CefBrowserHostCToCpp::ShowDevTools(const CefWindowInfo& windowInfo,
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: client; type: refptr_diff
DCHECK(client.get());
if (!client.get())
return;
// Unverified params: inspect_element_at
// Unverified params: windowInfo, client, settings, inspect_element_at
// Execute
_struct->show_dev_tools(_struct,
@@ -400,6 +396,20 @@ void CefBrowserHostCToCpp::CloseDevTools() {
_struct->close_dev_tools(_struct);
}
bool CefBrowserHostCToCpp::HasDevTools() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, has_dev_tools))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->has_dev_tools(_struct);
// Return type: bool
return _retval?true:false;
}
void CefBrowserHostCToCpp::GetNavigationEntries(
CefRefPtr<CefNavigationEntryVisitor> visitor, bool current_only) {
cef_browser_host_t* _struct = GetStruct();

View File

@@ -63,6 +63,7 @@ class CefBrowserHostCToCpp
CefRefPtr<CefClient> client, const CefBrowserSettings& settings,
const CefPoint& inspect_element_at) OVERRIDE;
void CloseDevTools() OVERRIDE;
bool HasDevTools() OVERRIDE;
void GetNavigationEntries(CefRefPtr<CefNavigationEntryVisitor> visitor,
bool current_only) OVERRIDE;
void SetMouseCursorChangeDisabled(bool disabled) OVERRIDE;

View File

@@ -61,7 +61,7 @@ CefRefPtr<CefRequestContext> CefRequestContext::CreateContext(
// Unverified params: handler
// Execute
cef_request_context_t* _retval = create_context_shared(
cef_request_context_t* _retval = cef_create_context_shared(
CefRequestContextCToCpp::Unwrap(other),
CefRequestContextHandlerCppToC::Wrap(handler));

View File

@@ -43,6 +43,32 @@ bool CefResponseCToCpp::IsReadOnly() {
return _retval?true:false;
}
cef_errorcode_t CefResponseCToCpp::GetError() {
cef_response_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_error))
return ERR_NONE;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_errorcode_t _retval = _struct->get_error(_struct);
// Return type: simple
return _retval;
}
void CefResponseCToCpp::SetError(cef_errorcode_t error) {
cef_response_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_error))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_error(_struct,
error);
}
int CefResponseCToCpp::GetStatus() {
cef_response_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_status))

View File

@@ -31,6 +31,8 @@ class CefResponseCToCpp
// CefResponse methods.
bool IsReadOnly() OVERRIDE;
cef_errorcode_t GetError() OVERRIDE;
void SetError(cef_errorcode_t error) OVERRIDE;
int GetStatus() OVERRIDE;
void SetStatus(int status) OVERRIDE;
CefString GetStatusText() OVERRIDE;

9
libcef_dll/libcef.lst Normal file
View File

@@ -0,0 +1,9 @@
# 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.
{
/* Only export necessary symbols from libcef.so. */
global: cef_*;
local: *;
};

View File

@@ -1,259 +0,0 @@
# Copyright (c) 2014 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.
#
# Shared macros.
#
# Append platform specific sources to a list of sources.
macro(APPEND_PLATFORM_SOURCES name_of_list)
if(OS_LINUX AND ${name_of_list}_LINUX)
list(APPEND ${name_of_list} ${${name_of_list}_LINUX})
endif()
if(OS_POSIX AND ${name_of_list}_POSIX)
list(APPEND ${name_of_list} ${${name_of_list}_POSIX})
endif()
if(OS_WINDOWS AND ${name_of_list}_WINDOWS)
list(APPEND ${name_of_list} ${${name_of_list}_WINDOWS})
endif()
if(OS_MACOSX AND ${name_of_list}_MACOSX)
list(APPEND ${name_of_list} ${${name_of_list}_MACOSX})
endif()
endmacro()
# Add a logical target that can be used to link the specified libraries into an
# executable target.
macro(ADD_LOGICAL_TARGET target debug_lib release_lib)
add_library(${target} ${CEF_LIBTYPE} IMPORTED)
set_target_properties(${target} PROPERTIES
IMPORTED_LOCATION "${release_lib}"
IMPORTED_LOCATION_DEBUG "${debug_lib}"
IMPORTED_LOCATION_RELEASE "${release_lib}"
)
endmacro()
# Determine the target output directory based on platform and generator.
macro(SET_CEF_TARGET_OUT_DIR)
if(${CMAKE_GENERATOR} STREQUAL "Ninja")
# Ninja does not create a subdirectory named after the configuration.
set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")
elseif(OS_LINUX)
set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}")
else()
set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
endif()
endmacro()
# Copy a list of files from one directory to another. Relative files paths are maintained.
macro(COPY_FILES target file_list source_dir target_dir)
foreach(FILENAME ${file_list})
set(source_file ${source_dir}/${FILENAME})
set(target_file ${target_dir}/${FILENAME})
if(IS_DIRECTORY ${source_file})
add_custom_command(
TARGET ${target}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory "${source_file}" "${target_file}"
VERBATIM
)
else()
add_custom_command(
TARGET ${target}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${source_file}" "${target_file}"
VERBATIM
)
endif()
endforeach()
endmacro()
# Rename a directory replacing the target if it already exists.
macro(RENAME_DIRECTORY target source_dir target_dir)
add_custom_command(
TARGET ${target}
POST_BUILD
# Remove the target directory if it already exists.
COMMAND ${CMAKE_COMMAND} -E remove_directory "${target_dir}"
# Rename the source directory to target directory.
COMMAND ${CMAKE_COMMAND} -E rename "${source_dir}" "${target_dir}"
VERBATIM
)
endmacro()
#
# Linux macros.
#
if(OS_LINUX)
# Use pkg-config to find Linux libraries and update compiler/linker variables.
macro(FIND_LINUX_LIBRARIES libraries)
# Read pkg-config info into variables.
execute_process(COMMAND pkg-config --cflags ${libraries} OUTPUT_VARIABLE FLL_CFLAGS)
execute_process(COMMAND pkg-config --libs-only-L --libs-only-other ${libraries} OUTPUT_VARIABLE FLL_LDFLAGS)
execute_process(COMMAND pkg-config --libs-only-l ${libraries} OUTPUT_VARIABLE FLL_LIBS)
# Strip leading and trailing whitepspace.
STRING(STRIP "${FLL_CFLAGS}" FLL_CFLAGS)
STRING(STRIP "${FLL_LDFLAGS}" FLL_LDFLAGS)
STRING(STRIP "${FLL_LIBS}" FLL_LIBS)
# Update the variables.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLL_CFLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLL_CFLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FLL_LDFLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${FLL_LDFLAGS}")
set(CEF_STANDARD_LIBS "${CEF_STANDARD_LIBS} ${FLL_LIBS}")
endmacro()
# Set SUID permissions on the specified executable.
macro(SET_LINUX_SUID_PERMISSIONS target executable)
add_custom_command(
TARGET ${target}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo ""
COMMAND ${CMAKE_COMMAND} -E echo "*** Run the following command manually to set SUID permissions ***"
COMMAND ${CMAKE_COMMAND} -E echo "EXE=\"${executable}\" && sudo -- chown root:root $EXE && sudo -- chmod 4755 $EXE"
COMMAND ${CMAKE_COMMAND} -E echo ""
VERBATIM
)
endmacro()
endif(OS_LINUX)
#
# Mac OS X macros.
#
if(OS_MACOSX)
# Set Xcode target properties.
function(SET_XCODE_TARGET_PROPERTIES target)
set_target_properties(${target} PROPERTIES
XCODE_ATTRIBUTE_ALWAYS_SEARCH_USER_PATHS NO
XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "gnu++11" # -std=gnu++11
XCODE_ATTRIBUTE_CLANG_LINK_OBJC_RUNTIME NO # -fno-objc-link-runtime
XCODE_ATTRIBUTE_CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS YES # -Wobjc-missing-property-synthesis
XCODE_ATTRIBUTE_COPY_PHASE_STRIP NO
XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING[variant=Release] YES # -Wl,-dead_strip
XCODE_ATTRIBUTE_GCC_C_LANGUAGE_STANDARD "c99" # -std=c99
XCODE_ATTRIBUTE_GCC_CW_ASM_SYNTAX NO # No -fasm-blocks
XCODE_ATTRIBUTE_GCC_DYNAMIC_NO_PIC NO
XCODE_ATTRIBUTE_GCC_ENABLE_CPP_EXCEPTIONS NO # -fno-exceptions
XCODE_ATTRIBUTE_GCC_ENABLE_CPP_RTTI NO # -fno-rtti
XCODE_ATTRIBUTE_GCC_ENABLE_PASCAL_STRINGS NO # No -mpascal-strings
XCODE_ATTRIBUTE_GCC_INLINES_ARE_PRIVATE_EXTERN YES # -fvisibility-inlines-hidden
XCODE_ATTRIBUTE_GCC_OBJC_CALL_CXX_CDTORS YES # -fobjc-call-cxx-cdtors
XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES # -fvisibility=hidden
XCODE_ATTRIBUTE_GCC_THREADSAFE_STATICS NO # -fno-threadsafe-statics
XCODE_ATTRIBUTE_GCC_TREAT_WARNINGS_AS_ERRORS YES # -Werror
XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvm.clang.1_0"
XCODE_ATTRIBUTE_GCC_WARN_ABOUT_MISSING_NEWLINE YES # -Wnewline-eof
XCODE_ATTRIBUTE_USE_HEADERMAP NO
OSX_ARCHITECTURES_DEBUG "${CMAKE_OSX_ARCHITECTURES}"
OSX_ARCHITECTURES_RELEASE "${CMAKE_OSX_ARCHITECTURES}"
)
endfunction()
# Override default add_library function.
function(add_library name)
_add_library(${name} ${ARGN})
SET_XCODE_TARGET_PROPERTIES(${name})
endfunction()
# Override default add_executable function.
function(add_executable name)
_add_executable(${name} ${ARGN})
SET_XCODE_TARGET_PROPERTIES(${name})
endfunction()
# 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
)
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
)
endmacro()
# Manually process and copy over resource files.
macro(COPY_MACOSX_RESOURCES resource_list prefix_list target source_dir app_path)
foreach(FILENAME ${resource_list})
# Remove one or more prefixes from the source paths.
set(TARGET_FILENAME "${FILENAME}")
foreach(PREFIX ${prefix_list})
string(REGEX REPLACE "^.*${PREFIX}" "" TARGET_FILENAME ${TARGET_FILENAME})
endforeach()
# Determine the absolute source and target paths.
set(TARGET_PATH "${app_path}/Contents/Resources/${TARGET_FILENAME}")
if(IS_ABSOLUTE ${FILENAME})
set(SOURCE_PATH ${FILENAME})
else()
set(SOURCE_PATH "${source_dir}/${FILENAME}")
endif()
if(${FILENAME} MATCHES ".xib$")
# Change the target file extension.
string(REGEX REPLACE ".xib$" ".nib" TARGET_PATH ${TARGET_PATH})
get_filename_component(TARGET_DIRECTORY ${TARGET_PATH} PATH)
add_custom_command(
TARGET ${target}
POST_BUILD
# Create the target directory.
COMMAND ${CMAKE_COMMAND} -E make_directory "${TARGET_DIRECTORY}"
# Compile the XIB file to a NIB.
COMMAND /usr/bin/ibtool --output-format binary1 --compile "${TARGET_PATH}" "${SOURCE_PATH}"
VERBATIM
)
elseif(NOT ${TARGET_FILENAME} STREQUAL "Info.plist")
# Copy the file as-is.
add_custom_command(
TARGET ${target}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_PATH}" "${TARGET_PATH}"
VERBATIM
)
endif()
endforeach()
endmacro()
endif(OS_MACOSX)
#
# Windows macros.
#
if(OS_WINDOWS)
# Add custom manifest files to an executable target.
macro(ADD_WINDOWS_MANIFEST manifest_path target)
add_custom_command(
TARGET ${target}
POST_BUILD
COMMAND "mt.exe" -nologo
-manifest \"${manifest_path}/${target}.exe.manifest\" \"${manifest_path}/compatibility.manifest\"
-outputresource:"${CEF_TARGET_OUT_DIR}/${target}.exe"\;\#1
COMMENT "Adding manifest..."
)
endmacro()
endif(OS_WINDOWS)

View File

@@ -255,4 +255,10 @@ patches = [
'name': 'render_view_host_impl_1392',
'path': '../content/browser/renderer_host/',
},
{
# Fix incorrect initialization of WebCursor object.
# https://bitbucket.org/chromiumembedded/cef/issues/1894
'name': 'webcursor_1894',
'path': '../content/common/cursors/',
},
]

View File

@@ -1,5 +1,5 @@
diff --git render_widget_host_view_guest.cc render_widget_host_view_guest.cc
index 41e31c0..509ebd8 100644
index e90f44b..6310c2e 100644
--- render_widget_host_view_guest.cc
+++ render_widget_host_view_guest.cc
@@ -191,6 +191,9 @@ void RenderWidgetHostViewGuest::Destroy() {

View File

@@ -1,5 +1,5 @@
diff --git browser/browser_plugin/browser_plugin_guest.cc browser/browser_plugin/browser_plugin_guest.cc
index ad4474f..d0318065 100644
index fd0c173..ad6d821 100644
--- browser/browser_plugin/browser_plugin_guest.cc
+++ browser/browser_plugin/browser_plugin_guest.cc
@@ -28,7 +28,7 @@

View File

@@ -1,8 +1,8 @@
diff --git web_contents_impl.cc web_contents_impl.cc
index 61d8bf3..0cee4d7 100644
index e41ef9f..06884f3 100644
--- web_contents_impl.cc
+++ web_contents_impl.cc
@@ -1412,32 +1412,40 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
@@ -1456,32 +1456,40 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
std::string unique_name = params.main_frame_name;
frame_tree_.root()->SetFrameName(params.main_frame_name, unique_name);
@@ -62,7 +62,7 @@ index 61d8bf3..0cee4d7 100644
CHECK(render_view_host_delegate_view_);
CHECK(view_.get());
@@ -1867,11 +1875,14 @@ void WebContentsImpl::CreateNewWindow(
@@ -1911,11 +1919,14 @@ void WebContentsImpl::CreateNewWindow(
static_cast<SessionStorageNamespaceImpl*>(session_storage_namespace);
CHECK(session_storage_namespace_impl->IsFromContext(dom_storage_context));
@@ -78,7 +78,7 @@ index 61d8bf3..0cee4d7 100644
if (route_id != MSG_ROUTING_NONE &&
!RenderViewHost::FromID(render_process_id, route_id)) {
// If the embedder didn't create a WebContents for this route, we need to
@@ -1895,6 +1906,8 @@ void WebContentsImpl::CreateNewWindow(
@@ -1939,6 +1950,8 @@ void WebContentsImpl::CreateNewWindow(
create_params.opener_render_process_id = render_process_id;
create_params.opener_render_frame_id = params.opener_render_frame_id;
create_params.opener_suppressed = params.opener_suppressed;

View File

@@ -1,8 +1,8 @@
diff --git pepper_flash.cc pepper_flash.cc
index 3b6cbd9..d4ba7ed 100644
index d7a5ac4..e6858ee 100644
--- pepper_flash.cc
+++ pepper_flash.cc
@@ -121,8 +121,15 @@ bool CheckPepperFlashManifest(const base::DictionaryValue& manifest,
@@ -126,8 +126,15 @@ bool CheckPepperFlashManifest(const base::DictionaryValue& manifest,
std::string arch;
manifest.GetStringASCII("x-ppapi-arch", &arch);

View File

@@ -39,10 +39,10 @@ index 0fab037..848a8f7 100644
// built in media player for the given |url|. Defaults to false.
virtual bool ShouldUseMediaPlayerForURL(const GURL& url);
diff --git renderer/render_frame_impl.cc renderer/render_frame_impl.cc
index af44d57..93a57ff 100644
index 3f3fe7b..dc313ae 100644
--- renderer/render_frame_impl.cc
+++ renderer/render_frame_impl.cc
@@ -4697,7 +4697,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
@@ -4703,7 +4703,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
(pending_navigation_params_ &&
!pending_navigation_params_->request_params.redirects.empty());
@@ -50,7 +50,7 @@ index af44d57..93a57ff 100644
// The handlenavigation API is deprecated and will be removed once
// crbug.com/325351 is resolved.
if (GetContentClient()->renderer()->HandleNavigation(
@@ -4706,7 +4705,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
@@ -4712,7 +4711,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
is_redirect)) {
return blink::WebNavigationPolicyIgnore;
}

View File

@@ -1,8 +1,8 @@
diff --git input_method_win.cc input_method_win.cc
index 47160e5..1de804e 100644
index df9ac66..8b5d15e 100644
--- input_method_win.cc
+++ input_method_win.cc
@@ -629,8 +629,9 @@ bool InputMethodWin::IsWindowFocused(const TextInputClient* client) const {
@@ -631,8 +631,9 @@ bool InputMethodWin::IsWindowFocused(const TextInputClient* client) const {
// receiving keyboard input as long as it is an active window. This works well
// even when the |attached_window_handle| becomes active but has not received
// WM_FOCUS yet.

View File

@@ -35,10 +35,10 @@ index 7b72351..7513ce2 100644
bool inert_visual_viewport;
bool record_whole_document;
diff --git renderer/render_view_impl.cc renderer/render_view_impl.cc
index ae2d8ec..f90fba7 100644
index 4da799e..5028984 100644
--- renderer/render_view_impl.cc
+++ renderer/render_view_impl.cc
@@ -1483,6 +1483,8 @@ void RenderViewImpl::ApplyWebPreferencesInternal(
@@ -1482,6 +1482,8 @@ void RenderViewImpl::ApplyWebPreferencesInternal(
blink::WebView* web_view,
CompositorDependencies* compositor_deps) {
ApplyWebPreferences(prefs, web_view);

View File

@@ -1,8 +1,8 @@
diff --git render_widget_host_view_mac.mm render_widget_host_view_mac.mm
index 09859f1..0c546e5 100644
index 9b3f3f6..ddd2464 100644
--- render_widget_host_view_mac.mm
+++ render_widget_host_view_mac.mm
@@ -537,9 +537,6 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget,
@@ -550,9 +550,6 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget,
// Paint this view host with |background_color_| when there is no content
// ready to draw.
background_layer_.reset([[CALayer alloc] init]);

View File

@@ -1,8 +1,8 @@
diff --git content/browser/renderer_host/render_widget_host_view_aura.cc content/browser/renderer_host/render_widget_host_view_aura.cc
index 29e1eef0..2d3408d 100644
index 8b16632..fb22089 100644
--- content/browser/renderer_host/render_widget_host_view_aura.cc
+++ content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -674,6 +674,13 @@ void RenderWidgetHostViewAura::SetKeyboardFocus() {
@@ -678,6 +678,13 @@ void RenderWidgetHostViewAura::SetKeyboardFocus() {
}
}
#endif
@@ -17,18 +17,18 @@ index 29e1eef0..2d3408d 100644
if (host_ && set_focus_on_mouse_down_or_key_event_) {
set_focus_on_mouse_down_or_key_event_ = false;
diff --git content/browser/renderer_host/render_widget_host_view_base.cc content/browser/renderer_host/render_widget_host_view_base.cc
index febe516..208bdad 100644
index d7e3d00..7d54dc3 100644
--- content/browser/renderer_host/render_widget_host_view_base.cc
+++ content/browser/renderer_host/render_widget_host_view_base.cc
@@ -47,6 +47,7 @@ RenderWidgetHostViewBase::RenderWidgetHostViewBase()
@@ -40,6 +40,7 @@ RenderWidgetHostViewBase::RenderWidgetHostViewBase()
current_device_scale_factor_(0),
current_display_rotation_(gfx::Display::ROTATE_0),
pinch_zoom_enabled_(content::IsPinchToZoomEnabled()),
+ has_external_parent_(false),
renderer_frame_number_(0),
text_input_state_(new TextInputState()),
weak_factory_(this) {}
@@ -300,6 +301,10 @@ void RenderWidgetHostViewBase::EndFrameSubscription() {
@@ -250,6 +251,10 @@ void RenderWidgetHostViewBase::EndFrameSubscription() {
NOTREACHED();
}
@@ -40,7 +40,7 @@ index febe516..208bdad 100644
return renderer_frame_number_;
}
diff --git content/browser/renderer_host/render_widget_host_view_base.h content/browser/renderer_host/render_widget_host_view_base.h
index c11775b..535caa2 100644
index c6d15c1..9d9da7b 100644
--- content/browser/renderer_host/render_widget_host_view_base.h
+++ content/browser/renderer_host/render_widget_host_view_base.h
@@ -97,6 +97,7 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
@@ -51,7 +51,7 @@ index c11775b..535caa2 100644
// This only needs to be overridden by RenderWidgetHostViewBase subclasses
// that handle content embedded within other RenderWidgetHostViews.
@@ -444,6 +445,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
@@ -422,6 +423,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
// renderer.
bool pinch_zoom_enabled_;
@@ -473,7 +473,7 @@ index ca561b6..7940b5a 100644
}
case Widget::InitParams::TYPE_CONTROL:
diff --git ui/views/win/hwnd_message_handler.cc ui/views/win/hwnd_message_handler.cc
index 74d5cd6..19d208e 100644
index 7555abd..78ebc93 100644
--- ui/views/win/hwnd_message_handler.cc
+++ ui/views/win/hwnd_message_handler.cc
@@ -838,6 +838,8 @@ void HWNDMessageHandler::SizeConstraintsChanged() {
@@ -485,7 +485,7 @@ index 74d5cd6..19d208e 100644
SetWindowLong(hwnd(), GWL_STYLE, style);
}
@@ -2433,8 +2435,12 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
@@ -2435,8 +2437,12 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
active_mouse_tracking_flags_ = 0;
} else if (event.type() == ui::ET_MOUSEWHEEL) {
// Reroute the mouse wheel to the window under the pointer if applicable.

View File

@@ -0,0 +1,20 @@
diff --git webcursor_aurawin.cc webcursor_aurawin.cc
index b8b4c57..69fe05e 100644
--- webcursor_aurawin.cc
+++ webcursor_aurawin.cc
@@ -37,6 +37,7 @@ ui::PlatformCursor WebCursor::GetPlatformCursor() {
void WebCursor::InitPlatformData() {
custom_cursor_ = NULL;
+ device_scale_factor_ = 1.0f;
}
bool WebCursor::SerializePlatformData(base::Pickle* pickle) const {
@@ -59,6 +60,7 @@ void WebCursor::CleanupPlatformData() {
}
void WebCursor::CopyPlatformData(const WebCursor& other) {
+ device_scale_factor_ = other.device_scale_factor_;
}
} // namespace content

View File

@@ -1,5 +1,5 @@
diff --git Source/web/ChromeClientImpl.cpp Source/web/ChromeClientImpl.cpp
index 821b3de..fa8898f 100644
index 8884238..7b139ba 100644
--- Source/web/ChromeClientImpl.cpp
+++ Source/web/ChromeClientImpl.cpp
@@ -879,7 +879,7 @@ bool ChromeClientImpl::hasOpenedPopup() const
@@ -12,7 +12,7 @@ index 821b3de..fa8898f 100644
DCHECK(RuntimeEnabledFeatures::pagePopupEnabled());
diff --git Source/web/WebViewImpl.cpp Source/web/WebViewImpl.cpp
index e906bb7..40965ed 100644
index 22c0a1e..4996084 100644
--- Source/web/WebViewImpl.cpp
+++ Source/web/WebViewImpl.cpp
@@ -416,6 +416,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
@@ -23,7 +23,7 @@ index e906bb7..40965ed 100644
, m_doingDragAndDrop(false)
, m_ignoreInputEvents(false)
, m_compositorDeviceScaleFactorOverride(0)
@@ -4120,9 +4121,14 @@ void WebViewImpl::pageScaleFactorChanged()
@@ -4119,9 +4120,14 @@ void WebViewImpl::pageScaleFactorChanged()
m_client->pageScaleFactorChanged();
}

View File

@@ -117,6 +117,7 @@ if(OS_LINUX)
# Executable target.
add_executable(${CEF_TARGET} ${CEFCLIENT_SRCS})
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET})
add_dependencies(${CEF_TARGET} libcef_dll_wrapper)
target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS})
@@ -170,6 +171,7 @@ if(OS_MACOSX)
# Helper executable target.
add_executable(${CEF_HELPER_TARGET} MACOSX_BUNDLE ${CEFCLIENT_HELPER_SRCS})
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_HELPER_TARGET})
add_dependencies(${CEF_HELPER_TARGET} libcef_dll_wrapper)
target_link_libraries(${CEF_HELPER_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS})
set_target_properties(${CEF_HELPER_TARGET} PROPERTIES
@@ -181,6 +183,7 @@ if(OS_MACOSX)
# Main executable target.
add_executable(${CEF_TARGET} MACOSX_BUNDLE ${CEFCLIENT_RESOURCES_SRCS} ${CEFCLIENT_SRCS})
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET})
add_dependencies(${CEF_TARGET} libcef_dll_wrapper "${CEF_HELPER_TARGET}")
target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS} "-framework OpenGL")
set_target_properties(${CEF_TARGET} PROPERTIES
@@ -232,8 +235,9 @@ if(OS_WINDOWS)
# Executable target.
add_executable(${CEF_TARGET} WIN32 ${CEFCLIENT_SRCS})
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET})
add_dependencies(${CEF_TARGET} libcef_dll_wrapper)
target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS} "glu32.lib" "opengl32.lib")
target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS} glu32.lib opengl32.lib)
if(USE_SANDBOX)
# Logical target used to link the cef_sandbox library.
@@ -242,7 +246,7 @@ if(OS_WINDOWS)
endif()
# Add the custom manifest files to the executable.
ADD_WINDOWS_MANIFEST("${CMAKE_CURRENT_SOURCE_DIR}/resources/win" "${CEF_TARGET}")
ADD_WINDOWS_MANIFEST("${CMAKE_CURRENT_SOURCE_DIR}/resources/win" "${CEF_TARGET}" "exe")
# Copy CEF binary and resource files to the target output directory.
COPY_FILES("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}")

View File

@@ -87,29 +87,6 @@
namespace {
// This method will return YES for OS X versions 10.7.3 and later, and NO
// otherwise.
// Used to prevent a crash when building with the 10.7 SDK and accessing the
// notification below. See: http://crbug.com/260595.
BOOL SupportsBackingPropertiesChangedNotification() {
// windowDidChangeBackingProperties: method has been added to the
// NSWindowDelegate protocol in 10.7.3, at the same time as the
// NSWindowDidChangeBackingPropertiesNotification notification was added.
// If the protocol contains this method description, the notification should
// be supported as well.
Protocol* windowDelegateProtocol = NSProtocolFromString(@"NSWindowDelegate");
struct objc_method_description methodDescription =
protocol_getMethodDescription(
windowDelegateProtocol,
@selector(windowDidChangeBackingProperties:),
NO,
YES);
// If the protocol does not contain the method, the returned method
// description is {NULL, NULL}
return methodDescription.name != NULL || methodDescription.types != NULL;
}
NSString* const kCEFDragDummyPboardType = @"org.CEF.drag-dummy-type";
NSString* const kNSURLTitlePboardType = @"public.url-name";
@@ -191,14 +168,10 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) {
}
- (void)dealloc {
static BOOL supportsBackingPropertiesNotification =
SupportsBackingPropertiesChangedNotification();
if (supportsBackingPropertiesNotification) {
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:NSWindowDidChangeBackingPropertiesNotification
object:nil];
}
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:NSWindowDidChangeBackingPropertiesNotification
object:nil];
[super dealloc];
}
@@ -377,7 +350,6 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) {
}
- (void)shortCircuitScrollWheelEvent:(NSEvent*)event {
// Phase is only supported in OS-X 10.7 and newer.
if ([event phase] != NSEventPhaseEnded &&
[event phase] != NSEventPhaseCancelled)
return;
@@ -391,7 +363,6 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) {
}
- (void)scrollWheel:(NSEvent*)event {
// Phase is only supported in OS-X 10.7 and newer.
// Use an NSEvent monitor to listen for the wheel-end end. This ensures that
// the event is received even when the mouse cursor is no longer over the
// view when the scrolling ends. Also it avoids sending duplicate scroll
@@ -1483,17 +1454,11 @@ void BrowserWindowOsrMac::Create(ClientWindowHandle parent_handle,
// Determine the default scale factor.
[GLView(nsview_) resetDeviceScaleFactor];
// Backing property notifications crash on 10.6 when building with the 10.7
// SDK, see http://crbug.com/260595.
static BOOL supportsBackingPropertiesNotification =
SupportsBackingPropertiesChangedNotification();
if (supportsBackingPropertiesNotification) {
[[NSNotificationCenter defaultCenter]
addObserver:nsview_
selector:@selector(windowDidChangeBackingProperties:)
name:NSWindowDidChangeBackingPropertiesNotification
object:[nsview_ window]];
}
[[NSNotificationCenter defaultCenter]
addObserver:nsview_
selector:@selector(windowDidChangeBackingProperties:)
name:NSWindowDidChangeBackingPropertiesNotification
object:[nsview_ window]];
}
} // namespace client

View File

@@ -687,14 +687,33 @@ int ClientHandler::GetBrowserCount() const {
void ClientHandler::ShowDevTools(CefRefPtr<CefBrowser> browser,
const CefPoint& inspect_element_at) {
if (!CefCurrentlyOn(TID_UI)) {
// Execute this method on the UI thread.
CefPostTask(TID_UI, base::Bind(&ClientHandler::ShowDevTools, this, browser,
inspect_element_at));
return;
}
CefWindowInfo windowInfo;
CefRefPtr<CefClient> client;
CefBrowserSettings settings;
if (CreatePopupWindow(browser, true, CefPopupFeatures(), windowInfo, client,
settings)) {
browser->GetHost()->ShowDevTools(windowInfo, client, settings,
inspect_element_at);
CefRefPtr<CefBrowserHost> host = browser->GetHost();
// Test if the DevTools browser already exists.
bool has_devtools = host->HasDevTools();
if (!has_devtools) {
// Create a new RootWindow for the DevTools browser that will be created
// by ShowDevTools().
has_devtools = CreatePopupWindow(browser, true, CefPopupFeatures(),
windowInfo, client, settings);
}
if (has_devtools) {
// Create the DevTools browser if it doesn't already exist.
// Otherwise, focus the existing DevTools browser and inspect the element
// at |inspect_element_at| if non-empty.
host->ShowDevTools(windowInfo, client, settings, inspect_element_at);
}
}

View File

@@ -468,7 +468,8 @@ void RootWindowMac::CreateRootWindow(const CefBrowserSettings& settings) {
styleMask:(NSTitledWindowMask |
NSClosableWindowMask |
NSMiniaturizableWindowMask |
NSResizableWindowMask )
NSResizableWindowMask |
NSUnifiedTitleAndToolbarWindowMask )
backing:NSBackingStoreBuffered
defer:NO];
[window_ setTitle:@"cefclient"];
@@ -494,6 +495,13 @@ void RootWindowMac::CreateRootWindow(const CefBrowserSettings& settings) {
NSView* contentView = [window_ contentView];
NSRect contentBounds = [contentView bounds];
if (!with_osr_) {
// Make the content view for the window have a layer. This will make all
// sub-views have layers. This is necessary to ensure correct layer
// ordering of all child views and their layers.
[contentView setWantsLayer:YES];
}
if (with_controls_) {
// Create the buttons.
NSRect button_rect = contentBounds;

View File

@@ -24,7 +24,7 @@
// #define CEF_USE_SANDBOX 1
#if defined(CEF_USE_SANDBOX)
// The cef_sandbox.lib static library is currently built with VS2013. It may not
// The cef_sandbox.lib static library is currently built with VS2015. It may not
// link successfully with other VS versions.
#pragma comment(lib, "cef_sandbox.lib")
#endif

View File

@@ -20,6 +20,8 @@
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSMinimumSystemVersion</key>
<string>10.9.0</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>

View File

@@ -21,7 +21,7 @@
<key>LSFileQuarantineEnabled</key>
<true/>
<key>LSMinimumSystemVersion</key>
<string>10.5.0</string>
<string>10.9.0</string>
<key>LSUIElement</key>
<string>1</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>

View File

@@ -60,6 +60,7 @@ SET_CEF_TARGET_OUT_DIR()
if(OS_LINUX)
# Executable target.
add_executable(${CEF_TARGET} ${CEFSIMPLE_SRCS})
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET})
add_dependencies(${CEF_TARGET} libcef_dll_wrapper)
target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS})
@@ -91,6 +92,7 @@ if(OS_MACOSX)
# Helper executable target.
add_executable(${CEF_HELPER_TARGET} MACOSX_BUNDLE ${CEFSIMPLE_HELPER_SRCS})
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_HELPER_TARGET})
add_dependencies(${CEF_HELPER_TARGET} libcef_dll_wrapper)
target_link_libraries(${CEF_HELPER_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS})
set_target_properties(${CEF_HELPER_TARGET} PROPERTIES
@@ -102,6 +104,7 @@ if(OS_MACOSX)
# Main executable target.
add_executable(${CEF_TARGET} MACOSX_BUNDLE ${CEFSIMPLE_RESOURCES_SRCS} ${CEFSIMPLE_SRCS})
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET})
add_dependencies(${CEF_TARGET} libcef_dll_wrapper "${CEF_HELPER_TARGET}")
target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS})
set_target_properties(${CEF_TARGET} PROPERTIES
@@ -144,6 +147,7 @@ if(OS_WINDOWS)
# Executable target.
add_executable(${CEF_TARGET} WIN32 ${CEFSIMPLE_SRCS})
add_dependencies(${CEF_TARGET} libcef_dll_wrapper)
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET})
target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS})
if(USE_SANDBOX)
@@ -153,7 +157,7 @@ if(OS_WINDOWS)
endif()
# Add the custom manifest files to the executable.
ADD_WINDOWS_MANIFEST("${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_TARGET}")
ADD_WINDOWS_MANIFEST("${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_TARGET}" "exe")
# Copy binary and resource files to the target output directory.
COPY_FILES("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}")

View File

@@ -20,6 +20,8 @@
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSMinimumSystemVersion</key>
<string>10.9.0</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>

View File

@@ -21,7 +21,7 @@
<key>LSFileQuarantineEnabled</key>
<true/>
<key>LSMinimumSystemVersion</key>
<string>10.5.0</string>
<string>10.9.0</string>
<key>LSUIElement</key>
<string>1</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>

View File

@@ -713,7 +713,12 @@ class RedirectSchemeHandler : public CefResourceHandler {
class RedirectSchemeHandlerFactory : public CefSchemeHandlerFactory {
public:
RedirectSchemeHandlerFactory() {}
RedirectSchemeHandlerFactory() {
g_got_nav1_request = false;
g_got_nav3_request = false;
g_got_nav4_request = false;
g_got_invalid_request = false;
}
CefRefPtr<CefResourceHandler> Create(
CefRefPtr<CefBrowser> browser,
@@ -829,6 +834,41 @@ class RedirectTestHandler : public TestHandler {
IMPLEMENT_REFCOUNTING(RedirectTestHandler);
};
// Like above but destroy the WebContents while the redirect is in-progress.
class RedirectDestroyTestHandler : public TestHandler {
public:
RedirectDestroyTestHandler() {}
void RunTest() override {
// Create the browser.
CreateBrowser(kRNav1);
// Time out the test after a reasonable period of time.
SetTestTimeout();
}
void OnResourceRedirect(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
CefString& new_url) override {
const std::string& old_url = request->GetURL();
if (old_url == kRNav1 && new_url == kRNav2) {
// Called due to the nav1 redirect response.
got_nav1_redirect_.yes();
new_url = "about:blank";
// Destroy the test (and the underlying WebContents) while the redirect
// is still pending.
DestroyTest();
}
}
TrackCallback got_nav1_redirect_;
IMPLEMENT_REFCOUNTING(RedirectDestroyTestHandler);
};
} // namespace
// Verify frame names and identifiers.
@@ -864,6 +904,28 @@ TEST(NavigationTest, Redirect) {
ReleaseAndWaitForDestructor(handler);
}
// Verify that destroying the WebContents while the redirect is in-progress does
// not result in a crash.
TEST(NavigationTest, RedirectDestroy) {
CefRegisterSchemeHandlerFactory("http", "tests",
new RedirectSchemeHandlerFactory());
WaitForIOThread();
CefRefPtr<RedirectDestroyTestHandler> handler =
new RedirectDestroyTestHandler();
handler->ExecuteTest();
CefClearSchemeHandlerFactories();
WaitForIOThread();
ASSERT_TRUE(handler->got_nav1_redirect_);
ASSERT_TRUE(g_got_nav1_request);
ASSERT_FALSE(g_got_nav3_request);
ASSERT_FALSE(g_got_nav4_request);
ASSERT_FALSE(g_got_invalid_request);
ReleaseAndWaitForDestructor(handler);
}
namespace {

View File

@@ -26,6 +26,8 @@ class TestResults {
url.clear();
html.clear();
status_code = 0;
response_error_code = ERR_NONE;
expected_error_code = ERR_NONE;
redirect_url.clear();
sub_url.clear();
sub_html.clear();
@@ -48,6 +50,11 @@ class TestResults {
std::string html;
int status_code;
// Error code set on the response.
cef_errorcode_t response_error_code;
// Error code expected in OnLoadError.
cef_errorcode_t expected_error_code;
// Used for testing redirects
std::string redirect_url;
@@ -165,6 +172,8 @@ class TestSchemeHandler : public TestHandler {
const CefString& errorText,
const CefString& failedUrl) override {
test_results_->got_error.yes();
// Check that the error code matches the expectation.
EXPECT_EQ(errorCode, test_results_->expected_error_code);
DestroyTest();
}
@@ -239,6 +248,10 @@ class ClientSchemeHandler : public CefResourceHandler {
callback->Continue();
}
return true;
} else if (test_results_->response_error_code != ERR_NONE) {
// Propagate the error code.
callback->Continue();
return true;
}
// Response was canceled.
@@ -268,6 +281,8 @@ class ClientSchemeHandler : public CefResourceHandler {
}
} else if (!test_results_->redirect_url.empty()) {
redirectUrl = test_results_->redirect_url;
} else if (test_results_->response_error_code != ERR_NONE) {
response->SetError(test_results_->response_error_code);
} else {
response->SetStatus(test_results_->status_code);
@@ -527,6 +542,7 @@ TEST(SchemeHandlerTest, Registration) {
g_TestResults.got_request.reset();
g_TestResults.got_read.reset();
g_TestResults.got_output.reset();
g_TestResults.expected_error_code = ERR_UNKNOWN_URL_SCHEME;
handler->ExecuteTest();
EXPECT_TRUE(g_TestResults.got_error);
@@ -540,10 +556,12 @@ TEST(SchemeHandlerTest, Registration) {
WaitForIOThread();
g_TestResults.got_error.reset();
g_TestResults.expected_error_code = ERR_NONE;
handler->ExecuteTest();
ReleaseAndWaitForDestructor(handler);
EXPECT_FALSE(g_TestResults.got_error);
EXPECT_TRUE(g_TestResults.got_request);
EXPECT_TRUE(g_TestResults.got_read);
EXPECT_TRUE(g_TestResults.got_output);
@@ -629,6 +647,25 @@ TEST(SchemeHandlerTest, CustomStandardErrorResponse) {
ClearTestSchemes();
}
// Test that a custom standard scheme can return a CEF error code in the response.
TEST(SchemeHandlerTest, CustomStandardErrorCodeResponse) {
RegisterTestScheme("customstd", "test");
g_TestResults.url = "customstd://test/run.html";
g_TestResults.response_error_code = ERR_FILE_TOO_BIG;
g_TestResults.expected_error_code = ERR_FILE_TOO_BIG;
CefRefPtr<TestSchemeHandler> handler = new TestSchemeHandler(&g_TestResults);
handler->ExecuteTest();
ReleaseAndWaitForDestructor(handler);
EXPECT_TRUE(g_TestResults.got_request);
EXPECT_FALSE(g_TestResults.got_read);
EXPECT_FALSE(g_TestResults.got_output);
EXPECT_TRUE(g_TestResults.got_error);
ClearTestSchemes();
}
// Test that a custom nonstandard scheme can return an error code.
TEST(SchemeHandlerTest, CustomNonStandardErrorResponse) {
RegisterTestScheme("customnonstd", std::string());
@@ -653,6 +690,7 @@ TEST(SchemeHandlerTest, CustomNonStandardErrorResponse) {
TEST(SchemeHandlerTest, CustomStandardNameNotHandled) {
RegisterTestScheme("customstd", "test");
g_TestResults.url = "customstd2://test/run.html";
g_TestResults.expected_error_code = ERR_UNKNOWN_URL_SCHEME;
CefRefPtr<TestSchemeHandler> handler = new TestSchemeHandler(&g_TestResults);
handler->ExecuteTest();
@@ -661,6 +699,7 @@ TEST(SchemeHandlerTest, CustomStandardNameNotHandled) {
EXPECT_FALSE(g_TestResults.got_request);
EXPECT_FALSE(g_TestResults.got_read);
EXPECT_FALSE(g_TestResults.got_output);
EXPECT_TRUE(g_TestResults.got_error);
ClearTestSchemes();
}
@@ -670,6 +709,7 @@ TEST(SchemeHandlerTest, CustomStandardNameNotHandled) {
TEST(SchemeHandlerTest, CustomNonStandardNameNotHandled) {
RegisterTestScheme("customnonstd", std::string());
g_TestResults.url = "customnonstd2:some%20value";
g_TestResults.expected_error_code = ERR_UNKNOWN_URL_SCHEME;
CefRefPtr<TestSchemeHandler> handler = new TestSchemeHandler(&g_TestResults);
handler->ExecuteTest();
@@ -678,6 +718,7 @@ TEST(SchemeHandlerTest, CustomNonStandardNameNotHandled) {
EXPECT_FALSE(g_TestResults.got_request);
EXPECT_FALSE(g_TestResults.got_read);
EXPECT_FALSE(g_TestResults.got_output);
EXPECT_TRUE(g_TestResults.got_error);
ClearTestSchemes();
}
@@ -687,6 +728,7 @@ TEST(SchemeHandlerTest, CustomNonStandardNameNotHandled) {
TEST(SchemeHandlerTest, CustomStandardDomainNotHandled) {
RegisterTestScheme("customstd", "test");
g_TestResults.url = "customstd://noexist/run.html";
g_TestResults.expected_error_code = ERR_FAILED;
CefRefPtr<TestSchemeHandler> handler = new TestSchemeHandler(&g_TestResults);
handler->ExecuteTest();
@@ -695,6 +737,7 @@ TEST(SchemeHandlerTest, CustomStandardDomainNotHandled) {
EXPECT_FALSE(g_TestResults.got_request);
EXPECT_FALSE(g_TestResults.got_read);
EXPECT_FALSE(g_TestResults.got_output);
EXPECT_TRUE(g_TestResults.got_error);
ClearTestSchemes();
}

View File

@@ -47,10 +47,13 @@ void TextfieldContentsImpl() {
// Test select range.
EXPECT_FALSE(textfield->HasSelection());
EXPECT_EQ(CefRange(cursor_pos, cursor_pos), textfield->GetSelectedRange());
textfield->SelectRange(CefRange(0, cursor_pos));
EXPECT_EQ(CefRange(static_cast<int>(cursor_pos),
static_cast<int>(cursor_pos)),
textfield->GetSelectedRange());
textfield->SelectRange(CefRange(0, static_cast<int>(cursor_pos)));
EXPECT_TRUE(textfield->HasSelection());
EXPECT_EQ(CefRange(0, cursor_pos), textfield->GetSelectedRange());
EXPECT_EQ(CefRange(0, static_cast<int>(cursor_pos)),
textfield->GetSelectedRange());
EXPECT_STREQ(kText, textfield->GetSelectedText().ToString().c_str());
EXPECT_EQ(cursor_pos, textfield->GetCursorPosition());
@@ -69,20 +72,24 @@ void TextfieldContentsImpl() {
EXPECT_TRUE(textfield->HasSelection());
cursor_pos = sizeof(kReplaceText) + sizeof(kAppendText) - 2;
EXPECT_EQ(CefRange(0, cursor_pos), textfield->GetSelectedRange());
EXPECT_EQ(CefRange(0, static_cast<int>(cursor_pos)),
textfield->GetSelectedRange());
EXPECT_EQ(cursor_pos, textfield->GetCursorPosition());
// Test clear selection.
textfield->ClearSelection();
EXPECT_FALSE(textfield->HasSelection());
EXPECT_EQ(CefRange(cursor_pos, cursor_pos), textfield->GetSelectedRange());
EXPECT_EQ(CefRange(static_cast<int>(cursor_pos),
static_cast<int>(cursor_pos)),
textfield->GetSelectedRange());
EXPECT_EQ(cursor_pos, textfield->GetCursorPosition());
// Test selection with command.
EXPECT_TRUE(textfield->IsCommandEnabled(IDS_APP_SELECT_ALL));
textfield->ExecuteCommand(IDS_APP_SELECT_ALL);
EXPECT_TRUE(textfield->HasSelection());
EXPECT_EQ(CefRange(0, cursor_pos), textfield->GetSelectedRange());
EXPECT_EQ(CefRange(0, static_cast<int>(cursor_pos)),
textfield->GetSelectedRange());
EXPECT_EQ(cursor_pos, textfield->GetCursorPosition());
textfield->ClearEditHistory();

View File

@@ -1,7 +1,7 @@
CONTENTS
--------
Release Contains a release build of the cefclient sample application.
Release Contains a release build of the sample application.
USAGE

View File

@@ -1,6 +1,13 @@
CONTENTS
--------
cmake Contains CMake configuration files shared by all targets.
include Contains all required CEF header files.
libcef_dll Contains the source code for the libcef_dll_wrapper static library
that all applications using the CEF C++ API must link against.
Release Contains libcef.so and other components required to run the release
version of CEF-based applications. By default these files should be
placed in the same directory as the executable.
@@ -12,6 +19,10 @@ Resources Contains resources required by libcef.so. By default these files
USAGE
-----
Building using CMake:
CMake can be used to generate project files in many different formats. See
usage instructions at the top of the CMakeLists.txt file.
Please visit the CEF Website for additional usage information.
https://bitbucket.org/chromiumembedded/cef/

View File

@@ -9,6 +9,8 @@ cefsimple Contains the cefsimple sample application configured to build
using the files in this distribution. This application demonstrates
the minimal functionality required to create a browser window.
cmake Contains CMake configuration files shared by all targets.
Debug Contains libcef.so and other components required to run the debug
version of CEF-based applications. By default these files should be
placed in the same directory as the executable and will be copied

View File

@@ -1,6 +1,13 @@
CONTENTS
--------
cmake Contains CMake configuration files shared by all targets.
include Contains all required CEF header files.
libcef_dll Contains the source code for the libcef_dll_wrapper static library
that all applications using the CEF C++ API must link against.
Release Contains the "Chromium Embedded Framework.framework" and other
components required to run the release version of CEF-based
applications.
@@ -9,6 +16,10 @@ Release Contains the "Chromium Embedded Framework.framework" and other
USAGE
-----
Building using CMake:
CMake can be used to generate project files in many different formats. See
usage instructions at the top of the CMakeLists.txt file.
Please visit the CEF Website for additional usage information.
https://bitbucket.org/chromiumembedded/cef/

View File

@@ -9,6 +9,8 @@ cefsimple Contains the cefsimple sample application configured to build
using the files in this distribution. This application demonstrates
the minimal functionality required to create a browser window.
cmake Contains CMake configuration files shared by all targets.
Debug Contains the "Chromium Embedded Framework.framework" and other
components required to run the debug version of CEF-based
applications.

View File

@@ -1,19 +1,29 @@
CONTENTS
--------
cmake Contains CMake configuration files shared by all targets.
include Contains all required CEF header files.
libcef_dll Contains the source code for the libcef_dll_wrapper static library
that all applications using the CEF C++ API must link against.
Release Contains libcef.dll, libcef.lib and other components required to
build and run the release version of CEF-based applications. By
default these files should be placed in the same directory as the
executable.
Resources Contains resources required by libcef.dll. By default these files
should be placed in the same directory as libcef.dll. By default
these files should be placed in the same directory as libcef.dll.
should be placed in the same directory as libcef.dll.
USAGE
-----
Building using CMake:
CMake can be used to generate project files in many different formats. See
usage instructions at the top of the CMakeLists.txt file.
Please visit the CEF Website for additional usage information.
https://bitbucket.org/chromiumembedded/cef/

View File

@@ -62,8 +62,3 @@ run but any related functionality may become broken or disabled.
* libGLESv2.dll
Without these files HTML5 accelerated content like 2D canvas, 3D CSS and WebGL
will not function.
* Windows Vista 64-bit sandbox support (32-bit distributions only)
* wow_helper.exe
Without this file the 32-bit build of CEF will not run on 64-bit Vista
machines with the sandbox enabled.

View File

@@ -9,6 +9,8 @@ cefsimple Contains the cefsimple sample application configured to build
using the files in this distribution. This application demonstrates
the minimal functionality required to create a browser window.
cmake Contains CMake configuration files shared by all targets.
Debug Contains libcef.dll, libcef.lib and other components required to
build and run the debug version of CEF-based applications. By
default these files should be placed in the same directory as the

View File

@@ -12,10 +12,12 @@ import shlex
import subprocess
import git_util as git
import sys
import tarfile
import zipfile
def create_archive(input_dir, zip_file):
def create_zip_archive(input_dir):
""" Creates a zip archive of the specified input directory. """
zip_file = input_dir + '.zip'
zf = zipfile.ZipFile(zip_file, 'w', zipfile.ZIP_DEFLATED, True)
def addDir(dir):
for f in os.listdir(dir):
@@ -28,10 +30,38 @@ def create_archive(input_dir, zip_file):
addDir(input_dir)
zf.close()
def create_7z_archive(input_dir, zip_file):
def create_tar_archive(input_dir, format):
""" Creates a tar archive of the specified input directory. """
# Supported formats include "gz" and "bz2".
tar_file = input_dir + '.tar.' + format
tf = tarfile.open(tar_file, "w:" + format)
tf.add(input_dir, arcname=os.path.basename(input_dir))
tf.close()
def create_7z_archive(input_dir, format):
""" Creates a 7z archive of the specified input directory. """
# CEF_COMMAND_7ZIP might be "c:\Program Files (x86)\7Zip\7z.exe" or /usr/bin/7za
# or simply 7z if the user knows that it's in the PATH var. Supported formats
# depend on the 7za version -- check the 7-zip documentation for details.
command = os.environ['CEF_COMMAND_7ZIP']
run('"' + command + '" a -y ' + zip_file + ' ' + input_dir, os.path.split(zip_file)[0])
working_dir = os.path.abspath(os.path.join(input_dir, os.pardir))
tar_file = None
if format in ('xz', 'gzip', 'bzip2'):
# These formats only support one file per archive. Create a tar file first.
tar_file = input_dir + '.tar'
run('"%s" a -ttar -y %s %s' % (command, tar_file, input_dir), working_dir)
zip_file = tar_file + '.' + format
zip_input = tar_file
else:
zip_file = input_dir + '.' + format
zip_input = input_dir
# Create the compressed archive.
run('"%s" a -t%s -y %s %s' % (command, format, zip_file, zip_input), working_dir)
if not tar_file is None:
remove_file(tar_file)
def create_output_dir(name, parent_dir):
""" Creates an output directory and adds the path to the archive list. """
@@ -98,12 +128,16 @@ def create_readme():
'section of this document for licensing terms and conditions.'
elif mode == 'minimal':
distrib_type = 'Minimal'
distrib_desc = 'This distribution contains only the components required to distribute an\n' \
'application using CEF on the ' + platform_str + ' platform. Please see the LICENSING\n' \
'section of this document for licensing terms and conditions.'
distrib_desc = 'This distribution contains the minimial components necessary to build and\n' \
'distribute an application using CEF on the ' + platform_str + ' platform. Please see\n' \
'the LICENSING section of this document for licensing terms and conditions.'
elif mode == 'client':
distrib_type = 'Client'
distrib_desc = 'This distribution contains a release build of the cefclient sample application\n' \
if platform == 'linux':
client_app = 'cefsimple'
else:
client_app = 'cefclient'
distrib_desc = 'This distribution contains a release build of the ' + client_app + ' sample application\n' \
'for the ' + platform_str + ' platform. Please see the LICENSING section of this document for\n' \
'licensing terms and conditions.'
@@ -137,7 +171,7 @@ def normalize_headers(file, new_path = ''):
"// Include path modified for CEF Binary Distribution.\n#include \""+new_path+"\\1\"", data)
write_file(file, data)
def transfer_files(cef_dir, script_dir, transfer_cfg, output_dir, quiet):
def eval_transfer_file(cef_dir, script_dir, transfer_cfg, output_dir, quiet):
""" Transfer files based on the specified configuration. """
if not path_exists(transfer_cfg):
return
@@ -168,9 +202,17 @@ def transfer_files(cef_dir, script_dir, transfer_cfg, output_dir, quiet):
new_path = cfg['new_header_path']
normalize_headers(dst, new_path)
def transfer_files(cef_dir, script_dir, transfer_cfg_dir, mode, output_dir, quiet):
# Non-mode-specific transfers.
transfer_cfg = os.path.join(transfer_cfg_dir, 'transfer.cfg')
eval_transfer_file(cef_dir, script_dir, transfer_cfg, output_dir, quiet)
# Mode-specific transfers.
transfer_cfg = os.path.join(transfer_cfg_dir, 'transfer_%s.cfg' % mode)
eval_transfer_file(cef_dir, script_dir, transfer_cfg, output_dir, quiet)
def combine_libs(build_dir, libs, dest_lib):
""" Combine multiple static libraries into a single static library. """
cmdline = 'msvs_env.bat python combine_libs.py -o "%s"' % dest_lib
cmdline = 'msvs_env.bat win%s python combine_libs.py -o "%s"' % (platform_arch, dest_lib)
for lib in libs:
lib_path = os.path.join(build_dir, lib)
if not path_exists(lib_path):
@@ -225,7 +267,7 @@ parser.add_option('--minimal',
help='include only release build binary files')
parser.add_option('--client',
action='store_true', dest='client', default=False,
help='include only the cefclient application')
help='include only the sample application')
parser.add_option('-q', '--quiet',
action='store_true', dest='quiet', default=False,
help='do not output detailed status information')
@@ -341,22 +383,18 @@ cef_paths = cef_paths['variables']
cef_paths2 = eval_file(os.path.join(cef_dir, 'cef_paths2.gypi'))
cef_paths2 = cef_paths2['variables']
if mode == 'standard':
if mode == 'standard' or mode == 'minimal':
# create the include directory
include_dir = os.path.join(output_dir, 'include')
make_dir(include_dir, options.quiet)
# create the cefclient directory
cefclient_dir = os.path.join(output_dir, 'cefclient')
make_dir(cefclient_dir, options.quiet)
# create the cefsimple directory
cefsimple_dir = os.path.join(output_dir, 'cefsimple')
make_dir(cefsimple_dir, options.quiet)
# create the cmake directory
cmake_dir = os.path.join(output_dir, 'cmake')
make_dir(cmake_dir, options.quiet)
# create the libcef_dll_wrapper directory
wrapper_dir = os.path.join(output_dir, 'libcef_dll')
make_dir(wrapper_dir, options.quiet)
libcef_dll_dir = os.path.join(output_dir, 'libcef_dll')
make_dir(libcef_dll_dir, options.quiet)
# transfer common include files
transfer_gypi_files(cef_dir, cef_paths2['includes_common'], \
@@ -370,6 +408,45 @@ if mode == 'standard':
transfer_gypi_files(cef_dir, cef_paths['autogen_capi_includes'], \
'include/', include_dir, options.quiet)
# transfer common libcef_dll_wrapper files
transfer_gypi_files(cef_dir, cef_paths2['libcef_dll_wrapper_sources_base'], \
'libcef_dll/', libcef_dll_dir, options.quiet)
transfer_gypi_files(cef_dir, cef_paths2['libcef_dll_wrapper_sources_common'], \
'libcef_dll/', libcef_dll_dir, options.quiet)
transfer_gypi_files(cef_dir, cef_paths['autogen_client_side'], \
'libcef_dll/', libcef_dll_dir, options.quiet)
# transfer additional files
transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib'), \
mode, output_dir, options.quiet)
# process cmake templates
variables = dict(cef_paths.items() + cef_paths2.items())
process_cmake_template(os.path.join(cef_dir, 'CMakeLists.txt.in'), \
os.path.join(output_dir, 'CMakeLists.txt'), \
variables, options.quiet)
process_cmake_template(os.path.join(cef_dir, 'cmake', 'cef_macros.cmake.in'), \
os.path.join(cmake_dir, 'cef_macros.cmake'), \
variables, options.quiet)
process_cmake_template(os.path.join(cef_dir, 'cmake', 'cef_variables.cmake.in'), \
os.path.join(cmake_dir, 'cef_variables.cmake'), \
variables, options.quiet)
process_cmake_template(os.path.join(cef_dir, 'cmake', 'FindCEF.cmake.in'), \
os.path.join(cmake_dir, 'FindCEF.cmake'), \
variables, options.quiet)
process_cmake_template(os.path.join(cef_dir, 'libcef_dll', 'CMakeLists.txt.in'), \
os.path.join(libcef_dll_dir, 'CMakeLists.txt'), \
variables, options.quiet)
if mode == 'standard':
# create the cefclient directory
cefclient_dir = os.path.join(output_dir, 'cefclient')
make_dir(cefclient_dir, options.quiet)
# create the cefsimple directory
cefsimple_dir = os.path.join(output_dir, 'cefsimple')
make_dir(cefsimple_dir, options.quiet)
# transfer common cefclient files
transfer_gypi_files(cef_dir, cef_paths2['cefclient_sources_browser'], \
'tests/cefclient/', cefclient_dir, options.quiet)
@@ -384,13 +461,13 @@ if mode == 'standard':
transfer_gypi_files(cef_dir, cef_paths2['cefsimple_sources_common'], \
'tests/cefsimple/', cefsimple_dir, options.quiet)
# transfer common libcef_dll_wrapper files
transfer_gypi_files(cef_dir, cef_paths2['libcef_dll_wrapper_sources_base'], \
'libcef_dll/', wrapper_dir, options.quiet)
transfer_gypi_files(cef_dir, cef_paths2['libcef_dll_wrapper_sources_common'], \
'libcef_dll/', wrapper_dir, options.quiet)
transfer_gypi_files(cef_dir, cef_paths['autogen_client_side'], \
'libcef_dll/', wrapper_dir, options.quiet)
# process cmake templates
process_cmake_template(os.path.join(cef_dir, 'tests', 'cefclient', 'CMakeLists.txt.in'), \
os.path.join(cefclient_dir, 'CMakeLists.txt'), \
variables, options.quiet)
process_cmake_template(os.path.join(cef_dir, 'tests', 'cefsimple', 'CMakeLists.txt.in'), \
os.path.join(cefsimple_dir, 'CMakeLists.txt'), \
variables, options.quiet)
# transfer gyp files
copy_file(os.path.join(script_dir, 'distrib/cefclient.gyp'), output_dir, options.quiet)
@@ -402,27 +479,6 @@ if mode == 'standard':
copy_file(os.path.join(cef_dir, 'cef_paths.gypi'), \
os.path.join(output_dir, 'cef_paths.gypi'), options.quiet)
# transfer additional files
transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib/transfer.cfg'), \
output_dir, options.quiet)
# process cmake templates
variables = dict(cef_paths.items() + cef_paths2.items())
process_cmake_template(os.path.join(cef_dir, 'CMakeLists.txt.in'), \
os.path.join(output_dir, 'CMakeLists.txt'), \
variables, options.quiet)
process_cmake_template(os.path.join(cef_dir, 'macros.cmake.in'), \
os.path.join(output_dir, 'macros.cmake'), \
variables, options.quiet)
process_cmake_template(os.path.join(cef_dir, 'libcef_dll', 'CMakeLists.txt.in'), \
os.path.join(output_dir, 'libcef_dll', 'CMakeLists.txt'), \
variables, options.quiet)
process_cmake_template(os.path.join(cef_dir, 'tests', 'cefclient', 'CMakeLists.txt.in'), \
os.path.join(output_dir, 'cefclient', 'CMakeLists.txt'), \
variables, options.quiet)
process_cmake_template(os.path.join(cef_dir, 'tests', 'cefsimple', 'CMakeLists.txt.in'), \
os.path.join(output_dir, 'cefsimple', 'CMakeLists.txt'), \
variables, options.quiet)
if platform == 'windows':
binaries = [
@@ -434,8 +490,6 @@ if platform == 'windows':
'snapshot_blob.bin',
'widevinecdmadapter.dll',
]
if not options.x64build:
binaries.append('wow_helper.exe')
out_dir = os.path.join(src_dir, 'out')
libcef_dll_file = 'libcef.dll.lib'
@@ -516,11 +570,16 @@ if platform == 'windows':
copy_file(os.path.join(build_dir, 'icudtl.dat'), dst_dir, options.quiet)
copy_dir(os.path.join(build_dir, 'locales'), os.path.join(dst_dir, 'locales'), options.quiet)
if mode == 'standard':
if mode == 'standard' or mode == 'minimal':
# transfer include files
transfer_gypi_files(cef_dir, cef_paths2['includes_win'], \
'include/', include_dir, options.quiet)
# transfer additional files, if any
transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib', 'win'), \
mode, output_dir, options.quiet)
if mode == 'standard':
# transfer cefclient files
transfer_gypi_files(cef_dir, cef_paths2['cefclient_sources_win'], \
'tests/cefclient/', cefclient_dir, options.quiet)
@@ -529,10 +588,6 @@ if platform == 'windows':
transfer_gypi_files(cef_dir, cef_paths2['cefsimple_sources_win'], \
'tests/cefsimple/', cefsimple_dir, options.quiet)
# transfer additional files, if any
transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib/win/transfer.cfg'), \
output_dir, options.quiet)
if not options.nodocs:
# generate doc files
os.popen('make_cppdocs.bat '+cef_rev)
@@ -583,11 +638,16 @@ elif platform == 'macosx':
dst_path = os.path.join(symbol_output_dir, '%s.dSYM' % framework_name)
run('dsymutil "%s" -o "%s"' % (src_path, dst_path), cef_dir)
if mode == 'standard':
if mode == 'standard' or mode == 'minimal':
# transfer include files
transfer_gypi_files(cef_dir, cef_paths2['includes_mac'], \
'include/', include_dir, options.quiet)
# transfer additional files, if any
transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib', 'mac'), \
mode, output_dir, options.quiet)
if mode == 'standard':
# transfer cefclient files
transfer_gypi_files(cef_dir, cef_paths2['cefclient_sources_mac'], \
'tests/cefclient/', cefclient_dir, options.quiet)
@@ -613,10 +673,6 @@ elif platform == 'macosx':
copy_dir(os.path.join(cef_dir, 'tests/cefsimple/mac/'), os.path.join(output_dir, 'cefsimple/mac/'), \
options.quiet)
# transfer additional files, if any
transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib/mac/transfer.cfg'), \
output_dir, options.quiet)
elif platform == 'linux':
out_dir = os.path.join(src_dir, 'out')
lib_dir_name = 'lib'
@@ -650,7 +706,7 @@ elif platform == 'linux':
lib_dst_dir = os.path.join(dst_dir, lib_dir_name)
make_dir(lib_dst_dir, options.quiet)
copy_file(libcef_path, lib_dst_dir, options.quiet)
copy_file(os.path.join(build_dir, 'cefclient'), dst_dir, options.quiet)
copy_file(os.path.join(build_dir, 'cefsimple'), dst_dir, options.quiet)
else:
copy_file(libcef_path, dst_dir, options.quiet)
copy_file(os.path.join(build_dir, 'chrome_sandbox'), os.path.join(dst_dir, 'chrome-sandbox'), options.quiet)
@@ -664,7 +720,6 @@ elif platform == 'linux':
build_dir = valid_build_dir
if mode == 'client':
dst_dir = os.path.join(output_dir, 'Release')
copy_dir(os.path.join(build_dir, 'files'), os.path.join(dst_dir, 'files'), options.quiet)
else:
dst_dir = os.path.join(output_dir, 'Resources')
make_dir(dst_dir, options.quiet)
@@ -676,11 +731,16 @@ elif platform == 'linux':
copy_file(os.path.join(build_dir, 'icudtl.dat'), dst_dir, options.quiet)
copy_dir(os.path.join(build_dir, 'locales'), os.path.join(dst_dir, 'locales'), options.quiet)
if mode == 'standard':
if mode == 'standard' or mode == 'minimal':
# transfer include files
transfer_gypi_files(cef_dir, cef_paths2['includes_linux'], \
'include/', include_dir, options.quiet)
# transfer additional files, if any
transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib', 'linux'), \
mode, output_dir, options.quiet)
if mode == 'standard':
# transfer cefclient files
transfer_gypi_files(cef_dir, cef_paths2['cefclient_sources_linux'], \
'tests/cefclient/', cefclient_dir, options.quiet)
@@ -691,20 +751,23 @@ elif platform == 'linux':
transfer_gypi_files(cef_dir, cef_paths2['cefsimple_sources_linux'], \
'tests/cefsimple/', cefsimple_dir, options.quiet)
# transfer additional files, if any
transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib/linux/transfer.cfg'), \
output_dir, options.quiet)
if not options.noarchive:
# create an archive for each output directory
archive_extenstion = '.zip'
archive_format = os.getenv('CEF_ARCHIVE_FORMAT', 'zip')
if archive_format not in ('zip', 'tar.gz', 'tar.bz2'):
raise Exception('Unsupported archive format: %s' % archive_format)
if os.getenv('CEF_COMMAND_7ZIP', '') != '':
archive_extenstion = '.7z'
archive_format = os.getenv('CEF_COMMAND_7ZIP_FORMAT', '7z')
for dir in archive_dirs:
zip_file = os.path.split(dir)[1] + archive_extenstion
if not options.quiet:
sys.stdout.write('Creating '+zip_file+"...\n")
if archive_extenstion == '.zip':
create_archive(dir, os.path.join(dir, os.pardir, zip_file))
sys.stdout.write("Creating %s archive for %s...\n" % (archive_format, os.path.basename(dir)))
if archive_format == 'zip':
create_zip_archive(dir)
elif archive_format == 'tar.gz':
create_tar_archive(dir, 'gz')
elif archive_format == 'tar.bz2':
create_tar_archive(dir, 'bz2')
else:
create_7z_archive(dir, os.path.join(dir, os.pardir, zip_file))
create_7z_archive(dir, archive_format)

View File

@@ -9,45 +9,55 @@
set RC=
setlocal
:: In case it's already provided via the environment.
:: Require that platform is passed as the first argument.
set ARGSOK=F
if "%1" == "win32" set ARGSOK=T
if "%1" == "win64" set ARGSOK=T
if "%ARGSOK%" == "F" (
echo ERROR: Please specify a target platform: win32 or win64
set ERRORLEVEL=1
goto end
)
:: In case vcvars is already provided via the environment.
set vcvars="%CEF_VCVARS%"
if exist %vcvars% goto found_vcvars
if %vcvars% == "none" goto found_vcvars
:: Hardcoded list of MSVS paths.
:: Alternatively we could 'reg query' this key:
:: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Setup\VS;ProductDir
set vcvars="%PROGRAMFILES(X86)%\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"
if "%1" == "win64" goto check_win64
:: Hardcoded list of MSVS paths for VS2015 32-bit builds.
set vcvars="%PROGRAMFILES(X86)%\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat"
if exist %vcvars% goto found_vcvars
set vcvars="%PROGRAMFILES(X86)%\Microsoft Visual Studio 11.0\VC\bin\vcvars32.bat"
if exist %vcvars% goto found_vcvars
set vcvars="%PROGRAMFILES(X86)%\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat"
if exist %vcvars% goto found_vcvars
set vcvars="%PROGRAMFILES%\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"
if exist %vcvars% goto found_vcvars
set vcvars="%PROGRAMFILES%\Microsoft Visual Studio 11.0\VC\bin\vcvars32.bat"
if exist %vcvars% goto found_vcvars
set vcvars="%PROGRAMFILES%\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat"
if exist %vcvars% goto found_vcvars
:: VS 2008 vcvars isn't standalone, it needs this env var.
set VS90COMNTOOLS=%PROGRAMFILES(X86)%\Microsoft Visual Studio 9.0\Common7\Tools\
set vcvars="%PROGRAMFILES(X86)%\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat"
if exist %vcvars% goto found_vcvars
set VS90COMNTOOLS=%PROGRAMFILES%\Microsoft Visual Studio 9.0\Common7\Tools\
set vcvars="%PROGRAMFILES%\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat"
set vcvars="%PROGRAMFILES%\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat"
if exist %vcvars% goto found_vcvars
set RC=1
echo Failed to find vcvars
:check_win64
:: Hardcoded list of MSVS paths for VS2015 64-bit builds.
set vcvars="%PROGRAMFILES(X86)%\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
if exist %vcvars% goto found_vcvars
set vcvars="%PROGRAMFILES%\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
if exist %vcvars% goto found_vcvars
goto notfound_vcvars
:notfound_vcvars
echo ERROR: Failed to find vcvars
set ERRORLEVEL=1
goto end
:found_vcvars
echo vcvars:
echo %vcvars%
call %vcvars%
if not %vcvars% == "none" call %vcvars%
echo PATH:
echo %PATH%
%*
:: Remove the first argument and execute the command.
for /f "tokens=1,* delims= " %%a in ("%*") do set ALL_BUT_FIRST=%%b
echo command:
echo %ALL_BUT_FIRST%
%ALL_BUT_FIRST%
:end
endlocal & set RC=%ERRORLEVEL%