Compare commits

...

50 Commits
2704 ... 2743

Author SHA1 Message Date
Marshall Greenblatt
90ba67d8ea Fix crash when scrolling to the bottom of an iframe with --root-layer-scrolls 2016-08-22 17:13:48 +03:00
Marshall Greenblatt
f5be340d57 cefclient: Allow dragging of fragments and show message when blocking URLs/files (issue #1976) 2016-08-19 14:03:09 +02:00
Marshall Greenblatt
37d988bda8 Windows: Resize offscreen compositor window to match view size (issue #1933) 2016-08-17 17:33:00 +02:00
Marshall Greenblatt
e2f626dcf8 Linux: Flush display after showing window (issue #1946) 2016-08-17 17:01:09 +02:00
Marshall Greenblatt
dad7c0a6af Check that platform_delegate_ is non-NULL 2016-08-15 12:36:31 +03:00
Marshall Greenblatt
7c94121cbb Update to Chromium version 52.0.2743.116 2016-08-05 19:51:38 +03:00
Marshall Greenblatt
61abe4a841 Windows: Add VS2015 Update 3 build support for GYP 2016-08-05 18:22:38 +03:00
Marshall Greenblatt
e29124d62f Fix Widevine CDM download (issue #1950) 2016-07-15 13:14:56 -04:00
Marshall Greenblatt
f1f4e9fbea Update to Chromium version 52.0.2743.75 2016-07-14 16:46:23 -04:00
Marshall Greenblatt
086447f605 Update component updater configurator to match chrome 2016-07-14 12:56:42 -04:00
Marshall Greenblatt
7cf8c6ff5c Move HTTP cache to a subfolder of CefSettings.cache_path (issue #1940) 2016-07-12 15:02:49 -04:00
Marshall Greenblatt
33d0fc3657 Pass transition type to CefLoadHandler::OnLoadStart (issue #1943) 2016-07-12 12:14:46 -04:00
Marshall Greenblatt
6779696971 Mac: Remove duplicate focus change notification 2016-07-11 17:13:25 -04:00
Marshall Greenblatt
558e60afba Fix crash in CefResourceDispatcherHostDelegate::HandleExternalProtocol when destroying a browser during redirect (issue #1941) 2016-07-08 15:31:54 -04:00
Marshall Greenblatt
48b9fd38ab CefBrowserHost::Invalidate should call OnPaint unconditionally (issue #1871) 2016-07-08 13:56:48 -04:00
Marshall Greenblatt
8a351d1d42 Update to Chromium version 52.0.2743.60 2016-07-05 12:56:32 -04:00
Marshall Greenblatt
da5b00c3dd Fix unreferenced variable error 2016-06-21 13:19:37 -04:00
Marshall Greenblatt
51ba965d4e Update to Chromium version 52.0.2743.41 2016-06-17 14:03:35 -04:00
Marshall Greenblatt
1fbc5c4393 Fix crash in CefTaskRunnerImpl::GetTaskRunner when CEF is not initialized (issue #1925) 2016-06-15 14:13:07 -04:00
Marshall Greenblatt
6ee1922b2c Mac: Fix file dialog behavior (issue #1919) 2016-06-15 14:12:58 -04:00
Marshall Greenblatt
1658648fe1 Improve binary distribution CMake macros (issue #1923) 2016-06-14 18:30:34 -04:00
Marshall Greenblatt
ee28b94e1e Linux: Don't add version script in Debug build (issue #1765) 2016-06-14 13:48:20 -04:00
Marshall Greenblatt
daac89badd cefclient: Don't create multiple DevTools windows (issue #1920) 2016-06-10 14:42:13 -04:00
Marshall Greenblatt
a11780730b ShowDevTools should inspect element in existing window (issue #1487) 2016-06-10 13:16:06 -04:00
Marshall Greenblatt
c90cd8da3f Mac: Fix window sharing type (issue #1884) 2016-06-09 16:35:40 -04:00
Marshall Greenblatt
c9d0a7f7a5 Linux: Don't add version script when using ASAN build (issue #1765) 2016-06-07 15:18:43 -04:00
Marshall Greenblatt
f73d23d847 Add Google SafeSearch support (issue #1917) 2016-06-07 15:09:40 -04:00
Marshall Greenblatt
976502eab1 Linux: Include cefsimple instead of cefclient in client distribution (issue #1916) 2016-06-06 18:27:37 -04:00
Marshall Greenblatt
aa727705b8 Windows: Remove wow_helper.exe which is no longer required (issue #1915) 2016-06-06 12:50:15 -04:00
Marshall Greenblatt
b1517ab47d Linux: Add version script to restrict exported symbols (issue #1765) 2016-06-06 12:34:33 -04:00
Marshall Greenblatt
b4e81659a4 Update to Chromium version 52.0.2743.24 2016-06-03 15:43:53 -04:00
Marshall Greenblatt
aca12b004c Linux: Fix warn_unused_result error (issue #1911) 2016-06-03 11:37:00 -04:00
Marshall Greenblatt
a7837aa070 Windows: Set CEF_VCVARS=none when using a custom VS install location 2016-05-28 22:04:31 -04:00
Marshall Greenblatt
4786cb735e Update to Chromium version 52.0.2743.10 2016-05-27 22:00:18 -04:00
Marshall Greenblatt
769150e178 Add cefbuilds tools. See AutomatedBuildSetup Wiki page for usage. 2016-05-27 17:55:00 -04:00
Marshall Greenblatt
ab2636b012 Update to Chromium revision 2b3ae3b8 (#394939) 2016-05-25 08:10:01 -07:00
Marshall Greenblatt
582ce074aa Add new CEF_ARCHIVE_FORMAT env var to support different built-in compression formats (issue #1067) 2016-05-18 18:14:26 -04:00
Marshall Greenblatt
0b3d93cc8f Add new CEF_COMMAND_7ZIP_FORMAT env var to support different compression formats (issue #1067) 2016-05-17 13:52:31 -04:00
Marshall Greenblatt
ca928bd3f7 Update msvs_env.bat to respect platform architecture 2016-05-17 12:50:04 -04:00
Marshall Greenblatt
80c7c1bd77 Add cmake, include and libcef_dll directories to minimal binary distribution (issue #1897) 2016-05-16 14:46:13 -04:00
Marshall Greenblatt
575c968a55 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-12 18:10:31 -04:00
Marshall Greenblatt
958618359c Add error code to CefResponse (issue #1845) 2016-05-11 15:36:15 -04:00
Marshall Greenblatt
543178ce67 Call RenderProcessHost::Send from correct thread (issue #1881) 2016-05-11 12:18:43 -04:00
Marshall Greenblatt
839e78a519 Fix incorrect initialization of WebCursor object (issue #1894) 2016-05-11 11:03:40 -04:00
Marshall Greenblatt
bff6dd684c Fix assertion when only video or audio capture is selected (issue #1802) 2016-05-09 16:17:54 -04:00
Marshall Greenblatt
157f526d07 Fix Win 64-bit conversion from 'size_t' to 'int' error (issue #1887) 2016-05-09 12:04:06 -07:00
Marshall Greenblatt
da3c6a3b61 Enable unified text checker to match Chrome spellcheck behavior (issue #1891) 2016-05-09 14:10:52 -04:00
Marshall Greenblatt
1ff26aa02a Improve support for a host owned message pump (issue #1805)
- Add new CefSettings.external_message_pump option and
  CefBrowserProcessHandler::OnScheduleMessagePumpWork() callback.
- Improve documentation related to CefDoMessageLoopWork().
- Pass `--external-message-pump` command-line flag to cefclient or
  cef_unittests to test the new mode.
2016-05-04 18:35:49 -04:00
Marshall Greenblatt
52f9aacdf5 Fix heap-use-after-free during CefCookieManagerImpl destruction (issue #1882) 2016-04-29 17:16:28 -04:00
Marshall Greenblatt
e690fa444c 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:16:28 -04:00
224 changed files with 5141 additions and 2051 deletions

View File

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

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()

50
cef.gyp
View File

@@ -149,6 +149,7 @@
# Modify the Info.plist as needed.
'postbuild_name': 'Tweak Info.plist',
'action': ['../build/mac/tweak_info_plist.py',
'--plist=${TARGET_BUILD_DIR}/${INFOPLIST_PATH}',
'--scm=1'],
},
],
@@ -317,6 +318,7 @@
# Modify the Info.plist as needed.
'postbuild_name': 'Tweak Info.plist',
'action': ['../build/mac/tweak_info_plist.py',
'--plist=${TARGET_BUILD_DIR}/${INFOPLIST_PATH}',
'--scm=1'],
},
],
@@ -365,6 +367,13 @@
'sources': [
'tests/cefclient/browser/client_app_browser.cc',
'tests/cefclient/browser/client_app_browser.h',
'tests/cefclient/browser/main_message_loop.cc',
'tests/cefclient/browser/main_message_loop.h',
'tests/cefclient/browser/main_message_loop_external_pump.cc',
'tests/cefclient/browser/main_message_loop_external_pump.h',
'tests/cefclient/browser/main_message_loop_std.cc',
'tests/cefclient/browser/main_message_loop_std.h',
'tests/cefclient/browser/resource_util.h',
'tests/cefclient/browser/resource_util.cc',
'tests/cefclient/browser/resource_util.h',
'tests/cefclient/common/client_app.cc',
@@ -468,7 +477,10 @@
'libcef',
],
'sources': [
'tests/cefclient/browser/main_message_loop_external_pump_win.cc',
'tests/cefclient/browser/resource_util_win.cc',
'tests/cefclient/browser/util_win.cc',
'tests/cefclient/browser/util_win.h',
'tests/cefclient/resources/win/cefclient.rc',
],
'msvs_settings': {
@@ -532,6 +544,7 @@
# Modify the Info.plist as needed.
'postbuild_name': 'Tweak Info.plist',
'action': ['../build/mac/tweak_info_plist.py',
'--plist=${TARGET_BUILD_DIR}/${INFOPLIST_PATH}',
'--scm=1'],
},
],
@@ -541,6 +554,7 @@
],
},
'sources': [
'tests/cefclient/browser/main_message_loop_external_pump_mac.mm',
'tests/cefclient/browser/resource_util_mac.mm',
'tests/cefclient/browser/resource_util_posix.cc',
'tests/unittests/os_rendering_unittest_mac.h',
@@ -553,6 +567,7 @@
'libcef',
],
'sources': [
'tests/cefclient/browser/main_message_loop_external_pump_linux.cc',
'tests/cefclient/browser/resource_util_linux.cc',
'tests/cefclient/browser/resource_util_posix.cc',
],
@@ -953,6 +968,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',
@@ -1002,6 +1018,7 @@
'<(DEPTH)/skia/skia.gyp:skia',
'<(DEPTH)/storage/storage_browser.gyp:storage',
'<(DEPTH)/sync/sync.gyp:sync',
'<(DEPTH)/third_party/cld_2/cld_2.gyp:cld2_platform_impl',
'<(DEPTH)/third_party/hunspell/hunspell.gyp:hunspell',
'<(DEPTH)/third_party/libxml/libxml.gyp:libxml',
'<(DEPTH)/third_party/WebKit/public/blink.gyp:blink',
@@ -1012,7 +1029,7 @@
'<(DEPTH)/ui/gl/gl.gyp:gl',
'<(DEPTH)/ui/base/ime/ui_base_ime.gyp:ui_base_ime',
'<(DEPTH)/ui/base/ui_base.gyp:ui_base',
'<(DEPTH)/v8/tools/gyp/v8.gyp:v8',
'<(DEPTH)/v8/src/v8.gyp:v8',
# Necessary to generate the grit include files.
'cef_pak',
# Necessary to generate API bindings for extensions.
@@ -1316,8 +1333,8 @@
'libcef/renderer/render_frame_observer.h',
'libcef/renderer/render_message_filter.cc',
'libcef/renderer/render_message_filter.h',
'libcef/renderer/render_process_observer.cc',
'libcef/renderer/render_process_observer.h',
'libcef/renderer/render_thread_observer.cc',
'libcef/renderer/render_thread_observer.h',
'libcef/renderer/render_urlrequest_impl.cc',
'libcef/renderer/render_urlrequest_impl.h',
'libcef/renderer/thread_util.h',
@@ -1489,6 +1506,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"', {
@@ -1570,11 +1590,6 @@
'<(DEPTH)/components/components.gyp:breakpad_host',
],
}],
['cld_version==2', {
'dependencies': [
'<(DEPTH)/third_party/cld_2/cld_2.gyp:cld2_platform_impl',
],
}],
['use_aura==1', {
'dependencies': [
'<(DEPTH)/ui/views/controls/webview/webview.gyp:webview',
@@ -1751,6 +1766,7 @@
# but this seems like a really good place to store them.
'postbuild_name': 'Tweak Info.plist',
'action': ['../build/mac/tweak_info_plist.py',
'--plist=${TARGET_BUILD_DIR}/${INFOPLIST_PATH}',
'--breakpad=1',
'--keystone=0',
'--scm=1',
@@ -1834,6 +1850,7 @@
# never placed into the helper.
'postbuild_name': 'Tweak Info.plist',
'action': ['../build/mac/tweak_info_plist.py',
'--plist=${TARGET_BUILD_DIR}/${INFOPLIST_PATH}',
'--breakpad=0',
'--keystone=0',
'--scm=0'],
@@ -1905,6 +1922,7 @@
# never placed into the helper.
'postbuild_name': 'Tweak Info.plist',
'action': ['../build/mac/tweak_info_plist.py',
'--plist=${TARGET_BUILD_DIR}/${INFOPLIST_PATH}',
'--breakpad=0',
'--keystone=0',
'--scm=0'],
@@ -1932,8 +1950,6 @@
'tests',
],
'sources': [
'tests/cefclient/browser/client_app_browser.cc',
'tests/cefclient/browser/client_app_browser.h',
'tests/cefclient/browser/resource_util.cc',
'tests/cefclient/browser/resource_util.h',
'tests/cefclient/browser/resource_util_mac.mm',
@@ -2014,6 +2030,7 @@
# never placed into the helper.
'postbuild_name': 'Tweak Info.plist',
'action': ['../build/mac/tweak_info_plist.py',
'--plist=${TARGET_BUILD_DIR}/${INFOPLIST_PATH}',
'--breakpad=0',
'--keystone=0',
'--scm=0'],
@@ -2077,6 +2094,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"

View File

@@ -167,6 +167,8 @@
'tests/cefclient/browser/main_context_impl.h',
'tests/cefclient/browser/main_message_loop.h',
'tests/cefclient/browser/main_message_loop.cc',
'tests/cefclient/browser/main_message_loop_external_pump.cc',
'tests/cefclient/browser/main_message_loop_external_pump.h',
'tests/cefclient/browser/main_message_loop_std.h',
'tests/cefclient/browser/main_message_loop_std.cc',
'tests/cefclient/browser/osr_dragdrop_events.h',
@@ -247,6 +249,7 @@
'tests/cefclient/browser/browser_window_std_win.cc',
'tests/cefclient/browser/browser_window_std_win.h',
'tests/cefclient/browser/main_context_impl_win.cc',
'tests/cefclient/browser/main_message_loop_external_pump_win.cc',
'tests/cefclient/browser/main_message_loop_multithreaded_win.cc',
'tests/cefclient/browser/main_message_loop_multithreaded_win.h',
'tests/cefclient/browser/osr_dragdrop_win.cc',
@@ -284,6 +287,7 @@
'tests/cefclient/browser/browser_window_std_mac.h',
'tests/cefclient/browser/browser_window_std_mac.mm',
'tests/cefclient/browser/main_context_impl_posix.cc',
'tests/cefclient/browser/main_message_loop_external_pump_mac.mm',
'tests/cefclient/browser/resource_util_mac.mm',
'tests/cefclient/browser/resource_util_posix.cc',
'tests/cefclient/browser/root_window_mac.h',
@@ -316,6 +320,7 @@
'tests/cefclient/browser/dialog_handler_gtk.cc',
'tests/cefclient/browser/dialog_handler_gtk.h',
'tests/cefclient/browser/main_context_impl_posix.cc',
'tests/cefclient/browser/main_message_loop_external_pump_linux.cc',
'tests/cefclient/browser/print_handler_gtk.cc',
'tests/cefclient/browser/print_handler_gtk.h',
'tests/cefclient/browser/resource_util_linux.cc',

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

@@ -50,6 +50,7 @@
#include "include/base/internal/cef_lock_impl.h"
namespace base {
namespace cef_internal {
// A convenient wrapper for an OS specific critical section. The only real
// intelligence in this class is in debug mode for the support for the
@@ -113,7 +114,7 @@ class Lock {
#endif // NDEBUG
// Platform specific underlying lock implementation.
cef_internal::LockImpl lock_;
LockImpl lock_;
DISALLOW_COPY_AND_ASSIGN(Lock);
};
@@ -160,6 +161,15 @@ class AutoUnlock {
DISALLOW_COPY_AND_ASSIGN(AutoUnlock);
};
} // namespace cef_internal
// Implement classes in the cef_internal namespace and then expose them to the
// base namespace. This avoids conflicts with the base.lib implementation when
// linking sandbox support on Windows.
using cef_internal::Lock;
using cef_internal::AutoLock;
using cef_internal::AutoUnlock;
} // namespace base
#endif // !USING_CHROMIUM_INCLUDES

View File

@@ -39,6 +39,10 @@
// Chromium uses movable types.
#define MOVE_SCOPED_PTR(var) std::move(var)
// Chromium uses std types.
#define SCOPED_PTR(type) std::unique_ptr<type>
#define DEFAULT_DELETER(type) std::default_delete<type>
#else // !USING_CHROMIUM_INCLUDES
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be
@@ -50,6 +54,10 @@
// CEF does not use movable types.
#define MOVE_SCOPED_PTR(var) var.Pass()
// CEF uses base types.
#define SCOPED_PTR(type) scoped_ptr<type>
#define DEFAULT_DELETER(type) struct base::DefaultDeleter<type>
#if !defined(arraysize)
// The arraysize(arr) macro returns the # of elements in an array arr.

View File

@@ -120,8 +120,7 @@
// client application. When using Chromium code directly always include
// the Chromium header first to avoid type conflicts.
#elif defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
#include "base/memory/scoped_ptr.h"
// Do nothing when building CEF.
#else // !USING_CHROMIUM_INCLUDES
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be

View File

@@ -144,11 +144,18 @@ CEF_EXPORT void cef_shutdown();
///
// Perform a single iteration of CEF message loop processing. This function is
// used to integrate the CEF message loop into an existing application message
// loop. Care must be taken to balance performance against excessive CPU usage.
// This function should only be called on the main application thread and only
// if cef_initialize() is called with a CefSettings.multi_threaded_message_loop
// value of false (0). This function will not block.
// provided for cases where the CEF message loop must be integrated into an
// existing application message loop. Use of this function is not recommended
// for most users; use either the cef_run_message_loop() function or
// CefSettings.multi_threaded_message_loop if possible. When using this function
// care must be taken to balance performance against excessive CPU usage. It is
// recommended to enable the CefSettings.external_message_pump option when using
// this function so that
// cef_browser_process_handler_t::on_schedule_message_pump_work() callbacks can
// facilitate the scheduling process. This function should only be called on the
// main application thread and only if cef_initialize() is called with a
// CefSettings.multi_threaded_message_loop value of false (0). This function
// will not block.
///
CEF_EXPORT void cef_do_message_loop_work();

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

@@ -94,6 +94,22 @@ typedef struct _cef_browser_process_handler_t {
///
struct _cef_print_handler_t* (CEF_CALLBACK *get_print_handler)(
struct _cef_browser_process_handler_t* self);
///
// Called from any thread when work has been scheduled for the browser process
// main (UI) thread. This callback is used in combination with CefSettings.
// external_message_pump and cef_do_message_loop_work() in cases where the CEF
// message loop must be integrated into an existing application message loop
// (see additional comments and warnings on CefDoMessageLoopWork). This
// callback should schedule a cef_do_message_loop_work() call to happen on the
// main (UI) thread. |delay_ms| is the requested delay in milliseconds. If
// |delay_ms| is <= 0 then the call should happen reasonably soon. If
// |delay_ms| is > 0 then the call should be scheduled to happen after the
// specified delay and any currently pending scheduled call should be
// cancelled.
///
void (CEF_CALLBACK *on_schedule_message_pump_work)(
struct _cef_browser_process_handler_t* self, int64 delay_ms);
} cef_browser_process_handler_t;

View File

@@ -72,14 +72,17 @@ typedef struct _cef_load_handler_t {
///
// Called when the browser begins loading a frame. The |frame| value will
// never be NULL -- call the is_main() function to check if this frame is the
// main frame. Multiple frames may be loading at the same time. Sub-frames may
// start or continue loading after the main frame load has ended. This
// function will always be called for all frames irrespective of whether the
// request completes successfully. For notification of overall browser load
// status use OnLoadingStateChange instead.
// main frame. |transition_type| provides information about the source of the
// navigation and an accurate value is only available in the browser process.
// Multiple frames may be loading at the same time. Sub-frames may start or
// continue loading after the main frame load has ended. This function will
// always be called for all frames irrespective of whether the request
// completes successfully. For notification of overall browser load status use
// OnLoadingStateChange instead.
///
void (CEF_CALLBACK *on_load_start)(struct _cef_load_handler_t* self,
struct _cef_browser_t* browser, struct _cef_frame_t* frame);
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
cef_transition_type_t transition_type);
///
// Called when the browser is done loading a frame. The |frame| value will

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

@@ -89,11 +89,17 @@ void CefShutdown();
///
// Perform a single iteration of CEF message loop processing. This function is
// used to integrate the CEF message loop into an existing application message
// loop. Care must be taken to balance performance against excessive CPU usage.
// This function should only be called on the main application thread and only
// if CefInitialize() is called with a CefSettings.multi_threaded_message_loop
// value of false. This function will not block.
// provided for cases where the CEF message loop must be integrated into an
// existing application message loop. Use of this function is not recommended
// for most users; use either the CefRunMessageLoop() function or
// CefSettings.multi_threaded_message_loop if possible. When using this function
// care must be taken to balance performance against excessive CPU usage. It is
// recommended to enable the CefSettings.external_message_pump option when using
// this function so that CefBrowserProcessHandler::OnScheduleMessagePumpWork()
// callbacks can facilitate the scheduling process. This function should only be
// called on the main application thread and only if CefInitialize() is called
// with a CefSettings.multi_threaded_message_loop value of false. This function
// will not block.
///
/*--cef()--*/
void CefDoMessageLoopWork();

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

@@ -87,6 +87,22 @@ class CefBrowserProcessHandler : public virtual CefBase {
virtual CefRefPtr<CefPrintHandler> GetPrintHandler() {
return NULL;
}
///
// Called from any thread when work has been scheduled for the browser process
// main (UI) thread. This callback is used in combination with CefSettings.
// external_message_pump and CefDoMessageLoopWork() in cases where the CEF
// message loop must be integrated into an existing application message loop
// (see additional comments and warnings on CefDoMessageLoopWork). This
// callback should schedule a CefDoMessageLoopWork() call to happen on the
// main (UI) thread. |delay_ms| is the requested delay in milliseconds. If
// |delay_ms| is <= 0 then the call should happen reasonably soon. If
// |delay_ms| is > 0 then the call should be scheduled to happen after the
// specified delay and any currently pending scheduled call should be
// cancelled.
///
/*--cef()--*/
virtual void OnScheduleMessagePumpWork(int64 delay_ms) {}
};
#endif // CEF_INCLUDE_CEF_BROWSER_PROCESS_HANDLER_H_

View File

@@ -51,6 +51,7 @@
class CefLoadHandler : public virtual CefBase {
public:
typedef cef_errorcode_t ErrorCode;
typedef cef_transition_type_t TransitionType;
///
// Called when the loading state has changed. This callback will be executed
@@ -68,15 +69,18 @@ class CefLoadHandler : public virtual CefBase {
///
// Called when the browser begins loading a frame. The |frame| value will
// never be empty -- call the IsMain() method to check if this frame is the
// main frame. Multiple frames may be loading at the same time. Sub-frames may
// start or continue loading after the main frame load has ended. This method
// will always be called for all frames irrespective of whether the request
// main frame. |transition_type| provides information about the source of the
// navigation and an accurate value is only available in the browser process.
// Multiple frames may be loading at the same time. Sub-frames may start or
// continue loading after the main frame load has ended. This method will
// always be called for all frames irrespective of whether the request
// completes successfully. For notification of overall browser load status use
// OnLoadingStateChange instead.
///
/*--cef()--*/
virtual void OnLoadStart(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame) {}
CefRefPtr<CefFrame> frame,
TransitionType transition_type) {}
///
// Called when the browser is done loading a frame. The |frame| value will

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

@@ -31,7 +31,7 @@
#define CEF_INCLUDE_CEF_SANDBOX_WIN_H_
#pragma once
#include "include/cef_base.h"
#include "include/base/cef_build.h"
#if defined(OS_WIN)

View File

@@ -180,6 +180,18 @@ typedef struct _cef_settings_t {
///
int multi_threaded_message_loop;
///
// Set to true (1) to control browser process main (UI) thread message pump
// scheduling via the CefBrowserProcessHandler::OnScheduleMessagePumpWork()
// callback. This option is recommended for use in combination with the
// CefDoMessageLoopWork() function in cases where the CEF message loop must be
// integrated into an existing application message loop (see additional
// comments and warnings on CefDoMessageLoopWork). Enabling this option is not
// recommended for most users; leave this option disabled and use either the
// CefRunMessageLoop() function or multi_threaded_message_loop if possible.
///
int external_message_pump;
///
// Set to true (1) to enable windowless (off-screen) rendering support. Do not
// enable this value if the application does not use windowless rendering as

View File

@@ -575,6 +575,7 @@ struct CefSettingsTraits {
src->browser_subprocess_path.length,
&target->browser_subprocess_path, copy);
target->multi_threaded_message_loop = src->multi_threaded_message_loop;
target->external_message_pump = src->external_message_pump;
target->windowless_rendering_enabled = src->windowless_rendering_enabled;
target->command_line_args_disabled = src->command_line_args_disabled;

View File

@@ -159,18 +159,18 @@ class CefResourceManager :
// The below methods are called on the browser process IO thread.
explicit Request(scoped_ptr<RequestState> state);
explicit Request(SCOPED_PTR(RequestState) state);
scoped_ptr<RequestState> SendRequest();
SCOPED_PTR(RequestState) SendRequest();
bool HasState();
static void ContinueOnIOThread(scoped_ptr<RequestState> state,
static void ContinueOnIOThread(SCOPED_PTR(RequestState) state,
CefRefPtr<CefResourceHandler> handler);
static void StopOnIOThread(scoped_ptr<RequestState> state);
static void StopOnIOThread(SCOPED_PTR(RequestState) state);
// Will be non-NULL while the request is pending. Only accessed on the
// browser process IO thread.
scoped_ptr<RequestState> state_;
SCOPED_PTR(RequestState) state_;
// Params that stay with this request object. Safe to access on any thread.
RequestParams params_;
@@ -343,10 +343,10 @@ class CefResourceManager :
// Methods that manage request state between requests. Called on the browser
// process IO thread.
bool SendRequest(scoped_ptr<RequestState> state);
void ContinueRequest(scoped_ptr<RequestState> state,
bool SendRequest(SCOPED_PTR(RequestState) state);
void ContinueRequest(SCOPED_PTR(RequestState) state,
CefRefPtr<CefResourceHandler> handler);
void StopRequest(scoped_ptr<RequestState> state);
void StopRequest(SCOPED_PTR(RequestState) state);
bool IncrementProvider(RequestState* state);
void DetachRequestFromProvider(RequestState* state);
void GetNextValidProvider(ProviderEntryList::iterator& iterator);
@@ -365,7 +365,7 @@ class CefResourceManager :
MimeTypeResolver mime_type_resolver_;
// Must be the last member. Created and accessed on the IO thread.
scoped_ptr<base::WeakPtrFactory<CefResourceManager> > weak_ptr_factory_;
SCOPED_PTR(base::WeakPtrFactory<CefResourceManager>) weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(CefResourceManager);
};

View File

@@ -90,7 +90,7 @@ class CefStreamResourceHandler : public CefResourceHandler {
bool read_on_file_thread_;
class Buffer;
scoped_ptr<Buffer> buffer_;
SCOPED_PTR(Buffer) buffer_;
#ifndef NDEBUG
// Used in debug builds to verify that |buffer_| isn't being accessed on
// multiple threads at the same time.

View File

@@ -102,6 +102,22 @@ content::ResourceContext* CefBrowserContext::GetResourceContext() {
return resource_context_.get();
}
net::URLRequestContextGetter* CefBrowserContext::GetRequestContext() {
CEF_REQUIRE_UIT();
return GetDefaultStoragePartition(this)->GetURLRequestContext();
}
net::URLRequestContextGetter* CefBrowserContext::CreateMediaRequestContext() {
return GetRequestContext();
}
net::URLRequestContextGetter*
CefBrowserContext::CreateMediaRequestContextForStoragePartition(
const base::FilePath& partition_path,
bool in_memory) {
return nullptr;
}
ChromeZoomLevelPrefs* CefBrowserContext::GetZoomLevelPrefs() {
return static_cast<ChromeZoomLevelPrefs*>(
GetStoragePartition(this, NULL)->GetZoomLevelDelegate());

View File

@@ -127,6 +127,11 @@ class CefBrowserContext
// BrowserContext methods.
content::ResourceContext* GetResourceContext() override;
net::URLRequestContextGetter* GetRequestContext() override;
net::URLRequestContextGetter* CreateMediaRequestContext() override;
net::URLRequestContextGetter* CreateMediaRequestContextForStoragePartition(
const base::FilePath& partition_path,
bool in_memory) override;
// Profile methods.
ChromeZoomLevelPrefs* GetZoomLevelPrefs() override;

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_);
@@ -339,7 +341,7 @@ std::unique_ptr<content::ZoomLevelDelegate>
if (cache_path_.empty())
return std::unique_ptr<content::ZoomLevelDelegate>();
return make_scoped_ptr(new ChromeZoomLevelPrefs(
return base::WrapUnique(new ChromeZoomLevelPrefs(
GetPrefs(), cache_path_, partition_path,
ui_zoom::ZoomEventManager::GetForBrowserContext(this)->GetWeakPtr()));
}
@@ -357,29 +359,6 @@ content::DownloadManagerDelegate*
return download_manager_delegate_.get();
}
net::URLRequestContextGetter* CefBrowserContextImpl::GetRequestContext() {
CEF_REQUIRE_UIT();
return GetDefaultStoragePartition(this)->GetURLRequestContext();
}
net::URLRequestContextGetter*
CefBrowserContextImpl::GetMediaRequestContext() {
return GetRequestContext();
}
net::URLRequestContextGetter*
CefBrowserContextImpl::GetMediaRequestContextForRenderProcess(
int renderer_child_id) {
return GetRequestContext();
}
net::URLRequestContextGetter*
CefBrowserContextImpl::GetMediaRequestContextForStoragePartition(
const base::FilePath& partition_path,
bool in_memory) {
return GetRequestContext();
}
content::BrowserPluginGuestManager* CefBrowserContextImpl::GetGuestManager() {
DCHECK(extensions::ExtensionsEnabled());
return guest_view::GuestViewManager::FromBrowserContext(this);

View File

@@ -59,14 +59,6 @@ class CefBrowserContextImpl : public CefBrowserContext,
const base::FilePath& partition_path) override;
bool IsOffTheRecord() const override;
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
net::URLRequestContextGetter* GetRequestContext() override;
net::URLRequestContextGetter* GetMediaRequestContext() override;
net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess(
int renderer_child_id) override;
net::URLRequestContextGetter*
GetMediaRequestContextForStoragePartition(
const base::FilePath& partition_path,
bool in_memory) override;
content::BrowserPluginGuestManager* GetGuestManager() override;
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
content::PushMessagingService* GetPushMessagingService() override;

View File

@@ -101,29 +101,6 @@ content::DownloadManagerDelegate*
return download_manager_delegate_.get();
}
net::URLRequestContextGetter* CefBrowserContextProxy::GetRequestContext() {
CEF_REQUIRE_UIT();
return GetDefaultStoragePartition(this)->GetURLRequestContext();
}
net::URLRequestContextGetter*
CefBrowserContextProxy::GetMediaRequestContext() {
return GetRequestContext();
}
net::URLRequestContextGetter*
CefBrowserContextProxy::GetMediaRequestContextForRenderProcess(
int renderer_child_id) {
return GetRequestContext();
}
net::URLRequestContextGetter*
CefBrowserContextProxy::GetMediaRequestContextForStoragePartition(
const base::FilePath& partition_path,
bool in_memory) {
return GetRequestContext();
}
content::BrowserPluginGuestManager* CefBrowserContextProxy::GetGuestManager() {
return parent_->GetGuestManager();
}

View File

@@ -34,14 +34,6 @@ class CefBrowserContextProxy : public CefBrowserContext {
const base::FilePath& partition_path) override;
bool IsOffTheRecord() const override;
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
net::URLRequestContextGetter* GetRequestContext() override;
net::URLRequestContextGetter* GetMediaRequestContext() override;
net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess(
int renderer_child_id) override;
net::URLRequestContextGetter*
GetMediaRequestContextForStoragePartition(
const base::FilePath& partition_path,
bool in_memory) override;
content::BrowserPluginGuestManager* GetGuestManager() override;
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
content::PushMessagingService* GetPushMessagingService() override;

View File

@@ -556,7 +556,7 @@ void CefBrowserHostImpl::CloseBrowser(bool force_close) {
if (contents && contents->NeedToFireBeforeUnload()) {
// Will result in a call to BeforeUnloadFired() and, if the close isn't
// canceled, CloseContents().
contents->DispatchBeforeUnload(false);
contents->DispatchBeforeUnload();
} else {
CloseContents(contents);
}
@@ -596,7 +596,7 @@ void CefBrowserHostImpl::SetFocus(bool focus) {
if (focus)
OnSetFocus(FOCUS_SOURCE_SYSTEM);
else
else if (platform_delegate_)
platform_delegate_->SendFocusEvent(false);
}
@@ -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) {
@@ -926,7 +939,7 @@ void CefBrowserHostImpl::WasResized() {
return;
}
if (!web_contents())
if (!web_contents() || !platform_delegate_)
return;
platform_delegate_->WasResized();
@@ -944,7 +957,7 @@ void CefBrowserHostImpl::WasHidden(bool hidden) {
return;
}
if (!web_contents())
if (!web_contents() || !platform_delegate_)
return;
platform_delegate_->WasHidden(hidden);
@@ -962,7 +975,7 @@ void CefBrowserHostImpl::NotifyScreenInfoChanged() {
return;
}
if (!web_contents())
if (!web_contents() || !platform_delegate_)
return;
platform_delegate_->NotifyScreenInfoChanged();
@@ -980,7 +993,7 @@ void CefBrowserHostImpl::Invalidate(PaintElementType type) {
return;
}
if (!web_contents())
if (!web_contents() || !platform_delegate_)
return;
platform_delegate_->Invalidate(type);
@@ -993,7 +1006,7 @@ void CefBrowserHostImpl::SendKeyEvent(const CefKeyEvent& event) {
return;
}
if (!web_contents())
if (!web_contents() || !platform_delegate_)
return;
content::NativeWebKeyboardEvent web_event;
@@ -1010,7 +1023,7 @@ void CefBrowserHostImpl::SendMouseClickEvent(const CefMouseEvent& event,
return;
}
if (!web_contents())
if (!web_contents() || !platform_delegate_)
return;
blink::WebMouseEvent web_event;
@@ -1028,7 +1041,7 @@ void CefBrowserHostImpl::SendMouseMoveEvent(const CefMouseEvent& event,
return;
}
if (!web_contents())
if (!web_contents() || !platform_delegate_)
return;
blink::WebMouseEvent web_event;
@@ -1045,7 +1058,7 @@ void CefBrowserHostImpl::SendMouseWheelEvent(const CefMouseEvent& event,
return;
}
if (!web_contents())
if (!web_contents() || !platform_delegate_)
return;
blink::WebMouseWheelEvent web_event;
@@ -1064,7 +1077,7 @@ void CefBrowserHostImpl::SendCaptureLostEvent() {
return;
}
if (!web_contents())
if (!web_contents() || !platform_delegate_)
return;
platform_delegate_->SendCaptureLostEvent();
@@ -1078,7 +1091,7 @@ void CefBrowserHostImpl::NotifyMoveOrResizeStarted() {
return;
}
if (!web_contents())
if (!web_contents() || !platform_delegate_)
return;
platform_delegate_->NotifyMoveOrResizeStarted();
@@ -1104,7 +1117,9 @@ void CefBrowserHostImpl::SetWindowlessFrameRate(int frame_rate) {
}
settings_.windowless_frame_rate = frame_rate;
platform_delegate_->SetWindowlessFrameRate(frame_rate);
if (platform_delegate_)
platform_delegate_->SetWindowlessFrameRate(frame_rate);
}
// CefBrowser methods.
@@ -1407,12 +1422,14 @@ void CefBrowserHostImpl::DestroyBrowser() {
#if defined(USE_AURA)
views::Widget* CefBrowserHostImpl::GetWindowWidget() const {
CEF_REQUIRE_UIT();
if (!platform_delegate_)
return nullptr;
return platform_delegate_->GetWindowWidget();
}
CefRefPtr<CefBrowserView> CefBrowserHostImpl::GetBrowserView() const {
CEF_REQUIRE_UIT();
if (IsViewsHosted())
if (IsViewsHosted() && platform_delegate_)
return platform_delegate_->GetBrowserView();
return nullptr;
}
@@ -1651,7 +1668,8 @@ void CefBrowserHostImpl::ViewText(const std::string& text) {
return;
}
platform_delegate_->ViewText(text);
if (platform_delegate_)
platform_delegate_->ViewText(text);
}
void CefBrowserHostImpl::HandleExternalProtocol(const GURL& url) {
@@ -1664,7 +1682,7 @@ void CefBrowserHostImpl::HandleExternalProtocol(const GURL& url) {
handler->OnProtocolExecution(this, url.spec(), allow_os_execution);
}
if (allow_os_execution)
if (allow_os_execution && platform_delegate_)
platform_delegate_->HandleExternalProtocol(url);
} else {
CEF_POST_TASK(CEF_UIT,
@@ -1694,7 +1712,8 @@ void CefBrowserHostImpl::OnSetFocus(cef_focus_source_t source) {
}
}
platform_delegate_->SendFocusEvent(true);
if (platform_delegate_)
platform_delegate_->SendFocusEvent(true);
} else {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::OnSetFocus, this, source));
@@ -1766,7 +1785,7 @@ CefTextInputContext CefBrowserHostImpl::GetNSTextInputContext() {
return nullptr;
}
if (!web_contents())
if (!web_contents() || !platform_delegate_)
return nullptr;
return platform_delegate_->GetNSTextInputContext();
@@ -1788,7 +1807,7 @@ void CefBrowserHostImpl::HandleKeyEventBeforeTextInputClient(
return;
}
if (!web_contents())
if (!web_contents() || !platform_delegate_)
return;
platform_delegate_->HandleKeyEventBeforeTextInputClient(keyEvent);
@@ -1808,7 +1827,7 @@ void CefBrowserHostImpl::HandleKeyEventAfterTextInputClient(
return;
}
if (!web_contents())
if (!web_contents() || !platform_delegate_)
return;
return platform_delegate_->HandleKeyEventAfterTextInputClient(keyEvent);
@@ -1835,7 +1854,7 @@ void CefBrowserHostImpl::DragTargetDragEnter(CefRefPtr<CefDragData> drag_data,
return;
}
if (!web_contents())
if (!web_contents() || !platform_delegate_)
return;
platform_delegate_->DragTargetDragEnter(drag_data, event, allowed_ops);
@@ -1855,7 +1874,7 @@ void CefBrowserHostImpl::DragTargetDragOver(const CefMouseEvent& event,
return;
}
if (!web_contents())
if (!web_contents() || !platform_delegate_)
return;
platform_delegate_->DragTargetDragOver(event, allowed_ops);
@@ -1873,7 +1892,7 @@ void CefBrowserHostImpl::DragTargetDragLeave() {
return;
}
if (!web_contents())
if (!web_contents() || !platform_delegate_)
return;
platform_delegate_->DragTargetDragLeave();
@@ -1891,7 +1910,7 @@ void CefBrowserHostImpl::DragTargetDrop(const CefMouseEvent& event) {
return;
}
if (!web_contents())
if (!web_contents() || !platform_delegate_)
return;
platform_delegate_->DragTargetDrop(event);
@@ -1909,6 +1928,9 @@ void CefBrowserHostImpl::DragSourceSystemDragEnded() {
return;
}
if (!web_contents() || !platform_delegate_)
return;
platform_delegate_->DragSourceSystemDragEnded();
}
@@ -1925,7 +1947,7 @@ void CefBrowserHostImpl::DragSourceEndedAt(
return;
}
if (!web_contents())
if (!web_contents() || !platform_delegate_)
return;
platform_delegate_->DragSourceEndedAt(x, y, op);
@@ -2095,6 +2117,9 @@ bool CefBrowserHostImpl::PreHandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event,
bool* is_keyboard_shortcut) {
if (!platform_delegate_)
return false;
if (client_.get()) {
CefRefPtr<CefKeyboardHandler> handler = client_->GetKeyboardHandler();
if (handler.get()) {
@@ -2120,6 +2145,9 @@ void CefBrowserHostImpl::HandleKeyboardEvent(
if (event.skip_in_browser)
return;
if (!platform_delegate_)
return;
if (client_.get()) {
CefRefPtr<CefKeyboardHandler> handler = client_->GetKeyboardHandler();
if (handler.get()) {
@@ -2221,7 +2249,7 @@ void CefBrowserHostImpl::DidNavigateMainFramePostCommit(
content::JavaScriptDialogManager*
CefBrowserHostImpl::GetJavaScriptDialogManager(
content::WebContents* source) {
if (!javascript_dialog_manager_.get()) {
if (!javascript_dialog_manager_.get() && platform_delegate_) {
javascript_dialog_manager_.reset(
new CefJavaScriptDialogManager(this,
platform_delegate_->CreateJavaScriptDialogRunner()));
@@ -2240,7 +2268,7 @@ bool CefBrowserHostImpl::HandleContextMenu(
content::WebContents* web_contents,
const content::ContextMenuParams& params) {
CEF_REQUIRE_UIT();
if (!menu_manager_.get()) {
if (!menu_manager_.get() && platform_delegate_) {
menu_manager_.reset(
new CefMenuManager(this,
platform_delegate_->CreateMenuRunner()));
@@ -2252,7 +2280,8 @@ void CefBrowserHostImpl::UpdatePreferredSize(content::WebContents* source,
const gfx::Size& pref_size) {
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX))
CEF_REQUIRE_UIT();
platform_delegate_->SizeTo(pref_size.width(), pref_size.height());
if (platform_delegate_)
platform_delegate_->SizeTo(pref_size.width(), pref_size.height());
#endif
}
@@ -2286,17 +2315,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;
}
}
@@ -2915,7 +2947,7 @@ void CefBrowserHostImpl::SetFocusedFrame(int64 frame_id) {
gfx::Point CefBrowserHostImpl::GetScreenPoint(const gfx::Point& view) const {
CEF_REQUIRE_UIT();
if (platform_delegate_.get())
if (platform_delegate_)
return platform_delegate_->GetScreenPoint(view);
return gfx::Point();
}
@@ -2938,7 +2970,8 @@ void CefBrowserHostImpl::OnLoadStart(CefRefPtr<CefFrame> frame,
CefRefPtr<CefLoadHandler> handler = client_->GetLoadHandler();
if (handler.get()) {
// Notify the handler that loading has started.
handler->OnLoadStart(this, frame);
handler->OnLoadStart(this, frame,
static_cast<cef_transition_type_t>(transition_type));
}
}
}
@@ -3000,7 +3033,7 @@ void CefBrowserHostImpl::OnDevToolsWebContentsDestroyed() {
void CefBrowserHostImpl::EnsureFileDialogManager() {
CEF_REQUIRE_UIT();
if (!file_dialog_manager_.get()) {
if (!file_dialog_manager_.get() && platform_delegate_) {
file_dialog_manager_.reset(
new CefFileDialogManager(this,
platform_delegate_->CreateFileDialogRunner()));

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));
}
@@ -485,7 +488,7 @@ std::unique_ptr<CefBrowserInfoManager::PendingPopup>
popup->opener_view_id == opener_view_id &&
popup->target_url == target_url) {
pending_popup_list_.weak_erase(it);
return make_scoped_ptr(popup);
return base::WrapUnique(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

@@ -39,7 +39,7 @@
#if defined(USE_AURA)
#include "ui/aura/env.h"
#include "ui/gfx/screen.h"
#include "ui/display/screen.h"
#include "ui/views/test/desktop_test_views_delegate.h"
#include "ui/views/widget/desktop_aura/desktop_screen.h"
@@ -120,7 +120,7 @@ int CefBrowserMainParts::PreCreateThreads() {
content::GpuDataManager::GetInstance();
#if defined(USE_AURA)
gfx::Screen::SetScreenInstance(views::CreateDesktopScreen());
display::Screen::SetScreenInstance(views::CreateDesktopScreen());
#endif
return 0;
@@ -187,8 +187,6 @@ void CefBrowserMainParts::PostMainMessageLoopRun() {
void CefBrowserMainParts::PostDestroyThreads() {
#if defined(USE_AURA)
aura::Env::DeleteInstance();
// Delete the DesktopTestViewsDelegate.
delete views::ViewsDelegate::GetInstance();
#endif

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

@@ -3,9 +3,108 @@
// be found in the LICENSE file.
#include "libcef/browser/browser_message_loop.h"
#include "libcef/browser/context.h"
#include "libcef/common/content_client.h"
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
CefBrowserMessageLoop::CefBrowserMessageLoop() {
#if defined(OS_MACOSX)
#include "base/mac/scoped_nsautorelease_pool.h"
#endif
namespace {
// MessagePump implementation that delegates to OnScheduleMessagePumpWork() for
// scheduling.
class MessagePumpExternal : public base::MessagePump {
public:
MessagePumpExternal(float max_time_slice,
CefRefPtr<CefBrowserProcessHandler> handler)
: max_time_slice_(max_time_slice),
handler_(handler) {
}
void Run(Delegate* delegate) override {
base::TimeTicks start = base::TimeTicks::Now();
while (true) {
#if defined(OS_MACOSX)
base::mac::ScopedNSAutoreleasePool autorelease_pool;
#endif
const bool has_more_work = DirectRunWork(delegate);
if (!has_more_work)
break;
const base::TimeDelta& delta = base::TimeTicks::Now() - start;
if (delta.InSecondsF() > max_time_slice_)
break;
}
}
void Quit() override {
}
void ScheduleWork() override {
handler_->OnScheduleMessagePumpWork(0);
}
void ScheduleDelayedWork(const base::TimeTicks& delayed_work_time) override {
const base::TimeDelta& delta = delayed_work_time - base::TimeTicks::Now();
handler_->OnScheduleMessagePumpWork(delta.InMilliseconds());
}
private:
bool DirectRunWork(Delegate* delegate) {
bool did_work = false;
bool did_delayed_work = false;
bool did_idle_work = false;
// Perform work & delayed work.
// If no work was found, then perform idle work.
did_work = delegate->DoWork();
// We are using an external timer, so we don't have any action based on the
// returned next delayed work time.
base::TimeTicks next_time;
did_delayed_work = delegate->DoDelayedWork(&next_time);
if (!did_work && !did_delayed_work) {
did_idle_work = delegate->DoIdleWork();
}
return did_work || did_delayed_work || did_idle_work;
}
const float max_time_slice_;
CefRefPtr<CefBrowserProcessHandler> handler_;
};
CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() {
CefRefPtr<CefApp> app = CefContentClient::Get()->application();
if (app)
return app->GetBrowserProcessHandler();
return nullptr;
}
std::unique_ptr<base::MessagePump> CreatePump() {
const CefSettings& settings = CefContext::Get()->settings();
if (settings.external_message_pump) {
CefRefPtr<CefBrowserProcessHandler> handler = GetBrowserProcessHandler();
if (handler)
return base::WrapUnique(new MessagePumpExternal(0.01f, handler));
}
return base::MessageLoop::CreateMessagePumpForType(
base::MessageLoop::TYPE_UI);
}
} // namespace
CefBrowserMessageLoop::CefBrowserMessageLoop()
: base::MessageLoopForUI(CreatePump()) {
BindToCurrentThread();
}
CefBrowserMessageLoop::~CefBrowserMessageLoop() {
@@ -14,7 +113,7 @@ CefBrowserMessageLoop::~CefBrowserMessageLoop() {
// static
CefBrowserMessageLoop* CefBrowserMessageLoop::current() {
base::MessageLoop* loop = base::MessageLoop::current();
DCHECK_EQ(base::MessageLoop::TYPE_UI, loop->type());
DCHECK(loop->IsType(base::MessageLoop::TYPE_UI));
return static_cast<CefBrowserMessageLoop*>(loop);
}

View File

@@ -17,7 +17,7 @@ class CefBrowserMessageLoop : public base::MessageLoopForUI {
CefBrowserMessageLoop();
~CefBrowserMessageLoop() override;
// Returns the MessageLoopForUI of the current thread.
// Returns the CefBrowserMessageLoop of the current thread.
static CefBrowserMessageLoop* current();
// Do a single interation of the UI message loop.

View File

@@ -6,6 +6,7 @@
#include <utility>
#include "base/memory/ptr_util.h"
#include "build/build_config.h"
#if defined(OS_WIN)
@@ -30,11 +31,11 @@ namespace {
std::unique_ptr<CefBrowserPlatformDelegateNative> CreateNativeDelegate(
const CefWindowInfo& window_info) {
#if defined(OS_WIN)
return make_scoped_ptr(new CefBrowserPlatformDelegateNativeWin(window_info));
return base::WrapUnique(new CefBrowserPlatformDelegateNativeWin(window_info));
#elif defined(OS_MACOSX)
return make_scoped_ptr(new CefBrowserPlatformDelegateNativeMac(window_info));
return base::WrapUnique(new CefBrowserPlatformDelegateNativeMac(window_info));
#elif defined(OS_LINUX)
return make_scoped_ptr(
return base::WrapUnique(
new CefBrowserPlatformDelegateNativeLinux(window_info));
#endif
}
@@ -42,14 +43,14 @@ std::unique_ptr<CefBrowserPlatformDelegateNative> CreateNativeDelegate(
std::unique_ptr<CefBrowserPlatformDelegateOsr> CreateOSRDelegate(
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate) {
#if defined(OS_WIN)
return make_scoped_ptr(
new CefBrowserPlatformDelegateOsrWin(std::move(native_delegate)));
return base::WrapUnique(
new CefBrowserPlatformDelegateOsrWin(std::move(native_delegate)));
#elif defined(OS_MACOSX)
return make_scoped_ptr(
new CefBrowserPlatformDelegateOsrMac(std::move(native_delegate)));
return base::WrapUnique(
new CefBrowserPlatformDelegateOsrMac(std::move(native_delegate)));
#elif defined(OS_LINUX)
return make_scoped_ptr(
new CefBrowserPlatformDelegateOsrLinux(std::move(native_delegate)));
return base::WrapUnique(
new CefBrowserPlatformDelegateOsrLinux(std::move(native_delegate)));
#endif
}
@@ -73,7 +74,7 @@ std::unique_ptr<CefBrowserPlatformDelegate> CefBrowserPlatformDelegate::Create(
// CefWindowInfo is not used in this case.
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate =
CreateNativeDelegate(CefWindowInfo());
return make_scoped_ptr(new CefBrowserPlatformDelegateViews(
return base::WrapUnique(new CefBrowserPlatformDelegateViews(
std::move(native_delegate),
static_cast<CefBrowserViewImpl*>(create_params.browser_view.get())));
}

View File

@@ -72,12 +72,6 @@ variations::VariationsService*
return NULL;
}
web_resource::PromoResourceService*
ChromeBrowserProcessStub::promo_resource_service() {
NOTIMPLEMENTED();
return NULL;
}
BrowserProcessPlatformPart* ChromeBrowserProcessStub::platform_part() {
NOTIMPLEMENTED();
return NULL;
@@ -94,6 +88,12 @@ NotificationUIManager* ChromeBrowserProcessStub::notification_ui_manager() {
return NULL;
}
NotificationPlatformBridge*
ChromeBrowserProcessStub::notification_platform_bridge() {
NOTIMPLEMENTED();
return NULL;
}
message_center::MessageCenter* ChromeBrowserProcessStub::message_center() {
NOTIMPLEMENTED();
return NULL;

View File

@@ -40,11 +40,11 @@ class ChromeBrowserProcessStub : public BrowserProcess {
PrefService* local_state() override;
net::URLRequestContextGetter* system_request_context() override;
variations::VariationsService* variations_service() override;
web_resource::PromoResourceService* promo_resource_service() override;
BrowserProcessPlatformPart* platform_part() override;
extensions::EventRouterForwarder*
extension_event_router_forwarder() override;
NotificationUIManager* notification_ui_manager() override;
NotificationPlatformBridge* notification_platform_bridge() override;
message_center::MessageCenter* message_center() override;
policy::BrowserPolicyConnector* browser_policy_connector() override;
policy::PolicyService* policy_service() override;

View File

@@ -5,94 +5,20 @@
#include "libcef/browser/component_updater/cef_component_updater_configurator.h"
#include "include/cef_version.h"
#include <algorithm>
#include <string>
#include <vector>
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/strings/stringprintf.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/version.h"
#include "build/build_config.h"
#include "chrome/browser/update_client/chrome_update_query_params_delegate.h"
#include "components/component_updater/configurator_impl.h"
#include "components/update_client/component_patcher_operation.h"
#include "components/component_updater/component_updater_switches.h"
#include "components/component_updater/component_updater_url_constants.h"
#include "components/update_client/configurator.h"
#include "content/public/browser/browser_thread.h"
#include "net/url_request/url_request_context_getter.h"
#include "url/gurl.h"
#if defined(OS_WIN)
#include "base/win/win_util.h"
#endif // OS_WIN
using update_client::Configurator;
namespace component_updater {
namespace {
// Default time constants.
const int kDelayOneMinute = 60;
const int kDelayOneHour = kDelayOneMinute * 60;
// Debug values you can pass to --component-updater=value1,value2.
// Speed up component checking.
const char kSwitchFastUpdate[] = "fast-update";
// Add "testrequest=1" attribute to the update check request.
const char kSwitchRequestParam[] = "test-request";
// Disables pings. Pings are the requests sent to the update server that report
// the success or the failure of component install or update attempts.
extern const char kSwitchDisablePings[] = "disable-pings";
// Sets the URL for updates.
const char kSwitchUrlSource[] = "url-source";
// Disables differential updates.
const char kSwitchDisableDeltaUpdates[] = "disable-delta-updates";
#if defined(OS_WIN)
// Disables background downloads.
const char kSwitchDisableBackgroundDownloads[] = "disable-background-downloads";
#endif // defined(OS_WIN)
// Returns true if and only if |test| is contained in |vec|.
bool HasSwitchValue(const std::vector<std::string>& vec, const char* test) {
if (vec.empty())
return 0;
return (std::find(vec.begin(), vec.end(), test) != vec.end());
}
// If there is an element of |vec| of the form |test|=.*, returns the right-
// hand side of that assignment. Otherwise, returns an empty string.
// The right-hand side may contain additional '=' characters, allowing for
// further nesting of switch arguments.
std::string GetSwitchArgument(const std::vector<std::string>& vec,
const char* test) {
if (vec.empty())
return std::string();
for (std::vector<std::string>::const_iterator it = vec.begin();
it != vec.end();
++it) {
const std::size_t found = it->find("=");
if (found != std::string::npos) {
if (it->substr(0, found) == test) {
return it->substr(found + 1);
}
}
}
return std::string();
}
class CefConfigurator : public Configurator {
class CefConfigurator : public update_client::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,137 +42,75 @@ 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>;
~CefConfigurator() override {}
net::URLRequestContextGetter* url_request_getter_;
std::string extra_info_;
GURL url_source_override_;
bool fast_update_;
bool pings_enabled_;
bool deltas_enabled_;
bool background_downloads_enabled_;
ConfiguratorImpl configurator_impl_;
PrefService* pref_service_;
};
CefConfigurator::CefConfigurator(
const base::CommandLine* cmdline,
net::URLRequestContextGetter* url_request_getter)
: url_request_getter_(url_request_getter),
fast_update_(false),
pings_enabled_(false),
deltas_enabled_(false),
background_downloads_enabled_(false) {
// Parse comma-delimited debug flags.
std::vector<std::string> switch_values = base::SplitString(
cmdline->GetSwitchValueASCII(switches::kComponentUpdater),
",", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
fast_update_ = HasSwitchValue(switch_values, kSwitchFastUpdate);
pings_enabled_ = !HasSwitchValue(switch_values, kSwitchDisablePings);
deltas_enabled_ = !HasSwitchValue(switch_values, kSwitchDisableDeltaUpdates);
// TODO(dberger): Pull this (and possibly the various hard-coded
// delay params in this file) from cef settings.
fast_update_ = true;
#if defined(OS_WIN)
background_downloads_enabled_ =
!HasSwitchValue(switch_values, kSwitchDisableBackgroundDownloads);
#else
background_downloads_enabled_ = false;
#endif
const std::string switch_url_source =
GetSwitchArgument(switch_values, kSwitchUrlSource);
if (!switch_url_source.empty()) {
url_source_override_ = GURL(switch_url_source);
DCHECK(url_source_override_.is_valid());
}
if (HasSwitchValue(switch_values, kSwitchRequestParam))
extra_info_ += "testrequest=\"1\"";
net::URLRequestContextGetter* url_request_getter,
PrefService* pref_service)
: configurator_impl_(cmdline, url_request_getter, false),
pref_service_(pref_service) {
}
int CefConfigurator::InitialDelay() const {
return fast_update_ ? 10 : (6 * kDelayOneMinute);
return configurator_impl_.InitialDelay();
}
int CefConfigurator::NextCheckDelay() const {
return fast_update_ ? 60 : (6 * kDelayOneHour);
return configurator_impl_.NextCheckDelay();
}
int CefConfigurator::StepDelay() const {
return fast_update_ ? 1 : 1;
return configurator_impl_.StepDelay();
}
int CefConfigurator::OnDemandDelay() const {
return fast_update_ ? 2 : (30 * kDelayOneMinute);
return configurator_impl_.OnDemandDelay();
}
int CefConfigurator::UpdateDelay() const {
return fast_update_ ? 10 : (15 * kDelayOneMinute);
return configurator_impl_.UpdateDelay();
}
std::vector<GURL> CefConfigurator::UpdateUrl() const {
std::vector<GURL> urls;
if (url_source_override_.is_valid()) {
urls.push_back(GURL(url_source_override_));
} else {
urls.push_back(GURL(kUpdaterDefaultUrl));
}
return urls;
return configurator_impl_.UpdateUrl();
}
std::vector<GURL> CefConfigurator::PingUrl() const {
return pings_enabled_ ? UpdateUrl() : std::vector<GURL>();
return configurator_impl_.PingUrl();
}
base::Version CefConfigurator::GetBrowserVersion() const {
return base::Version(base::StringPrintf("%d.%d.%d.%d",
CHROME_VERSION_MAJOR,
CHROME_VERSION_MINOR,
CHROME_VERSION_BUILD,
CHROME_VERSION_PATCH));
return configurator_impl_.GetBrowserVersion();
}
std::string CefConfigurator::GetChannel() const {
return "";
return std::string();
}
std::string CefConfigurator::GetBrand() const {
return "";
return std::string();
}
std::string CefConfigurator::GetLang() const {
return "";
return std::string();
}
std::string CefConfigurator::GetOSLongName() const {
#if defined(OS_WIN)
return "Windows";
#elif defined(OS_MACOSX)
return "Mac OS X";
#elif defined(OS_CHROMEOS)
return "Chromium OS";
#elif defined(OS_ANDROID)
return "Android";
#elif defined(OS_LINUX)
return "Linux";
#elif defined(OS_FREEBSD)
return "FreeBSD";
#elif defined(OS_OPENBSD)
return "OpenBSD";
#elif defined(OS_SOLARIS)
return "Solaris";
#else
return "Unknown";
#endif
return configurator_impl_.GetOSLongName();
}
std::string CefConfigurator::ExtraRequestParams() const {
return extra_info_;
return configurator_impl_.ExtraRequestParams();
}
std::string CefConfigurator::GetDownloadPreference() const {
@@ -254,32 +118,40 @@ std::string CefConfigurator::GetDownloadPreference() const {
}
net::URLRequestContextGetter* CefConfigurator::RequestContext() const {
return url_request_getter_;
return configurator_impl_.RequestContext();
}
scoped_refptr<update_client::OutOfProcessPatcher>
CefConfigurator::CreateOutOfProcessPatcher() const {
return NULL;
return nullptr;
}
bool CefConfigurator::DeltasEnabled() const {
return deltas_enabled_;
return configurator_impl_.DeltasEnabled();
}
bool CefConfigurator::UseBackgroundDownloader() const {
return background_downloads_enabled_;
return configurator_impl_.UseBackgroundDownloader();
}
bool CefConfigurator::UseCupSigning() const {
return true;
return configurator_impl_.UseCupSigning();
}
// Returns a task runner to run blocking tasks. The task runner continues to run
// after the browser shuts down, until the OS terminates the process. This
// imposes certain requirements for the code using the task runner, such as
// not accessing any global browser state while the code is running.
scoped_refptr<base::SequencedTaskRunner>
CefConfigurator::GetSequencedTaskRunner() const {
return content::BrowserThread::GetBlockingPool()
->GetSequencedTaskRunnerWithShutdownBehavior(
base::SequencedWorkerPool::GetSequenceToken(),
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
}
PrefService* CefConfigurator::GetPrefService() const {
return pref_service_;
}
} // namespace
@@ -287,8 +159,9 @@ CefConfigurator::GetSequencedTaskRunner() const {
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)) {
@@ -823,12 +823,7 @@ const wchar_t* CefContentBrowserClient::GetResourceDllName() {
bool CefContentBrowserClient::PreSpawnRenderer(
sandbox::TargetPolicy* policy) {
// Flash requires this permission to play video files.
sandbox::ResultCode result = policy->AddRule(
sandbox::TargetPolicy::SUBSYS_HANDLES,
sandbox::TargetPolicy::HANDLES_DUP_ANY,
L"File");
return result == sandbox::SBOX_ALL_OK;
return true;
}
#endif // defined(OS_WIN)

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

@@ -18,6 +18,7 @@
#include "base/format_macros.h"
#include "base/logging.h"
#include "base/threading/thread_restrictions.h"
#include "content/browser/storage_partition_impl.h"
#include "net/cookies/cookie_util.h"
#include "net/cookies/parsed_cookie.h"
#include "net/extras/sqlite/sqlite_persistent_cookie_store.h"
@@ -113,10 +114,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 +169,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.
@@ -592,8 +609,9 @@ void CefCookieManagerImpl::DeleteCookiesInternal(
base::Bind(DeleteCookiesCallbackImpl, callback));
} else if (cookie_name.empty()) {
// Delete all matching host cookies.
cookie_store->DeleteAllCreatedBetweenForHostAsync(
base::Time(), base::Time::Max(), url,
cookie_store->DeleteAllCreatedBetweenWithPredicateAsync(
base::Time(), base::Time::Max(),
content::StoragePartitionImpl::CreatePredicateForHostCookies(url),
base::Bind(DeleteCookiesCallbackImpl, callback));
} else {
// Delete all matching host and domain cookies.

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

@@ -12,6 +12,7 @@
#include "base/command_line.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
@@ -19,6 +20,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_client.h"
#include "ipc/ipc_channel.h"
@@ -121,38 +123,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 +164,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 +198,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);
}
}
@@ -261,10 +258,12 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
net::URLFetcher* fetcher =
net::URLFetcher::Create(gurl, net::URLFetcher::GET, this).release();
pending_requests_[fetcher] = request_id;
fetcher->SetRequestContext(web_contents()->GetBrowserContext()->
GetRequestContext());
fetcher->SetRequestContext(
content::BrowserContext::GetDefaultStoragePartition(
web_contents()->GetBrowserContext())->
GetURLRequestContext());
fetcher->SetExtraRequestHeaders(headers);
fetcher->SaveResponseWithWriter(std::unique_ptr<net::URLFetcherResponseWriter>(
fetcher->SaveResponseWithWriter(base::WrapUnique(
new ResponseWriter(weak_factory_.GetWeakPtr(), stream_id)));
fetcher->Start();
return;

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

@@ -263,7 +263,7 @@ ContentVerifier* CefExtensionSystem::content_verifier() {
std::unique_ptr<ExtensionSet> CefExtensionSystem::GetDependentExtensions(
const Extension* extension) {
return make_scoped_ptr(new ExtensionSet());
return base::WrapUnique(new ExtensionSet());
}
void CefExtensionSystem::InstallUpdate(const std::string& extension_id,

View File

@@ -12,6 +12,7 @@
#include "libcef/browser/extensions/pdf_web_contents_helper_client.h"
#include "libcef/browser/printing/print_view_manager.h"
#include "base/memory/ptr_util.h"
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
#include "components/pdf/browser/pdf_web_contents_helper.h"
#include "extensions/browser/guest_view/extensions_guest_view_manager_delegate.h"
@@ -39,7 +40,7 @@ CefExtensionsAPIClient::CreateGuestViewManagerDelegate(
// to provide the *Impl object instead of |context| which may be a *Proxy
// object. If we don't do this then the Delegate may attempt to access a
// *Proxy object that has already been deleted.
return make_scoped_ptr(
return base::WrapUnique(
new extensions::ExtensionsGuestViewManagerDelegate(
CefBrowserContextImpl::GetForContext(context).get()));
}
@@ -47,7 +48,7 @@ CefExtensionsAPIClient::CreateGuestViewManagerDelegate(
std::unique_ptr<MimeHandlerViewGuestDelegate>
CefExtensionsAPIClient::CreateMimeHandlerViewGuestDelegate(
MimeHandlerViewGuest* guest) const {
return make_scoped_ptr(new CefMimeHandlerViewGuestDelegate(guest));
return base::WrapUnique(new CefMimeHandlerViewGuestDelegate(guest));
}
void CefExtensionsAPIClient::AttachWebContentsHelpers(

View File

@@ -115,6 +115,14 @@ void CefMediaCaptureDevicesDispatcher::OnCreatingAudioStream(
int render_view_id) {
}
void CefMediaCaptureDevicesDispatcher::OnSetCapturingLinkSecured(
int render_process_id,
int render_frame_id,
int page_request_id,
content::MediaStreamType stream_type,
bool is_secure) {
}
const MediaStreamDevices&
CefMediaCaptureDevicesDispatcher::GetAudioCaptureDevices() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

View File

@@ -6,7 +6,6 @@
#define CEF_LIBCEF_BROWSER_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
#include "base/observer_list.h"
#include "content/public/browser/media_observer.h"
@@ -53,6 +52,11 @@ class CefMediaCaptureDevicesDispatcher : public content::MediaObserver {
content::MediaRequestState state) override;
void OnCreatingAudioStream(int render_process_id,
int render_view_id) override;
void OnSetCapturingLinkSecured(int render_process_id,
int render_frame_id,
int page_request_id,
content::MediaStreamType stream_type,
bool is_secure) override;
private:
friend struct base::DefaultSingletonTraits<CefMediaCaptureDevicesDispatcher>;

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(
@@ -369,7 +370,7 @@ CefEventHandle CefBrowserPlatformDelegateNativeLinux::GetEventHandle(
std::unique_ptr<CefMenuRunner>
CefBrowserPlatformDelegateNativeLinux::CreateMenuRunner() {
return make_scoped_ptr(new CefMenuRunnerLinux);
return base::WrapUnique(new CefMenuRunnerLinux);
}
void CefBrowserPlatformDelegateNativeLinux::TranslateMouseEvent(

View File

@@ -15,6 +15,7 @@
#include "libcef/browser/thread_util.h"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/memory/ptr_util.h"
#include "base/threading/thread_restrictions.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/browser/render_widget_host_view.h"
@@ -91,18 +92,6 @@
[super dealloc];
}
// Called when we are activated (when we gain focus).
- (void)windowDidBecomeKey:(NSNotification*)notification {
if (browser_)
browser_->SetFocus(true);
}
// Called when we are deactivated (when we lose focus).
- (void)windowDidResignKey:(NSNotification*)notification {
if (browser_)
browser_->SetFocus(false);
}
- (BOOL)windowShouldClose:(id)window {
if (browser_ && !browser_->TryCloseBrowser()) {
// Cancel the close.
@@ -216,12 +205,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;
@@ -465,17 +454,17 @@ CefEventHandle CefBrowserPlatformDelegateNativeMac::GetEventHandle(
std::unique_ptr<CefFileDialogRunner>
CefBrowserPlatformDelegateNativeMac::CreateFileDialogRunner() {
return make_scoped_ptr(new CefFileDialogRunnerMac);
return base::WrapUnique(new CefFileDialogRunnerMac);
}
std::unique_ptr<CefJavaScriptDialogRunner>
CefBrowserPlatformDelegateNativeMac::CreateJavaScriptDialogRunner() {
return make_scoped_ptr(new CefJavaScriptDialogRunnerMac);
return base::WrapUnique(new CefJavaScriptDialogRunnerMac);
}
std::unique_ptr<CefMenuRunner>
CefBrowserPlatformDelegateNativeMac::CreateMenuRunner() {
return make_scoped_ptr(new CefMenuRunnerMac);
return base::WrapUnique(new CefMenuRunnerMac);
}
void CefBrowserPlatformDelegateNativeMac::TranslateMouseEvent(

View File

@@ -22,7 +22,8 @@
#include "content/public/browser/native_web_keyboard_event.h"
#include "ui/aura/window.h"
#include "ui/base/win/shell.h"
#include "ui/gfx/screen.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/gfx/win/hwnd_util.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h"
#include "ui/views/widget/widget.h"
@@ -166,7 +167,7 @@ bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() {
// Adjust for potential display scaling.
gfx::Point point = gfx::Point(cr.right, cr.bottom);
float scale = gfx::Screen::GetScreen()->
float scale = display::Screen::GetScreen()->
GetDisplayNearestPoint(point).device_scale_factor();
point = gfx::ToFlooredPoint(
gfx::ScalePoint(gfx::PointF(point), 1.0f / scale));
@@ -296,7 +297,7 @@ gfx::Point CefBrowserPlatformDelegateNativeWin::GetScreenPoint(
bounds_in_screen.y() + view.y());
// Adjust for potential display scaling.
float scale = gfx::Screen::GetScreen()->
float scale = display::Screen::GetScreen()->
GetDisplayNearestPoint(screen_point).device_scale_factor();
return gfx::ToFlooredPoint(
gfx::ScalePoint(gfx::PointF(screen_point), scale));
@@ -499,17 +500,17 @@ CefEventHandle CefBrowserPlatformDelegateNativeWin::GetEventHandle(
std::unique_ptr<CefFileDialogRunner>
CefBrowserPlatformDelegateNativeWin::CreateFileDialogRunner() {
return make_scoped_ptr(new CefFileDialogRunnerWin);
return base::WrapUnique(new CefFileDialogRunnerWin);
}
std::unique_ptr<CefJavaScriptDialogRunner>
CefBrowserPlatformDelegateNativeWin::CreateJavaScriptDialogRunner() {
return make_scoped_ptr(new CefJavaScriptDialogRunnerWin);
return base::WrapUnique(new CefJavaScriptDialogRunnerWin);
}
std::unique_ptr<CefMenuRunner>
CefBrowserPlatformDelegateNativeWin::CreateMenuRunner() {
return make_scoped_ptr(new CefMenuRunnerWin);
return base::WrapUnique(new CefMenuRunnerWin);
}
void CefBrowserPlatformDelegateNativeWin::TranslateMouseEvent(

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

@@ -258,16 +258,15 @@ class NativeMenuWin::MenuHostWindow {
gfx::Image icon;
if (data->native_menu_win->model_->GetIconAt(data->model_index, &icon)) {
// We currently don't support items with both icons and checkboxes.
const gfx::ImageSkia* skia_icon = icon.ToImageSkia();
const gfx::ImageSkia skia_icon = icon.AsImageSkia();
DCHECK(type != ui::MenuModel::TYPE_CHECK);
gfx::Canvas canvas(
skia_icon->GetRepresentation(1.0f),
false);
gfx::Canvas canvas(skia_icon.size(), 1.0f, false);
canvas.DrawImageInt(skia_icon, 0, 0);
skia::DrawToNativeContext(
canvas.sk_canvas(), dc,
draw_item_struct->rcItem.left + kItemLeftMargin,
draw_item_struct->rcItem.top + (draw_item_struct->rcItem.bottom -
draw_item_struct->rcItem.top - skia_icon->height()) / 2, NULL);
draw_item_struct->rcItem.top - skia_icon.height()) / 2, NULL);
} else if (type == ui::MenuModel::TYPE_CHECK &&
data->native_menu_win->model_->IsItemCheckedAt(
data->model_index)) {

View File

@@ -190,7 +190,7 @@ class TemplateParser {
using ResourcesMap = base::hash_map<std::string, int>;
// TODO(rkc): Once we have a separate source for apps, remove '*/apps/' aliases.
const char* kPathAliases[][2] = {
const char* const kPathAliases[][2] = {
{"../../../third_party/polymer/v1_0/components-chromium/", "polymer/v1_0/"},
{"../../../third_party/web-animations-js/sources/",
"polymer/v1_0/web-animations-js/"},
@@ -211,7 +211,7 @@ const ResourcesMap* CreateResourcesMap() {
const std::string resource_name = kWebuiResources[i].name;
const int resource_id = kWebuiResources[i].value;
AddResource(resource_name, resource_id, result);
for (const char* (&alias)[2]: kPathAliases) {
for (const char* const (&alias)[2] : kPathAliases) {
if (base::StartsWith(resource_name, alias[0],
base::CompareCase::SENSITIVE)) {
AddResource(alias[1] + resource_name.substr(strlen(alias[0])),

View File

@@ -115,15 +115,15 @@ void CefCookieStoreProxy::DeleteAllCreatedBetweenAsync(
}
}
void CefCookieStoreProxy::DeleteAllCreatedBetweenForHostAsync(
const base::Time delete_begin,
const base::Time delete_end,
const GURL& url,
void CefCookieStoreProxy::DeleteAllCreatedBetweenWithPredicateAsync(
const base::Time& delete_begin,
const base::Time& delete_end,
const CookiePredicate& predicate,
const DeleteCallback& callback) {
net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) {
cookie_store->DeleteAllCreatedBetweenForHostAsync(delete_begin, delete_end,
url, callback);
cookie_store->DeleteAllCreatedBetweenWithPredicateAsync(
delete_begin, delete_end, predicate, callback);
}
}

View File

@@ -59,10 +59,10 @@ class CefCookieStoreProxy : public net::CookieStore {
void DeleteAllCreatedBetweenAsync(const base::Time& delete_begin,
const base::Time& delete_end,
const DeleteCallback& callback) override;
void DeleteAllCreatedBetweenForHostAsync(
const base::Time delete_begin,
const base::Time delete_end,
const GURL& url,
void DeleteAllCreatedBetweenWithPredicateAsync(
const base::Time& delete_begin,
const base::Time& delete_end,
const CookiePredicate& predicate,
const DeleteCallback& callback) override;
void DeleteSessionCookiesAsync(const DeleteCallback& callback) override;
void FlushStore(const base::Closure& callback) override;

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

@@ -10,6 +10,7 @@
#include "libcef/browser/net/devtools_scheme_handler.h"
#include "libcef/common/net/scheme_registration.h"
#include "base/memory/ptr_util.h"
#include "base/threading/sequenced_worker_pool.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/url_constants.h"
@@ -60,7 +61,7 @@ void InstallInternalProtectedHandlers(
protocol_handler.reset(
scheme::WrapChromeProtocolHandler(
request_manager,
make_scoped_ptr(it->second.release())).release());
base::WrapUnique(it->second.release())).release());
} else {
protocol_handler.reset(it->second.release());
}
@@ -70,7 +71,7 @@ void InstallInternalProtectedHandlers(
DCHECK(IsInternalProtectedScheme(scheme));
bool set_protocol = job_factory->SetProtocolHandler(
scheme, make_scoped_ptr(protocol_handler.release()));
scheme, base::WrapUnique(protocol_handler.release()));
DCHECK(set_protocol);
}
}

View File

@@ -27,6 +27,7 @@
#include "build/build_config.h"
#include "chrome/browser/net/proxy_service_factory.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_client.h"
@@ -120,6 +121,19 @@ CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
std::swap(protocol_handlers_, *protocol_handlers);
auto io_thread_proxy =
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
quick_check_enabled_.Init(prefs::kQuickCheckEnabled, pref_service);
quick_check_enabled_.MoveToThread(io_thread_proxy);
pac_https_url_stripping_enabled_.Init(prefs::kPacHttpsUrlStrippingEnabled,
pref_service);
pac_https_url_stripping_enabled_.MoveToThread(io_thread_proxy);
force_google_safesearch_.Init(prefs::kForceGoogleSafeSearch, pref_service);
force_google_safesearch_.MoveToThread(io_thread_proxy);
#if defined(OS_POSIX) && !defined(OS_ANDROID)
gsapi_library_name_ = pref_service->GetString(prefs::kGSSAPILibraryName);
#endif
@@ -134,6 +148,27 @@ CefURLRequestContextGetterImpl::~CefURLRequestContextGetterImpl() {
storage_->set_proxy_service(NULL);
}
// static
void CefURLRequestContextGetterImpl::RegisterPrefs(
PrefRegistrySimple* registry) {
// Based on IOThread::RegisterPrefs.
#if defined(OS_POSIX) && !defined(OS_ANDROID)
registry->RegisterStringPref(prefs::kGSSAPILibraryName, std::string());
#endif
registry->RegisterBooleanPref(prefs::kQuickCheckEnabled, true);
registry->RegisterBooleanPref(prefs::kPacHttpsUrlStrippingEnabled, true);
// Based on ProfileImpl::RegisterProfilePrefs.
registry->RegisterBooleanPref(prefs::kForceGoogleSafeSearch, false);
}
void CefURLRequestContextGetterImpl::ShutdownOnUIThread() {
CEF_REQUIRE_UIT();
quick_check_enabled_.Destroy();
pac_https_url_stripping_enabled_.Destroy();
force_google_safesearch_.Destroy();
}
net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
CEF_REQUIRE_IOT();
@@ -152,9 +187,12 @@ 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(
storage_->set_channel_id_service(base::WrapUnique(
new net::ChannelIDService(
new net::DefaultChannelIDStore(NULL),
base::WorkerPool::GetTaskRunner(true))));
@@ -168,7 +206,7 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
storage_->set_host_resolver(net::HostResolver::CreateDefaultResolver(NULL));
storage_->set_cert_verifier(net::CertVerifier::CreateDefault());
storage_->set_transport_security_state(
make_scoped_ptr(new net::TransportSecurityState));
base::WrapUnique(new net::TransportSecurityState));
std::unique_ptr<net::ProxyService> system_proxy_service =
ProxyServiceFactory::CreateProxyService(
@@ -177,7 +215,8 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
url_request_context_->network_delegate(),
std::move(proxy_config_service_),
*command_line,
true);
quick_check_enabled_.GetValue(),
pac_https_url_stripping_enabled_.GetValue());
storage_->set_proxy_service(std::move(system_proxy_service));
storage_->set_ssl_config_service(new net::SSLConfigServiceDefaults);
@@ -202,11 +241,14 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
storage_->set_http_server_properties(base::WrapUnique(
new net::HttpServerPropertiesImpl));
base::FilePath http_cache_path;
if (!cache_path.empty())
http_cache_path = cache_path.Append(FILE_PATH_LITERAL("Cache"));
std::unique_ptr<net::HttpCache::DefaultBackend> main_backend(
new net::HttpCache::DefaultBackend(
cache_path.empty() ? net::MEMORY_CACHE : net::DISK_CACHE,
net::CACHE_BACKEND_DEFAULT,
cache_path,
http_cache_path,
0,
BrowserThread::GetMessageLoopProxyForThread(
BrowserThread::CACHE)));
@@ -232,8 +274,8 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
settings_.ignore_certificate_errors ? true : false;
storage_->set_http_network_session(
make_scoped_ptr(new net::HttpNetworkSession(network_session_params)));
storage_->set_http_transaction_factory(make_scoped_ptr(
base::WrapUnique(new net::HttpNetworkSession(network_session_params)));
storage_->set_http_transaction_factory(base::WrapUnique(
new net::HttpCache(storage_->http_network_session(),
std::move(main_backend),
true /* set_up_quic_server_info */)));
@@ -267,7 +309,7 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
i != request_interceptors_.rend();
++i) {
top_job_factory.reset(new net::URLRequestInterceptingJobFactory(
std::move(top_job_factory), make_scoped_ptr(*i)));
std::move(top_job_factory), base::WrapUnique(*i)));
}
request_interceptors_.weak_clear();

View File

@@ -17,9 +17,11 @@
#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"
class PrefRegistrySimple;
class PrefService;
namespace base {
@@ -52,6 +54,12 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
content::URLRequestInterceptorScopedVector request_interceptors);
~CefURLRequestContextGetterImpl() override;
// Register preferences. Called from browser_prefs::CreatePrefService().
static void RegisterPrefs(PrefRegistrySimple* registry);
// Called when the BrowserContextImpl is destroyed.
void ShutdownOnUIThread();
// net::URLRequestContextGetter implementation.
net::URLRequestContext* GetURLRequestContext() override;
scoped_refptr<base::SingleThreadTaskRunner>
@@ -102,6 +110,12 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
std::vector<CefRefPtr<CefRequestContextHandler> > handler_list_;
BooleanPrefMember quick_check_enabled_;
BooleanPrefMember pac_https_url_stripping_enabled_;
// Member variables which are pointed to by the various context objects.
mutable BooleanPrefMember force_google_safesearch_;
DISALLOW_COPY_AND_ASSIGN(CefURLRequestContextGetterImpl);
};

View File

@@ -16,6 +16,7 @@
#include "libcef/common/request_impl.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/strings/string_util.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"
@@ -201,7 +202,7 @@ void CefURLRequestManager::SetProtocolHandlerIfNecessary(
bool set_protocol = job_factory_->SetProtocolHandler(
scheme,
make_scoped_ptr(add ? new CefProtocolHandler(this, scheme) : NULL));
base::WrapUnique(add ? new CefProtocolHandler(this, scheme) : NULL));
DCHECK(set_protocol);
}

View File

@@ -20,10 +20,11 @@
#include "cc/base/switches.h"
#include "cc/output/copy_output_request.h"
#include "cc/scheduler/delay_based_time_source.h"
#include "components/display_compositor/gl_helper.h"
#include "content/browser/bad_message.h"
#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"
@@ -251,7 +252,7 @@ class CefCopyFrameGenerator {
content::ImageTransportFactory* factory =
content::ImageTransportFactory::GetInstance();
content::GLHelper* gl_helper = factory->GetGLHelper();
display_compositor::GLHelper* gl_helper = factory->GetGLHelper();
if (!gl_helper)
return;
@@ -283,7 +284,7 @@ class CefCopyFrameGenerator {
damage_rect,
base::Passed(&bitmap_),
base::Passed(&bitmap_pixels_lock)),
content::GLHelper::SCALER_QUALITY_FAST);
display_compositor::GLHelper::SCALER_QUALITY_FAST);
}
static void CopyFromCompositingSurfaceFinishedProxy(
@@ -296,7 +297,7 @@ class CefCopyFrameGenerator {
// This method may be called after the view has been deleted.
gpu::SyncToken sync_token;
if (result) {
content::GLHelper* gl_helper =
display_compositor::GLHelper* gl_helper =
content::ImageTransportFactory::GetInstance()->GetGLHelper();
if (gl_helper)
gl_helper->GenerateSyncToken(&sync_token);
@@ -552,10 +553,6 @@ gfx::NativeView CefRenderWidgetHostViewOSR::GetNativeView() const {
return gfx::NativeView();
}
gfx::NativeViewId CefRenderWidgetHostViewOSR::GetNativeViewId() const {
return gfx::NativeViewId();
}
gfx::NativeViewAccessible
CefRenderWidgetHostViewOSR::GetNativeViewAccessible() {
return gfx::NativeViewAccessible();
@@ -788,8 +785,8 @@ void CefRenderWidgetHostViewOSR::SetIsLoading(bool is_loading) {
}
#if !defined(OS_MACOSX)
void CefRenderWidgetHostViewOSR::UpdateInputMethodIfNecessary(
bool text_input_state_changed) {
void CefRenderWidgetHostViewOSR::TextInputStateChanged(
const content::TextInputState& params) {
}
void CefRenderWidgetHostViewOSR::ImeCancelComposition() {
@@ -1017,6 +1014,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();
@@ -1068,6 +1078,17 @@ void CefRenderWidgetHostViewOSR::DelegatedFrameHostUpdateVSyncParameters(
render_widget_host_->UpdateVSyncParameters(timebase, interval);
}
void CefRenderWidgetHostViewOSR::SetBeginFrameSource(
cc::BeginFrameSource* source) {
// TODO(cef): Maybe we can use this method in combination with
// OnSetNeedsBeginFrames() instead of using CefBeginFrameTimer.
// See https://codereview.chromium.org/1841083007.
}
bool CefRenderWidgetHostViewOSR::IsAutoResizeEnabled() const {
return render_widget_host_->auto_resize_enabled();
}
bool CefRenderWidgetHostViewOSR::InstallTransparency() {
if (transparent_) {
SetBackgroundColor(SkColor());
@@ -1120,13 +1141,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);
}
@@ -1360,18 +1375,7 @@ void CefRenderWidgetHostViewOSR::ResizeRootLayer() {
root_layer_->SetBounds(gfx::Rect(size));
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;
PlatformResizeCompositorWidget(size_in_pixels);
}
void CefRenderWidgetHostViewOSR::OnBeginFrameTimerTick() {

View File

@@ -96,7 +96,6 @@ class CefRenderWidgetHostViewOSR
void SetBounds(const gfx::Rect& rect) override;
gfx::Vector2dF GetLastScrollOffset() const override;
gfx::NativeView GetNativeView() const override;
gfx::NativeViewId GetNativeViewId() const override;
gfx::NativeViewAccessible GetNativeViewAccessible() override;
ui::TextInputClient* GetTextInputClient() override;
void Focus() override;
@@ -111,6 +110,7 @@ class CefRenderWidgetHostViewOSR
void UnlockMouse() override;
#if defined(OS_MACOSX)
ui::AcceleratedWidgetMac* GetAcceleratedWidgetMac() const override;
void SetActive(bool active) override;
void ShowDefinitionForSelection() override;
bool SupportsSpeech() const override;
@@ -130,7 +130,7 @@ 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 content::TextInputState& params) override;
void ImeCancelComposition() override;
void RenderProcessGone(base::TerminationStatus status,
int error_code) override;
@@ -203,6 +203,7 @@ 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;
std::unique_ptr<content::ResizeLock> DelegatedFrameHostCreateResizeLock(
@@ -218,6 +219,8 @@ class CefRenderWidgetHostViewOSR
void DelegatedFrameHostUpdateVSyncParameters(
const base::TimeTicks& timebase,
const base::TimeDelta& interval) override;
void SetBeginFrameSource(cc::BeginFrameSource* source) override;
bool IsAutoResizeEnabled() const override;
bool InstallTransparency();
@@ -280,9 +283,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,
@@ -315,6 +315,7 @@ class CefRenderWidgetHostViewOSR
#endif // defined(OS_MACOSX)
void PlatformCreateCompositorWidget();
void PlatformResizeCompositorWidget(const gfx::Size& size);
void PlatformDestroyCompositorWidget();
#if defined(USE_AURA)

View File

@@ -123,6 +123,9 @@ void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget() {
compositor_widget_ = window_->xwindow();
}
void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(const gfx::Size&) {
}
void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() {
DCHECK(window_);
window_->Close();

View File

@@ -30,6 +30,13 @@ CefTextInputClientOSRMac* GetInputClientFromContext(
} // namespace
ui::AcceleratedWidgetMac* CefRenderWidgetHostViewOSR::GetAcceleratedWidgetMac()
const {
if (browser_compositor_)
return browser_compositor_->accelerated_widget_mac();
return nullptr;
}
void CefRenderWidgetHostViewOSR::SetActive(bool active) {
}
@@ -50,8 +57,8 @@ bool CefRenderWidgetHostViewOSR::IsSpeaking() const {
void CefRenderWidgetHostViewOSR::StopSpeaking() {
}
void CefRenderWidgetHostViewOSR::UpdateInputMethodIfNecessary(
bool text_input_state_changed) {
void CefRenderWidgetHostViewOSR::TextInputStateChanged(
const content::TextInputState& params) {
[NSApp updateWindows];
}
@@ -311,6 +318,9 @@ void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget() {
browser_compositor_->Unsuspend();
}
void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(const gfx::Size&) {
}
void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() {
DCHECK(window_);

View File

@@ -149,6 +149,12 @@ void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget() {
compositor_widget_ = window_->hwnd();
}
void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(const gfx::Size& size) {
DCHECK(window_);
SetWindowPos(window_->hwnd(), NULL, 0, 0, size.width(), size.height(),
SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW);
}
void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() {
window_.reset(NULL);
compositor_widget_ = gfx::kNullAcceleratedWidget;

View File

@@ -16,7 +16,7 @@
#include "base/bind.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/utf_string_conversions.h"
#include "base/thread_task_runner_handle.h"
#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
#include "chrome/browser/plugins/plugin_finder.h"
#include "chrome/common/pref_names.h"

View File

@@ -51,12 +51,13 @@ class CefPluginInfoMessageFilter : public content::BrowserMessageFilter {
const content::WebPluginInfo& plugin,
const PluginMetadata* plugin_metadata,
CefViewHostMsg_GetPluginInfo_Status* status) const;
bool FindEnabledPlugin(const GetPluginInfo_Params& params,
CefRequestContextHandler* handler,
CefViewHostMsg_GetPluginInfo_Status* status,
content::WebPluginInfo* plugin,
std::string* actual_mime_type,
std::unique_ptr<PluginMetadata>* plugin_metadata) const;
bool FindEnabledPlugin(
const GetPluginInfo_Params& params,
CefRequestContextHandler* handler,
CefViewHostMsg_GetPluginInfo_Status* status,
content::WebPluginInfo* plugin,
std::string* actual_mime_type,
std::unique_ptr<PluginMetadata>* plugin_metadata) const;
void GetPluginContentSetting(const content::WebPluginInfo& plugin,
const GURL& policy_url,
const GURL& plugin_url,
@@ -64,8 +65,6 @@ class CefPluginInfoMessageFilter : public content::BrowserMessageFilter {
ContentSetting* setting,
bool* is_default,
bool* is_managed) const;
void MaybeGrantAccess(CefViewHostMsg_GetPluginInfo_Status status,
const base::FilePath& path) const;
bool IsPluginEnabled(const content::WebPluginInfo& plugin) const;
private:

View File

@@ -5,6 +5,7 @@
#include "libcef/browser/prefs/browser_prefs.h"
#include "libcef/browser/media_capture_devices_dispatcher.h"
#include "libcef/browser/net/url_request_context_getter_impl.h"
#include "libcef/browser/prefs/renderer_prefs.h"
#include "libcef/common/cef_switches.h"
@@ -25,6 +26,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"
@@ -125,7 +127,9 @@ std::unique_ptr<PrefService> CreatePrefService(const base::FilePath& pref_path)
PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get());
extensions::ExtensionPrefs::RegisterProfilePrefs(registry.get());
HostContentSettingsMap::RegisterProfilePrefs(registry.get());
CefURLRequestContextGetterImpl::RegisterPrefs(registry.get());
renderer_prefs::RegisterProfilePrefs(registry.get());
update_client::RegisterPrefs(registry.get());
// Print preferences.
registry->RegisterBooleanPref(prefs::kPrintingEnabled, true);
@@ -158,12 +162,6 @@ std::unique_ptr<PrefService> CreatePrefService(const base::FilePath& pref_path)
registry->RegisterBooleanPref(prefs::kPluginsAllowOutdated, false);
registry->RegisterBooleanPref(prefs::kPluginsAlwaysAuthorize, false);
// Network preferences.
// Based on IOThread::RegisterPrefs.
#if defined(OS_POSIX) && !defined(OS_ANDROID)
registry->RegisterStringPref(prefs::kGSSAPILibraryName, std::string());
#endif
if (command_line->HasSwitch(switches::kEnablePreferenceTesting)) {
// Preferences used with unit tests.
registry->RegisterBooleanPref("test.bool", true);

View File

@@ -5,7 +5,7 @@
#ifndef CEF_LIBCEF_BROWSER_PREFS_BROWSER_PREFS_H_
#define CEF_LIBCEF_BROWSER_PREFS_BROWSER_PREFS_H_
#include "base/memory/scoped_ptr.h"
#include <memory>
class PrefService;

View File

@@ -13,6 +13,7 @@
#include "libcef/common/extensions/extensions_util.h"
#include "base/command_line.h"
#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "chrome/browser/accessibility/animation_policy_prefs.h"
#include "chrome/browser/character_encoding.h"
@@ -126,6 +127,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 =
@@ -278,7 +281,7 @@ void SetString(CommandLinePrefStore* prefs,
const std::string& value) {
prefs->SetValue(
key,
make_scoped_ptr(new base::StringValue(value)),
base::WrapUnique(new base::StringValue(value)),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
}
@@ -286,7 +289,7 @@ void SetBool(CommandLinePrefStore* prefs,
const std::string& key,
bool value) {
prefs->SetValue(key,
make_scoped_ptr(new base::FundamentalValue(value)),
base::WrapUnique(new base::FundamentalValue(value)),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
}

View File

@@ -13,7 +13,7 @@
#include "base/location.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/utf_string_conversions.h"
#include "base/thread_task_runner_handle.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/timer/timer.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"

View File

@@ -33,13 +33,14 @@
namespace {
void SendExecuteMimeTypeHandlerEvent(std::unique_ptr<content::StreamInfo> stream,
int64_t expected_content_size,
int render_process_id,
int render_frame_id,
const std::string& extension_id,
const std::string& view_id,
bool embedded) {
void SendExecuteMimeTypeHandlerEvent(
std::unique_ptr<content::StreamInfo> stream,
int64_t expected_content_size,
int render_process_id,
int render_frame_id,
const std::string& extension_id,
const std::string& view_id,
bool embedded) {
CEF_REQUIRE_UIT();
CefRefPtr<CefBrowserHostImpl> browser =
@@ -86,10 +87,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

@@ -198,12 +198,6 @@ void CefSpeechRecognitionManagerDelegate::OnAudioLevelsChange(
void CefSpeechRecognitionManagerDelegate::OnRecognitionEnd(int session_id) {
}
void CefSpeechRecognitionManagerDelegate::GetDiagnosticInformation(
bool* can_report_metrics,
std::string* hardware_info) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
}
void CefSpeechRecognitionManagerDelegate::CheckRecognitionIsAllowed(
int session_id,
base::Callback<void(bool ask_user, bool is_allowed)> callback) {

View File

@@ -7,7 +7,6 @@
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "content/public/browser/speech_recognition_event_listener.h"
#include "content/public/browser/speech_recognition_manager_delegate.h"
@@ -39,8 +38,6 @@ class CefSpeechRecognitionManagerDelegate
float noise_volume) override;
// SpeechRecognitionManagerDelegate methods.
void GetDiagnosticInformation(bool* can_report_metrics,
std::string* hardware_info) override;
void CheckRecognitionIsAllowed(
int session_id,
base::Callback<void(bool ask_user, bool is_allowed)> callback) override;

View File

@@ -10,7 +10,6 @@
#include "base/files/file_path.h"
#include "base/memory/ref_counted_memory.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
// May only be accessed on the browser process UI thread.

View File

@@ -267,8 +267,9 @@ std::unique_ptr<CefJavaScriptDialogRunner>
return native_delegate_->CreateJavaScriptDialogRunner();
}
std::unique_ptr<CefMenuRunner> CefBrowserPlatformDelegateViews::CreateMenuRunner() {
return make_scoped_ptr(new CefMenuRunnerViews(browser_view_.get()));
std::unique_ptr<CefMenuRunner>
CefBrowserPlatformDelegateViews::CreateMenuRunner() {
return base::WrapUnique(new CefMenuRunnerViews(browser_view_.get()));
}
bool CefBrowserPlatformDelegateViews::IsWindowless() const {

View File

@@ -6,12 +6,12 @@
#include "libcef/browser/views/view_util.h"
#include "ui/gfx/screen.h"
#include "ui/display/screen.h"
// static
CefRefPtr<CefDisplay> CefDisplay::GetPrimaryDisplay() {
CEF_REQUIRE_UIT_RETURN(nullptr);
return new CefDisplayImpl(gfx::Screen::GetScreen()->GetPrimaryDisplay());
return new CefDisplayImpl(display::Screen::GetScreen()->GetPrimaryDisplay());
}
// static
@@ -36,7 +36,7 @@ CefRefPtr<CefDisplay> CefDisplay::GetDisplayMatchingBounds(
// static
size_t CefDisplay::GetDisplayCount() {
CEF_REQUIRE_UIT_RETURN(0U);
return static_cast<size_t>(gfx::Screen::GetScreen()->GetNumDisplays());
return static_cast<size_t>(display::Screen::GetScreen()->GetNumDisplays());
}
// static
@@ -45,13 +45,13 @@ void CefDisplay::GetAllDisplays(std::vector<CefRefPtr<CefDisplay> >& displays) {
displays.clear();
typedef std::vector<gfx::Display> DisplayVector;
DisplayVector vec = gfx::Screen::GetScreen()->GetAllDisplays();
typedef std::vector<display::Display> DisplayVector;
DisplayVector vec = display::Screen::GetScreen()->GetAllDisplays();
for (size_t i = 0; i < vec.size(); ++i)
displays.push_back(new CefDisplayImpl(vec[i]));
}
CefDisplayImpl::CefDisplayImpl(const gfx::Display& display)
CefDisplayImpl::CefDisplayImpl(const display::Display& display)
: display_(display) {
CEF_REQUIRE_UIT();
}

View File

@@ -9,11 +9,11 @@
#include "include/views/cef_display.h"
#include "libcef/browser/thread_util.h"
#include "ui/gfx/display.h"
#include "ui/display/display.h"
class CefDisplayImpl : public CefDisplay {
public:
explicit CefDisplayImpl(const gfx::Display& display);
explicit CefDisplayImpl(const display::Display& display);
~CefDisplayImpl() override;
// CefDisplay methods:
@@ -25,10 +25,10 @@ class CefDisplayImpl : public CefDisplay {
CefRect GetWorkArea() override;
int GetRotation() override;
const gfx::Display& display() const { return display_; }
const display::Display& display() const { return display_; }
private:
gfx::Display display_;
display::Display display_;
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefDisplayImpl);
DISALLOW_COPY_AND_ASSIGN(CefDisplayImpl);

View File

@@ -620,7 +620,8 @@ CEF_VIEW_IMPL_T bool CEF_VIEW_IMPL_D::IsEnabled() {
CEF_VIEW_IMPL_T void CEF_VIEW_IMPL_D::SetFocusable(bool focusable) {
CEF_REQUIRE_VALID_RETURN_VOID();
root_view()->SetFocusable(focusable);
root_view()->SetFocusBehavior(focusable ? views::View::FocusBehavior::ALWAYS :
views::View::FocusBehavior::NEVER);
}
CEF_VIEW_IMPL_T bool CEF_VIEW_IMPL_D::IsFocusable() {

View File

@@ -12,13 +12,14 @@
#include "ui/aura/window_tree_host.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/point_conversions.h"
#include "ui/gfx/screen.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
#include "ui/views/window/non_client_view.h"
#if defined(OS_WIN)
#include "ui/gfx/win/dpi.h"
#include "ui/display/win/screen_win.h"
#endif
namespace view_util {
@@ -180,24 +181,26 @@ CefRefPtr<CefWindow> GetWindowFor(views::Widget* widget) {
return window;
}
gfx::Display GetDisplayNearestPoint(const gfx::Point& point,
bool input_pixel_coords) {
display::Display GetDisplayNearestPoint(const gfx::Point& point,
bool input_pixel_coords) {
gfx::Point find_point = point;
#if defined(OS_WIN)
if (input_pixel_coords)
find_point = gfx::win::ScreenToDIPPoint(point);
find_point = display::win::ScreenWin::ScreenToDIPPoint(point);
#endif
return gfx::Screen::GetScreen()->GetDisplayNearestPoint(find_point);
return display::Screen::GetScreen()->GetDisplayNearestPoint(find_point);
}
gfx::Display GetDisplayMatchingBounds(const gfx::Rect& bounds,
bool input_pixel_coords) {
display::Display GetDisplayMatchingBounds(const gfx::Rect& bounds,
bool input_pixel_coords) {
gfx::Rect find_bounds = bounds;
#if defined(OS_WIN)
if (input_pixel_coords)
find_bounds = gfx::win::ScreenToDIPRect(find_bounds);
if (input_pixel_coords) {
find_bounds = display::win::ScreenWin::ScreenToDIPRect(nullptr,
find_bounds);
}
#endif
return gfx::Screen::GetScreen()->GetDisplayMatching(bounds);
return display::Screen::GetScreen()->GetDisplayMatching(find_bounds);
}
void ConvertPointFromPixels(gfx::Point* point,
@@ -221,7 +224,7 @@ bool ConvertPointToScreen(views::View* view,
views::View::ConvertPointToScreen(view, point);
if (output_pixel_coords) {
const gfx::Display& display = GetDisplayNearestPoint(*point, false);
const display::Display& display = GetDisplayNearestPoint(*point, false);
ConvertPointToPixels(point, display.device_scale_factor());
}
@@ -235,7 +238,7 @@ bool ConvertPointFromScreen(views::View* view,
return false;
if (input_pixel_coords) {
const gfx::Display& display = GetDisplayNearestPoint(*point, true);
const display::Display& display = GetDisplayNearestPoint(*point, true);
ConvertPointFromPixels(point, display.device_scale_factor());
}

View File

@@ -11,8 +11,11 @@
#include "ui/views/view.h"
namespace gfx {
namespace display {
class Display;
}
namespace gfx {
class Point;
}
@@ -70,14 +73,14 @@ CefRefPtr<CefWindow> GetWindowFor(views::Widget* widget);
// Returns the Display nearest |point|. Set |input_pixel_coords| to true if
// |point| is in pixel coordinates instead of density independent pixels (DIP).
gfx::Display GetDisplayNearestPoint(const gfx::Point& point,
bool input_pixel_coords);
display::Display GetDisplayNearestPoint(const gfx::Point& point,
bool input_pixel_coords);
// Returns the Display that most closely intersects |bounds|. Set
// |input_pixel_coords| to true if |bounds| is in pixel coordinates instead of
// density independent pixels (DIP).
gfx::Display GetDisplayMatchingBounds(const gfx::Rect& bounds,
bool input_pixel_coords);
display::Display GetDisplayMatchingBounds(const gfx::Rect& bounds,
bool input_pixel_coords);
// Convert |point| from pixel coordinates to density independent pixels (DIP)
// using |device_scale_factor|.

View File

@@ -24,7 +24,7 @@
#endif
#if defined(OS_WIN)
#include "ui/gfx/win/dpi.h"
#include "ui/display/win/screen_win.h"
#endif
namespace {
@@ -379,7 +379,7 @@ void CefWindowImpl::CancelMenu() {
CefRefPtr<CefDisplay> CefWindowImpl::GetDisplay() {
CEF_REQUIRE_VALID_RETURN(nullptr);
if (widget_ && root_view()) {
const gfx::Display& display = root_view()->GetDisplay();
const display::Display& display = root_view()->GetDisplay();
if (display.is_valid())
return new CefDisplayImpl(display);
}
@@ -444,7 +444,7 @@ void CefWindowImpl::SendMouseMove(int screen_x, int screen_y) {
gfx::Point point(screen_x, screen_y);
#if defined(OS_WIN)
// Windows expects pixel coordinates.
point = gfx::win::DIPToScreenPoint(point);
point = display::win::ScreenWin::DIPToScreenPoint(point);
#endif
ui_controls::SendMouseMove(point.x(), point.y());

View File

@@ -18,7 +18,7 @@
#endif
#if defined(OS_WIN)
#include "ui/gfx/win/dpi.h"
#include "ui/display/screen.h"
#include "ui/views/win/hwnd_util.h"
#endif
@@ -61,11 +61,14 @@ class NativeFrameViewEx : public views::NativeFrameView {
// views::GetWindowBoundsForClientBounds() expects the input Rect to be in
// pixel coordinates. NativeFrameView does not implement this correctly so
// we need to provide our own implementation. See http://crbug.com/602692.
gfx::Rect pixel_bounds = gfx::win::DIPToScreenRect(client_bounds);
gfx::Rect pixel_bounds =
display::Screen::GetScreen()->DIPToScreenRectInWindow(
view_util::GetNativeWindow(widget_), client_bounds);
pixel_bounds = views::GetWindowBoundsForClientBounds(
static_cast<View*>(const_cast<NativeFrameViewEx*>(this)),
pixel_bounds);
return gfx::win::ScreenToDIPRect(pixel_bounds);
return display::Screen::GetScreen()->ScreenToDIPRectInWindow(
view_util::GetNativeWindow(widget_), pixel_bounds);
#else
// Use the default implementation.
return views::NativeFrameView::GetWindowBoundsForClientBounds(
@@ -427,13 +430,13 @@ void CefWindowView::ViewHierarchyChanged(
ParentClass::ViewHierarchyChanged(details);
}
gfx::Display CefWindowView::GetDisplay() const {
display::Display CefWindowView::GetDisplay() const {
const views::Widget* widget = GetWidget();
if (widget) {
return view_util::GetDisplayMatchingBounds(
widget->GetWindowBoundsInScreen(), false);
}
return gfx::Display();
return display::Display();
}
void CefWindowView::SetTitle(const base::string16& title) {

View File

@@ -11,7 +11,7 @@
#include "libcef/browser/views/panel_view.h"
#include "ui/gfx/display.h"
#include "ui/display/display.h"
#include "ui/views/widget/widget_delegate.h"
class SkRegion;
@@ -71,7 +71,7 @@ class CefWindowView :
const views::View::ViewHierarchyChangedDetails& details) override;
// Returns the Display containing this Window.
gfx::Display GetDisplay() const;
display::Display GetDisplay() const;
// Set/get the window title.
void SetTitle(const base::string16& title);

View File

@@ -27,6 +27,7 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "components/component_updater/component_updater_paths.h"
#include "components/content_settings/core/common/content_settings_pattern.h"
#include "content/public/browser/browser_main_runner.h"
#include "content/public/browser/render_process_host.h"
@@ -35,6 +36,7 @@
#include "extensions/common/constants.h"
#include "pdf/pdf.h"
#include "ui/base/layout.h"
#include "ui/base/material_design/material_design_controller.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_paths.h"
#include "ui/base/ui_base_switches.h"
@@ -558,21 +560,23 @@ void CefMainDelegate::PreSandboxStartup() {
false, // May not be an absolute path.
true); // Create if necessary.
const base::FilePath& resources_path = GetResourcesFilePath();
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
const base::FilePath& widevine_plugin_path =
GetResourcesFilePath().AppendASCII(kWidevineCdmAdapterFileName);
resources_path.AppendASCII(kWidevineCdmAdapterFileName);
if (base::PathExists(widevine_plugin_path)) {
PathService::Override(chrome::FILE_WIDEVINE_CDM_ADAPTER,
widevine_plugin_path);
}
#if defined(WIDEVINE_CDM_IS_COMPONENT)
if (command_line->HasSwitch(switches::kEnableWidevineCdm)) {
PathService::Override(
chrome::DIR_COMPONENT_WIDEVINE_CDM,
user_data_path.Append(FILE_PATH_LITERAL("WidevineCDM")));
}
#endif // defined(WIDEVINE_CDM_IS_COMPONENT)
#endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
// Paths to find pre-installed components.
PathService::Override(chrome::DIR_COMPONENTS, resources_path);
// Register paths to be used by the component updater.
component_updater::RegisterPathProvider(chrome::DIR_COMPONENTS,
chrome::DIR_USER_DATA);
}
if (command_line->HasSwitch(switches::kDisablePackLoading))
@@ -709,6 +713,9 @@ void CefMainDelegate::InitializeResourceBundle() {
std::string locale = command_line->GetSwitchValueASCII(switches::kLang);
DCHECK(!locale.empty());
// Avoid DCHECK() in ResourceBundle::LoadChromeResources().
ui::MaterialDesignController::Initialize();
const std::string loaded_locale =
ui::ResourceBundle::InitSharedInstanceWithLocale(
locale,

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