Compare commits

..

111 Commits
2454 ... 2623

Author SHA1 Message Date
Marshall Greenblatt
b90a3be186 Call RenderProcessHost::Send from correct thread (issue #1881) 2016-05-11 12:31:39 -04:00
Marshall Greenblatt
5b27df39b2 Fix incorrect initialization of WebCursor object (issue #1894) 2016-05-11 11:01:21 -04:00
Marshall Greenblatt
64e2fe1d2b Fix assertion when only video or audio capture is selected (issue #1802) 2016-05-09 16:20:43 -04:00
Marshall Greenblatt
93f810339f Enable unified text checker to match Chrome spellcheck behavior (issue #1891) 2016-05-09 14:14:53 -04:00
Marshall Greenblatt
af139d7761 make_distrib.py: Look for libcef instead of cefclient when running with --allow-partial (issue #1804) 2016-03-31 15:32:15 +02:00
Marshall Greenblatt
0451528779 Update to Chromium version 49.0.2623.110 2016-03-29 13:16:02 +02:00
Marshall Greenblatt
3034273cb9 Linux: Don't try to resolve missing package dependencies when use_sysroot==1 (issue #1804) 2016-03-10 09:33:21 -08:00
Marshall Greenblatt
2a6491bf8d Update to Chromium version 49.0.2623.87 2016-03-09 18:34:24 -05:00
Marshall Greenblatt
9e0fda80bd Add patch file for overlay scroll bar color fix 2016-03-04 12:44:03 -05:00
Marshall Greenblatt
c59d47ad9e Fix duplicate entries in CefRequest header map (issue #1840) 2016-03-01 19:12:21 -05:00
Marshall Greenblatt
fc96ca576f Fix documentation errors (issue #1834) 2016-03-01 17:26:52 -05:00
Marshall Greenblatt
44fcb48baa Fix thread safety issue with CefBrowserHostImpl::IsWindowless 2016-02-29 15:25:45 -05:00
Marshall Greenblatt
483cb2ea69 Update to Chromium version 49.0.2623.54 2016-02-24 14:19:19 -08:00
Marshall Greenblatt
969ebf0ca9 Windows: cmake: Add ws2_32.lib to CEF_STANDARD_LIBS (issue #1842) 2016-02-24 12:55:43 -05:00
Marshall Greenblatt
820e629774 Windows: cmake: Disable VS2010 override warning (issue #1642) 2016-02-24 12:55:34 -05:00
Marshall Greenblatt
3c1f28b051 Add missing values to cef_resource_type_t 2016-02-24 12:43:30 -05:00
Marshall Greenblatt
ce1e9e65fd Add DNS resolution methods to CefRequestContext (issue #1841) 2016-02-23 18:38:24 -05:00
Marshall Greenblatt
cd7e8a0558 Allow clients to clear certificate exceptions and close connections (issue #1793) 2016-02-23 15:08:39 -05:00
Marshall Greenblatt
912e94bf61 Continue OnDownloadUpdated notifications after navigation (issue #1833) 2016-02-16 13:51:48 -05:00
Marshall Greenblatt
d300dc43d9 Update to Chromium version 49.0.2623.28 2016-02-03 15:35:01 -05:00
Marshall Greenblatt
70ab57ab23 Update to Chromium revision 92d77538 (#369907) 2016-02-02 22:16:48 -05:00
Marshall Greenblatt
d6fa9ed3e3 Windows: Disable use of FMA3 versions of CRT functions on x64 (issue #1410) 2016-01-28 11:16:14 -05:00
Marshall Greenblatt
c3d80a5658 Always pass callback object to CefRequestHandler::OnCertificateError (issue #1795) 2016-01-27 12:57:48 -05:00
Marshall Greenblatt
63d313de76 Persist visited link status (issue #287) 2016-01-13 15:38:50 -05:00
Marshall Greenblatt
6d7ee1e084 Add --built-target option to automate-git.py (issue #1804) 2016-01-11 13:55:46 -05:00
Marshall Greenblatt
d829e80f5e Fix compile error in cef_thread_checker.h due to DCHECK_IS_ON not being defined in some cases. 2016-01-08 17:47:24 -05:00
Marshall Greenblatt
c1efd5b5be Linux: Fix pkg-config execution with custom sysroot (issue #1804) 2016-01-08 11:50:34 -08:00
Marshall Greenblatt
ff8c5a6caa Update generated file copyright year 2016-01-08 14:00:27 -05:00
Marshall Greenblatt
d2372c3d11 Update to Chromium revision d7d5682a (#367535) 2016-01-07 11:53:39 -08:00
Marshall Greenblatt
12f19e3a33 Expose additional SSL certificate information.
- Provide access to the full certificate issuer chain (issue #1530)
- Add several missing certificate error codes to cef_errorcode_t (issue #1784)
- Provide the full certificate status bitmask (issue #1790)
2015-12-18 14:05:42 -05:00
Marshall Greenblatt
07e845ed31 CefRequestHandler::GetAuthCredentials |scheme| argument is optional for FTP sources (issue #1794) 2015-12-17 13:24:22 -05:00
Marshall Greenblatt
ae25a352d0 Linux: Fix compile error due to Chromium update (issue #1788) 2015-12-14 14:57:29 -05:00
Marshall Greenblatt
5dec0c5f57 Update to Chromium revision c78c0ad7 (#363565) 2015-12-10 12:45:26 -05:00
Marshall Greenblatt
535c4fbc30 tools: Add --patch argument to patch_updater.py 2015-12-08 14:14:09 -05:00
Marshall Greenblatt
f207a555a3 Add support for response filtering (issue #515).
- Add a new CefRequestHandler::GetResourceResponseFilter method and
  CefResponseFilter class.
2015-12-08 13:47:52 -05:00
Marshall Greenblatt
864db71f6b Mac: Fix Xcode 7 (10.11 SDK) build errors (issue #1732) 2015-12-08 12:59:42 -05:00
Marshall Greenblatt
626fc561ca Add new CefRequestHandler::OnResourceLoadComplete callback (issue #1781) 2015-12-04 13:59:14 -05:00
Marshall Greenblatt
bd6e656747 cefsimple: Only instantiate SimpleApp in the browser process (issue #1776) 2015-12-03 17:27:32 -05:00
Marshall Greenblatt
b4a159a1da Add CommandLineTest.IgnorePrefixes unit test to verify prefix removal behavior (issue #1778) 2015-12-03 17:13:23 -05:00
Marshall Greenblatt
aaa5563582 Windows: Add CMake configuration option in the binary distribution to support /Z7 (issue #385) 2015-12-03 16:32:39 -05:00
Marshall Greenblatt
06e1a34850 Consider scale factor changes to OSR browsers when switching monitors (issue #1774) 2015-12-03 15:24:41 -05:00
Marshall Greenblatt
667f0edcf4 Do not remove OSR transparency when switching monitors (issue #1775) 2015-12-03 15:15:32 -05:00
Marshall Greenblatt
903e296621 Set visibility state correctly after OSR renderer process crashes and avoid DCHECKs (issue #1779) 2015-12-03 14:48:26 -05:00
Marshall Greenblatt
6824387c8d Allow blank URL when creating popup windows (issue #1289) 2015-12-03 13:41:40 -05:00
Marshall Greenblatt
26e68c3d26 Fix crash when receiving a title change notification without a navigation entry (issue #1764) 2015-12-03 13:40:16 -05:00
Marshall Greenblatt
9bc8da1e02 - Add CefPostData::HasExcludedElements which returns true if the underlying
POST data includes elements that are not represented (issue #1761).
- Add CefRequest::SetReferrer and CefRequest::GetReferrer[URL|Policy]. The
  Referer value will no longer be stored in the header map.
- Move request-related conversion logic to CefRequestImpl and standardize the
  implementation.
2015-12-02 17:23:16 -05:00
Marshall Greenblatt
2a658c414b Windows: Fix AtExitManager assertions on shutdown when running with multi-threaded message loop (issue #1680) 2015-11-25 22:46:08 -05:00
Marshall Greenblatt
269aaa2c3c Move network-related code to net/ folder 2015-11-25 21:53:12 -05:00
Marshall Greenblatt
6cccc3b8a7 - Factor platform-specific code out of CefBrowserHostImpl (issue #1749).
- Introduce native/ and osr/ folders for native (non-platform-agnostic) and
    osr (windowless) code respectively.
  - Introduce CefBrowserPlatformDelegate for abstracting platform-specific
    implementations of browser host functionality.
  - Move dialog and menu code to separate manager and platform-specific runner
    implementations exposed via CefBrowserPlatformDelegate.
  - Standardize focus-handling behavior between windowed and windowless
    implementations. CefFocusHandler::OnSetFocus() will now also be called for
    osr focus changes.
- Support multiple simultaneous popups (issue #1289).
2015-11-25 20:19:36 -05:00
Marshall Greenblatt
4b5f052e13 README.md edited online with Bitbucket 2015-11-21 05:38:17 +00:00
Marshall Greenblatt
c199539747 Fix multi-part file uploads (issue #1761) 2015-11-16 17:20:34 -05:00
Marshall Greenblatt
694b45717c Windows: Fix VS2008SP1 compiler errors (issue #1758)
- override was being defined but this compiler doesn't support it.
- Warning C4355 wasn't being properly suppressed in cef_resource_manager.cc
2015-11-13 11:19:27 -05:00
Marshall Greenblatt
07d75e540f Improvements to automate-git.py for local mirror support (issue #1728)
- Add new command-line flags:
  --chromium-url: Allows overriding the synced Chromium URL.
  --no-cef-update: Allows bypassing the step to sync CEF.
  --no-chromium-update: Allows bypassing the step to sync Chromium.
  --no-depot-tools-update: Allows bypassing the step to update depot_tools.
  --distrib-subdir: Allows specifying the subdirectory name of
    chromium/src/cef/binary_distrib.
- Add support in make_distrib.py for the --distrib-subdir flag.
- Change CMake requirement from 2.8.12.2 to 2.8.12.1.
2015-11-13 11:02:17 -05:00
Marshall Greenblatt
c6111d5947 Update to Chromium revision 304f01a1 (#358063)
- Improve ordering of CefLoadHandler callbacks. OnLoadingStateChange will
  be called before and after all calls to OnLoadStart and OnLoadEnd.
  OnLoadStart/OnLoadEnd calls will occur as matching pairs
  (see http://crbug.com/539952#c2).
- Remove the |requesting_url| argument to CefGeolocationHandler::
  OnCancelGeolocationPermission. Clients can use the |request_id| argument
  to track this information themselves.
- Fix a crash when loading the PDF extension in multiple browsers with a
  custom CefRequestContext (issue #1757).
2015-11-11 18:24:00 -05:00
Marshall Greenblatt
e0974ea64d Add |has_external_parent| flag in Chromium patches to avoid behavior changes
when the widget is not parented to an external window (issue #1749).
2015-10-26 18:17:32 -04:00
Marshall Greenblatt
1f86d24d48 Use a reasonable default log file location if none is specified (issue #1757) 2015-10-23 18:32:40 -04:00
Marshall Greenblatt
b731133713 Windows: cefclient: Size browser window correctly when RootWindow is initially shown as maximized (issue #1745) 2015-10-23 15:06:02 -04:00
Marshall Greenblatt
018f9b0f9a Mac: Fix positioning of default open/save dialog (issue #1740) 2015-10-22 10:02:25 -04:00
Marshall Greenblatt
211c81cb14 CTRL + left click on a link in a PDF document should call OnOpenURLFromTab (issue #1737) 2015-10-21 17:06:53 -04:00
Marshall Greenblatt
936e595fe5 - Support runtime configuration of renderer-related preferences (issue #1501).
- Persist modified user preferences including per-host zoom settings when a
  cache_path value is specified and persist_user_preferences is set to true
  via CefSettings or CefRequestContextSettings.
- Avoid the need to duplicate files from chrome/ by having CefBrowserContext
  extend Chrome's Profile class.
2015-10-20 11:12:21 -04:00
Marshall Greenblatt
487ea8a99d Restore previous CefFrame::GetText behavior (issue #1743) 2015-10-15 13:16:45 -04:00
Marshall Greenblatt
19b61ec391 Add missing touch menu resources (issue #1739) 2015-10-15 10:37:05 -04:00
Marshall Greenblatt
5033a27e58 Fix navigation from inside PDF files (issue #1737) 2015-10-14 15:27:05 -04:00
Marshall Greenblatt
efbc200b51 Linux: Fix focus/activation handling and keyboard input (issue #1679). 2015-10-14 09:46:42 -07:00
Marshall Greenblatt
fdf3088470 Linux: Fix BadWindow error when creating popup windows (issue #1717). 2015-10-14 09:46:02 -07:00
Marshall Greenblatt
16f8a66040 - Fix use-after-return in ReleaseAndWaitForDestructor if it times out
while running unit tests.
- Increase PluginTest PDF load timeout.
2015-10-14 09:42:44 -07:00
Marshall Greenblatt
70ed95bcca base: Change DCHECK_IS_ON to a macro DCHECK_IS_ON() to match Chromium
changes (see http://crrev.com/e649f573) and fix unit test runtime
errors when building with GYP_DEFINES=dcheck_always_on=1.
2015-10-14 09:40:59 -07:00
Marshall Greenblatt
3f4687a4cd Fix parsing of CefResourceManager::Request::url() when both query
and fragment components are present (issue #1733)
2015-10-13 16:51:52 -04:00
Marshall Greenblatt
1f21fe5412 Add CefPrintHandler::OnPrintStart callback (issue #1736) 2015-10-13 14:04:02 -04:00
Marshall Greenblatt
f7d9457c20 Fix extension resource access permissions (issue #1719) 2015-10-12 14:13:13 -04:00
Marshall Greenblatt
dd0bb98c22 Remove final keyword to fix builds with non-C++11 compilers (issue #1725) 2015-10-12 12:43:04 -04:00
Marshall Greenblatt
8aac23386e Update to Chromium revision cb947c01 (#352221)
- Implement CefRequestHandler::OnBeforeBrowse using NavigationThrottle
  instead of ResourceThrottle (see http://crbug.com/537634). The CefRequest
  object passed to OnBeforeBrowse will no longer have an associated request
  identifier.
- Mac: Remove additional helper apps which are no longer required (see
  http://crbug.com/520680)
- Remove the UR_FLAG_REPORT_RAW_HEADERS flag which is no longer supported (see
  http://crbug.com/517114)
- Remove the CefBrowserSettings.java parameter. Java is an NPAPI plugin and
  NPAPI plugins are no longer supported (see http://crbug.com/470301#c11)
- Add CefFormatUrlForSecurityDisplay function in cef_parser.h
- Fix crash when passing `--disable-extensions` command-line flag (issue #1721)
- Linux: Fix NSS handler loading (issue #1727)
2015-10-09 17:31:27 -04:00
Marshall Greenblatt
5780ea8baa Support configuration of preferences during runtime (issue #1709)
- Preferences are now associated with a CefRequestContext instead of
  being stored globally.
- Add methods to CefRequestContext for getting/setting preferences.
2015-10-06 18:14:11 -04:00
Marshall Greenblatt
2328b9be39 cefclient: Remove accidental change disabling plugin load (issue #1708) 2015-10-01 11:29:33 -04:00
Marshall Greenblatt
4149192d81 Call OnBeforePluginLoad when building the plugin list (issue #1708) 2015-09-30 18:09:28 -04:00
Marshall Greenblatt
a33720558e Don't create Widevine-related folders when Widevine support is disabled (issue #1713) 2015-09-24 11:35:42 +03:00
Marshall Greenblatt
74dfd9ad81 Mac: Fix background color (issue #1161) 2015-09-22 13:23:33 +02:00
Marshall Greenblatt
dc3aae19e8 Add plugin placeholder and policy support (issue #1708)
- Default plugin loading policy can be specified using the new
  `--plugin-policy=[allow|block|detect]` command-line flag.
- Move CefRequestHandler::OnBeforePluginLoad to
  CefRequestContextHandler and add a new policy argument that
  supports different actions (allow, block, detect, disable) on a
  per-plugin-instance basis.
- Add CefContextMenuHandler::RunContextMenu for providing a custom
  context menu implementation.
- Add CefResourceBundleHandler::GetDataResourceForScale for
  returning scaled resources (issue #1272).
- Add CefResourceBundle for retrieving resources from the resource
  bundle (*.pak) files loaded by CEF during startup or via the
  CefResourceBundleHandler.
- Linux: Fix Debug build IO access warning with CefGetMimeType.
- cef_unittests: Move the refcounting implementation from TestHandler
  to subclasses in order to support interface inheritance from
  subclasses.
2015-09-22 12:28:46 +03:00
Marshall Greenblatt
846107b291 Windows: Fix warning treated as error with Widevine CDM 64-bit build (issue #1631) 2015-09-16 13:37:58 +03:00
Marshall Greenblatt
2c3d761ad0 Fix PDF extension loading with custom request context handler (issue #1710) 2015-09-11 14:23:19 +02:00
Marshall Greenblatt
e343da7e40 Fix crash with OSR when the render process terminates (issue #1702) 2015-09-07 15:20:39 +02:00
Marshall Greenblatt
3640f81f01 Add Widevine CDM support (issue #1631)
- Windows/Mac: Use `--enable-widevine-cdm` command-line flag to
  enable download of CDM binaries via the component updater.
- Linux: Use `--widevide-cdm-path` and `--widevine-cdm-version`
  command-line flags to load CDM binaries that already exist on
  the system.
- A cache-path value is usually required when CDM is enabled.
2015-09-01 14:04:21 +02:00
Marshall Greenblatt
4a8546efd7 Windows: Fix focus/activation handling and keyboard input (issue #1700) 2015-08-27 20:09:19 -04:00
Marshall Greenblatt
c2086cf7c7 Mac: Fix 10.10 SDK compile and test errors (issue #1414) 2015-08-26 16:39:09 -04:00
Marshall Greenblatt
9af98fab45 Update to Chromium revision 788460a4 (#345352)
- Mac: 10.10 SDK is now required for building (see http://crbug.com/463170#c63).
  Older SDKs can be used for a short time by setting mac_sdk_min via GYP_DEFINES.
2015-08-26 12:42:54 -04:00
Marshall Greenblatt
aa72f402ba Always save cookies for http, https, ws and wss schemes (issue #1684) 2015-08-21 16:38:19 -04:00
Marshall Greenblatt
e6e123d503 Windows: Fix warning C4267: 'argument' : conversion from 'size_t' to 'int' (issue #1695) 2015-08-21 13:55:13 -04:00
Marshall Greenblatt
9ec03906a8 Don't execute URLRequest callback for already canceled requests (issue #1685) 2015-08-20 17:05:14 -04:00
Marshall Greenblatt
1999a3f237 Don't render the OSR parent view when a full-screen view is visible (issue #1694) 2015-08-20 12:28:48 -07:00
Marshall Greenblatt
b543d3217d Windows: Fix incorrect usage of MAKEINTRESOURCE (issue #1692) 2015-08-20 13:14:14 -04:00
Marshall Greenblatt
f4e579f1e8 Remove C++11 "= default" to maintain compatibility with older VS versions (issue #1693) 2015-08-20 10:50:11 -04:00
Marshall Greenblatt
fda35eae80 Windows: Fix VS2015 build errors in the binary distribution (issue #1692) 2015-08-20 10:22:12 -04:00
Marshall Greenblatt
cd7e0eef20 Fix rendering of the PDF extension with OSR when the device scale factor is not 1 (issue #1687) 2015-08-19 12:40:38 -07:00
Marshall Greenblatt
39020fb2ea Fix duplicate/incorrect type defines (issue #1683) 2015-08-17 20:59:36 -04:00
Marshall Greenblatt
614e2a5b7e Add missing OVERRIDE specifier to avoid compile errors with clang 3.6 (issue #1688) 2015-08-17 19:06:43 -04:00
Marshall Greenblatt
aef9fd486a cefclient: Set recommended command-line switches for off-screen rendering 2015-08-17 18:14:59 -04:00
Marshall Greenblatt
4b491c3a77 Fix assertion when loading the PDF extension with begin-frame-scheduling and OSR (issue #1686) 2015-08-17 15:50:04 -04:00
Marshall Greenblatt
a63d646e3b Update to Chromium revision fc6ad471 (#342568) 2015-08-14 14:42:03 -04:00
Marshall Greenblatt
a08686e6a6 cefclient: Support dynamic configuration of the device scale factor with off-screen rendering (issue #1674) 2015-08-11 14:19:16 -04:00
Marshall Greenblatt
41669141eb Windows: cefclient: Improve high-dpi display (issue #1674).
- Add high-dpi support to the OSR example.
- Apply DPI scaling to the buttons and URL bar.
2015-08-10 14:08:15 -04:00
Marshall Greenblatt
9e0d84d94a Windows: Add CefEnableHighDPISupport function and fix high-dpi scaling issues (issue #1674) 2015-08-07 16:04:03 -04:00
Marshall Greenblatt
2792d1bb12 Linux: Fix undefined reference to 'AtomicOps_Internalx86CPUFeatures' (issue #1681) 2015-08-07 15:13:49 -04:00
Marshall Greenblatt
828fe45bc1 Linux: Fix Debug build IO access warning (issue #1565) 2015-08-07 15:08:52 -04:00
Marshall Greenblatt
560b881a2f Add missing kSpellCheckDictionaries preference (issue #1682) 2015-08-07 15:04:50 -04:00
Marshall Greenblatt
6cb3be7395 Windows: Fix crash on startup with multi-threaded-message-loop (issue #1678) 2015-08-05 13:24:01 -04:00
Marshall Greenblatt
3010ee1ce6 Windows: Fix focus/blur handling (issue #1677) 2015-08-04 13:53:59 -04:00
Marshall Greenblatt
5f0720e096 Fix loading of the DevTools window.
- The devtools.html file has been renamed to inspector.html.
2015-07-31 16:54:57 -04:00
Marshall Greenblatt
96e116de9e Windows: Fix multiple handling of WM_MOUSEWHEEL messages (issue #1481) 2015-07-31 14:45:31 -04:00
Marshall Greenblatt
84c7b0ad8a Add CHECK() to verify that the resources directory is an absolute path (issue #1673) 2015-07-29 12:13:14 -04:00
Marshall Greenblatt
322d697169 Linux: Remove DCHECK hit when initializing CEF from a non-main thread (issue #1639) 2015-07-29 12:04:19 -04:00
Marshall Greenblatt
c992ef9d57 Update automate-git.py for removal of .DEPS.git in newer branches (issue #1671) 2015-07-27 13:43:43 -04:00
860 changed files with 22341 additions and 9502 deletions

View File

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

View File

@@ -40,7 +40,7 @@
#
# The below requirements must be met to build this CEF binary distribution.
#
# - CMake version 2.8.12.2 or newer.
# - CMake version 2.8.12.1 or newer.
#
# - Linux requirements:
# Currently supported distributions include Debian Wheezy, Ubuntu Precise, and
@@ -121,7 +121,7 @@
# Shared configuration.
#
cmake_minimum_required(VERSION 2.8.12.2)
cmake_minimum_required(VERSION 2.8.12.1)
# Only generate Debug and Release configuration types.
set(CMAKE_CONFIGURATION_TYPES Debug Release)
@@ -333,7 +333,7 @@ if(OS_MACOSX)
# -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,-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
@@ -379,22 +379,25 @@ endif()
#
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
# /Zi = Enable program database
# /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- /Zi /W4 /WX /wd\"4100\" /wd\"4127\" /wd\"4244\" /wd\"4512\" /wd\"4701\" /wd\"4702\" /wd\"4996\"")
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
@@ -421,7 +424,7 @@ if(OS_WINDOWS)
-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")
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")

View File

@@ -5,6 +5,7 @@ The Chromium Embedded Framework (CEF) is a simple framework for embedding Chromi
* Project Page - https://bitbucket.org/chromiumembedded/cef
* Tutorial - https://bitbucket.org/chromiumembedded/cef/wiki/Tutorial
* General Usage - https://bitbucket.org/chromiumembedded/cef/wiki/GeneralUsage
* Master Build Quick-Start - https://bitbucket.org/chromiumembedded/cef/wiki/MasterBuildQuickStart
* Branches and Building - https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
* Support Forum - http://www.magpcss.org/ceforum/
* CEF1 C++ API Docs - http://magpcss.org/ceforum/apidocs/

399
cef.gyp
View File

@@ -4,16 +4,17 @@
{
'variables': {
'pkg-config': 'pkg-config',
'chromium_code': 1,
'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/cef',
'about_credits_file': '<(SHARED_INTERMEDIATE_DIR)/about_credits.html',
'framework_name': 'Chromium Embedded Framework',
'commit_number': '<!(python tools/commit_number.py)',
'chrome_version': '<!(python ../build/util/version.py -f ../chrome/VERSION -t "@MAJOR@.@MINOR@.@BUILD@.@PATCH@")',
# Need to be creative to match dylib version formatting requirements.
'version_mac_dylib':
'<!(python ../build/util/version.py -f VERSION -f ../chrome/VERSION -t "@CEF_MAJOR@<(commit_number).@BUILD_HI@.@BUILD_LO@" -e "BUILD_HI=int(BUILD)/256" -e "BUILD_LO=int(BUILD)%256")',
# For some reason we don't get the 'use_sysroot' default from common.gypi so
# set it here as well.
'use_sysroot%': 0,
},
'includes': [
# Bring in the source file lists.
@@ -153,22 +154,6 @@
'action': ['../build/mac/tweak_info_plist.py',
'--scm=1'],
},
{
# This postbuid step is responsible for creating the following
# helpers:
#
# cefclient Helper EH.app and cefclient Helper NP.app are created
# from cefclient Helper.app.
#
# The EH helper is marked for an executable heap. The NP helper
# is marked for no PIE (ASLR).
'postbuild_name': 'Make More Helpers',
'action': [
'../build/mac/make_more_helpers.sh',
'Frameworks',
'cefclient',
],
},
],
'link_settings': {
'libraries': [
@@ -181,7 +166,10 @@
'<@(cefclient_sources_mac)',
],
}],
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
[ '(OS=="linux" or OS=="freebsd" or OS=="openbsd") and use_sysroot==0', {
# Required packages are not available when using the default sysroot
# environment. Consequently the cefclient target cannot be built with
# use_sysroot==1.
'dependencies': [
'gtk',
'gtkglext',
@@ -337,22 +325,6 @@
'action': ['../build/mac/tweak_info_plist.py',
'--scm=1'],
},
{
# This postbuid step is responsible for creating the following
# helpers:
#
# cefsimple Helper EH.app and cefsimple Helper NP.app are created
# from cefsimple Helper.app.
#
# The EH helper is marked for an executable heap. The NP helper
# is marked for no PIE (ASLR).
'postbuild_name': 'Make More Helpers',
'action': [
'../build/mac/make_more_helpers.sh',
'Frameworks',
'cefsimple',
],
},
],
'link_settings': {
'libraries': [
@@ -428,6 +400,7 @@
'tests/unittests/os_rendering_unittest.cc',
'tests/unittests/parser_unittest.cc',
'tests/unittests/plugin_unittest.cc',
'tests/unittests/preference_unittest.cc',
'tests/unittests/print_unittest.cc',
'tests/unittests/process_message_unittest.cc',
'tests/unittests/request_context_unittest.cc',
@@ -557,22 +530,6 @@
'action': ['../build/mac/tweak_info_plist.py',
'--scm=1'],
},
{
# This postbuid step is responsible for creating the following
# helpers:
#
# cefclient Helper EH.app and cefclient Helper NP.app are created
# from cefclient Helper.app.
#
# The EH helper is marked for an executable heap. The NP helper
# is marked for no PIE (ASLR).
'postbuild_name': 'Make More Helpers',
'action': [
'../build/mac/make_more_helpers.sh',
'Frameworks',
'cef_unittests',
],
},
],
'link_settings': {
'libraries': [
@@ -660,10 +617,11 @@
'target_name': 'cef_locales',
'type': 'none',
'dependencies': [
'<(DEPTH)/ui/strings/ui_strings.gyp:ui_strings',
'<(DEPTH)/chrome/chrome_resources.gyp:platform_locale_settings',
'<(DEPTH)/components/components_strings.gyp:components_strings',
'<(DEPTH)/content/app/strings/content_strings.gyp:content_strings',
'<(DEPTH)/extensions/extensions_strings.gyp:extensions_strings',
'<(DEPTH)/ui/strings/ui_strings.gyp:ui_strings',
'cef_strings',
],
'actions': [
@@ -686,47 +644,15 @@
},
],
},
{
'target_name': 'about_credits',
'type': 'none',
'actions': [
{
'variables': {
'generator_path': '../tools/licenses.py',
},
'action_name': 'generate_about_credits',
'inputs': [
# TODO(phajdan.jr): make licenses.py print inputs too.
'<(generator_path)',
],
'outputs': [
'<(about_credits_file)',
],
'hard_dependency': 1,
'action': ['python',
'<(generator_path)',
'credits',
'<(about_credits_file)',
],
'message': 'Generating about:credits.',
},
],
},
{
# Create the pack file for CEF resources.
'target_name': 'cef_resources',
'type': 'none',
'dependencies': [
'about_credits',
],
'actions': [
{
'action_name': 'cef_resources',
'variables': {
'grit_grd_file': 'libcef/resources/cef_resources.grd',
'grit_additional_defines': [
'-E', 'about_credits_file=<(about_credits_file)',
],
},
'includes': [ '../build/grit_action.gypi' ],
},
@@ -891,6 +817,7 @@
'action_name': 'make_pack_strings_header',
'variables': {
'header_inputs': [
'<(SHARED_INTERMEDIATE_DIR)/chrome/grit/platform_locale_settings.h',
'<(SHARED_INTERMEDIATE_DIR)/components/strings/grit/components_strings.h',
'<(SHARED_INTERMEDIATE_DIR)/content/app/strings/grit/content_strings.h',
'<(SHARED_INTERMEDIATE_DIR)/extensions/strings/grit/extensions_strings.h',
@@ -934,9 +861,10 @@
'<(DEPTH)/cef/libcef/resources/grit_stub',
'<(DEPTH)/cef/libcef/resources/grit_stub/chrome',
'<(grit_out_dir)',
'<(SHARED_INTERMEDIATE_DIR)/chrome',
'<(SHARED_INTERMEDIATE_DIR)/components',
'<(SHARED_INTERMEDIATE_DIR)/ui/resources',
'<(SHARED_INTERMEDIATE_DIR)/ui/strings',
'<(SHARED_INTERMEDIATE_DIR)/webkit',
],
'dependencies': [
'<(DEPTH)/base/base.gyp:base',
@@ -948,12 +876,19 @@
# Generate chrome/common/safe_browsing/csd.pb.h required by
# zip_analyzer_results.h via chrome_utility_messages.h
'<(DEPTH)/chrome/chrome.gyp:safe_browsing_proto',
# Generate chrome/common/features.h required by Chrome code that uses
# the BUILDFLAG() macro.
'<(DEPTH)/chrome/chrome_features.gyp:chrome_common_features',
# Generate chrome/common/chrome_version.h required by
# chrome/common/chrome_contants.cc
'<(DEPTH)/chrome/common_constants.gyp:version_header',
'<(DEPTH)/components/components.gyp:cdm_renderer',
'<(DEPTH)/components/components.gyp:component_updater',
'<(DEPTH)/components/components.gyp:content_settings_core_browser',
'<(DEPTH)/components/components.gyp:content_settings_core_common',
'<(DEPTH)/components/components.gyp:crash_component_breakpad_mac_to_be_deleted',
'<(DEPTH)/components/components.gyp:crash_component_breakpad_to_be_deleted',
'<(DEPTH)/components/components.gyp:crx_file',
'<(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:keyed_service_content',
@@ -963,12 +898,19 @@
'<(DEPTH)/components/components.gyp:pdf_renderer',
'<(DEPTH)/components/components.gyp:plugins_renderer',
'<(DEPTH)/components/components.gyp:pref_registry',
'<(DEPTH)/components/components.gyp:printing_browser',
'<(DEPTH)/components/components.gyp:printing_common',
'<(DEPTH)/components/components.gyp:printing_renderer',
'<(DEPTH)/components/components.gyp:proxy_config',
'<(DEPTH)/components/components.gyp:ssl_config',
'<(DEPTH)/components/components.gyp:update_client',
'<(DEPTH)/components/components.gyp:user_prefs',
'<(DEPTH)/components/components.gyp:version_info',
'<(DEPTH)/components/components.gyp:visitedlink_browser',
'<(DEPTH)/components/components.gyp:visitedlink_common',
'<(DEPTH)/components/components.gyp:visitedlink_renderer',
'<(DEPTH)/components/components.gyp:web_cache_renderer',
'<(DEPTH)/components/url_formatter/url_formatter.gyp:url_formatter',
'<(DEPTH)/content/content.gyp:content_app_both',
'<(DEPTH)/content/content.gyp:content_browser',
'<(DEPTH)/content/content.gyp:content_common',
@@ -1027,22 +969,25 @@
'libcef/browser/browser_host_impl.h',
'libcef/browser/browser_info.cc',
'libcef/browser/browser_info.h',
'libcef/browser/browser_info_manager.cc',
'libcef/browser/browser_info_manager.h',
'libcef/browser/browser_main.cc',
'libcef/browser/browser_main.h',
'libcef/browser/browser_message_filter.cc',
'libcef/browser/browser_message_filter.h',
'libcef/browser/browser_message_loop.cc',
'libcef/browser/browser_message_loop.h',
'libcef/browser/browser_pref_store.cc',
'libcef/browser/browser_pref_store.h',
'libcef/browser/browser_settings.cc',
'libcef/browser/browser_settings.h',
'libcef/browser/browser_platform_delegate.cc',
'libcef/browser/browser_platform_delegate.h',
'libcef/browser/browser_platform_delegate_create.cc',
'libcef/browser/browser_urlrequest_impl.cc',
'libcef/browser/browser_urlrequest_impl.h',
'libcef/browser/chrome_browser_process_stub.cc',
'libcef/browser/chrome_browser_process_stub.h',
'libcef/browser/chrome_scheme_handler.cc',
'libcef/browser/chrome_scheme_handler.h',
'libcef/browser/chrome_profile_stub.cc',
'libcef/browser/chrome_profile_stub.h',
'libcef/browser/component_updater/cef_component_updater_configurator.cc',
'libcef/browser/component_updater/cef_component_updater_configurator.h',
'libcef/browser/content_browser_client.cc',
'libcef/browser/content_browser_client.h',
'libcef/browser/context.cc',
@@ -1051,22 +996,14 @@
'libcef/browser/context_menu_params_impl.h',
'libcef/browser/cookie_manager_impl.cc',
'libcef/browser/cookie_manager_impl.h',
'libcef/browser/cookie_store_proxy.cc',
'libcef/browser/cookie_store_proxy.h',
'libcef/browser/devtools_delegate.cc',
'libcef/browser/devtools_delegate.h',
'libcef/browser/devtools_frontend.cc',
'libcef/browser/devtools_frontend.h',
'libcef/browser/devtools_scheme_handler.cc',
'libcef/browser/devtools_scheme_handler.h',
'libcef/browser/download_item_impl.cc',
'libcef/browser/download_item_impl.h',
'libcef/browser/download_manager_delegate.cc',
'libcef/browser/download_manager_delegate.h',
'libcef/browser/component_updater/cef_component_updater_configurator.cc',
'libcef/browser/component_updater/cef_component_updater_configurator.h',
'libcef/browser/component_updater/widevine_cdm_component_installer.cc',
'libcef/browser/component_updater/widevine_cdm_component_installer.h',
'libcef/browser/extensions/api/streams_private/streams_private_api.cc',
'libcef/browser/extensions/api/streams_private/streams_private_api.h',
'libcef/browser/extensions/browser_context_keyed_service_factories.cc',
@@ -1095,26 +1032,72 @@
'libcef/browser/extensions/pdf_web_contents_helper_client.h',
'libcef/browser/extensions/url_request_util.cc',
'libcef/browser/extensions/url_request_util.h',
'libcef/browser/file_dialog_runner.h',
'libcef/browser/file_dialog_manager.cc',
'libcef/browser/file_dialog_manager.h',
'libcef/browser/frame_host_impl.cc',
'libcef/browser/frame_host_impl.h',
'libcef/browser/geolocation_impl.cc',
'libcef/browser/internal_scheme_handler.cc',
'libcef/browser/internal_scheme_handler.h',
'libcef/browser/javascript_dialog.h',
'libcef/browser/javascript_dialog_runner.h',
'libcef/browser/javascript_dialog_manager.cc',
'libcef/browser/javascript_dialog_manager.h',
'libcef/browser/media_capture_devices_dispatcher.cc',
'libcef/browser/media_capture_devices_dispatcher.h',
'libcef/browser/menu_creator.cc',
'libcef/browser/menu_creator.h',
'libcef/browser/menu_manager.cc',
'libcef/browser/menu_manager.h',
'libcef/browser/menu_model_impl.cc',
'libcef/browser/menu_model_impl.h',
'libcef/browser/menu_runner.h',
'libcef/browser/native/browser_platform_delegate_native.cc',
'libcef/browser/native/browser_platform_delegate_native.h',
'libcef/browser/navigate_params.cc',
'libcef/browser/navigate_params.h',
'libcef/browser/navigation_entry_impl.cc',
'libcef/browser/navigation_entry_impl.h',
'libcef/browser/net/chrome_scheme_handler.cc',
'libcef/browser/net/chrome_scheme_handler.h',
'libcef/browser/net/cookie_store_proxy.cc',
'libcef/browser/net/cookie_store_proxy.h',
'libcef/browser/net/devtools_scheme_handler.cc',
'libcef/browser/net/devtools_scheme_handler.h',
'libcef/browser/net/internal_scheme_handler.cc',
'libcef/browser/net/internal_scheme_handler.h',
'libcef/browser/net/network_delegate.cc',
'libcef/browser/net/network_delegate.h',
'libcef/browser/net/resource_request_job.cc',
'libcef/browser/net/resource_request_job.h',
'libcef/browser/net/response_filter_wrapper.cc',
'libcef/browser/net/response_filter_wrapper.h',
'libcef/browser/net/scheme_handler.cc',
'libcef/browser/net/scheme_handler.h',
'libcef/browser/net/url_request_context.cc',
'libcef/browser/net/url_request_context.h',
'libcef/browser/net/url_request_context_getter.h',
'libcef/browser/net/url_request_context_getter_impl.cc',
'libcef/browser/net/url_request_context_getter_impl.h',
'libcef/browser/net/url_request_context_getter_proxy.cc',
'libcef/browser/net/url_request_context_getter_proxy.h',
'libcef/browser/net/url_request_context_impl.h',
'libcef/browser/net/url_request_context_proxy.cc',
'libcef/browser/net/url_request_context_proxy.h',
'libcef/browser/net/url_request_interceptor.cc',
'libcef/browser/net/url_request_interceptor.h',
'libcef/browser/net/url_request_manager.cc',
'libcef/browser/net/url_request_manager.h',
'libcef/browser/net/url_request_user_data.cc',
'libcef/browser/net/url_request_user_data.h',
'libcef/browser/origin_whitelist_impl.cc',
'libcef/browser/origin_whitelist_impl.h',
'libcef/browser/osr/browser_platform_delegate_osr.cc',
'libcef/browser/osr/browser_platform_delegate_osr.h',
'libcef/browser/osr/osr_util.cc',
'libcef/browser/osr/osr_util.h',
'libcef/browser/osr/render_widget_host_view_osr.cc',
'libcef/browser/osr/render_widget_host_view_osr.h',
'libcef/browser/osr/software_output_device_osr.cc',
'libcef/browser/osr/software_output_device_osr.h',
'libcef/browser/osr/web_contents_view_osr.cc',
'libcef/browser/osr/web_contents_view_osr.h',
'libcef/browser/path_util_impl.cc',
'libcef/browser/pepper/browser_pepper_host_factory.cc',
'libcef/browser/pepper/browser_pepper_host_factory.h',
@@ -1123,12 +1106,20 @@
'libcef/browser/pepper/pepper_isolated_file_system_message_filter.cc',
'libcef/browser/pepper/pepper_isolated_file_system_message_filter.h',
'libcef/browser/pepper/device_id_fetcher.cc',
'libcef/browser/permission_manager.cc',
'libcef/browser/permission_manager.h',
'libcef/browser/permissions/permission_context.cc',
'libcef/browser/permissions/permission_context.h',
'libcef/browser/permissions/permission_manager.cc',
'libcef/browser/permissions/permission_manager.h',
'libcef/browser/permissions/permission_util.cc',
'libcef/browser/permissions/permission_util.h',
'libcef/browser/plugins/plugin_info_message_filter.cc',
'libcef/browser/plugins/plugin_info_message_filter.h',
'libcef/browser/plugins/plugin_service_filter.cc',
'libcef/browser/plugins/plugin_service_filter.h',
'libcef/browser/prefs/browser_prefs.cc',
'libcef/browser/prefs/browser_prefs.h',
'libcef/browser/prefs/renderer_prefs.cc',
'libcef/browser/prefs/renderer_prefs.h',
'libcef/browser/print_settings_impl.cc',
'libcef/browser/print_settings_impl.h',
'libcef/browser/printing/printing_message_filter.cc',
@@ -1139,21 +1130,13 @@
'libcef/browser/printing/print_view_manager_base.h',
'libcef/browser/process_util_impl.cc',
'libcef/browser/proxy_stubs.cc',
'libcef/browser/render_widget_host_view_osr.cc',
'libcef/browser/render_widget_host_view_osr.h',
'libcef/browser/resource_context.cc',
'libcef/browser/resource_context.h',
'libcef/browser/resource_dispatcher_host_delegate.cc',
'libcef/browser/resource_dispatcher_host_delegate.h',
'libcef/browser/resource_request_job.cc',
'libcef/browser/resource_request_job.h',
'libcef/browser/request_context_impl.cc',
'libcef/browser/request_context_impl.h',
'libcef/browser/scheme_handler.cc',
'libcef/browser/scheme_handler.h',
'libcef/browser/scheme_impl.cc',
'libcef/browser/software_output_device_osr.cc',
'libcef/browser/software_output_device_osr.h',
'libcef/browser/speech_recognition_manager_delegate.cc',
'libcef/browser/speech_recognition_manager_delegate.h',
'libcef/browser/ssl_cert_principal_impl.cc',
@@ -1168,26 +1151,6 @@
'libcef/browser/trace_subscriber.cc',
'libcef/browser/trace_subscriber.h',
'libcef/browser/thread_util.h',
'libcef/browser/url_network_delegate.cc',
'libcef/browser/url_network_delegate.h',
'libcef/browser/url_request_context.cc',
'libcef/browser/url_request_context.h',
'libcef/browser/url_request_context_getter.h',
'libcef/browser/url_request_context_getter_impl.cc',
'libcef/browser/url_request_context_getter_impl.h',
'libcef/browser/url_request_context_getter_proxy.cc',
'libcef/browser/url_request_context_getter_proxy.h',
'libcef/browser/url_request_context_impl.h',
'libcef/browser/url_request_context_proxy.cc',
'libcef/browser/url_request_context_proxy.h',
'libcef/browser/url_request_manager.cc',
'libcef/browser/url_request_manager.h',
'libcef/browser/url_request_interceptor.cc',
'libcef/browser/url_request_interceptor.h',
'libcef/browser/url_request_user_data.cc',
'libcef/browser/url_request_user_data.h',
'libcef/browser/web_contents_view_osr.cc',
'libcef/browser/web_contents_view_osr.h',
'libcef/browser/web_plugin_impl.cc',
'libcef/browser/web_plugin_impl.h',
'libcef/browser/xml_reader_impl.cc',
@@ -1213,13 +1176,19 @@
'libcef/common/extensions/extensions_client.h',
'libcef/common/extensions/extensions_util.cc',
'libcef/common/extensions/extensions_util.h',
'libcef/common/http_header_utils.cc',
'libcef/common/http_header_utils.h',
'libcef/common/json_impl.cc',
'libcef/common/main_delegate.cc',
'libcef/common/main_delegate.h',
'libcef/common/net_resource_provider.cc',
'libcef/common/net_resource_provider.h',
'libcef/common/net/http_header_utils.cc',
'libcef/common/net/http_header_utils.h',
'libcef/common/net/net_resource_provider.cc',
'libcef/common/net/net_resource_provider.h',
'libcef/common/net/scheme_registration.cc',
'libcef/common/net/scheme_registration.h',
'libcef/common/net/upload_data.cc',
'libcef/common/net/upload_data.h',
'libcef/common/net/upload_element.cc',
'libcef/common/net/upload_element.h',
'libcef/common/parser_impl.cc',
'libcef/common/process_message_impl.cc',
'libcef/common/process_message_impl.h',
@@ -1233,8 +1202,6 @@
'libcef/common/response_manager.h',
'libcef/common/scheme_registrar_impl.cc',
'libcef/common/scheme_registrar_impl.h',
'libcef/common/scheme_registration.cc',
'libcef/common/scheme_registration.h',
'libcef/common/string_list_impl.cc',
'libcef/common/string_map_impl.cc',
'libcef/common/string_multimap_impl.cc',
@@ -1252,10 +1219,6 @@
'libcef/common/value_base.h',
'libcef/common/values_impl.cc',
'libcef/common/values_impl.h',
'libcef/common/upload_data.cc',
'libcef/common/upload_data.h',
'libcef/common/upload_element.cc',
'libcef/common/upload_element.h',
'libcef/renderer/browser_impl.cc',
'libcef/renderer/browser_impl.h',
'libcef/renderer/content_renderer_client.cc',
@@ -1264,6 +1227,8 @@
'libcef/renderer/dom_document_impl.h',
'libcef/renderer/dom_node_impl.cc',
'libcef/renderer/dom_node_impl.h',
'libcef/renderer/extensions/extensions_dispatcher_delegate.cc',
'libcef/renderer/extensions/extensions_dispatcher_delegate.h',
'libcef/renderer/extensions/extensions_renderer_client.cc',
'libcef/renderer/extensions/extensions_renderer_client.h',
'libcef/renderer/extensions/print_web_view_helper_delegate.cc',
@@ -1299,20 +1264,10 @@
'<(DEPTH)/chrome/common/chrome_switches.cc',
'<(DEPTH)/chrome/common/chrome_switches.h',
# Include sources for proxy support.
'<(DEPTH)/base/prefs/testing_pref_store.cc',
'<(DEPTH)/base/prefs/testing_pref_store.h',
'<(DEPTH)/chrome/browser/net/pref_proxy_config_tracker.cc',
'<(DEPTH)/chrome/browser/net/pref_proxy_config_tracker.h',
'<(DEPTH)/chrome/browser/net/pref_proxy_config_tracker_impl.cc',
'<(DEPTH)/chrome/browser/net/pref_proxy_config_tracker_impl.h',
'<(DEPTH)/chrome/browser/net/proxy_service_factory.cc',
'<(DEPTH)/chrome/browser/net/proxy_service_factory.h',
'<(DEPTH)/chrome/browser/net/utility_process_mojo_proxy_resolver_factory.cc',
'<(DEPTH)/chrome/browser/net/utility_process_mojo_proxy_resolver_factory.h',
'<(DEPTH)/chrome/browser/prefs/command_line_pref_store.cc',
'<(DEPTH)/chrome/browser/prefs/command_line_pref_store.h',
'<(DEPTH)/chrome/common/pref_names.cc',
'<(DEPTH)/chrome/common/pref_names.h',
'<(DEPTH)/components/data_reduction_proxy/core/common/data_reduction_proxy_switches.cc',
'<(DEPTH)/components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h',
'<(DEPTH)/components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.cc',
@@ -1425,8 +1380,8 @@
'<(DEPTH)/extensions/shell/browser/shell_web_contents_modal_dialog_manager.cc',
'<(grit_out_dir)/grit/component_extension_resources_map.cc',
# Include sources for component-updater support.
'<(DEPTH)/chrome/browser/component_updater/component_updater_url_constants.cc',
'<(DEPTH)/chrome/browser/component_updater/component_updater_url_constants.h',
'<(DEPTH)/chrome/browser/component_updater/widevine_cdm_component_installer.cc',
'<(DEPTH)/chrome/browser/component_updater/widevine_cdm_component_installer.h',
# Include sources for widevine support.
'<(DEPTH)/chrome/common/widevine_cdm_constants.cc',
'<(DEPTH)/chrome/common/widevine_cdm_constants.h',
@@ -1435,19 +1390,61 @@
'<(DEPTH)/chrome/browser/plugins/plugin_finder.h',
'<(DEPTH)/chrome/browser/plugins/plugin_metadata.cc',
'<(DEPTH)/chrome/browser/plugins/plugin_metadata.h',
'<(DEPTH)/chrome/renderer/plugins/power_saver_info.cc',
'<(DEPTH)/chrome/renderer/plugins/power_saver_info.h',
'<(DEPTH)/components/nacl/common/nacl_constants.cc',
'<(DEPTH)/components/nacl/common/nacl_constants.h',
# Include sources for preferences support.
'<(DEPTH)/base/prefs/testing_pref_store.cc',
'<(DEPTH)/base/prefs/testing_pref_store.h',
'<(DEPTH)/chrome/browser/accessibility/animation_policy_prefs.cc',
'<(DEPTH)/chrome/browser/accessibility/animation_policy_prefs.h',
'<(DEPTH)/chrome/browser/character_encoding.cc',
'<(DEPTH)/chrome/browser/character_encoding.h',
'<(DEPTH)/chrome/browser/defaults.cc',
'<(DEPTH)/chrome/browser/defaults.h',
'<(DEPTH)/chrome/browser/extensions/extension_webkit_preferences.cc',
'<(DEPTH)/chrome/browser/extensions/extension_webkit_preferences.h',
'<(DEPTH)/chrome/browser/font_family_cache.cc',
'<(DEPTH)/chrome/browser/font_family_cache.h',
'<(DEPTH)/chrome/browser/prefs/command_line_pref_store.cc',
'<(DEPTH)/chrome/browser/prefs/command_line_pref_store.h',
'<(DEPTH)/chrome/browser/renderer_preferences_util.cc',
'<(DEPTH)/chrome/browser/renderer_preferences_util.h',
'<(DEPTH)/chrome/browser/ui/prefs/prefs_tab_helper.cc',
'<(DEPTH)/chrome/browser/ui/prefs/prefs_tab_helper.h',
'<(DEPTH)/chrome/browser/ui/zoom/chrome_zoom_level_prefs.cc',
'<(DEPTH)/chrome/browser/ui/zoom/chrome_zoom_level_prefs.h',
'<(DEPTH)/chrome/common/pref_font_webkit_names.h',
'<(DEPTH)/chrome/common/pref_names.cc',
'<(DEPTH)/chrome/common/pref_names.h',
'<(DEPTH)/chrome/common/pref_names_util.cc',
'<(DEPTH)/chrome/common/pref_names_util.h',
# Include sources for permissions support.
'<(DEPTH)/chrome/browser/permissions/permission_request_id.h',
'<(DEPTH)/chrome/browser/permissions/permission_request_id.cc',
],
'conditions': [
['OS=="win"', {
'sources': [
'<@(includes_win)',
'libcef/browser/browser_host_impl_win.cc',
'libcef/browser/browser_main_win.cc',
'libcef/browser/javascript_dialog_win.cc',
'libcef/browser/menu_creator_runner_win.cc',
'libcef/browser/menu_creator_runner_win.h',
'libcef/browser/render_widget_host_view_osr_win.cc',
'libcef/browser/native/browser_platform_delegate_native_win.cc',
'libcef/browser/native/browser_platform_delegate_native_win.h',
'libcef/browser/native/file_dialog_runner_win.cc',
'libcef/browser/native/file_dialog_runner_win.h',
'libcef/browser/native/javascript_dialog_runner_win.cc',
'libcef/browser/native/javascript_dialog_runner_win.h',
'libcef/browser/native/menu_2.cc',
'libcef/browser/native/menu_2.h',
'libcef/browser/native/menu_runner_win.cc',
'libcef/browser/native/menu_runner_win.h',
'libcef/browser/native/menu_wrapper.h',
'libcef/browser/native/native_menu_win.cc',
'libcef/browser/native/native_menu_win.h',
'libcef/browser/osr/browser_platform_delegate_osr_win.cc',
'libcef/browser/osr/browser_platform_delegate_osr_win.h',
'libcef/browser/osr/render_widget_host_view_osr_win.cc',
# Include sources for printing using PDF.
'libcef/utility/printing_handler.cc',
'libcef/utility/printing_handler.h',
@@ -1462,22 +1459,28 @@
[ 'OS=="mac"', {
'sources': [
'<@(includes_mac)',
'libcef/browser/browser_host_impl_mac.mm',
'libcef/browser/javascript_dialog_mac.mm',
'libcef/browser/menu_creator_runner_mac.h',
'libcef/browser/menu_creator_runner_mac.mm',
'libcef/browser/render_widget_host_view_osr_mac.mm',
'libcef/browser/text_input_client_osr_mac.mm',
'libcef/browser/text_input_client_osr_mac.h',
'libcef/browser/native/browser_platform_delegate_native_mac.h',
'libcef/browser/native/browser_platform_delegate_native_mac.mm',
'libcef/browser/native/file_dialog_runner_mac.h',
'libcef/browser/native/file_dialog_runner_mac.mm',
'libcef/browser/native/javascript_dialog_runner_mac.h',
'libcef/browser/native/javascript_dialog_runner_mac.mm',
'libcef/browser/native/menu_runner_mac.h',
'libcef/browser/native/menu_runner_mac.mm',
'libcef/browser/osr/browser_platform_delegate_osr_mac.h',
'libcef/browser/osr/browser_platform_delegate_osr_mac.mm',
'libcef/browser/osr/render_widget_host_view_osr_mac.mm',
'libcef/browser/osr/text_input_client_osr_mac.mm',
'libcef/browser/osr/text_input_client_osr_mac.h',
'libcef/common/util_mac.h',
'libcef/common/util_mac.mm',
# Include sources for spell checking support.
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_message_filter_mac.cc',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_message_filter_mac.h',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_platform_mac.h',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_message_filter_platform.h',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_message_filter_platform_mac.cc',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_platform.h',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_platform_mac.mm',
'<(DEPTH)/chrome/renderer/spellchecker/cocoa_spelling_engine_mac.cc',
'<(DEPTH)/chrome/renderer/spellchecker/cocoa_spelling_engine_mac.h',
'<(DEPTH)/chrome/renderer/spellchecker/platform_spelling_engine.cc',
'<(DEPTH)/chrome/renderer/spellchecker/platform_spelling_engine.h',
# Include sources for pepper flash support.
'<(DEPTH)/chrome/browser/renderer_host/pepper/monitor_finder_mac.h',
'<(DEPTH)/chrome/browser/renderer_host/pepper/monitor_finder_mac.mm',
@@ -1486,15 +1489,17 @@
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
'sources': [
'<@(includes_linux)',
'libcef/browser/browser_host_impl_linux.cc',
'libcef/browser/javascript_dialog_linux.cc',
'libcef/browser/menu_creator_runner_linux.cc',
'libcef/browser/menu_creator_runner_linux.h',
'libcef/browser/native/browser_platform_delegate_native_linux.cc',
'libcef/browser/native/browser_platform_delegate_native_linux.h',
'libcef/browser/native/menu_runner_linux.cc',
'libcef/browser/native/menu_runner_linux.h',
'libcef/browser/osr/browser_platform_delegate_osr_linux.cc',
'libcef/browser/osr/browser_platform_delegate_osr_linux.h',
'libcef/browser/osr/render_widget_host_view_osr_linux.cc',
'libcef/browser/printing/print_dialog_linux.cc',
'libcef/browser/printing/print_dialog_linux.h',
'libcef/browser/render_widget_host_view_osr_linux.cc',
'libcef/browser/window_x11.cc',
'libcef/browser/window_x11.h',
'libcef/browser/native/window_x11.cc',
'libcef/browser/native/window_x11.h',
],
}],
['os_posix == 1 and OS != "mac"', {
@@ -1502,14 +1507,19 @@
'<(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',
'<(DEPTH)/ui/views/views.gyp:views',
],
'sources': [
'libcef/browser/window_delegate_view.cc',
'libcef/browser/window_delegate_view.h',
'libcef/browser/native/window_delegate_view.cc',
'libcef/browser/native/window_delegate_view.h',
'<(DEPTH)/ui/views/test/desktop_test_views_delegate.h',
'<(DEPTH)/ui/views/test/desktop_test_views_delegate_aura.cc',
'<(DEPTH)/ui/views/test/test_views_delegate.h',
@@ -1520,7 +1530,7 @@
},
],
'conditions': [
['os_posix==1 and OS!="mac" and OS!="android" and gcc_version>=46', {
['os_posix==1 and OS!="mac" and OS!="android"', {
'target_defaults': {
# Disable warnings about c++0x compatibility, as some names (such
# as nullptr) conflict with upcoming c++0x types.
@@ -1802,6 +1812,7 @@
'tests/unittests/message_router_unittest.cc',
'tests/unittests/navigation_unittest.cc',
'tests/unittests/plugin_unittest.cc',
'tests/unittests/preference_unittest.cc',
'tests/unittests/process_message_unittest.cc',
'tests/unittests/request_handler_unittest.cc',
'tests/unittests/request_unittest.cc',
@@ -1906,7 +1917,6 @@
'<@(includes_win)',
# TODO(cef): Remove ui_unscaled_resources.rc once custom cursor
# resources can be loaded via ResourceBundle. See crbug.com/147663.
'<(SHARED_INTERMEDIATE_DIR)/content/content_resources.rc',
'<(SHARED_INTERMEDIATE_DIR)/ui/resources/ui_unscaled_resources.rc',
'libcef_dll/libcef_dll.rc',
],
@@ -1935,7 +1945,10 @@
],
}],
}], # OS!="mac"
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
[ '(OS=="linux" or OS=="freebsd" or OS=="openbsd") and use_sysroot==0', {
# Required packages are not available when using the default sysroot
# environment. Consequently the cefclient target cannot be built with
# use_sysroot==1.
'targets': [
{
'target_name': 'gtk',
@@ -1947,15 +1960,15 @@
},
'direct_dependent_settings': {
'cflags': [
'<!@(pkg-config --cflags <(gtk_packages))',
'<!@(<(pkg-config) --cflags <(gtk_packages))',
],
},
'link_settings': {
'ldflags': [
'<!@(pkg-config --libs-only-L --libs-only-other <(gtk_packages))',
'<!@(<(pkg-config) --libs-only-L --libs-only-other <(gtk_packages))',
],
'libraries': [
'<!@(pkg-config --libs-only-l <(gtk_packages))',
'<!@(<(pkg-config) --libs-only-l <(gtk_packages))',
],
},
},
@@ -1968,20 +1981,20 @@
},
'direct_dependent_settings': {
'cflags': [
'<!@(pkg-config --cflags <(gtk_packages))',
'<!@(<(pkg-config) --cflags <(gtk_packages))',
],
},
'link_settings': {
'ldflags': [
'<!@(pkg-config --libs-only-L --libs-only-other <(gtk_packages))',
'<!@(<(pkg-config) --libs-only-L --libs-only-other <(gtk_packages))',
],
'libraries': [
'<!@(pkg-config --libs-only-l <(gtk_packages))',
'<!@(<(pkg-config) --libs-only-l <(gtk_packages))',
],
},
},
],
}], # OS=="linux" or OS=="freebsd" or OS=="openbsd"
}], # (OS=="linux" or OS=="freebsd" or OS=="openbsd") and use_sysroot==0
[ 'OS=="win"', {
'targets': [
{

View File

@@ -24,6 +24,11 @@
# Strip symbols and create dSYM files for the Release target.
'mac_strip_release': 1,
}],
['os_posix==1 and OS!="mac" and OS!="android"', {
# Disable theme support on Linux so we don't need to implement
# ThemeService[Factory] classes.
'enable_themes': 0,
}]
]
}, 'conditions': [
['os_posix==1 and OS!="mac" and OS!="android"', {

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
# Copyright (c) 2016 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
#
@@ -56,6 +56,7 @@
'include/cef_resource_bundle_handler.h',
'include/cef_resource_handler.h',
'include/cef_response.h',
'include/cef_response_filter.h',
'include/cef_scheme.h',
'include/cef_ssl_info.h',
'include/cef_stream.h',
@@ -115,6 +116,7 @@
'include/capi/cef_resource_bundle_handler_capi.h',
'include/capi/cef_resource_handler_capi.h',
'include/capi/cef_response_capi.h',
'include/capi/cef_response_filter_capi.h',
'include/capi/cef_scheme_capi.h',
'include/capi/cef_ssl_info_capi.h',
'include/capi/cef_stream_capi.h',
@@ -250,6 +252,8 @@
'libcef_dll/ctocpp/request_context_handler_ctocpp.h',
'libcef_dll/ctocpp/request_handler_ctocpp.cc',
'libcef_dll/ctocpp/request_handler_ctocpp.h',
'libcef_dll/ctocpp/resolve_callback_ctocpp.cc',
'libcef_dll/ctocpp/resolve_callback_ctocpp.h',
'libcef_dll/cpptoc/resource_bundle_cpptoc.cc',
'libcef_dll/cpptoc/resource_bundle_cpptoc.h',
'libcef_dll/ctocpp/resource_bundle_handler_ctocpp.cc',
@@ -258,6 +262,8 @@
'libcef_dll/ctocpp/resource_handler_ctocpp.h',
'libcef_dll/cpptoc/response_cpptoc.cc',
'libcef_dll/cpptoc/response_cpptoc.h',
'libcef_dll/ctocpp/response_filter_ctocpp.cc',
'libcef_dll/ctocpp/response_filter_ctocpp.h',
'libcef_dll/cpptoc/run_context_menu_callback_cpptoc.cc',
'libcef_dll/cpptoc/run_context_menu_callback_cpptoc.h',
'libcef_dll/ctocpp/run_file_dialog_callback_ctocpp.cc',
@@ -448,6 +454,8 @@
'libcef_dll/cpptoc/request_context_handler_cpptoc.h',
'libcef_dll/cpptoc/request_handler_cpptoc.cc',
'libcef_dll/cpptoc/request_handler_cpptoc.h',
'libcef_dll/cpptoc/resolve_callback_cpptoc.cc',
'libcef_dll/cpptoc/resolve_callback_cpptoc.h',
'libcef_dll/ctocpp/resource_bundle_ctocpp.cc',
'libcef_dll/ctocpp/resource_bundle_ctocpp.h',
'libcef_dll/cpptoc/resource_bundle_handler_cpptoc.cc',
@@ -456,6 +464,8 @@
'libcef_dll/cpptoc/resource_handler_cpptoc.h',
'libcef_dll/ctocpp/response_ctocpp.cc',
'libcef_dll/ctocpp/response_ctocpp.h',
'libcef_dll/cpptoc/response_filter_cpptoc.cc',
'libcef_dll/cpptoc/response_filter_cpptoc.h',
'libcef_dll/ctocpp/run_context_menu_callback_ctocpp.cc',
'libcef_dll/ctocpp/run_context_menu_callback_ctocpp.h',
'libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.cc',

View File

@@ -171,8 +171,12 @@
'tests/cefclient/browser/osr_dragdrop_events.h',
'tests/cefclient/browser/osr_renderer.h',
'tests/cefclient/browser/osr_renderer.cc',
'tests/cefclient/browser/preferences_test.cc',
'tests/cefclient/browser/preferences_test.h',
'tests/cefclient/browser/resource.h',
'tests/cefclient/browser/resource_util.h',
'tests/cefclient/browser/response_filter_test.cc',
'tests/cefclient/browser/response_filter_test.h',
'tests/cefclient/browser/root_window.cc',
'tests/cefclient/browser/root_window.h',
'tests/cefclient/browser/root_window_manager.cc',
@@ -220,6 +224,8 @@
'tests/cefclient/resources/pdf.pdf',
'tests/cefclient/resources/performance.html',
'tests/cefclient/resources/performance2.html',
'tests/cefclient/resources/preferences.html',
'tests/cefclient/resources/response_filter.html',
'tests/cefclient/resources/transparency.html',
'tests/cefclient/resources/urlrequest.html',
'tests/cefclient/resources/window.html',

View File

@@ -32,14 +32,6 @@
#define CEF_INCLUDE_BASE_CEF_BASICTYPES_H_
#pragma once
#if defined(BUILDING_CEF_SHARED)
// When building CEF include the Chromium header directly.
#include "base/basictypes.h"
#else // !BUILDING_CEF_SHARED
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be
// updated to match.
#include <limits.h> // For UINT_MAX
#include <stddef.h> // For size_t
@@ -72,8 +64,6 @@ typedef int int32;
typedef unsigned int uint32;
#endif
#endif // !BUILDING_CEF_SHARED
// UTF-16 character type.
// This should be kept synchronized with base/strings/string16.h
#ifndef char16

View File

@@ -135,7 +135,7 @@
// Annotate a function indicating the caller must examine the return value.
// Use like:
// int foo() WARN_UNUSED_RESULT;
// To explicitly ignore a result, see |ignore_result()| in <base/basictypes.h>.
// To explicitly ignore a result, see |ignore_result()| in <base/macros.h>.
#ifndef WARN_UNUSED_RESULT
#if defined(COMPILER_GCC)
#define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
@@ -175,7 +175,10 @@
// C++11 support may not be enabled in client applications. CEF internal classes
// should use the `override` keyword directly.
#ifndef OVERRIDE
#if defined(__clang__) || defined(COMPILER_MSVC)
#if defined(__clang__)
#define OVERRIDE override
#elif defined(COMPILER_MSVC) && _MSC_VER >= 1600
// Visual Studio 2010 and later support override.
#define OVERRIDE override
#elif defined(COMPILER_GCC) && __cplusplus >= 201103 && \
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40700

View File

@@ -141,6 +141,14 @@
// This can happen in cases where Chromium code is used directly by the
// client application. When using Chromium code directly always include
// the Chromium header first to avoid type conflicts.
// Always define the DCHECK_IS_ON macro which is used from other CEF headers.
#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
#define DCHECK_IS_ON() 0
#else
#define DCHECK_IS_ON() 1
#endif
#elif defined(BUILDING_CEF_SHARED)
// When building CEF include the Chromium header directly.
#include "base/logging.h"
@@ -419,9 +427,9 @@ DEFINE_CHECK_OP_IMPL(GT, > )
#endif
#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
#define DCHECK_IS_ON 0
#define DCHECK_IS_ON() 0
#else
#define DCHECK_IS_ON 1
#define DCHECK_IS_ON() 1
#endif
// Definitions for DLOG et al.
@@ -475,14 +483,14 @@ enum { DEBUG_MODE = ENABLE_DLOG };
// Definitions for DCHECK et al.
#if DCHECK_IS_ON
#if DCHECK_IS_ON()
#define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \
COMPACT_GOOGLE_LOG_EX_FATAL(ClassName , ##__VA_ARGS__)
#define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_FATAL
const LogSeverity LOG_DCHECK = LOG_FATAL;
#else // DCHECK_IS_ON
#else // DCHECK_IS_ON()
// These are just dummy values.
#define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \
@@ -490,31 +498,29 @@ const LogSeverity LOG_DCHECK = LOG_FATAL;
#define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_INFO
const LogSeverity LOG_DCHECK = LOG_INFO;
#endif // DCHECK_IS_ON
#endif // DCHECK_IS_ON()
// DCHECK et al. make sure to reference |condition| regardless of
// whether DCHECKs are enabled; this is so that we don't get unused
// variable warnings if the only use of a variable is in a DCHECK.
// This behavior is different from DLOG_IF et al.
#define DCHECK(condition) \
LAZY_STREAM(LOG_STREAM(DCHECK), DCHECK_IS_ON && !(condition)) \
<< "Check failed: " #condition ". "
#define DCHECK(condition) \
LAZY_STREAM(LOG_STREAM(DCHECK), DCHECK_IS_ON() && !(condition)) \
<< "Check failed: " #condition ". "
#define DPCHECK(condition) \
LAZY_STREAM(PLOG_STREAM(DCHECK), DCHECK_IS_ON && !(condition)) \
<< "Check failed: " #condition ". "
#define DPCHECK(condition) \
LAZY_STREAM(PLOG_STREAM(DCHECK), DCHECK_IS_ON() && !(condition)) \
<< "Check failed: " #condition ". "
// Helper macro for binary operators.
// Don't use this macro directly in your code, use DCHECK_EQ et al below.
#define DCHECK_OP(name, op, val1, val2) \
if (DCHECK_IS_ON) \
if (std::string* _result = \
cef::logging::Check##name##Impl((val1), (val2), \
#val1 " " #op " " #val2)) \
cef::logging::LogMessage( \
__FILE__, __LINE__, ::cef::logging::LOG_DCHECK, \
_result).stream()
#define DCHECK_OP(name, op, val1, val2) \
if (DCHECK_IS_ON()) \
if (std::string* _result = cef::logging::Check##name##Impl( \
(val1), (val2), #val1 " " #op " " #val2)) \
cef::logging::LogMessage(__FILE__, __LINE__, \
::cef::logging::LOG_DCHECK, _result).stream()
// Equality/Inequality checks - compare two values, and log a
// LOG_DCHECK message including the two values when the result is not

View File

@@ -41,6 +41,7 @@
// updated to match.
#include <stddef.h> // For size_t.
#include "include/base/cef_build.h" // For COMPILER_MSVC
#if !defined(ALLOW_THIS_IN_INITIALIZER_LIST)
#if defined(COMPILER_MSVC)

View File

@@ -45,25 +45,24 @@
// If the Chromium implementation diverges the below implementation should be
// updated to match.
#include "include/base/cef_logging.h"
#include "include/base/internal/cef_thread_checker_impl.h"
// Apart from debug builds, we also enable the thread checker in
// builds with DCHECK_ALWAYS_ON so that trybots and waterfall bots
// with this define will get the same level of thread checking as
// debug bots.
//
// Note that this does not perfectly match situations where DCHECK is
// enabled. For example a non-official release build may have
// DCHECK_ALWAYS_ON undefined (and therefore ThreadChecker would be
// disabled) but have DCHECKs enabled at runtime.
#if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON))
#if DCHECK_IS_ON()
#define ENABLE_THREAD_CHECKER 1
#else
#define ENABLE_THREAD_CHECKER 0
#endif
#include "include/base/internal/cef_thread_checker_impl.h"
namespace base {
namespace cef_internal {
// Do nothing implementation, for use in release mode.
//
// Note: You should almost always use the ThreadChecker class to get the
@@ -77,6 +76,8 @@ class ThreadCheckerDoNothing {
void DetachFromThread() {}
};
} // namespace cef_internal
// ThreadChecker is a helper class used to help verify that some methods of a
// class are called from the same thread. It provides identical functionality to
// base::NonThreadSafe, but it is meant to be held as a member variable, rather
@@ -109,10 +110,10 @@ class ThreadCheckerDoNothing {
//
// In Release mode, CalledOnValidThread will always return true.
#if ENABLE_THREAD_CHECKER
class ThreadChecker : public ThreadCheckerImpl {
class ThreadChecker : public cef_internal::ThreadCheckerImpl {
};
#else
class ThreadChecker : public ThreadCheckerDoNothing {
class ThreadChecker : public cef_internal::ThreadCheckerDoNothing {
};
#endif // ENABLE_THREAD_CHECKER

View File

@@ -42,6 +42,7 @@
//
// class Controller {
// public:
// Controller() : weak_factory_(this) {}
// void SpawnWorker() { Worker::StartNew(weak_factory_.GetWeakPtr()); }
// void WorkComplete(const Result& result) { ... }
// private:
@@ -83,8 +84,13 @@
// WeakPtrs can still be handed off to other threads, e.g. to use to post tasks
// back to object on the bound thread.
//
// Invalidating the factory's WeakPtrs un-binds it from the thread, allowing it
// to be passed for a different thread to use or delete it.
// If all WeakPtr objects are destroyed or invalidated then the factory is
// unbound from the SequencedTaskRunner/Thread. The WeakPtrFactory may then be
// destroyed, or new WeakPtr objects may be used, from a different sequence.
//
// Thus, at least one WeakPtr object must exist and have been dereferenced on
// the correct thread to enforce that other WeakPtr objects will enforce they
// are used on the desired thread.
#ifndef CEF_INCLUDE_BASE_CEF_WEAK_PTR_H_
#define CEF_INCLUDE_BASE_CEF_WEAK_PTR_H_

View File

@@ -37,6 +37,7 @@
#include "include/base/cef_platform_thread.h"
namespace base {
namespace cef_internal {
// Real implementation of ThreadChecker, for use in debug mode, or
// for temporary use in release mode (e.g. to CHECK on a threading issue
@@ -65,6 +66,7 @@ class ThreadCheckerImpl {
mutable PlatformThreadRef valid_thread_id_;
};
} // namespace cef_internal
} // namespace base
#endif // CEF_INCLUDE_BASE_INTERNAL_THREAD_CHECKER_IMPL_H_

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -174,7 +174,7 @@ typedef struct _cef_browser_t {
void (CEF_CALLBACK *get_frame_names)(struct _cef_browser_t* self,
cef_string_list_t names);
//
///
// Send a message to the specified |target_process|. Returns true (1) if the
// message was sent successfully.
///
@@ -418,7 +418,6 @@ typedef struct _cef_browser_host_t {
// navigation entry will be sent, otherwise all navigation entries will be
// sent.
///
///
void (CEF_CALLBACK *get_navigation_entries)(struct _cef_browser_host_t* self,
struct _cef_navigation_entry_visitor_t* visitor, int current_only);

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -176,7 +176,8 @@ typedef struct _cef_frame_t {
cef_string_userfree_t (CEF_CALLBACK *get_name)(struct _cef_frame_t* self);
///
// Returns the globally unique identifier for this frame.
// Returns the globally unique identifier for this frame or < 0 if the
// underlying frame does not yet exist.
///
int64 (CEF_CALLBACK *get_identifier)(struct _cef_frame_t* self);

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -89,13 +89,12 @@ typedef struct _cef_geolocation_handler_t {
struct _cef_geolocation_callback_t* callback);
///
// Called when a geolocation access request is canceled. |requesting_url| is
// the URL that originally requested permission and |request_id| is the unique
// ID for the permission request.
// Called when a geolocation access request is canceled. |request_id| is the
// unique ID for the permission request.
///
void (CEF_CALLBACK *on_cancel_geolocation_permission)(
struct _cef_geolocation_handler_t* self, struct _cef_browser_t* browser,
const cef_string_t* requesting_url, int request_id);
int request_id);
} cef_geolocation_handler_t;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -76,19 +76,21 @@ typedef struct _cef_jsdialog_handler_t {
cef_base_t base;
///
// Called to run a JavaScript dialog. The |default_prompt_text| value will be
// specified for prompt dialogs only. Set |suppress_message| to true (1) and
// return false (0) to suppress the message (suppressing messages is
// preferable to immediately executing the callback as this is used to detect
// presumably malicious behavior like spamming alert messages in
// onbeforeunload). Set |suppress_message| to false (0) and return false (0)
// to use the default implementation (the default implementation will show one
// modal dialog at a time and suppress any additional dialog requests until
// the displayed dialog is dismissed). Return true (1) if the application will
// use a custom dialog or if the callback has been executed immediately.
// Custom dialogs may be either modal or modeless. If a custom dialog is used
// the application must execute |callback| once the custom dialog is
// dismissed.
// Called to run a JavaScript dialog. If |origin_url| and |accept_lang| are
// non-NULL they can be passed to the CefFormatUrlForSecurityDisplay function
// to retrieve a secure and user-friendly display string. The
// |default_prompt_text| value will be specified for prompt dialogs only. Set
// |suppress_message| to true (1) and return false (0) to suppress the message
// (suppressing messages is preferable to immediately executing the callback
// as this is used to detect presumably malicious behavior like spamming alert
// messages in onbeforeunload). Set |suppress_message| to false (0) and return
// false (0) to use the default implementation (the default implementation
// will show one modal dialog at a time and suppress any additional dialog
// requests until the displayed dialog is dismissed). Return true (1) if the
// application will use a custom dialog or if the callback has been executed
// immediately. Custom dialogs may be either modal or modeless. If a custom
// dialog is used the application must execute |callback| once the custom
// dialog is dismissed.
///
int (CEF_CALLBACK *on_jsdialog)(struct _cef_jsdialog_handler_t* self,
struct _cef_browser_t* browser, const cef_string_t* origin_url,

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -56,11 +56,13 @@ typedef struct _cef_keyboard_handler_t {
///
cef_base_t base;
///
// Called before a keyboard event is sent to the renderer. |event| contains
// information about the keyboard event. |os_event| is the operating system
// event message, if any. Return true (1) if the event was handled or false
// (0) otherwise. If the event will be handled in on_key_event() as a keyboard
// shortcut set |is_keyboard_shortcut| to true (1) and return false (0).
///
int (CEF_CALLBACK *on_pre_key_event)(struct _cef_keyboard_handler_t* self,
struct _cef_browser_t* browser, const struct _cef_key_event_t* event,
cef_event_handle_t os_event, int* is_keyboard_shortcut);

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -75,6 +75,7 @@ typedef struct _cef_life_span_handler_t {
// default to the source browser's values. If the |no_javascript_access| value
// is set to false (0) the new browser will not be scriptable and may not be
// hosted in the same renderer process as the source browser.
///
int (CEF_CALLBACK *on_before_popup)(struct _cef_life_span_handler_t* self,
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
const cef_string_t* target_url, const cef_string_t* target_frame_name,

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -62,7 +62,8 @@ typedef struct _cef_load_handler_t {
// Called when the loading state has changed. This callback will be executed
// twice -- once when loading is initiated either programmatically or by user
// action, and once when loading is terminated due to completion, cancellation
// of failure.
// of failure. It will be called before any calls to OnLoadStart and after all
// calls to OnLoadError and/or OnLoadEnd.
///
void (CEF_CALLBACK *on_loading_state_change)(struct _cef_load_handler_t* self,
struct _cef_browser_t* browser, int isLoading, int canGoBack,
@@ -73,9 +74,9 @@ typedef struct _cef_load_handler_t {
// 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 may not be called for a particular frame if the load request for
// that frame fails. For notification of overall browser load status use
// OnLoadingStateChange instead.
// 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);
@@ -86,7 +87,8 @@ typedef struct _cef_load_handler_t {
// 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.
// request completes successfully. For notification of overall browser load
// status use OnLoadingStateChange instead.
///
void (CEF_CALLBACK *on_load_end)(struct _cef_load_handler_t* self,
struct _cef_browser_t* browser, struct _cef_frame_t* frame,

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -67,59 +67,59 @@ typedef struct _cef_menu_model_t {
///
int (CEF_CALLBACK *get_count)(struct _cef_menu_model_t* self);
//
///
// Add a separator to the menu. Returns true (1) on success.
///
int (CEF_CALLBACK *add_separator)(struct _cef_menu_model_t* self);
//
///
// Add an item to the menu. Returns true (1) on success.
///
int (CEF_CALLBACK *add_item)(struct _cef_menu_model_t* self, int command_id,
const cef_string_t* label);
//
///
// Add a check item to the menu. Returns true (1) on success.
///
int (CEF_CALLBACK *add_check_item)(struct _cef_menu_model_t* self,
int command_id, const cef_string_t* label);
//
///
// Add a radio item to the menu. Only a single item with the specified
// |group_id| can be checked at a time. Returns true (1) on success.
///
int (CEF_CALLBACK *add_radio_item)(struct _cef_menu_model_t* self,
int command_id, const cef_string_t* label, int group_id);
//
///
// Add a sub-menu to the menu. The new sub-menu is returned.
///
struct _cef_menu_model_t* (CEF_CALLBACK *add_sub_menu)(
struct _cef_menu_model_t* self, int command_id,
const cef_string_t* label);
//
///
// Insert a separator in the menu at the specified |index|. Returns true (1)
// on success.
///
int (CEF_CALLBACK *insert_separator_at)(struct _cef_menu_model_t* self,
int index);
//
///
// Insert an item in the menu at the specified |index|. Returns true (1) on
// success.
///
int (CEF_CALLBACK *insert_item_at)(struct _cef_menu_model_t* self, int index,
int command_id, const cef_string_t* label);
//
///
// Insert a check item in the menu at the specified |index|. Returns true (1)
// on success.
///
int (CEF_CALLBACK *insert_check_item_at)(struct _cef_menu_model_t* self,
int index, int command_id, const cef_string_t* label);
//
///
// Insert a radio item in the menu at the specified |index|. Only a single
// item with the specified |group_id| can be checked at a time. Returns true
// (1) on success.
@@ -127,7 +127,7 @@ typedef struct _cef_menu_model_t {
int (CEF_CALLBACK *insert_radio_item_at)(struct _cef_menu_model_t* self,
int index, int command_id, const cef_string_t* label, int group_id);
//
///
// Insert a sub-menu in the menu at the specified |index|. The new sub-menu is
// returned.
///
@@ -242,98 +242,98 @@ typedef struct _cef_menu_model_t {
struct _cef_menu_model_t* (CEF_CALLBACK *get_sub_menu_at)(
struct _cef_menu_model_t* self, int index);
//
///
// Returns true (1) if the specified |command_id| is visible.
///
int (CEF_CALLBACK *is_visible)(struct _cef_menu_model_t* self,
int command_id);
//
///
// Returns true (1) if the specified |index| is visible.
///
int (CEF_CALLBACK *is_visible_at)(struct _cef_menu_model_t* self, int index);
//
///
// Change the visibility of the specified |command_id|. Returns true (1) on
// success.
///
int (CEF_CALLBACK *set_visible)(struct _cef_menu_model_t* self,
int command_id, int visible);
//
///
// Change the visibility at the specified |index|. Returns true (1) on
// success.
///
int (CEF_CALLBACK *set_visible_at)(struct _cef_menu_model_t* self, int index,
int visible);
//
///
// Returns true (1) if the specified |command_id| is enabled.
///
int (CEF_CALLBACK *is_enabled)(struct _cef_menu_model_t* self,
int command_id);
//
///
// Returns true (1) if the specified |index| is enabled.
///
int (CEF_CALLBACK *is_enabled_at)(struct _cef_menu_model_t* self, int index);
//
///
// Change the enabled status of the specified |command_id|. Returns true (1)
// on success.
///
int (CEF_CALLBACK *set_enabled)(struct _cef_menu_model_t* self,
int command_id, int enabled);
//
///
// Change the enabled status at the specified |index|. Returns true (1) on
// success.
///
int (CEF_CALLBACK *set_enabled_at)(struct _cef_menu_model_t* self, int index,
int enabled);
//
///
// Returns true (1) if the specified |command_id| is checked. Only applies to
// check and radio items.
///
int (CEF_CALLBACK *is_checked)(struct _cef_menu_model_t* self,
int command_id);
//
///
// Returns true (1) if the specified |index| is checked. Only applies to check
// and radio items.
///
int (CEF_CALLBACK *is_checked_at)(struct _cef_menu_model_t* self, int index);
//
///
// Check the specified |command_id|. Only applies to check and radio items.
// Returns true (1) on success.
///
int (CEF_CALLBACK *set_checked)(struct _cef_menu_model_t* self,
int command_id, int checked);
//
///
// Check the specified |index|. Only applies to check and radio items. Returns
// true (1) on success.
///
int (CEF_CALLBACK *set_checked_at)(struct _cef_menu_model_t* self, int index,
int checked);
//
///
// Returns true (1) if the specified |command_id| has a keyboard accelerator
// assigned.
///
int (CEF_CALLBACK *has_accelerator)(struct _cef_menu_model_t* self,
int command_id);
//
///
// Returns true (1) if the specified |index| has a keyboard accelerator
// assigned.
///
int (CEF_CALLBACK *has_accelerator_at)(struct _cef_menu_model_t* self,
int index);
//
///
// Set the keyboard accelerator for the specified |command_id|. |key_code| can
// be any virtual key or character value. Returns true (1) on success.
///
@@ -341,7 +341,7 @@ typedef struct _cef_menu_model_t {
int command_id, int key_code, int shift_pressed, int ctrl_pressed,
int alt_pressed);
//
///
// Set the keyboard accelerator at the specified |index|. |key_code| can be
// any virtual key or character value. Returns true (1) on success.
///
@@ -349,21 +349,21 @@ typedef struct _cef_menu_model_t {
int index, int key_code, int shift_pressed, int ctrl_pressed,
int alt_pressed);
//
///
// Remove the keyboard accelerator for the specified |command_id|. Returns
// true (1) on success.
///
int (CEF_CALLBACK *remove_accelerator)(struct _cef_menu_model_t* self,
int command_id);
//
///
// Remove the keyboard accelerator at the specified |index|. Returns true (1)
// on success.
///
int (CEF_CALLBACK *remove_accelerator_at)(struct _cef_menu_model_t* self,
int index);
//
///
// Retrieves the keyboard accelerator for the specified |command_id|. Returns
// true (1) on success.
///
@@ -371,7 +371,7 @@ typedef struct _cef_menu_model_t {
int command_id, int* key_code, int* shift_pressed, int* ctrl_pressed,
int* alt_pressed);
//
///
// Retrieves the keyboard accelerator for the specified |index|. Returns true
// (1) on success.
///

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -60,6 +60,20 @@ CEF_EXPORT int cef_parse_url(const cef_string_t* url,
CEF_EXPORT int cef_create_url(const struct _cef_urlparts_t* parts,
cef_string_t* url);
///
// This is a convenience function for formatting a URL in a concise and human-
// friendly way to help users make security-related decisions (or in other
// circumstances when people need to distinguish sites, origins, or otherwise-
// simplified URLs from each other). Internationalized domain names (IDN) may be
// presented in Unicode if |languages| accepts the Unicode representation. The
// returned value will (a) omit the path for standard schemes, excepting file
// and filesystem, and (b) omit the port if it is the default for the scheme. Do
// not use this for URLs which will be parsed or sent to other applications.
///
// The resulting string must be freed by calling cef_string_userfree_free().
CEF_EXPORT cef_string_userfree_t cef_format_url_for_security_display(
const cef_string_t* origin_url, const cef_string_t* languages);
///
// Returns the mime type for the specified file extension or an NULL string if
// unknown.
@@ -68,10 +82,12 @@ CEF_EXPORT int cef_create_url(const struct _cef_urlparts_t* parts,
CEF_EXPORT cef_string_userfree_t cef_get_mime_type(
const cef_string_t* extension);
///
// Get the extensions associated with the given mime type. This should be passed
// in lower case. There could be multiple extensions for a given mime type, like
// "html,htm" for "text/html", or "txt,text,html,..." for "text/*". Any existing
// elements in the provided vector will not be erased.
///
CEF_EXPORT void cef_get_extensions_for_mime_type(const cef_string_t* mime_type,
cef_string_list_t extensions);
@@ -122,22 +138,28 @@ CEF_EXPORT cef_string_userfree_t cef_uridecode(const cef_string_t* text,
CEF_EXPORT int cef_parse_csscolor(const cef_string_t* string, int strict,
cef_color_t* color);
///
// Parses the specified |json_string| and returns a dictionary or list
// representation. If JSON parsing fails this function returns NULL.
///
CEF_EXPORT struct _cef_value_t* cef_parse_json(const cef_string_t* json_string,
cef_json_parser_options_t options);
///
// Parses the specified |json_string| and returns a dictionary or list
// representation. If JSON parsing fails this function returns NULL and
// populates |error_code_out| and |error_msg_out| with an error code and a
// formatted error message respectively.
///
CEF_EXPORT struct _cef_value_t* cef_parse_jsonand_return_error(
const cef_string_t* json_string, cef_json_parser_options_t options,
cef_json_parser_error_t* error_code_out, cef_string_t* error_msg_out);
///
// Generates a JSON string from the specified root |node| which should be a
// dictionary or list value. Returns an NULL string on failure. This function
// requires exclusive access to |node| including any underlying data.
///
// The resulting string must be freed by calling cef_string_userfree_free().
CEF_EXPORT cef_string_userfree_t cef_write_json(struct _cef_value_t* node,
cef_json_writer_options_t options);

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -87,6 +87,27 @@ typedef struct _cef_request_t {
void (CEF_CALLBACK *set_method)(struct _cef_request_t* self,
const cef_string_t* method);
///
// Set the referrer URL and policy. If non-NULL the referrer URL must be fully
// qualified with an HTTP or HTTPS scheme component. Any username, password or
// ref component will be removed.
///
void (CEF_CALLBACK *set_referrer)(struct _cef_request_t* self,
const cef_string_t* referrer_url, cef_referrer_policy_t policy);
///
// Get the referrer URL.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_referrer_url)(
struct _cef_request_t* self);
///
// Get the referrer policy.
///
cef_referrer_policy_t (CEF_CALLBACK *get_referrer_policy)(
struct _cef_request_t* self);
///
// Get the post data.
///
@@ -100,13 +121,14 @@ typedef struct _cef_request_t {
struct _cef_post_data_t* postData);
///
// Get the header values.
// Get the header values. Will not include the Referer value if any.
///
void (CEF_CALLBACK *get_header_map)(struct _cef_request_t* self,
cef_string_multimap_t headerMap);
///
// Set the header values.
// Set the header values. If a Referer value exists in the header map it will
// be removed and ignored.
///
void (CEF_CALLBACK *set_header_map)(struct _cef_request_t* self,
cef_string_multimap_t headerMap);
@@ -190,6 +212,14 @@ typedef struct _cef_post_data_t {
///
int (CEF_CALLBACK *is_read_only)(struct _cef_post_data_t* self);
///
// Returns true (1) if the underlying POST data includes elements that are not
// represented by this cef_post_data_t object (for example, multi-part file
// upload data). Modifying cef_post_data_t objects with excluded elements may
// result in the request failing.
///
int (CEF_CALLBACK *has_excluded_elements)(struct _cef_post_data_t* self);
///
// Returns the number of existing post data elements.
///

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -38,8 +38,10 @@
#define CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_CAPI_H_
#pragma once
#include "include/capi/cef_callback_capi.h"
#include "include/capi/cef_cookie_capi.h"
#include "include/capi/cef_request_context_handler_capi.h"
#include "include/capi/cef_values_capi.h"
#ifdef __cplusplus
extern "C" {
@@ -47,6 +49,26 @@ extern "C" {
struct _cef_scheme_handler_factory_t;
///
// Callback structure for cef_request_tContext::ResolveHost.
///
typedef struct _cef_resolve_callback_t {
///
// Base structure.
///
cef_base_t base;
///
// Called after the ResolveHost request has completed. |result| will be the
// result code. |resolved_ips| will be the list of resolved IP addresses or
// NULL if the resolution failed.
///
void (CEF_CALLBACK *on_resolve_completed)(
struct _cef_resolve_callback_t* self, cef_errorcode_t result,
cef_string_list_t resolved_ips);
} cef_resolve_callback_t;
///
// A request context provides request handling for a set of related browser or
// URL request objects. A request context can be specified when creating a new
@@ -150,6 +172,93 @@ typedef struct _cef_request_context_t {
///
void (CEF_CALLBACK *purge_plugin_list_cache)(
struct _cef_request_context_t* self, int reload_pages);
///
// Returns true (1) if a preference with the specified |name| exists. This
// function must be called on the browser process UI thread.
///
int (CEF_CALLBACK *has_preference)(struct _cef_request_context_t* self,
const cef_string_t* name);
///
// Returns the value for the preference with the specified |name|. Returns
// NULL if the preference does not exist. The returned object contains a copy
// of the underlying preference value and modifications to the returned object
// will not modify the underlying preference value. This function must be
// called on the browser process UI thread.
///
struct _cef_value_t* (CEF_CALLBACK *get_preference)(
struct _cef_request_context_t* self, const cef_string_t* name);
///
// Returns all preferences as a dictionary. If |include_defaults| is true (1)
// then preferences currently at their default value will be included. The
// returned object contains a copy of the underlying preference values and
// modifications to the returned object will not modify the underlying
// preference values. This function must be called on the browser process UI
// thread.
///
struct _cef_dictionary_value_t* (CEF_CALLBACK *get_all_preferences)(
struct _cef_request_context_t* self, int include_defaults);
///
// Returns true (1) if the preference with the specified |name| can be
// modified using SetPreference. As one example preferences set via the
// command-line usually cannot be modified. This function must be called on
// the browser process UI thread.
///
int (CEF_CALLBACK *can_set_preference)(struct _cef_request_context_t* self,
const cef_string_t* name);
///
// Set the |value| associated with preference |name|. Returns true (1) if the
// value is set successfully and false (0) otherwise. If |value| is NULL the
// preference will be restored to its default value. If setting the preference
// fails then |error| will be populated with a detailed description of the
// problem. This function must be called on the browser process UI thread.
///
int (CEF_CALLBACK *set_preference)(struct _cef_request_context_t* self,
const cef_string_t* name, struct _cef_value_t* value,
cef_string_t* error);
///
// Clears all certificate exceptions that were added as part of handling
// cef_request_tHandler::on_certificate_error(). If you call this it is
// recommended that you also call close_all_connections() or you risk not
// being prompted again for server certificates if you reconnect quickly. If
// |callback| is non-NULL it will be executed on the UI thread after
// completion.
///
void (CEF_CALLBACK *clear_certificate_exceptions)(
struct _cef_request_context_t* self,
struct _cef_completion_callback_t* callback);
///
// Clears all active and idle connections that Chromium currently has. This is
// only recommended if you have released all other CEF objects but don't yet
// want to call cef_shutdown(). If |callback| is non-NULL it will be executed
// on the UI thread after completion.
///
void (CEF_CALLBACK *close_all_connections)(
struct _cef_request_context_t* self,
struct _cef_completion_callback_t* callback);
///
// Attempts to resolve |origin| to a list of associated IP addresses.
// |callback| will be executed on the UI thread after completion.
///
void (CEF_CALLBACK *resolve_host)(struct _cef_request_context_t* self,
const cef_string_t* origin, struct _cef_resolve_callback_t* callback);
///
// Attempts to resolve |origin| to a list of associated IP addresses using
// cached data. |resolved_ips| will be populated with the list of resolved IP
// addresses or NULL if no cached data is available. Returns ERR_NONE on
// success. This function must be called on the browser process IO thread.
///
cef_errorcode_t (CEF_CALLBACK *resolve_host_cached)(
struct _cef_request_context_t* self, const cef_string_t* origin,
cef_string_list_t resolved_ips);
} cef_request_context_t;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -45,6 +45,7 @@
#include "include/capi/cef_request_capi.h"
#include "include/capi/cef_resource_handler_capi.h"
#include "include/capi/cef_response_capi.h"
#include "include/capi/cef_response_filter_capi.h"
#include "include/capi/cef_ssl_info_capi.h"
#ifdef __cplusplus
@@ -162,13 +163,38 @@ typedef struct _cef_request_handler_t {
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
struct _cef_request_t* request, struct _cef_response_t* response);
///
// Called on the IO thread to optionally filter resource response content.
// |request| and |response| represent the request and response respectively
// and cannot be modified in this callback.
///
struct _cef_response_filter_t* (CEF_CALLBACK *get_resource_response_filter)(
struct _cef_request_handler_t* self, struct _cef_browser_t* browser,
struct _cef_frame_t* frame, struct _cef_request_t* request,
struct _cef_response_t* response);
///
// Called on the IO thread when a resource load has completed. |request| and
// |response| represent the request and response respectively and cannot be
// modified in this callback. |status| indicates the load completion status.
// |received_content_length| is the number of response bytes actually read.
///
void (CEF_CALLBACK *on_resource_load_complete)(
struct _cef_request_handler_t* self, struct _cef_browser_t* browser,
struct _cef_frame_t* frame, struct _cef_request_t* request,
struct _cef_response_t* response, cef_urlrequest_status_t status,
int64 received_content_length);
///
// Called on the IO thread when the browser needs credentials from the user.
// |isProxy| indicates whether the host is a proxy server. |host| contains the
// hostname and |port| contains the port number. Return true (1) to continue
// the request and call cef_auth_callback_t::cont() either in this function or
// at a later time when the authentication information is available. Return
// false (0) to cancel the request immediately.
// hostname and |port| contains the port number. |realm| is the realm of the
// challenge and may be NULL. |scheme| is the authentication scheme used, such
// as "basic" or "digest", and will be NULL if the source of the request is an
// FTP server. Return true (1) to continue the request and call
// cef_auth_callback_t::cont() either in this function or at a later time when
// the authentication information is available. Return false (0) to cancel the
// request immediately.
///
int (CEF_CALLBACK *get_auth_credentials)(struct _cef_request_handler_t* self,
struct _cef_browser_t* browser, struct _cef_frame_t* frame, int isProxy,
@@ -203,10 +229,9 @@ typedef struct _cef_request_handler_t {
// Called on the UI thread to handle requests for URLs with an invalid SSL
// certificate. Return true (1) and call cef_request_tCallback::cont() either
// in this function or at a later time to continue or cancel the request.
// Return false (0) to cancel the request immediately. If |callback| is NULL
// the error cannot be recovered from and the request will be canceled
// automatically. If CefSettings.ignore_certificate_errors is set all invalid
// certificates will be accepted without calling this function.
// Return false (0) to cancel the request immediately. If
// CefSettings.ignore_certificate_errors is set all invalid certificates will
// be accepted without calling this function.
///
int (CEF_CALLBACK *on_certificate_error)(struct _cef_request_handler_t* self,
struct _cef_browser_t* browser, cef_errorcode_t cert_error,

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -0,0 +1,93 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_CEF_RESPONSE_FILTER_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_RESPONSE_FILTER_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// Implement this structure to filter resource response content. The functions
// of this structure will be called on the browser process IO thread.
///
typedef struct _cef_response_filter_t {
///
// Base structure.
///
cef_base_t base;
///
// Initialize the response filter. Will only be called a single time. The
// filter will not be installed if this function returns false (0).
///
int (CEF_CALLBACK *init_filter)(struct _cef_response_filter_t* self);
///
// Called to filter a chunk of data. |data_in| is the input buffer containing
// |data_in_size| bytes of pre-filter data (|data_in| will be NULL if
// |data_in_size| is zero). |data_out| is the output buffer that can accept up
// to |data_out_size| bytes of filtered output data. Set |data_in_read| to the
// number of bytes that were read from |data_in|. Set |data_out_written| to
// the number of bytes that were written into |data_out|. If some or all of
// the pre-filter data was read successfully but more data is needed in order
// to continue filtering (filtered output is pending) return
// RESPONSE_FILTER_NEED_MORE_DATA. If some or all of the pre-filter data was
// read successfully and all available filtered output has been written return
// RESPONSE_FILTER_DONE. If an error occurs during filtering return
// RESPONSE_FILTER_ERROR. This function will be called repeatedly until there
// is no more data to filter (resource response is complete), |data_in_read|
// matches |data_in_size| (all available pre-filter bytes have been read), and
// the function returns RESPONSE_FILTER_DONE or RESPONSE_FILTER_ERROR. Do not
// keep a reference to the buffers passed to this function.
///
cef_response_filter_status_t (CEF_CALLBACK *filter)(
struct _cef_response_filter_t* self, void* data_in, size_t data_in_size,
size_t* data_in_read, void* data_out, size_t data_out_size,
size_t* data_out_written);
} cef_response_filter_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_RESPONSE_FILTER_CAPI_H_

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -126,6 +126,24 @@ typedef struct _cef_sslinfo_t {
///
cef_base_t base;
///
// Returns a bitmask containing any and all problems verifying the server
// certificate.
///
cef_cert_status_t (CEF_CALLBACK *get_cert_status)(
struct _cef_sslinfo_t* self);
///
// Returns true (1) if the certificate status has any error, major or minor.
///
int (CEF_CALLBACK *is_cert_status_error)(struct _cef_sslinfo_t* self);
///
// Returns true (1) if the certificate status represents only minor errors
// (e.g. failure to verify certificate revocation).
///
int (CEF_CALLBACK *is_cert_status_minor_error)(struct _cef_sslinfo_t* self);
///
// Returns the subject of the X.509 certificate. For HTTPS server certificates
// this represents the web server. The common name of the subject should
@@ -170,6 +188,28 @@ typedef struct _cef_sslinfo_t {
///
struct _cef_binary_value_t* (CEF_CALLBACK *get_pemencoded)(
struct _cef_sslinfo_t* self);
///
// Returns the number of certificates in the issuer chain. If 0, the
// certificate is self-signed.
///
size_t (CEF_CALLBACK *get_issuer_chain_size)(struct _cef_sslinfo_t* self);
///
// Returns the DER encoded data for the certificate issuer chain. If we failed
// to encode a certificate in the chain it is still present in the array but
// is an NULL string.
///
void (CEF_CALLBACK *get_derencoded_issuer_chain)(struct _cef_sslinfo_t* self,
size_t* chainCount, struct _cef_binary_value_t** chain);
///
// Returns the PEM encoded data for the certificate issuer chain. If we failed
// to encode a certificate in the chain it is still present in the array but
// is an NULL string.
///
void (CEF_CALLBACK *get_pemencoded_issuer_chain)(struct _cef_sslinfo_t* self,
size_t* chainCount, struct _cef_binary_value_t** chain);
} cef_sslinfo_t;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View File

@@ -181,7 +181,7 @@ class CefBrowser : public virtual CefBase {
/*--cef()--*/
virtual void GetFrameNames(std::vector<CefString>& names) =0;
//
///
// Send a message to the specified |target_process|. Returns true if the
// message was sent successfully.
///
@@ -457,7 +457,6 @@ class CefBrowserHost : public virtual CefBase {
// specified visitor. If |current_only| is true only the current navigation
// entry will be sent, otherwise all navigation entries will be sent.
///
///
/*--cef()--*/
virtual void GetNavigationEntries(
CefRefPtr<CefNavigationEntryVisitor> visitor,

View File

@@ -182,7 +182,8 @@ class CefFrame : public virtual CefBase {
virtual CefString GetName() =0;
///
// Returns the globally unique identifier for this frame.
// Returns the globally unique identifier for this frame or < 0 if the
// underlying frame does not yet exist.
///
/*--cef()--*/
virtual int64 GetIdentifier() =0;

View File

@@ -82,14 +82,12 @@ class CefGeolocationHandler : public virtual CefBase {
}
///
// Called when a geolocation access request is canceled. |requesting_url| is
// the URL that originally requested permission and |request_id| is the unique
// ID for the permission request.
// Called when a geolocation access request is canceled. |request_id| is the
// unique ID for the permission request.
///
/*--cef()--*/
virtual void OnCancelGeolocationPermission(
CefRefPtr<CefBrowser> browser,
const CefString& requesting_url,
int request_id) {
}
};

View File

@@ -68,18 +68,21 @@ class CefJSDialogHandler : public virtual CefBase {
typedef cef_jsdialog_type_t JSDialogType;
///
// Called to run a JavaScript dialog. The |default_prompt_text| value will be
// specified for prompt dialogs only. Set |suppress_message| to true and
// return false to suppress the message (suppressing messages is preferable
// to immediately executing the callback as this is used to detect presumably
// malicious behavior like spamming alert messages in onbeforeunload). Set
// |suppress_message| to false and return false to use the default
// implementation (the default implementation will show one modal dialog at a
// time and suppress any additional dialog requests until the displayed dialog
// is dismissed). Return true if the application will use a custom dialog or
// if the callback has been executed immediately. Custom dialogs may be either
// modal or modeless. If a custom dialog is used the application must execute
// |callback| once the custom dialog is dismissed.
// Called to run a JavaScript dialog. If |origin_url| and |accept_lang| are
// non-empty they can be passed to the CefFormatUrlForSecurityDisplay function
// to retrieve a secure and user-friendly display string. The
// |default_prompt_text| value will be specified for prompt dialogs only. Set
// |suppress_message| to true and return false to suppress the message
// (suppressing messages is preferable to immediately executing the callback
// as this is used to detect presumably malicious behavior like spamming alert
// messages in onbeforeunload). Set |suppress_message| to false and return
// false to use the default implementation (the default implementation will
// show one modal dialog at a time and suppress any additional dialog requests
// until the displayed dialog is dismissed). Return true if the application
// will use a custom dialog or if the callback has been executed immediately.
// Custom dialogs may be either modal or modeless. If a custom dialog is used
// the application must execute |callback| once the custom dialog is
// dismissed.
///
/*--cef(optional_param=origin_url,optional_param=accept_lang,
optional_param=message_text,optional_param=default_prompt_text)--*/

View File

@@ -48,11 +48,13 @@
/*--cef(source=client)--*/
class CefKeyboardHandler : public virtual CefBase {
public:
///
// Called before a keyboard event is sent to the renderer. |event| contains
// information about the keyboard event. |os_event| is the operating system
// event message, if any. Return true if the event was handled or false
// otherwise. If the event will be handled in OnKeyEvent() as a keyboard
// shortcut set |is_keyboard_shortcut| to true and return false.
///
/*--cef()--*/
virtual bool OnPreKeyEvent(CefRefPtr<CefBrowser> browser,
const CefKeyEvent& event,

View File

@@ -70,6 +70,7 @@ class CefLifeSpanHandler : public virtual CefBase {
// source browser's values. If the |no_javascript_access| value is set to
// false the new browser will not be scriptable and may not be hosted in the
// same renderer process as the source browser.
///
/*--cef(optional_param=target_url,optional_param=target_frame_name)--*/
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,

View File

@@ -56,7 +56,8 @@ class CefLoadHandler : public virtual CefBase {
// Called when the loading state has changed. This callback will be executed
// twice -- once when loading is initiated either programmatically or by user
// action, and once when loading is terminated due to completion, cancellation
// of failure.
// of failure. It will be called before any calls to OnLoadStart and after all
// calls to OnLoadError and/or OnLoadEnd.
///
/*--cef()--*/
virtual void OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
@@ -69,8 +70,8 @@ class CefLoadHandler : public virtual CefBase {
// 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
// may not be called for a particular frame if the load request for that frame
// fails. For notification of overall browser load status use
// 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()--*/
@@ -83,7 +84,8 @@ class CefLoadHandler : public virtual CefBase {
// 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
// completes successfully.
// completes successfully. For notification of overall browser load status use
// OnLoadingStateChange instead.
///
/*--cef()--*/
virtual void OnLoadEnd(CefRefPtr<CefBrowser> browser,

View File

@@ -63,26 +63,26 @@ class CefMenuModel : public virtual CefBase {
/*--cef()--*/
virtual int GetCount() =0;
//
///
// Add a separator to the menu. Returns true on success.
///
/*--cef()--*/
virtual bool AddSeparator() =0;
//
///
// Add an item to the menu. Returns true on success.
///
/*--cef()--*/
virtual bool AddItem(int command_id,
const CefString& label) =0;
//
///
// Add a check item to the menu. Returns true on success.
///
/*--cef()--*/
virtual bool AddCheckItem(int command_id,
const CefString& label) =0;
//
///
// Add a radio item to the menu. Only a single item with the specified
// |group_id| can be checked at a time. Returns true on success.
///
@@ -91,21 +91,21 @@ class CefMenuModel : public virtual CefBase {
const CefString& label,
int group_id) =0;
//
///
// Add a sub-menu to the menu. The new sub-menu is returned.
///
/*--cef()--*/
virtual CefRefPtr<CefMenuModel> AddSubMenu(int command_id,
const CefString& label) =0;
//
///
// Insert a separator in the menu at the specified |index|. Returns true on
// success.
///
/*--cef()--*/
virtual bool InsertSeparatorAt(int index) =0;
//
///
// Insert an item in the menu at the specified |index|. Returns true on
// success.
///
@@ -114,7 +114,7 @@ class CefMenuModel : public virtual CefBase {
int command_id,
const CefString& label) =0;
//
///
// Insert a check item in the menu at the specified |index|. Returns true on
// success.
///
@@ -123,7 +123,7 @@ class CefMenuModel : public virtual CefBase {
int command_id,
const CefString& label) =0;
//
///
// Insert a radio item in the menu at the specified |index|. Only a single
// item with the specified |group_id| can be checked at a time. Returns true
// on success.
@@ -134,7 +134,7 @@ class CefMenuModel : public virtual CefBase {
const CefString& label,
int group_id) =0;
//
///
// Insert a sub-menu in the menu at the specified |index|. The new sub-menu
// is returned.
///
@@ -248,99 +248,99 @@ class CefMenuModel : public virtual CefBase {
/*--cef()--*/
virtual CefRefPtr<CefMenuModel> GetSubMenuAt(int index) =0;
//
///
// Returns true if the specified |command_id| is visible.
///
/*--cef()--*/
virtual bool IsVisible(int command_id) =0;
//
///
// Returns true if the specified |index| is visible.
///
/*--cef()--*/
virtual bool IsVisibleAt(int index) =0;
//
///
// Change the visibility of the specified |command_id|. Returns true on
// success.
///
/*--cef()--*/
virtual bool SetVisible(int command_id, bool visible) =0;
//
///
// Change the visibility at the specified |index|. Returns true on success.
///
/*--cef()--*/
virtual bool SetVisibleAt(int index, bool visible) =0;
//
///
// Returns true if the specified |command_id| is enabled.
///
/*--cef()--*/
virtual bool IsEnabled(int command_id) =0;
//
///
// Returns true if the specified |index| is enabled.
///
/*--cef()--*/
virtual bool IsEnabledAt(int index) =0;
//
///
// Change the enabled status of the specified |command_id|. Returns true on
// success.
///
/*--cef()--*/
virtual bool SetEnabled(int command_id, bool enabled) =0;
//
///
// Change the enabled status at the specified |index|. Returns true on
// success.
///
/*--cef()--*/
virtual bool SetEnabledAt(int index, bool enabled) =0;
//
///
// Returns true if the specified |command_id| is checked. Only applies to
// check and radio items.
///
/*--cef()--*/
virtual bool IsChecked(int command_id) =0;
//
///
// Returns true if the specified |index| is checked. Only applies to check
// and radio items.
///
/*--cef()--*/
virtual bool IsCheckedAt(int index) =0;
//
///
// Check the specified |command_id|. Only applies to check and radio items.
// Returns true on success.
///
/*--cef()--*/
virtual bool SetChecked(int command_id, bool checked) =0;
//
///
// Check the specified |index|. Only applies to check and radio items. Returns
// true on success.
///
/*--cef()--*/
virtual bool SetCheckedAt(int index, bool checked) =0;
//
///
// Returns true if the specified |command_id| has a keyboard accelerator
// assigned.
///
/*--cef()--*/
virtual bool HasAccelerator(int command_id) =0;
//
///
// Returns true if the specified |index| has a keyboard accelerator assigned.
///
/*--cef()--*/
virtual bool HasAcceleratorAt(int index) =0;
//
///
// Set the keyboard accelerator for the specified |command_id|. |key_code| can
// be any virtual key or character value. Returns true on success.
///
@@ -351,7 +351,7 @@ class CefMenuModel : public virtual CefBase {
bool ctrl_pressed,
bool alt_pressed) =0;
//
///
// Set the keyboard accelerator at the specified |index|. |key_code| can be
// any virtual key or character value. Returns true on success.
///
@@ -362,21 +362,21 @@ class CefMenuModel : public virtual CefBase {
bool ctrl_pressed,
bool alt_pressed) =0;
//
///
// Remove the keyboard accelerator for the specified |command_id|. Returns
// true on success.
///
/*--cef()--*/
virtual bool RemoveAccelerator(int command_id) =0;
//
///
// Remove the keyboard accelerator at the specified |index|. Returns true on
// success.
///
/*--cef()--*/
virtual bool RemoveAcceleratorAt(int index) =0;
//
///
// Retrieves the keyboard accelerator for the specified |command_id|. Returns
// true on success.
///
@@ -387,7 +387,7 @@ class CefMenuModel : public virtual CefBase {
bool& ctrl_pressed,
bool& alt_pressed) =0;
//
///
// Retrieves the keyboard accelerator for the specified |index|. Returns true
// on success.
///

View File

@@ -60,6 +60,20 @@ bool CefParseURL(const CefString& url,
bool CefCreateURL(const CefURLParts& parts,
CefString& url);
///
// This is a convenience function for formatting a URL in a concise and human-
// friendly way to help users make security-related decisions (or in other
// circumstances when people need to distinguish sites, origins, or otherwise-
// simplified URLs from each other). Internationalized domain names (IDN) may be
// presented in Unicode if |languages| accepts the Unicode representation. The
// returned value will (a) omit the path for standard schemes, excepting file
// and filesystem, and (b) omit the port if it is the default for the scheme. Do
// not use this for URLs which will be parsed or sent to other applications.
///
/*--cef(optional_param=languages)--*/
CefString CefFormatUrlForSecurityDisplay(const CefString& origin_url,
const CefString& languages);
///
// Returns the mime type for the specified file extension or an empty string if
// unknown.
@@ -67,10 +81,12 @@ bool CefCreateURL(const CefURLParts& parts,
/*--cef()--*/
CefString CefGetMimeType(const CefString& extension);
///
// Get the extensions associated with the given mime type. This should be passed
// in lower case. There could be multiple extensions for a given mime type, like
// "html,htm" for "text/html", or "txt,text,html,..." for "text/*". Any existing
// elements in the provided vector will not be erased.
///
/*--cef()--*/
void CefGetExtensionsForMimeType(const CefString& mime_type,
std::vector<CefString>& extensions);
@@ -123,16 +139,20 @@ bool CefParseCSSColor(const CefString& string,
bool strict,
cef_color_t& color);
///
// Parses the specified |json_string| and returns a dictionary or list
// representation. If JSON parsing fails this method returns NULL.
///
/*--cef()--*/
CefRefPtr<CefValue> CefParseJSON(const CefString& json_string,
cef_json_parser_options_t options);
///
// Parses the specified |json_string| and returns a dictionary or list
// representation. If JSON parsing fails this method returns NULL and populates
// |error_code_out| and |error_msg_out| with an error code and a formatted error
// message respectively.
///
/*--cef()--*/
CefRefPtr<CefValue> CefParseJSONAndReturnError(
const CefString& json_string,
@@ -140,9 +160,11 @@ CefRefPtr<CefValue> CefParseJSONAndReturnError(
cef_json_parser_error_t& error_code_out,
CefString& error_msg_out);
///
// Generates a JSON string from the specified root |node| which should be a
// dictionary or list value. Returns an empty string on failure. This method
// requires exclusive access to |node| including any underlying data.
///
/*--cef()--*/
CefString CefWriteJSON(CefRefPtr<CefValue> node,
cef_json_writer_options_t options);

View File

@@ -53,6 +53,7 @@ class CefPostDataElement;
class CefRequest : public virtual CefBase {
public:
typedef std::multimap<CefString, CefString> HeaderMap;
typedef cef_referrer_policy_t ReferrerPolicy;
typedef cef_resource_type_t ResourceType;
typedef cef_transition_type_t TransitionType;
@@ -93,6 +94,27 @@ class CefRequest : public virtual CefBase {
/*--cef()--*/
virtual void SetMethod(const CefString& method) =0;
///
// Set the referrer URL and policy. If non-empty the referrer URL must be
// fully qualified with an HTTP or HTTPS scheme component. Any username,
// password or ref component will be removed.
///
/*--cef()--*/
virtual void SetReferrer(const CefString& referrer_url,
ReferrerPolicy policy) =0;
///
// Get the referrer URL.
///
/*--cef()--*/
virtual CefString GetReferrerURL() =0;
///
// Get the referrer policy.
///
/*--cef(default_retval=REFERRER_POLICY_DEFAULT)--*/
virtual ReferrerPolicy GetReferrerPolicy() =0;
///
// Get the post data.
///
@@ -106,13 +128,14 @@ class CefRequest : public virtual CefBase {
virtual void SetPostData(CefRefPtr<CefPostData> postData) =0;
///
// Get the header values.
// Get the header values. Will not include the Referer value if any.
///
/*--cef()--*/
virtual void GetHeaderMap(HeaderMap& headerMap) =0;
///
// Set the header values.
// Set the header values. If a Referer value exists in the header map it will
// be removed and ignored.
///
/*--cef()--*/
virtual void SetHeaderMap(const HeaderMap& headerMap) =0;
@@ -200,6 +223,15 @@ class CefPostData : public virtual CefBase {
/*--cef()--*/
virtual bool IsReadOnly() =0;
///
// Returns true if the underlying POST data includes elements that are not
// represented by this CefPostData object (for example, multi-part file upload
// data). Modifying CefPostData objects with excluded elements may result in
// the request failing.
///
/*--cef()--*/
virtual bool HasExcludedElements() = 0;
///
// Returns the number of existing post data elements.
///

View File

@@ -38,11 +38,34 @@
#define CEF_INCLUDE_CEF_REQUEST_CONTEXT_H_
#pragma once
#include <vector>
#include "include/cef_callback.h"
#include "include/cef_cookie.h"
#include "include/cef_request_context_handler.h"
#include "include/cef_values.h"
class CefSchemeHandlerFactory;
///
// Callback interface for CefRequestContext::ResolveHost.
///
/*--cef(source=client)--*/
class CefResolveCallback : public virtual CefBase {
public:
///
// Called after the ResolveHost request has completed. |result| will be the
// result code. |resolved_ips| will be the list of resolved IP addresses or
// empty if the resolution failed.
///
/*--cef(optional_param=resolved_ips)--*/
virtual void OnResolveCompleted(
cef_errorcode_t result,
const std::vector<CefString>& resolved_ips) =0;
};
///
// A request context provides request handling for a set of related browser
// or URL request objects. A request context can be specified when creating a
@@ -166,6 +189,98 @@ class CefRequestContext : public virtual CefBase {
///
/*--cef()--*/
virtual void PurgePluginListCache(bool reload_pages) =0;
///
// Returns true if a preference with the specified |name| exists. This method
// must be called on the browser process UI thread.
///
/*--cef()--*/
virtual bool HasPreference(const CefString& name) =0;
///
// Returns the value for the preference with the specified |name|. Returns
// NULL if the preference does not exist. The returned object contains a copy
// of the underlying preference value and modifications to the returned object
// will not modify the underlying preference value. This method must be called
// on the browser process UI thread.
///
/*--cef()--*/
virtual CefRefPtr<CefValue> GetPreference(const CefString& name) =0;
///
// Returns all preferences as a dictionary. If |include_defaults| is true then
// preferences currently at their default value will be included. The returned
// object contains a copy of the underlying preference values and
// modifications to the returned object will not modify the underlying
// preference values. This method must be called on the browser process UI
// thread.
///
/*--cef()--*/
virtual CefRefPtr<CefDictionaryValue> GetAllPreferences(
bool include_defaults) =0;
///
// Returns true if the preference with the specified |name| can be modified
// using SetPreference. As one example preferences set via the command-line
// usually cannot be modified. This method must be called on the browser
// process UI thread.
///
/*--cef()--*/
virtual bool CanSetPreference(const CefString& name) =0;
///
// Set the |value| associated with preference |name|. Returns true if the
// value is set successfully and false otherwise. If |value| is NULL the
// preference will be restored to its default value. If setting the preference
// fails then |error| will be populated with a detailed description of the
// problem. This method must be called on the browser process UI thread.
///
/*--cef(optional_param=value)--*/
virtual bool SetPreference(const CefString& name,
CefRefPtr<CefValue> value,
CefString& error) =0;
///
// Clears all certificate exceptions that were added as part of handling
// CefRequestHandler::OnCertificateError(). If you call this it is
// recommended that you also call CloseAllConnections() or you risk not
// being prompted again for server certificates if you reconnect quickly.
// If |callback| is non-NULL it will be executed on the UI thread after
// completion.
///
/*--cef(optional_param=callback)--*/
virtual void ClearCertificateExceptions(
CefRefPtr<CefCompletionCallback> callback) =0;
///
// Clears all active and idle connections that Chromium currently has.
// This is only recommended if you have released all other CEF objects but
// don't yet want to call CefShutdown(). If |callback| is non-NULL it will be
// executed on the UI thread after completion.
///
/*--cef(optional_param=callback)--*/
virtual void CloseAllConnections(
CefRefPtr<CefCompletionCallback> callback) =0;
///
// Attempts to resolve |origin| to a list of associated IP addresses.
// |callback| will be executed on the UI thread after completion.
///
/*--cef()--*/
virtual void ResolveHost(
const CefString& origin,
CefRefPtr<CefResolveCallback> callback) =0;
///
// Attempts to resolve |origin| to a list of associated IP addresses using
// cached data. |resolved_ips| will be populated with the list of resolved IP
// addresses or empty if no cached data is available. Returns ERR_NONE on
// success. This method must be called on the browser process IO thread.
///
/*--cef(default_retval=ERR_FAILED)--*/
virtual cef_errorcode_t ResolveHostCached(
const CefString& origin,
std::vector<CefString>& resolved_ips) =0;
};
#endif // CEF_INCLUDE_CEF_REQUEST_CONTEXT_H_

View File

@@ -44,6 +44,7 @@
#include "include/cef_frame.h"
#include "include/cef_resource_handler.h"
#include "include/cef_response.h"
#include "include/cef_response_filter.h"
#include "include/cef_request.h"
#include "include/cef_ssl_info.h"
@@ -78,6 +79,7 @@ class CefRequestHandler : public virtual CefBase {
public:
typedef cef_return_value_t ReturnValue;
typedef cef_termination_status_t TerminationStatus;
typedef cef_urlrequest_status_t URLRequestStatus;
typedef cef_window_open_disposition_t WindowOpenDisposition;
///
@@ -180,15 +182,46 @@ class CefRequestHandler : public virtual CefBase {
return false;
}
///
// Called on the IO thread to optionally filter resource response content.
// |request| and |response| represent the request and response respectively
// and cannot be modified in this callback.
///
/*--cef()--*/
virtual CefRefPtr<CefResponseFilter> GetResourceResponseFilter(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
CefRefPtr<CefResponse> response) {
return NULL;
}
///
// Called on the IO thread when a resource load has completed. |request| and
// |response| represent the request and response respectively and cannot be
// modified in this callback. |status| indicates the load completion status.
// |received_content_length| is the number of response bytes actually read.
///
/*--cef()--*/
virtual void OnResourceLoadComplete(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
CefRefPtr<CefResponse> response,
URLRequestStatus status,
int64 received_content_length) {}
///
// Called on the IO thread when the browser needs credentials from the user.
// |isProxy| indicates whether the host is a proxy server. |host| contains the
// hostname and |port| contains the port number. Return true to continue the
// request and call CefAuthCallback::Continue() either in this method or
// at a later time when the authentication information is available. Return
// false to cancel the request immediately.
// hostname and |port| contains the port number. |realm| is the realm of the
// challenge and may be empty. |scheme| is the authentication scheme used,
// such as "basic" or "digest", and will be empty if the source of the request
// is an FTP server. Return true to continue the request and call
// CefAuthCallback::Continue() either in this method or at a later time when
// the authentication information is available. Return false to cancel the
// request immediately.
///
/*--cef(optional_param=realm)--*/
/*--cef(optional_param=realm,optional_param=scheme)--*/
virtual bool GetAuthCredentials(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
bool isProxy,
@@ -232,10 +265,9 @@ class CefRequestHandler : public virtual CefBase {
// Called on the UI thread to handle requests for URLs with an invalid
// SSL certificate. Return true and call CefRequestCallback::Continue() either
// in this method or at a later time to continue or cancel the request. Return
// false to cancel the request immediately. If |callback| is empty the error
// cannot be recovered from and the request will be canceled automatically.
// If CefSettings.ignore_certificate_errors is set all invalid certificates
// will be accepted without calling this method.
// false to cancel the request immediately. If
// CefSettings.ignore_certificate_errors is set all invalid certificates will
// be accepted without calling this method.
///
/*--cef()--*/
virtual bool OnCertificateError(

View File

@@ -0,0 +1,86 @@
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_CEF_RESPONSE_FILTER_H_
#define CEF_INCLUDE_CEF_RESPONSE_FILTER_H_
#pragma once
#include "include/cef_base.h"
///
// Implement this interface to filter resource response content. The methods of
// this class will be called on the browser process IO thread.
///
/*--cef(source=client)--*/
class CefResponseFilter : public virtual CefBase {
public:
typedef cef_response_filter_status_t FilterStatus;
///
// Initialize the response filter. Will only be called a single time. The
// filter will not be installed if this method returns false.
///
/*--cef()--*/
virtual bool InitFilter() =0;
///
// Called to filter a chunk of data. |data_in| is the input buffer containing
// |data_in_size| bytes of pre-filter data (|data_in| will be NULL if
// |data_in_size| is zero). |data_out| is the output buffer that can accept up
// to |data_out_size| bytes of filtered output data. Set |data_in_read| to the
// number of bytes that were read from |data_in|. Set |data_out_written| to
// the number of bytes that were written into |data_out|. If some or all of
// the pre-filter data was read successfully but more data is needed in order
// to continue filtering (filtered output is pending) return
// RESPONSE_FILTER_NEED_MORE_DATA. If some or all of the pre-filter data was
// read successfully and all available filtered output has been written return
// RESPONSE_FILTER_DONE. If an error occurs during filtering return
// RESPONSE_FILTER_ERROR. This method will be called repeatedly until there is
// no more data to filter (resource response is complete), |data_in_read|
// matches |data_in_size| (all available pre-filter bytes have been read), and
// the method returns RESPONSE_FILTER_DONE or RESPONSE_FILTER_ERROR. Do not
// keep a reference to the buffers passed to this method.
///
/*--cef(optional_param=data_in,default_retval=RESPONSE_FILTER_ERROR)--*/
virtual FilterStatus Filter(void* data_in,
size_t data_in_size,
size_t& data_in_read,
void* data_out,
size_t data_out_size,
size_t& data_out_written) =0;
};
#endif // CEF_INCLUDE_CEF_RESPONSE_FILTER_H_

View File

@@ -111,6 +111,28 @@ class CefSSLCertPrincipal : public virtual CefBase {
/*--cef(source=library)--*/
class CefSSLInfo : public virtual CefBase {
public:
typedef std::vector<CefRefPtr<CefBinaryValue> > IssuerChainBinaryList;
///
// Returns a bitmask containing any and all problems verifying the server
// certificate.
///
/*--cef(default_retval=CERT_STATUS_NONE)--*/
virtual cef_cert_status_t GetCertStatus() =0;
///
// Returns true if the certificate status has any error, major or minor.
///
/*--cef()--*/
virtual bool IsCertStatusError() =0;
///
// Returns true if the certificate status represents only minor errors
// (e.g. failure to verify certificate revocation).
///
/*--cef()--*/
virtual bool IsCertStatusMinorError() =0;
///
// Returns the subject of the X.509 certificate. For HTTPS server
// certificates this represents the web server. The common name of the
@@ -157,6 +179,29 @@ class CefSSLInfo : public virtual CefBase {
///
/*--cef()--*/
virtual CefRefPtr<CefBinaryValue> GetPEMEncoded() =0;
///
// Returns the number of certificates in the issuer chain.
// If 0, the certificate is self-signed.
///
/*--cef()--*/
virtual size_t GetIssuerChainSize() =0;
///
// Returns the DER encoded data for the certificate issuer chain.
// If we failed to encode a certificate in the chain it is still
// present in the array but is an empty string.
///
/*--cef(count_func=chain:GetIssuerChainSize)--*/
virtual void GetDEREncodedIssuerChain(IssuerChainBinaryList& chain) =0;
///
// Returns the PEM encoded data for the certificate issuer chain.
// If we failed to encode a certificate in the chain it is still
// present in the array but is an empty string.
///
/*--cef(count_func=chain:GetIssuerChainSize)--*/
virtual void GetPEMEncodedIssuerChain(IssuerChainBinaryList& chain) =0;
};
#endif // CEF_INCLUDE_CEF_SSL_INFO_H_

View File

@@ -218,15 +218,25 @@ typedef struct _cef_settings_t {
///
// To persist session cookies (cookies without an expiry date or validity
// interval) by default when using the global cookie manager set this value to
// true. Session cookies are generally intended to be transient and most Web
// browsers do not persist them. A |cache_path| value must also be specified
// to enable this feature. Also configurable using the
// true (1). Session cookies are generally intended to be transient and most
// Web browsers do not persist them. A |cache_path| value must also be
// specified to enable this feature. Also configurable using the
// "persist-session-cookies" command-line switch. Can be overridden for
// individual CefRequestContext instances via the
// CefRequestContextSettings.persist_session_cookies value.
///
int persist_session_cookies;
///
// To persist user preferences as a JSON file in the cache path directory set
// this value to true (1). A |cache_path| value must also be specified
// to enable this feature. Also configurable using the
// "persist-user-preferences" command-line switch. Can be overridden for
// individual CefRequestContext instances via the
// CefRequestContextSettings.persist_user_preferences value.
///
int persist_user_preferences;
///
// Value that will be returned as the User-Agent HTTP header. If empty the
// default User-Agent string will be used. Also configurable using the
@@ -252,10 +262,12 @@ typedef struct _cef_settings_t {
cef_string_t locale;
///
// The directory and file name to use for the debug log. If empty, the
// default name of "debug.log" will be used and the file will be written
// to the application directory. Also configurable using the "log-file"
// command-line switch.
// The directory and file name to use for the debug log. If empty a default
// log file name and location will be used. On Windows and Linux a "debug.log"
// file will be written in the main executable directory. On Mac OS X a
// "~/Library/Logs/<app name>_debug.log" file will be written where <app name>
// is the name of the main app executable. Also configurable using the
// "log-file" command-line switch.
///
cef_string_t log_file;
@@ -394,13 +406,21 @@ typedef struct _cef_request_context_settings_t {
///
// To persist session cookies (cookies without an expiry date or validity
// interval) by default when using the global cookie manager set this value to
// true. Session cookies are generally intended to be transient and most Web
// browsers do not persist them. Can be set globally using the
// true (1). Session cookies are generally intended to be transient and most
// Web browsers do not persist them. Can be set globally using the
// CefSettings.persist_session_cookies value. This value will be ignored if
// |cache_path| is empty or if it matches the CefSettings.cache_path value.
///
int persist_session_cookies;
///
// To persist user preferences as a JSON file in the cache path directory set
// this value to true (1). Can be set globally using the
// CefSettings.persist_user_preferences value. This value will be ignored if
// |cache_path| is empty or if it matches the CefSettings.cache_path value.
///
int persist_user_preferences;
///
// Set to true (1) to ignore errors related to invalid SSL certificates.
// Enabling this setting can lead to potential security vulnerabilities like
@@ -513,12 +533,6 @@ typedef struct _cef_browser_settings_t {
///
cef_state_t caret_browsing;
///
// Controls whether the Java plugin will be loaded. Also configurable using
// the "disable-java" command-line switch.
///
cef_state_t java;
///
// Controls whether any plugins will be loaded. Also configurable using the
// "disable-plugins" command-line switch.
@@ -852,6 +866,7 @@ typedef enum {
ERR_SSL_VERSION_OR_CIPHER_MISMATCH = -113,
ERR_SSL_RENEGOTIATION_REQUESTED = -114,
ERR_CERT_COMMON_NAME_INVALID = -200,
ERR_CERT_BEGIN = ERR_CERT_COMMON_NAME_INVALID,
ERR_CERT_DATE_INVALID = -201,
ERR_CERT_AUTHORITY_INVALID = -202,
ERR_CERT_CONTAINS_ERRORS = -203,
@@ -859,7 +874,13 @@ typedef enum {
ERR_CERT_UNABLE_TO_CHECK_REVOCATION = -205,
ERR_CERT_REVOKED = -206,
ERR_CERT_INVALID = -207,
ERR_CERT_END = -208,
ERR_CERT_WEAK_SIGNATURE_ALGORITHM = -208,
// -209 is available: was ERR_CERT_NOT_IN_DNS.
ERR_CERT_NON_UNIQUE_NAME = -210,
ERR_CERT_WEAK_KEY = -211,
ERR_CERT_NAME_CONSTRAINT_VIOLATION = -212,
ERR_CERT_VALIDITY_TOO_LONG = -213,
ERR_CERT_END = ERR_CERT_VALIDITY_TOO_LONG,
ERR_INVALID_URL = -300,
ERR_DISALLOWED_URL_SCHEME = -301,
ERR_UNKNOWN_URL_SCHEME = -302,
@@ -876,6 +897,38 @@ typedef enum {
ERR_INSECURE_RESPONSE = -501,
} cef_errorcode_t;
///
// Supported certificate status code values. See net\cert\cert_status_flags.h
// for more information. CERT_STATUS_NONE is new in CEF because we use an
// enum while cert_status_flags.h uses a typedef and static const variables.
///
typedef enum {
CERT_STATUS_NONE = 0,
CERT_STATUS_COMMON_NAME_INVALID = 1 << 0,
CERT_STATUS_DATE_INVALID = 1 << 1,
CERT_STATUS_AUTHORITY_INVALID = 1 << 2,
// 1 << 3 is reserved for ERR_CERT_CONTAINS_ERRORS (not useful with WinHTTP).
CERT_STATUS_NO_REVOCATION_MECHANISM = 1 << 4,
CERT_STATUS_UNABLE_TO_CHECK_REVOCATION = 1 << 5,
CERT_STATUS_REVOKED = 1 << 6,
CERT_STATUS_INVALID = 1 << 7,
CERT_STATUS_WEAK_SIGNATURE_ALGORITHM = 1 << 8,
// 1 << 9 was used for CERT_STATUS_NOT_IN_DNS
CERT_STATUS_NON_UNIQUE_NAME = 1 << 10,
CERT_STATUS_WEAK_KEY = 1 << 11,
// 1 << 12 was used for CERT_STATUS_WEAK_DH_KEY
CERT_STATUS_PINNED_KEY_MISSING = 1 << 13,
CERT_STATUS_NAME_CONSTRAINT_VIOLATION = 1 << 14,
CERT_STATUS_VALIDITY_TOO_LONG = 1 << 15,
// Bits 16 to 31 are for non-error statuses.
CERT_STATUS_IS_EV = 1 << 16,
CERT_STATUS_REV_CHECKING_ENABLED = 1 << 17,
// Bit 18 was CERT_STATUS_IS_DNSSEC
CERT_STATUS_SHA1_SIGNATURE_PRESENT = 1 << 19,
CERT_STATUS_CT_COMPLIANCE_FAILED = 1 << 20,
} cef_cert_status_t;
///
// The manner in which a link click should be opened.
///
@@ -1023,6 +1076,16 @@ typedef enum {
// Main resource of a service worker.
///
RT_SERVICE_WORKER,
///
// A report of Content Security Policy violations.
///
RT_CSP_REPORT,
///
// A resource that a plugin requested.
///
RT_PLUGIN_RESOURCE,
} cef_resource_type_t;
///
@@ -1151,11 +1214,6 @@ typedef enum {
///
UR_FLAG_REPORT_UPLOAD_PROGRESS = 1 << 3,
///
// If set the headers sent and received for the request will be recorded.
///
UR_FLAG_REPORT_RAW_HEADERS = 1 << 5,
///
// If set the CefURLRequestClient::OnDownloadData method will not be called.
///
@@ -2290,6 +2348,70 @@ typedef enum {
PLUGIN_POLICY_DISABLE,
} cef_plugin_policy_t;
///
// Policy for how the Referrer HTTP header value will be sent during navigation.
// If the `--no-referrers` command-line flag is specified then the policy value
// will be ignored and the Referrer value will never be sent.
///
typedef enum {
///
// Always send the complete Referrer value.
///
REFERRER_POLICY_ALWAYS,
///
// Use the default policy. This is REFERRER_POLICY_ORIGIN_WHEN_CROSS_ORIGIN
// when the `--reduced-referrer-granularity` command-line flag is specified
// and REFERRER_POLICY_NO_REFERRER_WHEN_DOWNGRADE otherwise.
//
///
REFERRER_POLICY_DEFAULT,
///
// When navigating from HTTPS to HTTP do not send the Referrer value.
// Otherwise, send the complete Referrer value.
///
REFERRER_POLICY_NO_REFERRER_WHEN_DOWNGRADE,
///
// Never send the Referrer value.
///
REFERRER_POLICY_NEVER,
///
// Only send the origin component of the Referrer value.
///
REFERRER_POLICY_ORIGIN,
///
// When navigating cross-origin only send the origin component of the Referrer
// value. Otherwise, send the complete Referrer value.
///
REFERRER_POLICY_ORIGIN_WHEN_CROSS_ORIGIN,
} cef_referrer_policy_t;
///
// Return values for CefResponseFilter::Filter().
///
typedef enum {
///
// Some or all of the pre-filter data was read successfully but more data is
// needed in order to continue filtering (filtered output is pending).
///
RESPONSE_FILTER_NEED_MORE_DATA,
///
// Some or all of the pre-filter data was read successfully and all available
// filtered output has been written.
///
RESPONSE_FILTER_DONE,
///
// An error occurred during filtering.
///
RESPONSE_FILTER_ERROR
} cef_response_filter_status_t;
#ifdef __cplusplus
}
#endif

View File

@@ -489,6 +489,7 @@ struct CefSettingsTraits {
cef_string_set(src->user_data_path.str, src->user_data_path.length,
&target->user_data_path, copy);
target->persist_session_cookies = src->persist_session_cookies;
target->persist_user_preferences = src->persist_user_preferences;
cef_string_set(src->user_agent.str, src->user_agent.length,
&target->user_agent, copy);
@@ -541,6 +542,7 @@ struct CefRequestContextSettingsTraits {
cef_string_set(src->cache_path.str, src->cache_path.length,
&target->cache_path, copy);
target->persist_session_cookies = src->persist_session_cookies;
target->persist_user_preferences = src->persist_user_preferences;
target->ignore_certificate_errors = src->ignore_certificate_errors;
cef_string_set(src->accept_language_list.str,
src->accept_language_list.length, &target->accept_language_list, copy);
@@ -605,7 +607,6 @@ struct CefBrowserSettingsTraits {
target->javascript_access_clipboard = src->javascript_access_clipboard;
target->javascript_dom_paste = src->javascript_dom_paste;
target->caret_browsing = src->caret_browsing;
target->java = src->java;
target->plugins = src->plugins;
target->universal_access_from_file_urls =
src->universal_access_from_file_urls;

View File

@@ -363,8 +363,8 @@ class CefResourceManager :
UrlFilter url_filter_;
MimeTypeResolver mime_type_resolver_;
// Must be the last member.
base::WeakPtrFactory<CefResourceManager> weak_ptr_factory_;
// Must be the last member. Created and accessed on the IO thread.
scoped_ptr<base::WeakPtrFactory<CefResourceManager> > weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(CefResourceManager);
};

View File

@@ -5,12 +5,15 @@
#include "libcef/browser/browser_context.h"
#include "libcef/browser/content_browser_client.h"
#include "libcef/browser/extensions/extension_system.h"
#include "libcef/browser/thread_util.h"
#include "libcef/common/extensions/extensions_util.h"
#include "base/logging.h"
#include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/user_prefs/user_prefs.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"
#ifndef NDEBUG
base::AtomicRefCount CefBrowserContext::DebugObjCt = 0;
@@ -24,16 +27,8 @@ CefBrowserContext::CefBrowserContext()
}
CefBrowserContext::~CefBrowserContext() {
if (resource_context_.get()) {
// Destruction of the ResourceContext will trigger destruction of all
// associated URLRequests.
content::BrowserThread::DeleteSoon(
content::BrowserThread::IO, FROM_HERE, resource_context_.release());
}
// Remove any BrowserContextKeyedServiceFactory associations.
BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(
this);
// Should be cleared in Shutdown().
DCHECK(!resource_context_.get());
#ifndef NDEBUG
base::AtomicRefCountDec(&DebugObjCt);
@@ -68,6 +63,27 @@ void CefBrowserContext::Initialize() {
extension_system_->Init();
}
void CefBrowserContext::Shutdown() {
CEF_REQUIRE_UIT();
if (resource_context_.get()) {
// Destruction of the ResourceContext will trigger destruction of all
// associated URLRequests.
content::BrowserThread::DeleteSoon(
content::BrowserThread::IO, FROM_HERE, resource_context_.release());
}
// Remove any BrowserContextKeyedServiceFactory associations. This must be
// called before the ProxyService owned by CefBrowserContextImpl is destroyed.
BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(
this);
}
content::ResourceContext* CefBrowserContext::GetResourceContext() {
return resource_context_.get();
}
ChromeZoomLevelPrefs* CefBrowserContext::GetZoomLevelPrefs() {
return static_cast<ChromeZoomLevelPrefs*>(
GetStoragePartition(this, NULL)->GetZoomLevelDelegate());
}

View File

@@ -7,8 +7,9 @@
#pragma once
#include "include/cef_request_context_handler.h"
#include "libcef/browser/chrome_profile_stub.h"
#include "libcef/browser/net/url_request_context_getter_impl.h"
#include "libcef/browser/resource_context.h"
#include "libcef/browser/url_request_context_getter_impl.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
@@ -104,6 +105,7 @@
// CefURLRequestContextGetter* destruction.
*/
class HostContentSettingsMap;
class PrefService;
namespace extensions {
@@ -114,7 +116,7 @@ class CefExtensionSystem;
// of this class is passed to WebContents::Create in CefBrowserHostImpl::
// CreateInternal. Only accessed on the UI thread unless otherwise indicated.
class CefBrowserContext
: public content::BrowserContext,
: public ChromeProfileStub,
public base::RefCountedThreadSafe<
CefBrowserContext, content::BrowserThread::DeleteOnUIThread> {
public:
@@ -126,6 +128,9 @@ class CefBrowserContext
// BrowserContext methods.
content::ResourceContext* GetResourceContext() override;
// Profile methods.
ChromeZoomLevelPrefs* GetZoomLevelPrefs() override;
// Returns the settings associated with this object. Safe to call from any
// thread.
virtual const CefRequestContextSettings& GetSettings() const = 0;
@@ -144,8 +149,12 @@ class CefBrowserContext
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) = 0;
// Preferences.
virtual PrefService* GetPrefs() = 0;
// Settings for plugins and extensions.
virtual HostContentSettingsMap* GetHostContentSettingsMap() = 0;
// Called from CefBrowserHostImpl::DidNavigateAnyFrame to update the table of
// visited links.
virtual void AddVisitedURLs(const std::vector<GURL>& urls) = 0;
CefResourceContext* resource_context() const {
return resource_context_.get();
@@ -162,6 +171,9 @@ class CefBrowserContext
protected:
~CefBrowserContext() override;
// Must be called before the child object destructor has completed.
void Shutdown();
private:
// Only allow deletion via scoped_refptr().
friend struct content::BrowserThread::DeleteOnThread<

View File

@@ -5,22 +5,33 @@
#include "libcef/browser/browser_context_impl.h"
#include <map>
#include <utility>
#include "libcef/browser/browser_context_proxy.h"
#include "libcef/browser/content_browser_client.h"
#include "libcef/browser/context.h"
#include "libcef/browser/download_manager_delegate.h"
#include "libcef/browser/permission_manager.h"
#include "libcef/browser/permissions/permission_manager.h"
#include "libcef/browser/prefs/browser_prefs.h"
#include "libcef/browser/ssl_host_state_delegate.h"
#include "libcef/browser/thread_util.h"
#include "libcef/common/cef_switches.h"
#include "libcef/common/extensions/extensions_util.h"
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/prefs/pref_service.h"
#include "base/strings/string_util.h"
#include "base/threading/thread_restrictions.h"
#include "chrome/browser/font_family_cache.h"
#include "chrome/browser/net/proxy_service_factory.h"
#include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/guest_view/browser/guest_view_manager.h"
#include "components/ui/zoom/zoom_event_manager.h"
#include "components/visitedlink/browser/visitedlink_event_listener.h"
#include "components/visitedlink/browser/visitedlink_master.h"
#include "content/public/browser/download_manager.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"
@@ -120,6 +131,69 @@ base::LazyInstance<ImplManager> g_manager = LAZY_INSTANCE_INITIALIZER;
} // namespace
// Creates and manages VisitedLinkEventListener objects for each
// CefBrowserContext sharing the same VisitedLinkMaster.
class CefVisitedLinkListener : public visitedlink::VisitedLinkMaster::Listener {
public:
CefVisitedLinkListener()
: master_(nullptr) {
}
void set_master(visitedlink::VisitedLinkMaster* master) {
DCHECK(!master_);
master_ = master;
}
void CreateListenerForContext(const CefBrowserContext* context) {
CEF_REQUIRE_UIT();
scoped_ptr<visitedlink::VisitedLinkEventListener> listener(
new visitedlink::VisitedLinkEventListener(
master_, const_cast<CefBrowserContext*>(context)));
listener_map_.insert(std::make_pair(context, std::move(listener)));
}
void RemoveListenerForContext(const CefBrowserContext* context) {
CEF_REQUIRE_UIT();
ListenerMap::iterator it = listener_map_.find(context);
DCHECK(it != listener_map_.end());
listener_map_.erase(it);
}
// visitedlink::VisitedLinkMaster::Listener methods.
void NewTable(base::SharedMemory* shared_memory) override {
CEF_REQUIRE_UIT();
ListenerMap::iterator it = listener_map_.begin();
for (; it != listener_map_.end(); ++it)
it->second->NewTable(shared_memory);
}
void Add(visitedlink::VisitedLinkCommon::Fingerprint fingerprint) override {
CEF_REQUIRE_UIT();
ListenerMap::iterator it = listener_map_.begin();
for (; it != listener_map_.end(); ++it)
it->second->Add(fingerprint);
}
void Reset(bool invalidate_hashes) override {
CEF_REQUIRE_UIT();
ListenerMap::iterator it = listener_map_.begin();
for (; it != listener_map_.end(); ++it)
it->second->Reset(invalidate_hashes);
}
private:
visitedlink::VisitedLinkMaster* master_;
// Map of CefBrowserContext to the associated VisitedLinkEventListener.
typedef std::map<const CefBrowserContext*,
scoped_ptr<visitedlink::VisitedLinkEventListener> >
ListenerMap;
ListenerMap listener_map_;
DISALLOW_COPY_AND_ASSIGN(CefVisitedLinkListener);
};
CefBrowserContextImpl::CefBrowserContextImpl(
const CefRequestContextSettings& settings)
: settings_(settings) {
@@ -127,8 +201,17 @@ CefBrowserContextImpl::CefBrowserContextImpl(
}
CefBrowserContextImpl::~CefBrowserContextImpl() {
Shutdown();
// The FontFamilyCache references the ProxyService so delete it before the
// ProxyService is deleted.
SetUserData(&kFontFamilyCacheKey, NULL);
pref_proxy_config_tracker_->DetachFromPrefService();
if (host_content_settings_map_.get())
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())
@@ -159,6 +242,25 @@ void CefBrowserContextImpl::Initialize() {
CefString(&CefContext::Get()->settings().accept_language_list);
}
// Initialize preferences.
base::FilePath pref_path;
if (!cache_path_.empty() && settings_.persist_user_preferences)
pref_path = cache_path_.AppendASCII(browser_prefs::kUserPrefsFileName);
pref_service_ = browser_prefs::CreatePrefService(pref_path);
// Initialize visited links management.
base::FilePath visited_link_path;
if (!cache_path_.empty())
visited_link_path = cache_path_.Append(FILE_PATH_LITERAL("Visited Links"));
visitedlink_listener_ = new CefVisitedLinkListener;
visitedlink_master_.reset(
new visitedlink::VisitedLinkMaster(visitedlink_listener_, this,
!visited_link_path.empty(), false,
visited_link_path, 0));
visitedlink_listener_->set_master(visitedlink_master_.get());
visitedlink_listener_->CreateListenerForContext(this);
visitedlink_master_->Init();
CefBrowserContext::Initialize();
// Initialize proxy configuration tracker.
@@ -178,10 +280,15 @@ void CefBrowserContextImpl::AddProxy(const CefBrowserContextProxy* proxy) {
CEF_REQUIRE_UIT();
DCHECK(!HasProxy(proxy));
proxy_list_.push_back(proxy);
visitedlink_listener_->CreateListenerForContext(proxy);
}
void CefBrowserContextImpl::RemoveProxy(const CefBrowserContextProxy* proxy) {
CEF_REQUIRE_UIT();
visitedlink_listener_->RemoveListenerForContext(proxy);
bool found = false;
ProxyList::iterator it = proxy_list_.begin();
for (; it != proxy_list_.end(); ++it) {
@@ -227,8 +334,14 @@ base::FilePath CefBrowserContextImpl::GetPath() const {
}
scoped_ptr<content::ZoomLevelDelegate>
CefBrowserContextImpl::CreateZoomLevelDelegate(const base::FilePath&) {
return scoped_ptr<content::ZoomLevelDelegate>();
CefBrowserContextImpl::CreateZoomLevelDelegate(
const base::FilePath& partition_path) {
if (cache_path_.empty())
return scoped_ptr<content::ZoomLevelDelegate>();
return make_scoped_ptr(new ChromeZoomLevelPrefs(
GetPrefs(), cache_path_, partition_path,
ui_zoom::ZoomEventManager::GetForBrowserContext(this)->GetWeakPtr()));
}
bool CefBrowserContextImpl::IsOffTheRecord() const {
@@ -297,10 +410,23 @@ content::SSLHostStateDelegate*
content::PermissionManager* CefBrowserContextImpl::GetPermissionManager() {
if (!permission_manager_.get())
permission_manager_.reset(new CefPermissionManager());
permission_manager_.reset(new CefPermissionManager(this));
return permission_manager_.get();
}
content::BackgroundSyncController*
CefBrowserContextImpl::GetBackgroundSyncController() {
return nullptr;
}
PrefService* CefBrowserContextImpl::GetPrefs() {
return pref_service_.get();
}
const PrefService* CefBrowserContextImpl::GetPrefs() const {
return pref_service_.get();
}
const CefRequestContextSettings& CefBrowserContextImpl::GetSettings() const {
return settings_;
}
@@ -316,18 +442,18 @@ net::URLRequestContextGetter* CefBrowserContextImpl::CreateRequestContext(
DCHECK(!url_request_getter_.get());
// Initialize the proxy configuration service.
scoped_ptr<net::ProxyConfigService> proxy_config_service;
proxy_config_service.reset(
scoped_ptr<net::ProxyConfigService> proxy_config_service(
ProxyServiceFactory::CreateProxyConfigService(
pref_proxy_config_tracker_.get()));
url_request_getter_ = new CefURLRequestContextGetterImpl(
settings_,
GetPrefs(),
BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO),
BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE),
protocol_handlers,
proxy_config_service.Pass(),
request_interceptors.Pass());
std::move(proxy_config_service),
std::move(request_interceptors));
resource_context()->set_url_request_context_getter(url_request_getter_.get());
return url_request_getter_.get();
}
@@ -341,7 +467,41 @@ net::URLRequestContextGetter*
return NULL;
}
PrefService* CefBrowserContextImpl::GetPrefs() {
// TODO(cef): Perhaps use per-context settings.
return CefContentBrowserClient::Get()->pref_service();
HostContentSettingsMap* CefBrowserContextImpl::GetHostContentSettingsMap() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (!host_content_settings_map_.get()) {
// The |incognito| argument is intentionally set to false as it otherwise
// limits the types of values that can be stored in the settings map (for
// example, default values set via DefaultProvider::SetWebsiteSetting).
host_content_settings_map_ = new HostContentSettingsMap(GetPrefs(), false);
// Change the default plugin policy.
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
const std::string& plugin_policy_str =
command_line->GetSwitchValueASCII(switches::kPluginPolicy);
if (!plugin_policy_str.empty()) {
ContentSetting plugin_policy = CONTENT_SETTING_ALLOW;
if (base::LowerCaseEqualsASCII(plugin_policy_str,
switches::kPluginPolicy_Detect)) {
plugin_policy = CONTENT_SETTING_DETECT_IMPORTANT_CONTENT;
} else if (base::LowerCaseEqualsASCII(plugin_policy_str,
switches::kPluginPolicy_Block)) {
plugin_policy = CONTENT_SETTING_BLOCK;
}
host_content_settings_map_->SetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_PLUGINS, plugin_policy);
}
}
return host_content_settings_map_.get();
}
void CefBrowserContextImpl::AddVisitedURLs(const std::vector<GURL>& urls) {
visitedlink_master_->AddURLs(urls);
}
void CefBrowserContextImpl::RebuildTable(
const scoped_refptr<URLEnumerator>& enumerator) {
// Called when visited links will not or cannot be loaded from disk.
enumerator->OnComplete(true);
}

View File

@@ -8,27 +8,29 @@
#include "libcef/browser/browser_context.h"
#include "libcef/browser/url_request_context_getter_impl.h"
#include "libcef/browser/net/url_request_context_getter_impl.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/net/pref_proxy_config_tracker.h"
namespace content {
class DownloadManagerDelegate;
class SpeechRecognitionPreferences;
}
#include "components/proxy_config/pref_proxy_config_tracker.h"
#include "components/visitedlink/browser/visitedlink_delegate.h"
class CefBrowserContextProxy;
class CefDownloadManagerDelegate;
class CefSSLHostStateDelegate;
class CefVisitedLinkListener;
namespace visitedlink {
class VisitedLinkMaster;
}
// Isolated BrowserContext implementation. Life span is controlled by
// CefRequestContextImpl and (for the main context) CefBrowserMainParts. Only
// accessed on the UI thread unless otherwise indicated. See browser_context.h
// for an object relationship diagram.
class CefBrowserContextImpl : public CefBrowserContext {
class CefBrowserContextImpl : public CefBrowserContext,
public visitedlink::VisitedLinkDelegate {
public:
explicit CefBrowserContextImpl(const CefRequestContextSettings& settings);
@@ -73,6 +75,11 @@ class CefBrowserContextImpl : public CefBrowserContext {
content::PushMessagingService* GetPushMessagingService() override;
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
content::PermissionManager* GetPermissionManager() override;
content::BackgroundSyncController* GetBackgroundSyncController() override;
// Profile methods.
PrefService* GetPrefs() override;
const PrefService* GetPrefs() const override;
// CefBrowserContext methods.
const CefRequestContextSettings& GetSettings() const override;
@@ -87,7 +94,11 @@ class CefBrowserContextImpl : public CefBrowserContext {
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors)
override;
PrefService* GetPrefs() override;
HostContentSettingsMap* GetHostContentSettingsMap() override;
void AddVisitedURLs(const std::vector<GURL>& urls) override;
// visitedlink::VisitedLinkDelegate methods.
void RebuildTable(const scoped_refptr<URLEnumerator>& enumerator) override;
// Guaranteed to exist once this object has been initialized.
scoped_refptr<CefURLRequestContextGetterImpl> request_context() const {
@@ -110,12 +121,17 @@ class CefBrowserContextImpl : public CefBrowserContext {
typedef std::vector<const CefBrowserContextProxy*> ProxyList;
ProxyList proxy_list_;
scoped_ptr<PrefService> pref_service_;
scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
scoped_ptr<CefDownloadManagerDelegate> download_manager_delegate_;
scoped_refptr<CefURLRequestContextGetterImpl> url_request_getter_;
scoped_ptr<content::PermissionManager> permission_manager_;
scoped_ptr<CefSSLHostStateDelegate> ssl_host_state_delegate_;
scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
scoped_ptr<visitedlink::VisitedLinkMaster> visitedlink_master_;
// |visitedlink_listener_| is owned by visitedlink_master_.
CefVisitedLinkListener* visitedlink_listener_;
DISALLOW_COPY_AND_ASSIGN(CefBrowserContextImpl);
};

View File

@@ -6,11 +6,13 @@
#include "libcef/browser/content_browser_client.h"
#include "libcef/browser/download_manager_delegate.h"
#include "libcef/browser/net/url_request_context_getter_proxy.h"
#include "libcef/browser/thread_util.h"
#include "libcef/browser/url_request_context_getter_proxy.h"
#include "base/logging.h"
#include "chrome/browser/font_family_cache.h"
#include "components/guest_view/common/guest_view_constants.h"
#include "components/visitedlink/browser/visitedlink_master.h"
#include "content/browser/streams/stream_context.h"
#include "content/public/browser/storage_partition.h"
@@ -24,9 +26,16 @@ bool ShouldProxyUserData(const void* key) {
// If this value is not proxied then CefBrowserContextImpl::GetGuestManager()
// returns NULL.
// See also CefExtensionsAPIClient::CreateGuestViewManagerDelegate.
if (key == guest_view::kGuestViewManagerKeyName)
return true;
// If this value is not proxied then there will be a use-after-free while
// destroying the FontFamilyCache because it will try to access the
// ProxyService owned by CefBrowserContextImpl (which has already been freed).
if (key == kFontFamilyCacheKey)
return true;
return false;
}
@@ -43,6 +52,8 @@ CefBrowserContextProxy::CefBrowserContextProxy(
}
CefBrowserContextProxy::~CefBrowserContextProxy() {
Shutdown();
parent_->RemoveProxy(this);
}
@@ -142,6 +153,19 @@ content::PermissionManager* CefBrowserContextProxy::GetPermissionManager() {
return parent_->GetPermissionManager();
}
content::BackgroundSyncController*
CefBrowserContextProxy::GetBackgroundSyncController() {
return parent_->GetBackgroundSyncController();
}
PrefService* CefBrowserContextProxy::GetPrefs() {
return parent_->GetPrefs();
}
const PrefService* CefBrowserContextProxy::GetPrefs() const {
return parent_->GetPrefs();
}
const CefRequestContextSettings& CefBrowserContextProxy::GetSettings() const {
return parent_->GetSettings();
}
@@ -170,6 +194,10 @@ net::URLRequestContextGetter*
return NULL;
}
PrefService* CefBrowserContextProxy::GetPrefs() {
return parent_->GetPrefs();
HostContentSettingsMap* CefBrowserContextProxy::GetHostContentSettingsMap() {
return parent_->GetHostContentSettingsMap();
}
void CefBrowserContextProxy::AddVisitedURLs(const std::vector<GURL>& urls) {
parent_->AddVisitedURLs(urls);
}

View File

@@ -13,11 +13,6 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
namespace content {
class DownloadManagerDelegate;
class SpeechRecognitionPreferences;
}
class CefDownloadManagerDelegate;
class CefURLRequestContextGetterProxy;
@@ -55,6 +50,11 @@ class CefBrowserContextProxy : public CefBrowserContext {
content::PushMessagingService* GetPushMessagingService() override;
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
content::PermissionManager* GetPermissionManager() override;
content::BackgroundSyncController* GetBackgroundSyncController() override;
// Profile methods.
PrefService* GetPrefs() override;
const PrefService* GetPrefs() const override;
// CefBrowserContext methods.
const CefRequestContextSettings& GetSettings() const override;
@@ -69,7 +69,8 @@ class CefBrowserContextProxy : public CefBrowserContext {
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors)
override;
PrefService* GetPrefs() override;
HostContentSettingsMap* GetHostContentSettingsMap() override;
void AddVisitedURLs(const std::vector<GURL>& urls) override;
scoped_refptr<CefBrowserContextImpl> parent() const {
return parent_;

File diff suppressed because it is too large Load Diff

View File

@@ -16,12 +16,15 @@
#include "include/cef_client.h"
#include "include/cef_frame.h"
#include "libcef/browser/browser_info.h"
#include "libcef/browser/browser_platform_delegate.h"
#include "libcef/browser/file_dialog_manager.h"
#include "libcef/browser/frame_host_impl.h"
#include "libcef/browser/javascript_dialog_manager.h"
#include "libcef/browser/menu_creator.h"
#include "libcef/browser/menu_manager.h"
#include "libcef/common/response_manager.h"
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "base/strings/string16.h"
#include "base/synchronization/lock.h"
#include "content/public/browser/notification_observer.h"
@@ -29,42 +32,11 @@
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/file_chooser_params.h"
#if defined(USE_AURA)
#include "third_party/WebKit/public/platform/WebCursorInfo.h"
#include "ui/base/cursor/cursor.h"
#endif
#if defined(USE_X11)
#include "ui/base/x/x11_util.h"
#endif
namespace content {
struct NativeWebKeyboardEvent;
}
namespace blink {
class WebMouseEvent;
class WebMouseWheelEvent;
class WebInputEvent;
}
namespace net {
class DirectoryLister;
class URLRequest;
}
#if defined(USE_AURA)
namespace views {
class Widget;
}
#endif
#if defined(USE_X11)
class CefWindowX11;
#endif
struct Cef_DraggableRegion_Params;
struct Cef_Request_Params;
struct Cef_Response_Params;
@@ -100,16 +72,16 @@ class CefBrowserHostImpl : public CefBrowserHost,
virtual void OnResponse(const std::string& response) =0;
};
// Extend content::FileChooserParams with some options unique to CEF.
struct FileChooserParams : public content::FileChooserParams {
// 0-based index of the selected value in |accept_types|.
int selected_accept_filter = 0;
// Interface to implement for observers that wish to be informed of changes
// to the CefBrowserHostImpl. All methods will be called on the UI thread.
class Observer {
public:
// Called before |browser| is destroyed. Any references to |browser| should
// be cleared when this method is called.
virtual void OnBrowserDestroyed(CefBrowserHostImpl* browser) =0;
// True if the Save dialog should prompt before overwriting files.
bool overwriteprompt = true;
// True if read-only files should be hidden.
bool hidereadonly = true;
protected:
virtual ~Observer() {}
};
~CefBrowserHostImpl() override;
@@ -120,7 +92,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
CefRefPtr<CefClient> client,
const CefString& url,
const CefBrowserSettings& settings,
CefWindowHandle opener,
CefRefPtr<CefBrowserHostImpl> opener,
bool is_popup,
CefRefPtr<CefRequestContext> request_context);
@@ -239,8 +211,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
// Returns true if windowless rendering is enabled.
bool IsWindowless() const;
// Returns true if transparent painting is enabled.
bool IsTransparent() const;
// Called when the OS window hosting the browser is destroyed.
void WindowDestroyed();
@@ -252,11 +222,11 @@ class CefBrowserHostImpl : public CefBrowserHost,
// Cancel display of the context menu, if any.
void CancelContextMenu();
// Returns the native view for the WebContents.
gfx::NativeView GetContentView() const;
// Returns a pointer to the WebContents.
content::WebContents* GetWebContents() const;
#if defined(USE_AURA)
// Returns the Widget owner for the browser window. Only used with windowed
// rendering.
views::Widget* GetWindowWidget() const;
#endif
// Returns the frame associated with the specified URLRequest.
CefRefPtr<CefFrame> GetFrameForRequest(net::URLRequest* request);
@@ -293,7 +263,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
bool user_initiated);
// Open the specified text in the default text editor.
bool ViewText(const std::string& text);
void ViewText(const std::string& text);
// Handler for URLs involving external protocols.
void HandleExternalProtocol(const GURL& url);
@@ -301,39 +271,23 @@ class CefBrowserHostImpl : public CefBrowserHost,
// Set the frame that currently has focus.
void SetFocusedFrame(int64 frame_id);
// Convert from view coordinates to screen coordinates.
gfx::Point GetScreenPoint(const gfx::Point& view) const;
// Thread safe accessors.
const CefBrowserSettings& settings() const { return settings_; }
CefRefPtr<CefClient> client() const { return client_; }
scoped_refptr<CefBrowserInfo> browser_info() const { return browser_info_; }
int browser_id() const;
#if defined(USE_AURA)
views::Widget* window_widget() const { return window_widget_; }
#endif
#if defined(USE_X11)
CefWindowX11* window_x11() const { return window_x11_; }
#endif
#if defined(OS_WIN)
static void RegisterWindowClass();
#endif
#if defined(USE_AURA)
ui::PlatformCursor GetPlatformCursor(blink::WebCursorInfo::Type type);
#endif
void OnSetFocus(cef_focus_source_t source);
// The argument vector will be empty if the dialog was cancelled.
typedef base::Callback<void(int, const std::vector<base::FilePath>&)>
RunFileChooserCallback;
// Run the file chooser dialog specified by |params|. Only a single dialog may
// be pending at any given time. |callback| will be executed asynchronously
// after the dialog is dismissed or if another dialog is already pending.
void RunFileChooser(const FileChooserParams& params,
const RunFileChooserCallback& callback);
void RunFileChooser(
const CefFileDialogRunner::FileChooserParams& params,
const CefFileDialogRunner::RunFileChooserCallback& callback);
bool HandleContextMenu(
content::WebContents* web_contents,
@@ -345,15 +299,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
// Otherwise, the browser's WebContents will be returned.
content::WebContents* GetActionableWebContents();
// Used when creating a new popup window.
struct PendingPopupInfo {
CefWindowInfo window_info;
CefBrowserSettings settings;
CefRefPtr<CefClient> client;
};
// Returns false if a popup is already pending.
bool SetPendingPopupInfo(scoped_ptr<PendingPopupInfo> info);
enum DestructionState {
DESTRUCTION_STATE_NONE = 0,
DESTRUCTION_STATE_PENDING,
@@ -372,9 +317,9 @@ class CefBrowserHostImpl : public CefBrowserHost,
void UpdateTargetURL(content::WebContents* source,
const GURL& url) override;
bool AddMessageToConsole(content::WebContents* source,
int32 level,
int32_t level,
const base::string16& message,
int32 line_no,
int32_t line_no,
const base::string16& source_id) override;
void BeforeUnloadFired(content::WebContents* source,
bool proceed,
@@ -398,6 +343,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
content::WebContents* web_contents,
int route_id,
int main_frame_route_id,
int32_t main_frame_widget_route_id,
WindowContainerType window_container_type,
const std::string& frame_name,
const GURL& target_url,
@@ -473,6 +419,11 @@ class CefBrowserHostImpl : public CefBrowserHost,
bool was_ignored_by_handler) override;
void FrameDeleted(
content::RenderFrameHost* render_frame_host) override;
void DidNavigateAnyFrame(
content::RenderFrameHost* render_frame_host,
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) override;
void TitleWasSet(content::NavigationEntry* entry, bool explicit_set) override;
void PluginCrashed(const base::FilePath& plugin_path,
base::ProcessId plugin_pid) override;
void DidUpdateFaviconURL(
@@ -482,17 +433,24 @@ class CefBrowserHostImpl : public CefBrowserHost,
// Override to provide a thread safe implementation.
bool Send(IPC::Message* message) override;
// Manage observer objects. The observer must either outlive this object or
// remove itself before destruction. These methods can only be called on the
// UI thread.
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
bool HasObserver(Observer* observer) const;
private:
class DevToolsWebContentsObserver;
static CefRefPtr<CefBrowserHostImpl> CreateInternal(
const CefWindowInfo& window_info,
const CefBrowserSettings& settings,
CefRefPtr<CefClient> client,
content::WebContents* web_contents,
scoped_refptr<CefBrowserInfo> browser_info,
CefWindowHandle opener,
CefRefPtr<CefRequestContext> request_context);
CefRefPtr<CefBrowserHostImpl> opener,
CefRefPtr<CefRequestContext> request_context,
scoped_ptr<CefBrowserPlatformDelegate> platform_delegate);
// content::WebContentsObserver::OnMessageReceived() message handlers.
void OnFrameIdentified(int64 frame_id,
@@ -514,13 +472,16 @@ class CefBrowserHostImpl : public CefBrowserHost,
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
CefBrowserHostImpl(const CefWindowInfo& window_info,
const CefBrowserSettings& settings,
CefBrowserHostImpl(const CefBrowserSettings& settings,
CefRefPtr<CefClient> client,
content::WebContents* web_contents,
scoped_refptr<CefBrowserInfo> browser_info,
CefWindowHandle opener,
CefRefPtr<CefRequestContext> request_context);
CefRefPtr<CefBrowserHostImpl> opener,
CefRefPtr<CefRequestContext> request_context,
scoped_ptr<CefBrowserPlatformDelegate> platform_delegate);
// Give the platform delegate an opportunity to create the host window.
bool CreateHostWindow();
// Updates and returns an existing frame or creates a new frame. Pass
// CefFrameHostImpl::kUnspecifiedFrameId for |parent_frame_id| if unknown.
@@ -532,59 +493,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
// Remove the references to all frames and mark them as detached.
void DetachAllFrames();
#if defined(OS_WIN)
static LPCTSTR GetWndClass();
static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam);
#endif
// Create the window.
bool PlatformCreateWindow();
// Sends a message via the OS to close the native browser window.
// DestroyBrowser will be called after the native window has closed.
void PlatformCloseWindow();
// Resize the window to the given dimensions.
void PlatformSizeTo(int width, int height);
// Set or remove focus from the window.
void PlatformSetFocus(bool focus);
#if defined(OS_MACOSX)
// Set or remove window visibility.
void PlatformSetWindowVisibility(bool visible);
#endif
// Return the handle for this window.
CefWindowHandle PlatformGetWindowHandle();
// Open the specified text in the default text editor.
bool PlatformViewText(const std::string& text);
// Forward the keyboard event to the application or frame window to allow
// processing of shortcut keys.
void PlatformHandleKeyboardEvent(
const content::NativeWebKeyboardEvent& event);
// Invoke platform specific handling for the external protocol.
void PlatformHandleExternalProtocol(const GURL& url);
// Invoke platform specific file chooser dialog.
void PlatformRunFileChooser(const FileChooserParams& params,
RunFileChooserCallback callback);
void PlatformTranslateKeyEvent(content::NativeWebKeyboardEvent& native_event,
const CefKeyEvent& key_event);
void PlatformTranslateClickEvent(blink::WebMouseEvent& web_event,
const CefMouseEvent& mouse_event,
CefBrowserHost::MouseButtonType type,
bool mouseUp, int clickCount);
void PlatformTranslateMoveEvent(blink::WebMouseEvent& web_event,
const CefMouseEvent& mouse_event,
bool mouseLeave);
void PlatformTranslateWheelEvent(blink::WebMouseWheelEvent& web_event,
const CefMouseEvent& mouse_event,
int deltaX, int deltaY);
void PlatformTranslateMouseEvent(blink::WebMouseEvent& web_event,
const CefMouseEvent& mouse_event);
void PlatformNotifyMoveOrResizeStarted();
int TranslateModifiers(uint32 cefKeyStates);
void SendMouseEvent(const blink::WebMouseEvent& web_event);
void OnAddressChange(CefRefPtr<CefFrame> frame,
const GURL& url);
void OnLoadStart(CefRefPtr<CefFrame> frame,
@@ -598,45 +506,21 @@ class CefBrowserHostImpl : public CefBrowserHost,
const GURL& url,
int http_status_code);
void OnFullscreenModeChange(bool fullscreen);
// Continuation from RunFileChooser.
void RunFileChooserOnUIThread(const FileChooserParams& params,
const RunFileChooserCallback& callback);
// Used with RunFileChooser to clear the |file_chooser_pending_| flag.
void OnRunFileChooserCallback(const RunFileChooserCallback& callback,
int selected_accept_filter,
const std::vector<base::FilePath>& file_paths);
// Used with WebContentsDelegate::RunFileChooser when mode is
// content::FileChooserParams::UploadFolder.
void OnRunFileChooserUploadFolderDelegateCallback(
content::WebContents* web_contents,
const content::FileChooserParams::Mode mode,
int selected_accept_filter,
const std::vector<base::FilePath>& file_paths);
// Used with WebContentsDelegate::RunFileChooser to notify the WebContents.
void OnRunFileChooserDelegateCallback(
content::WebContents* web_contents,
content::FileChooserParams::Mode mode,
int selected_accept_filter,
const std::vector<base::FilePath>& file_paths);
void OnTitleChange(const base::string16& title);
void OnDevToolsWebContentsDestroyed();
CefWindowInfo window_info_;
// Create the CefFileDialogManager if it doesn't already exist.
void EnsureFileDialogManager();
CefBrowserSettings settings_;
CefRefPtr<CefClient> client_;
scoped_ptr<content::WebContents> web_contents_;
scoped_refptr<CefBrowserInfo> browser_info_;
CefWindowHandle opener_;
CefRefPtr<CefRequestContext> request_context_;
// Pending popup information. Access must be protected by
// |pending_popup_info_lock_|.
base::Lock pending_popup_info_lock_;
scoped_ptr<PendingPopupInfo> pending_popup_info_;
scoped_ptr<CefBrowserPlatformDelegate> platform_delegate_;
const bool is_windowless_;
// Volatile state information. All access must be protected by the state lock.
base::Lock state_lock_;
@@ -691,11 +575,14 @@ class CefBrowserHostImpl : public CefBrowserHost,
// Manages response registrations.
scoped_ptr<CefResponseManager> response_manager_;
// Used for creating and managing file dialogs.
scoped_ptr<CefFileDialogManager> file_dialog_manager_;
// Used for creating and managing JavaScript dialogs.
scoped_ptr<CefJavaScriptDialogManager> dialog_manager_;
scoped_ptr<CefJavaScriptDialogManager> javascript_dialog_manager_;
// Used for creating and managing context menus.
scoped_ptr<CefMenuCreator> menu_creator_;
scoped_ptr<CefMenuManager> menu_manager_;
// Track the lifespan of the frontend WebContents associated with this
// browser.
@@ -704,24 +591,11 @@ class CefBrowserHostImpl : public CefBrowserHost,
// destroyed.
CefDevToolsFrontend* devtools_frontend_;
// True if a file chooser is currently pending.
bool file_chooser_pending_;
// Used for asynchronously listing directory contents.
scoped_ptr<net::DirectoryLister> lister_;
#if defined(USE_AURA)
// Widget hosting the web contents. It will be deleted automatically when the
// associated root window is destroyed.
views::Widget* window_widget_;
#endif // defined(USE_AURA)
#if defined(USE_X11)
CefWindowX11* window_x11_;
scoped_ptr<ui::XScopedCursor> invisible_cursor_;
#endif // defined(USE_X11)
// Observers that want to be notified of changes to this object.
base::ObserverList<Observer> observers_;
IMPLEMENT_REFCOUNTING(CefBrowserHostImpl);
DISALLOW_EVIL_CONSTRUCTORS(CefBrowserHostImpl);
DISALLOW_COPY_AND_ASSIGN(CefBrowserHostImpl);
};
#endif // CEF_LIBCEF_BROWSER_BROWSER_HOST_IMPL_H_

View File

@@ -1,944 +0,0 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors.
// Portions copyright (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.
#include "libcef/browser/browser_host_impl.h"
#import <Cocoa/Cocoa.h>
#import <CoreServices/CoreServices.h>
#include "libcef/browser/render_widget_host_view_osr.h"
#include "libcef/browser/text_input_client_osr_mac.h"
#include "libcef/browser/thread_util.h"
#include "base/files/file_util.h"
#include "base/mac/mac_util.h"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.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"
#include "content/public/browser/web_contents.h"
#include "content/public/common/file_chooser_params.h"
#include "grit/cef_strings.h"
#include "grit/ui_strings.h"
#include "net/base/mime_util.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "third_party/WebKit/public/web/mac/WebInputEventFactory.h"
#import "ui/base/cocoa/underlay_opengl_hosting_window.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/events/keycodes/keyboard_codes_posix.h"
#include "ui/gfx/geometry/rect.h"
// Wrapper NSView for the native view. Necessary to destroy the browser when
// the view is deleted.
@interface CefBrowserHostView : NSView {
@private
CefBrowserHostImpl* browser_; // weak
}
@property (nonatomic, assign) CefBrowserHostImpl* browser;
@end
@implementation CefBrowserHostView
@synthesize browser = browser_;
- (void) dealloc {
if (browser_) {
// Force the browser to be destroyed and release the reference added in
// PlatformCreateWindow().
browser_->WindowDestroyed();
}
[super dealloc];
}
@end
// Receives notifications from the browser window. Will delete itself when done.
@interface CefWindowDelegate : NSObject <NSWindowDelegate> {
@private
CefBrowserHostImpl* browser_; // weak
NSWindow* window_;
}
- (id)initWithWindow:(NSWindow*)window andBrowser:(CefBrowserHostImpl*)browser;
@end
@implementation CefWindowDelegate
- (id)initWithWindow:(NSWindow*)window andBrowser:(CefBrowserHostImpl*)browser {
if (self = [super init]) {
window_ = window;
browser_ = browser;
[window_ setDelegate:self];
// Register for application hide/unhide notifications.
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(applicationDidHide:)
name:NSApplicationDidHideNotification
object:nil];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(applicationDidUnhide:)
name:NSApplicationDidUnhideNotification
object:nil];
}
return self;
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[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);
}
// Called when we have been minimized.
- (void)windowDidMiniaturize:(NSNotification *)notification {
if (browser_)
browser_->SetWindowVisibility(false);
}
// Called when we have been unminimized.
- (void)windowDidDeminiaturize:(NSNotification *)notification {
if (browser_)
browser_->SetWindowVisibility(true);
}
// Called when the application has been hidden.
- (void)applicationDidHide:(NSNotification *)notification {
// If the window is miniaturized then nothing has really changed.
if (![window_ isMiniaturized]) {
if (browser_)
browser_->SetWindowVisibility(false);
}
}
// Called when the application has been unhidden.
- (void)applicationDidUnhide:(NSNotification *)notification {
// If the window is miniaturized then nothing has really changed.
if (![window_ isMiniaturized]) {
if (browser_)
browser_->SetWindowVisibility(true);
}
}
- (BOOL)windowShouldClose:(id)window {
// Protect against multiple requests to close while the close is pending.
if (browser_ && browser_->destruction_state() <=
CefBrowserHostImpl::DESTRUCTION_STATE_PENDING) {
if (browser_->destruction_state() ==
CefBrowserHostImpl::DESTRUCTION_STATE_NONE) {
// Request that the browser close.
browser_->CloseBrowser(false);
}
// Cancel the close.
return NO;
}
// Clean ourselves up after clearing the stack of anything that might have the
// window on it.
[self performSelectorOnMainThread:@selector(cleanup:)
withObject:window
waitUntilDone:NO];
// Allow the close.
return YES;
}
- (void)cleanup:(id)window {
[self release];
}
@end
namespace {
base::string16 GetDescriptionFromMimeType(const std::string& mime_type) {
// Check for wild card mime types and return an appropriate description.
static const struct {
const char* mime_type;
int string_id;
} kWildCardMimeTypes[] = {
{ "audio", IDS_APP_AUDIO_FILES },
{ "image", IDS_APP_IMAGE_FILES },
{ "text", IDS_APP_TEXT_FILES },
{ "video", IDS_APP_VIDEO_FILES },
};
for (size_t i = 0; i < arraysize(kWildCardMimeTypes); ++i) {
if (mime_type == std::string(kWildCardMimeTypes[i].mime_type) + "/*")
return l10n_util::GetStringUTF16(kWildCardMimeTypes[i].string_id);
}
return base::string16();
}
void AddFilters(NSPopUpButton *button,
const std::vector<base::string16>& accept_filters,
bool include_all_files,
std::vector<std::vector<base::string16> >* all_extensions) {
for (size_t i = 0; i < accept_filters.size(); ++i) {
const base::string16& filter = accept_filters[i];
if (filter.empty())
continue;
std::vector<base::string16> extensions;
base::string16 description;
size_t sep_index = filter.find('|');
if (sep_index != std::string::npos) {
// Treat as a filter of the form "Filter Name|.ext1;.ext2;.ext3".
description = filter.substr(0, sep_index);
std::vector<base::string16> ext;
base::SplitString(filter.substr(sep_index + 1), ';', &ext);
for (size_t x = 0; x < ext.size(); ++x) {
const base::string16& file_ext = ext[x];
if (!file_ext.empty() && file_ext[0] == '.')
extensions.push_back(file_ext);
}
} else if (filter[0] == '.') {
// Treat as an extension beginning with the '.' character.
extensions.push_back(filter);
} else {
// Otherwise convert mime type to one or more extensions.
const std::string& ascii = base::UTF16ToASCII(filter);
std::vector<base::FilePath::StringType> ext;
net::GetExtensionsForMimeType(ascii, &ext);
if (!ext.empty()) {
for (size_t x = 0; x < ext.size(); ++x)
extensions.push_back(base::ASCIIToUTF16("." + ext[x]));
description = GetDescriptionFromMimeType(ascii);
}
}
if (extensions.empty())
continue;
// Don't display a crazy number of extensions since the NSPopUpButton width
// will keep growing.
const size_t kMaxExtensions = 10;
base::string16 ext_str;
for (size_t x = 0; x < std::min(kMaxExtensions, extensions.size()); ++x) {
const base::string16& pattern = base::ASCIIToUTF16("*") + extensions[x];
if (x != 0)
ext_str += base::ASCIIToUTF16(";");
ext_str += pattern;
}
if (extensions.size() > kMaxExtensions)
ext_str += base::ASCIIToUTF16(";...");
if (description.empty()) {
description = ext_str;
} else {
description +=
base::ASCIIToUTF16(" (") + ext_str + base::ASCIIToUTF16(")");
}
[button addItemWithTitle:base::SysUTF16ToNSString(description)];
all_extensions->push_back(extensions);
}
// Add the *.* filter, but only if we have added other filters (otherwise it
// is implied).
if (include_all_files && !all_extensions->empty()) {
[button addItemWithTitle:base::SysUTF8ToNSString("All Files (*)")];
all_extensions->push_back(std::vector<base::string16>());
}
}
} // namespace
// Used to manage the file type filter in the NSSavePanel/NSOpenPanel.
@interface CefFilterDelegate : NSObject {
@private
NSSavePanel* panel_;
std::vector<std::vector<base::string16> > extensions_;
int selected_index_;
}
- (id)initWithPanel:(NSSavePanel*)panel
andAcceptFilters:(const std::vector<base::string16>&)accept_filters
andFilterIndex:(int)index;
- (void)setFilter:(int)index;
- (int)filter;
- (void)filterSelectionChanged:(id)sender;
- (void)setFileExtension;
@end
@implementation CefFilterDelegate
- (id)initWithPanel:(NSSavePanel*)panel
andAcceptFilters:(const std::vector<base::string16>&)accept_filters
andFilterIndex:(int)index {
if (self = [super init]) {
DCHECK(panel);
panel_ = panel;
selected_index_ = 0;
NSPopUpButton *button = [[NSPopUpButton alloc] init];
AddFilters(button, accept_filters, true, &extensions_);
[button sizeToFit];
[button setTarget:self];
[button setAction:@selector(filterSelectionChanged:)];
if (index < static_cast<int>(extensions_.size())) {
[button selectItemAtIndex:index];
[self setFilter:index];
}
[panel_ setAccessoryView:button];
}
return self;
}
// Set the current filter index.
- (void)setFilter:(int)index {
DCHECK(index >= 0 && index < static_cast<int>(extensions_.size()));
selected_index_ = index;
// Set the selectable file types. For open panels this limits the files that
// can be selected. For save panels this applies a default file extenion when
// the dialog is dismissed if none is already provided.
NSMutableArray* acceptArray = nil;
if (!extensions_[index].empty()) {
acceptArray = [[NSMutableArray alloc] init];
for (size_t i = 0; i < extensions_[index].size(); ++i) {
[acceptArray addObject:
base::SysUTF16ToNSString(extensions_[index][i].substr(1))];
}
}
[panel_ setAllowedFileTypes:acceptArray];
if (![panel_ isKindOfClass:[NSOpenPanel class]]) {
// For save panels set the file extension.
[self setFileExtension];
}
}
// Returns the current filter index.
- (int)filter {
return selected_index_;
}
// Called when the selected filter is changed via the NSPopUpButton.
- (void)filterSelectionChanged:(id)sender {
NSPopUpButton *button = (NSPopUpButton*)sender;
[self setFilter:[button indexOfSelectedItem]];
}
// Set the extension on the currently selected file name.
- (void)setFileExtension {
const std::vector<base::string16>& filter = extensions_[selected_index_];
if (filter.empty()) {
// All extensions are allowed so don't change anything.
return;
}
base::FilePath path(base::SysNSStringToUTF8([panel_ nameFieldStringValue]));
// If the file name currently includes an extension from |filter| then don't
// change anything.
base::string16 extension = base::UTF8ToUTF16(path.Extension());
if (!extension.empty()) {
for (size_t i = 0; i < filter.size(); ++i) {
if (filter[i] == extension)
return;
}
}
// Change the extension to the first value in |filter|.
path = path.ReplaceExtension(base::UTF16ToUTF8(filter[0]));
[panel_ setNameFieldStringValue:base::SysUTF8ToNSString(path.value())];
}
@end
namespace {
void RunOpenFileDialog(const CefBrowserHostImpl::FileChooserParams& params,
NSView* view,
int* filter_index,
std::vector<base::FilePath>* files) {
NSOpenPanel* openPanel = [NSOpenPanel openPanel];
base::string16 title;
if (!params.title.empty()) {
title = params.title;
} else {
title = l10n_util::GetStringUTF16(
params.mode == content::FileChooserParams::Open ?
IDS_OPEN_FILE_DIALOG_TITLE :
(params.mode == content::FileChooserParams::OpenMultiple ?
IDS_OPEN_FILES_DIALOG_TITLE : IDS_SELECT_FOLDER_DIALOG_TITLE));
}
[openPanel setTitle:base::SysUTF16ToNSString(title)];
std::string filename, directory;
if (!params.default_file_name.empty()) {
if (params.mode == content::FileChooserParams::UploadFolder ||
params.default_file_name.EndsWithSeparator()) {
// The value is only a directory.
directory = params.default_file_name.value();
} else {
// The value is a file name and possibly a directory.
filename = params.default_file_name.BaseName().value();
directory = params.default_file_name.DirName().value();
}
}
if (!filename.empty()) {
[openPanel setNameFieldStringValue:base::SysUTF8ToNSString(filename)];
}
if (!directory.empty()) {
[openPanel setDirectoryURL:
[NSURL fileURLWithPath:base::SysUTF8ToNSString(directory)]];
}
CefFilterDelegate* filter_delegate = nil;
if (params.mode != content::FileChooserParams::UploadFolder &&
!params.accept_types.empty()) {
// Add the file filter control.
filter_delegate =
[[CefFilterDelegate alloc] initWithPanel:openPanel
andAcceptFilters:params.accept_types
andFilterIndex:*filter_index];
}
// Further panel configuration.
[openPanel setAllowsOtherFileTypes:YES];
[openPanel setAllowsMultipleSelection:
(params.mode == content::FileChooserParams::OpenMultiple)];
[openPanel setCanChooseFiles:
(params.mode != content::FileChooserParams::UploadFolder)];
[openPanel setCanChooseDirectories:
(params.mode == content::FileChooserParams::UploadFolder)];
[openPanel setShowsHiddenFiles:!params.hidereadonly];
// 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])));
}
}
if (filter_delegate != nil)
*filter_index = [filter_delegate filter];
}
bool RunSaveFileDialog(const CefBrowserHostImpl::FileChooserParams& params,
NSView* view,
int* filter_index,
base::FilePath* file) {
NSSavePanel* savePanel = [NSSavePanel savePanel];
base::string16 title;
if (!params.title.empty())
title = params.title;
else
title = l10n_util::GetStringUTF16(IDS_SAVE_AS_DIALOG_TITLE);
[savePanel setTitle:base::SysUTF16ToNSString(title)];
std::string filename, directory;
if (!params.default_file_name.empty()) {
if (params.default_file_name.EndsWithSeparator()) {
// The value is only a directory.
directory = params.default_file_name.value();
} else {
// The value is a file name and possibly a directory.
filename = params.default_file_name.BaseName().value();
directory = params.default_file_name.DirName().value();
}
}
if (!filename.empty()) {
[savePanel setNameFieldStringValue:base::SysUTF8ToNSString(filename)];
}
if (!directory.empty()) {
[savePanel setDirectoryURL:
[NSURL fileURLWithPath:base::SysUTF8ToNSString(directory)]];
}
CefFilterDelegate* filter_delegate = nil;
if (!params.accept_types.empty()) {
// Add the file filter control.
filter_delegate =
[[CefFilterDelegate alloc] initWithPanel:savePanel
andAcceptFilters:params.accept_types
andFilterIndex:*filter_index];
}
[savePanel setAllowsOtherFileTypes:YES];
[savePanel setShowsHiddenFiles:!params.hidereadonly];
bool success = false;
// Show panel.
[savePanel beginSheetModalForWindow:[view window]
completionHandler:^(NSInteger resultCode) {
[NSApp stopModalWithCode:resultCode];
}];
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
bool CefBrowserHostImpl::PlatformViewText(const std::string& text) {
NOTIMPLEMENTED();
return false;
}
CefTextInputContext CefBrowserHostImpl::GetNSTextInputContext() {
if (!IsWindowless()) {
NOTREACHED() << "Window rendering is not disabled";
return NULL;
}
if (!CEF_CURRENTLY_ON_UIT()) {
NOTREACHED() << "Called on invalid thread";
return NULL;
}
CefRenderWidgetHostViewOSR* rwhv = static_cast<CefRenderWidgetHostViewOSR*>(
GetWebContents()->GetRenderWidgetHostView());
return rwhv->GetNSTextInputContext();
}
void CefBrowserHostImpl::HandleKeyEventBeforeTextInputClient(
CefEventHandle keyEvent) {
if (!IsWindowless()) {
NOTREACHED() << "Window rendering is not disabled";
return;
}
if (!CEF_CURRENTLY_ON_UIT()) {
NOTREACHED() << "Called on invalid thread";
return;
}
CefRenderWidgetHostViewOSR* rwhv = static_cast<CefRenderWidgetHostViewOSR*>(
GetWebContents()->GetRenderWidgetHostView());
rwhv->HandleKeyEventBeforeTextInputClient(keyEvent);
}
void CefBrowserHostImpl::HandleKeyEventAfterTextInputClient(
CefEventHandle keyEvent) {
if (!IsWindowless()) {
NOTREACHED() << "Window rendering is not disabled";
return;
}
if (!CEF_CURRENTLY_ON_UIT()) {
NOTREACHED() << "Called on invalid thread";
return;
}
CefRenderWidgetHostViewOSR* rwhv = static_cast<CefRenderWidgetHostViewOSR*>(
GetWebContents()->GetRenderWidgetHostView());
rwhv->HandleKeyEventAfterTextInputClient(keyEvent);
}
bool CefBrowserHostImpl::PlatformCreateWindow() {
base::mac::ScopedNSAutoreleasePool autorelease_pool;
NSWindow* newWnd = nil;
NSView* parentView = window_info_.parent_view;
NSRect contentRect = {{window_info_.x, window_info_.y},
{window_info_.width, window_info_.height}};
if (parentView == nil) {
// Create a new window.
NSRect screen_rect = [[NSScreen mainScreen] visibleFrame];
NSRect window_rect = {{window_info_.x,
screen_rect.size.height - window_info_.y},
{window_info_.width, window_info_.height}};
if (window_rect.size.width == 0)
window_rect.size.width = 750;
if (window_rect.size.height == 0)
window_rect.size.height = 750;
contentRect.origin.x = 0;
contentRect.origin.y = 0;
contentRect.size.width = window_rect.size.width;
contentRect.size.height = window_rect.size.height;
newWnd = [[UnderlayOpenGLHostingWindow alloc]
initWithContentRect:window_rect
styleMask:(NSTitledWindowMask |
NSClosableWindowMask |
NSMiniaturizableWindowMask |
NSResizableWindowMask |
NSUnifiedTitleAndToolbarWindowMask )
backing:NSBackingStoreBuffered
defer:NO];
// Create the delegate for control and browser window events.
[[CefWindowDelegate alloc] initWithWindow:newWnd andBrowser:this];
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];
// Add a reference that will be released in the dealloc handler.
AddRef();
// Create the browser view.
CefBrowserHostView* browser_view =
[[CefBrowserHostView alloc] initWithFrame:contentRect];
browser_view.browser = this;
[parentView addSubview:browser_view];
[browser_view setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
[browser_view setNeedsDisplay:YES];
[browser_view release];
// Parent the TabContents to the browser view.
const NSRect bounds = [browser_view bounds];
NSView* native_view = web_contents_->GetNativeView();
[browser_view addSubview:native_view];
[native_view setFrame:bounds];
[native_view setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
[native_view setNeedsDisplay:YES];
window_info_.view = browser_view;
if (newWnd != nil && !window_info_.hidden) {
// Show the window.
[newWnd makeKeyAndOrderFront: nil];
}
return true;
}
void CefBrowserHostImpl::PlatformCloseWindow() {
if (window_info_.view != nil) {
[[window_info_.view window]
performSelectorOnMainThread:@selector(performClose:)
withObject:nil
waitUntilDone:NO];
}
}
void CefBrowserHostImpl::PlatformSizeTo(int width, int height) {
// Not needed; subviews are bound.
}
void CefBrowserHostImpl::PlatformSetFocus(bool focus) {
if (web_contents_) {
if (content::RenderWidgetHostView* view =
web_contents_->GetRenderWidgetHostView()) {
view->SetActive(focus);
if (focus && !IsWindowless()) {
// Give keyboard focus to the native view.
NSView* view = web_contents_->GetContentNativeView();
DCHECK([view canBecomeKeyView]);
[[view window] makeFirstResponder:view];
}
}
}
}
void CefBrowserHostImpl::PlatformSetWindowVisibility(bool visible) {
if (web_contents_) {
if (content::RenderWidgetHostView* view =
web_contents_->GetRenderWidgetHostView()) {
view->SetWindowVisibility(visible);
}
}
}
CefWindowHandle CefBrowserHostImpl::PlatformGetWindowHandle() {
return IsWindowless() ? window_info_.parent_view : window_info_.view;
}
void CefBrowserHostImpl::PlatformHandleKeyboardEvent(
const content::NativeWebKeyboardEvent& event) {
// Give the top level menu equivalents a chance to handle the event.
if ([event.os_event type] == NSKeyDown)
[[NSApp mainMenu] performKeyEquivalent:event.os_event];
}
void CefBrowserHostImpl::PlatformRunFileChooser(
const FileChooserParams& params,
RunFileChooserCallback callback) {
std::vector<base::FilePath> files;
int filter_index = params.selected_accept_filter;
NSView* owner = PlatformGetWindowHandle();
if (params.mode == content::FileChooserParams::Open ||
params.mode == content::FileChooserParams::OpenMultiple ||
params.mode == content::FileChooserParams::UploadFolder) {
RunOpenFileDialog(params, owner, &filter_index, &files);
} else if (params.mode == content::FileChooserParams::Save) {
base::FilePath file;
if (RunSaveFileDialog(params, owner, &filter_index, &file)) {
files.push_back(file);
}
} else {
NOTIMPLEMENTED();
}
callback.Run(filter_index, files);
}
void CefBrowserHostImpl::PlatformHandleExternalProtocol(const GURL& url) {
}
static NSTimeInterval currentEventTimestamp() {
NSEvent* currentEvent = [NSApp currentEvent];
if (currentEvent)
return [currentEvent timestamp];
else {
// FIXME(API): In case there is no current event, the timestamp could be
// obtained by getting the time since the application started. This involves
// taking some more static functions from Chromium code.
// Another option is to have the timestamp as a field in CefEvent structures
// and let the client provide it.
return 0;
}
}
static NSUInteger NativeModifiers(int cef_modifiers) {
NSUInteger native_modifiers = 0;
if (cef_modifiers & EVENTFLAG_SHIFT_DOWN)
native_modifiers |= NSShiftKeyMask;
if (cef_modifiers & EVENTFLAG_CONTROL_DOWN)
native_modifiers |= NSControlKeyMask;
if (cef_modifiers & EVENTFLAG_ALT_DOWN)
native_modifiers |= NSAlternateKeyMask;
if (cef_modifiers & EVENTFLAG_COMMAND_DOWN)
native_modifiers |= NSCommandKeyMask;
if (cef_modifiers & EVENTFLAG_CAPS_LOCK_ON)
native_modifiers |= NSAlphaShiftKeyMask;
if (cef_modifiers & EVENTFLAG_NUM_LOCK_ON)
native_modifiers |= NSNumericPadKeyMask;
return native_modifiers;
}
void CefBrowserHostImpl::PlatformTranslateKeyEvent(
content::NativeWebKeyboardEvent& native_event,
const CefKeyEvent& key_event) {
// Use a synthetic NSEvent in order to obtain the windowsKeyCode member from
// the NativeWebKeyboardEvent constructor. This is the only member which can
// not be easily translated (without hardcoding keyCodes)
// Determining whether a modifier key is left or right seems to be done
// through the key code as well.
NSEventType event_type;
if (key_event.character == 0 && key_event.unmodified_character == 0) {
// Check if both character and unmodified_characther are empty to determine
// if this was a NSFlagsChanged event.
// A dead key will have an empty character, but a non-empty unmodified
// character
event_type = NSFlagsChanged;
} else {
switch (key_event.type) {
case KEYEVENT_RAWKEYDOWN:
case KEYEVENT_KEYDOWN:
case KEYEVENT_CHAR:
event_type = NSKeyDown;
break;
case KEYEVENT_KEYUP:
event_type = NSKeyUp;
break;
}
}
NSString* charactersIgnoringModifiers = [[[NSString alloc]
initWithCharacters:&key_event.unmodified_character length:1]
autorelease];
NSString* characters = [[[NSString alloc]
initWithCharacters:&key_event.character length:1] autorelease];
NSEvent* synthetic_event =
[NSEvent keyEventWithType:event_type
location:NSMakePoint(0, 0)
modifierFlags:NativeModifiers(key_event.modifiers)
timestamp:currentEventTimestamp()
windowNumber:0
context:nil
characters:characters
charactersIgnoringModifiers:charactersIgnoringModifiers
isARepeat:NO
keyCode:key_event.native_key_code];
native_event = content::NativeWebKeyboardEvent(synthetic_event);
if (key_event.type == KEYEVENT_CHAR)
native_event.type = blink::WebInputEvent::Char;
native_event.isSystemKey = key_event.is_system_key;
}
void CefBrowserHostImpl::PlatformTranslateClickEvent(
blink::WebMouseEvent& result,
const CefMouseEvent& mouse_event,
MouseButtonType type,
bool mouseUp, int clickCount) {
PlatformTranslateMouseEvent(result, mouse_event);
switch (type) {
case MBT_LEFT:
result.type = mouseUp ? blink::WebInputEvent::MouseUp :
blink::WebInputEvent::MouseDown;
result.button = blink::WebMouseEvent::ButtonLeft;
break;
case MBT_MIDDLE:
result.type = mouseUp ? blink::WebInputEvent::MouseUp :
blink::WebInputEvent::MouseDown;
result.button = blink::WebMouseEvent::ButtonMiddle;
break;
case MBT_RIGHT:
result.type = mouseUp ? blink::WebInputEvent::MouseUp :
blink::WebInputEvent::MouseDown;
result.button = blink::WebMouseEvent::ButtonRight;
break;
default:
NOTREACHED();
}
result.clickCount = clickCount;
}
void CefBrowserHostImpl::PlatformTranslateMoveEvent(
blink::WebMouseEvent& result,
const CefMouseEvent& mouse_event,
bool mouseLeave) {
PlatformTranslateMouseEvent(result, mouse_event);
if (!mouseLeave) {
result.type = blink::WebInputEvent::MouseMove;
if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON)
result.button = blink::WebMouseEvent::ButtonLeft;
else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON)
result.button = blink::WebMouseEvent::ButtonMiddle;
else if (mouse_event.modifiers & EVENTFLAG_RIGHT_MOUSE_BUTTON)
result.button = blink::WebMouseEvent::ButtonRight;
else
result.button = blink::WebMouseEvent::ButtonNone;
} else {
result.type = blink::WebInputEvent::MouseLeave;
result.button = blink::WebMouseEvent::ButtonNone;
}
result.clickCount = 0;
}
void CefBrowserHostImpl::PlatformTranslateWheelEvent(
blink::WebMouseWheelEvent& result,
const CefMouseEvent& mouse_event,
int deltaX, int deltaY) {
result = blink::WebMouseWheelEvent();
PlatformTranslateMouseEvent(result, mouse_event);
result.type = blink::WebInputEvent::MouseWheel;
static const double scrollbarPixelsPerCocoaTick = 40.0;
result.deltaX = deltaX;
result.deltaY = deltaY;
result.wheelTicksX = result.deltaX / scrollbarPixelsPerCocoaTick;
result.wheelTicksY = result.deltaY / scrollbarPixelsPerCocoaTick;
result.hasPreciseScrollingDeltas = true;
// Unless the phase and momentumPhase are passed in as parameters to this
// function, there is no way to know them
result.phase = blink::WebMouseWheelEvent::PhaseNone;
result.momentumPhase = blink::WebMouseWheelEvent::PhaseNone;
if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON)
result.button = blink::WebMouseEvent::ButtonLeft;
else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON)
result.button = blink::WebMouseEvent::ButtonMiddle;
else if (mouse_event.modifiers & EVENTFLAG_RIGHT_MOUSE_BUTTON)
result.button = blink::WebMouseEvent::ButtonRight;
else
result.button = blink::WebMouseEvent::ButtonNone;
}
void CefBrowserHostImpl::PlatformTranslateMouseEvent(
blink::WebMouseEvent& result,
const CefMouseEvent& mouse_event) {
// position
result.x = mouse_event.x;
result.y = mouse_event.y;
result.windowX = result.x;
result.windowY = result.y;
result.globalX = result.x;
result.globalY = result.y;
if (IsWindowless()) {
CefRefPtr<CefRenderHandler> handler = client_->GetRenderHandler();
if (handler.get()) {
handler->GetScreenPoint(this, result.x, result.y, result.globalX,
result.globalY);
}
} else {
NSView* view = window_info_.parent_view;
if (view) {
NSRect bounds = [view bounds];
NSPoint view_pt = {result.x, bounds.size.height - result.y};
NSPoint window_pt = [view convertPoint:view_pt toView:nil];
NSPoint screen_pt = [[view window] convertBaseToScreen:window_pt];
result.globalX = screen_pt.x;
result.globalY = screen_pt.y;
}
}
// modifiers
result.modifiers |= TranslateModifiers(mouse_event.modifiers);
// timestamp - Mac OSX specific
result.timeStampSeconds = currentEventTimestamp();
}
void CefBrowserHostImpl::PlatformNotifyMoveOrResizeStarted() {
}

File diff suppressed because it is too large Load Diff

View File

@@ -5,6 +5,7 @@
#include "libcef/browser/browser_info.h"
#include "libcef/browser/browser_host_impl.h"
#include "libcef/browser/thread_util.h"
#include "ipc/ipc_message.h"
@@ -36,14 +37,14 @@ void CefBrowserInfo::RenderIDManager::remove_render_frame_id(
}
bool CefBrowserInfo::RenderIDManager::is_render_view_id_match(
int render_process_id, int render_routing_id) {
int render_process_id, int render_routing_id) const {
return is_render_id_match(&render_view_id_set_,
render_process_id,
render_routing_id);
}
bool CefBrowserInfo::RenderIDManager::is_render_frame_id_match(
int render_process_id, int render_routing_id) {
int render_process_id, int render_routing_id) const {
return is_render_id_match(&render_frame_id_set_,
render_process_id,
render_routing_id);
@@ -87,7 +88,7 @@ void CefBrowserInfo::RenderIDManager::remove_render_id(RenderIdSet* id_set,
bool CefBrowserInfo::RenderIDManager::is_render_id_match(
const RenderIdSet* id_set,
int render_process_id,
int render_routing_id) {
int render_routing_id) const {
base::AutoLock lock_scope(*lock_);
if (id_set->empty())
@@ -117,7 +118,7 @@ void CefBrowserInfo::set_windowless(bool windowless) {
is_windowless_ = windowless;
}
CefRefPtr<CefBrowserHostImpl> CefBrowserInfo::browser() {
CefRefPtr<CefBrowserHostImpl> CefBrowserInfo::browser() const {
base::AutoLock lock_scope(lock_);
return browser_;
}

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