Internal change
PiperOrigin-RevId: 334866521
Change-Id: Ib4c3dbf35cc5846075c06536e68a1c23de4b3a28
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..fa89fde
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,232 @@
+// Copyright (c) 2008-2014 Marshall A. Greenblatt. Portions Copyright (c)
+// 2006-2009 Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/patch/patch.cfg b/patch/patch.cfg
new file mode 100755
index 0000000..c158d63
--- /dev/null
+++ b/patch/patch.cfg
@@ -0,0 +1,93 @@
+# Patch configuration file.
+#
+# Each dictionary entry passed to "register_google_patches" represents a single
+# patch file. Supported key/value pairs are as follows:
+#
+# - 'name' Required. The name of the patch file without the .patch
+# extension that will be read from the patches subdirectory.
+# - 'path' Optional. The repository root for the patch file. Defaults to
+# the Chromium "src" root. All patch file contents must be
+# relative to this repository root.
+# - 'condition' Optional. The patch file will only be applied if an environment
+# variable with this name exists.
+#
+# Each entry should also include a comment linking the bug the patch relates to.
+
+register_google_patches(
+ {
+ # Make CEF compatible with google3 code
+ #
+ # This fixes the google3 incompatibilities in CEF -- such as conflicting
+ # symbols, macros, and header guards -- to allow CEF and common google3
+ # libraries like //base to be used in client apps.
+ #
+ # - Do not check for Chromium header include guards when compiling
+ # //third_party/cef files in google3 (i.e., when USING_GOOGLE3_INCLUDES
+ # is defined).
+ #
+ # - Replace the definitions in CEF's include/base/cef_atomicops.h header
+ # with the google3 definitions in //base/atomicops.h header.
+ #
+ # - Replace the definitions in CEF's include/base/cef_basictypes.h header
+ # with the google3 definitions in //base/integral_types.h (and also
+ # define the char16 type required by CEF).
+ #
+ # - Replace the definitions in CEF's include/base/cef_logging.h header with
+ # the google3 definitions in //base/logging.h (and also define the
+ # NOTREACHED and DCHECK_IS_ON macros required by CEF).
+ #
+ # - Replace the definitions in CEF's include/base/cef_macros.h header with
+ # the google3 definitions in //base/macros.h.
+ #
+ # - Add a kludge to CEF's include/base/cef_callback.h header to support its
+ # use in the same translation unit as the google3 //base/callback.h
+ # header.
+ #
+ # See go/thor-desktop-cef-google3-support for more details.
+ #
+ # Bug: b/132197443
+ 'name': 'google3_compatibility',
+ 'path': 'cef',
+ },
+ {
+ # Include Piper changelist in CEF_VERSION and add CEF_PIPER_CL macro
+ #
+ # This updates the CEF_VERSION macro in cef_version.h to something like
+ # "cef_binary_73.1.12+gee4b49f+chromium-73.0.3683.75+piper-240653526". It
+ # also adds a CEF_PIPER_CL macro with just the changelist number.
+ #
+ # Bug: b/128862468
+ 'name': 'cef_version',
+ 'path': 'cef',
+ },
+ {
+ # Prefer using non-Depot Tools clang-format for Linux builds
+ #
+ # The clang-format from Depot Tools fails on some Linux Kokoro machines
+ # because of dynamic linker errors. This patch uses the clang-format we
+ # explicitly install instead (if it is in fact installed on the machine).
+ #
+ # Bug: b/122266829
+ 'name': 'clang_format_fix',
+ 'path': 'cef',
+ },
+ {
+ # Allow service account authentication when fetching the Mac toolchain
+ #
+ # Fetching the Mac toolchain requires cipd be authenticated. The scripts do
+ # not have support for this in a build bot; to fix this, we reinstate a
+ # temporary piece of code removed in
+ # https://crrev.com/a459f7dc6f606c988d58d72e6c71dce69bf5727b.
+ #
+ # Bug: b/159071415
+ 'name': 'mac_toolchain_creds',
+ },
+ {
+ # Temporary patch to remove reference to hermetic_xcode_path (now private
+ # and no longer needed).
+ #
+ # Bug: b/159071415
+ 'name': 'private_hermetic_xcode',
+ 'path': 'cef',
+ },
+)
diff --git a/patch/patches/cef_version.patch b/patch/patches/cef_version.patch
new file mode 100644
index 0000000..789551e
--- /dev/null
+++ b/patch/patches/cef_version.patch
@@ -0,0 +1,67 @@
+diff --git tools/cef_version.py tools/cef_version.py
+index 132438ba..6972680a 100644
+--- tools/cef_version.py
++++ tools/cef_version.py
+@@ -92,6 +92,10 @@ class VersionFormatter:
+ self._branch_version = {'MINOR': minor, 'PATCH': bugfix}
+ return self._branch_version
+
++ def get_piper_cl(self):
++ """ Returns the Piper CL. """
++ return os.getenv('CEF_PIPER_CL', '0')
++
+ def get_chromium_version_string(self):
+ """ Returns the Chromium version number string. """
+ chrome_version = self.get_chrome_version_components()
+@@ -170,6 +174,7 @@ class VersionFormatter:
+ chrome_version = self.get_chrome_version_components()
+ chrome_major = chrome_version['MAJOR']
+ chrome_version_part = 'chromium-' + self.get_chromium_version_string()
++ piper_cl_part = 'piper-' + self.get_piper_cl()
+
+ cef_commit = self.get_cef_commit_components()
+ cef_commit_hash = self._format_commit_hash(cef_commit['HASH'])
+@@ -187,9 +192,9 @@ class VersionFormatter:
+ cef_branch_name = git.get_branch_name(self.cef_path).split('/')[-1]
+
+ self._version_parts = {'MAJOR': int(chrome_major), 'MINOR': 0, 'PATCH': 0}
+- self._version_string = '%s.0.0-%s.%s+%s+%s' % \
++ self._version_string = '%s.0.0-%s.%s+%s+%s+%s' % \
+ (chrome_major, cef_branch_name, cef_commit['NUMBER'],
+- cef_commit_hash, chrome_version_part)
++ cef_commit_hash, chrome_version_part, piper_cl_part)
+ else:
+ cef_branch = self.get_cef_branch_version_components()
+
+@@ -198,9 +203,9 @@ class VersionFormatter:
+ 'MINOR': cef_branch['MINOR'],
+ 'PATCH': cef_branch['PATCH']
+ }
+- self._version_string = '%s.%d.%d+%s+%s' % \
++ self._version_string = '%s.%d.%d+%s+%s+%s' % \
+ (chrome_major, cef_branch['MINOR'], cef_branch['PATCH'],
+- cef_commit_hash, chrome_version_part)
++ cef_commit_hash, chrome_version_part, piper_cl_part)
+
+ def _get_version_string(self):
+ self._compute_version()
+diff --git tools/make_version_header.py tools/make_version_header.py
+index fa2325aa..a7ee5a43 100644
+--- tools/make_version_header.py
++++ tools/make_version_header.py
+@@ -31,6 +31,7 @@ def make_version_header(header):
+ #define CEF_VERSION_PATCH $VERSION_PATCH$
+ #define CEF_COMMIT_NUMBER $COMMIT_NUMBER$
+ #define CEF_COMMIT_HASH "$COMMIT_HASH$"
++#define CEF_PIPER_CL $PIPER_CL$
+ #define COPYRIGHT_YEAR $YEAR$
+
+ #define CHROME_VERSION_MAJOR $CHROME_MAJOR$
+@@ -76,6 +77,7 @@ CEF_EXPORT int cef_version_info(int entry);
+ # Substitute hash values for placeholders.
+ result = result.replace('$YEAR$', get_year())
+ result = result.replace('$VERSION$', formatter.get_version_string())
++ result = result.replace('$PIPER_CL$', formatter.get_piper_cl())
+
+ commit_components = formatter.get_cef_commit_components()
+ for key in ('HASH', 'NUMBER'):
diff --git a/patch/patches/clang_format_fix.patch b/patch/patches/clang_format_fix.patch
new file mode 100644
index 0000000..40839b2
--- /dev/null
+++ b/patch/patches/clang_format_fix.patch
@@ -0,0 +1,19 @@
+diff --git tools/clang_util.py tools/clang_util.py
+index 48354721..055d3710 100644
+--- tools/clang_util.py
++++ tools/clang_util.py
+@@ -18,6 +18,14 @@ if sys.platform == 'win32':
+ else:
+ clang_format_exe = 'clang-format'
+
++# Prefer using non-Depot Tools clang-format for Linux builds. The clang-format
++# from Depot Tools fails on some Linux Kokoro machines because of dynamic linker
++# errors. Use the clang-format we explicitly install instead (if it is in fact
++# installed on the machine). See b/122266829.
++if (sys.platform == 'linux2' and
++ os.path.isfile('/usr/lib/llvm-3.9/bin/clang-format')):
++ clang_format_exe = '/usr/lib/llvm-3.9/bin/clang-format'
++
+
+ def clang_format(file_name, file_contents):
+ # -assume-filename is necessary to find the .clang-format file and determine
diff --git a/patch/patches/google3_compatibility.patch b/patch/patches/google3_compatibility.patch
new file mode 100644
index 0000000..ae94e8e
--- /dev/null
+++ b/patch/patches/google3_compatibility.patch
@@ -0,0 +1,417 @@
+diff --git include/base/cef_atomicops.h include/base/cef_atomicops.h
+index 96aebab..501788f 100644
+--- include/base/cef_atomicops.h
++++ include/base/cef_atomicops.h
+@@ -54,7 +54,7 @@
+ #define CEF_INCLUDE_BASE_CEF_ATOMICOPS_H_
+ #pragma once
+
+-#if defined(BASE_ATOMICOPS_H_)
++#if defined(BASE_ATOMICOPS_H_) && !defined(USING_GOOGLE3_INCLUDES)
+ // Do nothing if the Chromium header has already been included.
+ // This can happen in cases where Chromium code is used directly by the
+ // client application. When using Chromium code directly always include
+@@ -92,9 +92,13 @@
+ // http://code.google.com/p/nativeclient/issues/detail?id=1162
+ typedef int64_t Atomic64;
+ #else
++#if defined(USING_GOOGLE3_INCLUDES)
++typedef int64_t Atomic64;
++#else
+ typedef intptr_t Atomic64;
+ #endif
+ #endif
++#endif
+
+ // Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or
+ // Atomic64 routines below, depending on your architecture.
+diff --git include/base/cef_basictypes.h include/base/cef_basictypes.h
+index e38f4f729..fcb0a5916 100644
+--- include/base/cef_basictypes.h
++++ include/base/cef_basictypes.h
+@@ -37,6 +37,11 @@
+
+ #include "include/base/cef_build.h"
+
++#if defined(USING_GOOGLE3_INCLUDES)
++// When building CEF in google3, use the google3 header directly.
++#include "base/integral_types.h"
++#else // !USING_GOOGLE3_INCLUDES
++
+ // The NSPR system headers define 64-bit as |long| when possible, except on
+ // Mac OS X. In order to not have typedef mismatches, we do the same on LP64.
+ //
+@@ -74,6 +79,8 @@ typedef short int16;
+ typedef unsigned short uint16;
+ #endif
+
++#endif // !USING_GOOGLE3_INCLUDES
++
+ // UTF-16 character type.
+ // This should be kept synchronized with base/strings/string16.h
+ #ifndef char16
+diff --git include/base/cef_bind.h include/base/cef_bind.h
+index 77c9c5573..a917a1887 100644
+--- include/base/cef_bind.h
++++ include/base/cef_bind.h
+@@ -32,7 +32,7 @@
+ #define CEF_INCLUDE_BASE_CEF_BIND_H_
+ #pragma once
+
+-#if defined(BASE_BIND_H_)
++#if defined(BASE_BIND_H_) && !defined(USING_GOOGLE3_INCLUDES)
+ // Do nothing if the Chromium header has already been included.
+ // This can happen in cases where Chromium code is used directly by the
+ // client application. When using Chromium code directly always include
+diff --git include/base/cef_bind_helpers.h include/base/cef_bind_helpers.h
+index 2b4798b2c..b220b9934 100644
+--- include/base/cef_bind_helpers.h
++++ include/base/cef_bind_helpers.h
+@@ -170,7 +170,7 @@
+ #define CEF_INCLUDE_BASE_CEF_BIND_HELPERS_H_
+ #pragma once
+
+-#if defined(BASE_BIND_HELPERS_H_)
++#if defined(BASE_BIND_HELPERS_H_) && !defined(USING_GOOGLE3_INCLUDES)
+ // Do nothing if the Chromium header has already been included.
+ // This can happen in cases where Chromium code is used directly by the
+ // client application. When using Chromium code directly always include
+diff --git include/base/cef_callback.h include/base/cef_callback.h
+index 16e238a97..83cb0ebe4 100644
+--- include/base/cef_callback.h
++++ include/base/cef_callback.h
+@@ -32,7 +32,7 @@
+ #define CEF_INCLUDE_BASE_CEF_CALLBACK_H_
+ #pragma once
+
+-#if defined(BASE_CALLBACK_H_)
++#if defined(BASE_CALLBACK_H_) && !defined(USING_GOOGLE3_INCLUDES)
+ // Do nothing if the Chromium header has already been included.
+ // This can happen in cases where Chromium code is used directly by the
+ // client application. When using Chromium code directly always include
+diff --git include/base/cef_callback_forward.h include/base/cef_callback_forward.h
+index d604d7cfa..e434bd12f 100644
+--- include/base/cef_callback_forward.h
++++ include/base/cef_callback_forward.h
+@@ -32,7 +32,7 @@
+ #define INCLUDE_BASE_CEF_CALLBACK_FORWARD_H_
+ #pragma once
+
+-#if defined(BASE_CALLBACK_FORWARD_H_)
++#if defined(BASE_CALLBACK_FORWARD_H_) && !defined(USING_GOOGLE3_INCLUDES)
+ // Do nothing if the Chromium header has already been included.
+ // This can happen in cases where Chromium code is used directly by the
+ // client application. When using Chromium code directly always include
+@@ -54,6 +54,27 @@ typedef Callback<void(void)> Closure;
+
+ } // namespace base
+
++#if defined(USING_GOOGLE3_INCLUDES)
++
++// The google3 //base/callback-specializations.h header declares class templates
++// in the base::callback_internal namespace that derive from ::Closure. However,
++// those class templates use " : public Closure" to achieve that relationship.
++// Because CEF declares a conflicting Closure type in the base namespace, the
++// google3 header picks up the incorrect Closure (CEF's base::Closure rather
++// than google3's ::Closure) when used in conjunction with the CEF header. The
++// kludge below resolves this issue by pulling the global ::Closure into the
++// base::callback_internal namespace.
++
++class Closure;
++
++namespace base {
++namespace callback_internal {
++using Closure = ::Closure;
++} // namespace callback_internal
++} // namespace base
++
++#endif // USING_GOOGLE3_INCLUDES
++
+ #endif // !!USING_CHROMIUM_INCLUDES
+
+ #endif // INCLUDE_BASE_CEF_CALLBACK_FORWARD_H_
+diff --git include/base/cef_callback_helpers.h include/base/cef_callback_helpers.h
+index ebe074a1f..1692cfde5 100644
+--- include/base/cef_callback_helpers.h
++++ include/base/cef_callback_helpers.h
+@@ -41,7 +41,7 @@
+ #define CEF_INCLUDE_BASE_CEF_CALLBACK_HELPERS_H_
+ #pragma once
+
+-#if defined(BASE_CALLBACK_HELPERS_H_)
++#if defined(BASE_CALLBACK_HELPERS_H_) && !defined(USING_GOOGLE3_INCLUDES)
+ // Do nothing if the Chromium header has already been included.
+ // This can happen in cases where Chromium code is used directly by the
+ // client application. When using Chromium code directly always include
+diff --git include/base/cef_callback_list.h include/base/cef_callback_list.h
+index e0ef3665b..8e0a5d6e5 100644
+--- include/base/cef_callback_list.h
++++ include/base/cef_callback_list.h
+@@ -32,7 +32,7 @@
+ #define CEF_INCLUDE_BASE_CEF_CALLBACK_LIST_H_
+ #pragma once
+
+-#if defined(BASE_CALLBACK_LIST_H_)
++#if defined(BASE_CALLBACK_LIST_H_) && !defined(USING_GOOGLE3_INCLUDES)
+ // Do nothing if the Chromium header has already been included.
+ // This can happen in cases where Chromium code is used directly by the
+ // client application. When using Chromium code directly always include
+diff --git include/base/cef_cancelable_callback.h include/base/cef_cancelable_callback.h
+index febce3a32..c1cfbf03d 100644
+--- include/base/cef_cancelable_callback.h
++++ include/base/cef_cancelable_callback.h
+@@ -69,7 +69,7 @@
+ #define CEF_INCLUDE_BASE_CEF_CANCELABLE_CALLBACK_H_
+ #pragma once
+
+-#if defined(BASE_CANCELABLE_CALLBACK_H_)
++#if defined(BASE_CANCELABLE_CALLBACK_H_) && !defined(USING_GOOGLE3_INCLUDES)
+ // Do nothing if the Chromium header has already been included.
+ // This can happen in cases where Chromium code is used directly by the
+ // client application. When using Chromium code directly always include
+diff --git include/base/cef_lock.h include/base/cef_lock.h
+index 6909bd6f2..cc122cafd 100644
+--- include/base/cef_lock.h
++++ include/base/cef_lock.h
+@@ -32,7 +32,7 @@
+ #define CEF_INCLUDE_BASE_CEF_LOCK_H_
+ #pragma once
+
+-#if defined(BASE_SYNCHRONIZATION_LOCK_H_)
++#if defined(BASE_SYNCHRONIZATION_LOCK_H_) && !defined(USING_GOOGLE3_INCLUDES)
+ // Do nothing if the Chromium header has already been included.
+ // This can happen in cases where Chromium code is used directly by the
+ // client application. When using Chromium code directly always include
+diff --git include/base/cef_logging.h include/base/cef_logging.h
+index 8d8bb889e..fef75d78b 100644
+--- include/base/cef_logging.h
++++ include/base/cef_logging.h
+@@ -136,7 +136,7 @@
+ #define CEF_INCLUDE_BASE_CEF_LOGGING_H_
+ #pragma once
+
+-#if defined(DCHECK)
++#if defined(DCHECK) && !defined(USING_GOOGLE3_INCLUDES)
+ // Do nothing if the macros provided by this header already exist.
+ // This can happen in cases where Chromium code is used directly by the
+ // client application. When using Chromium code directly always include
+@@ -162,6 +162,12 @@
+ #include <sstream>
+ #include <string>
+
++#if defined(USING_GOOGLE3_INCLUDES)
++// When building CEF in google3, use the google3 header directly, but keep the
++// namespaced CEF logging declarations and implementations (but not the macros).
++#include "base/logging.h"
++#endif // USING_GOOGLE3_INCLUDES
++
+ #include "include/base/cef_build.h"
+ #include "include/base/cef_macros.h"
+ #include "include/internal/cef_logging_internal.h"
+@@ -198,6 +204,8 @@ const LogSeverity LOG_DFATAL = LOG_ERROR;
+ const LogSeverity LOG_DFATAL = LOG_FATAL;
+ #endif
+
++#if !defined(USING_GOOGLE3_INCLUDES)
++
+ // A few definitions of macros that don't generate much code. These are used
+ // by LOG() and LOG_IF, etc. Since these are used all over our code, it's
+ // better to have compact code for these operations.
+@@ -355,6 +363,8 @@ const LogSeverity LOG_0 = LOG_ERROR;
+ (val1), (val2), #val1 " " #op " " #val2)) \
+ cef::logging::LogMessage(__FILE__, __LINE__, _result).stream()
+
++#endif // !USING_GOOGLE3_INCLUDES
++
+ // Build the error message string. This is separate from the "Impl"
+ // function template because it is not performance critical and so can
+ // be out of line, while the "Impl" code should be inline. Caller
+@@ -392,6 +402,8 @@ extern template std::string* MakeCheckOpString<std::string, std::string>(
+ const char* name);
+ #endif
+
++#if !defined(USING_GOOGLE3_INCLUDES)
++
+ // Helper functions for CHECK_OP macro.
+ // The (int, int) specialization works around the issue that the compiler
+ // will not instantiate the template version of the function on values of
+@@ -432,12 +444,16 @@ DEFINE_CHECK_OP_IMPL(GT, >)
+ #define ENABLE_DLOG 1
+ #endif
+
++#endif // !USING_GOOGLE3_INCLUDES
++
+ #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
+ #define DCHECK_IS_ON() 0
+ #else
+ #define DCHECK_IS_ON() 1
+ #endif
+
++#if !defined(USING_GOOGLE3_INCLUDES)
++
+ // Definitions for DLOG et al.
+
+ #if ENABLE_DLOG
+@@ -553,6 +569,8 @@ const LogSeverity LOG_DCHECK = LOG_INFO;
+ #define DCHECK_GE(val1, val2) DCHECK_OP(GE, >=, val1, val2)
+ #define DCHECK_GT(val1, val2) DCHECK_OP(GT, >, val1, val2)
+
++#endif // !USING_GOOGLE3_INCLUDES
++
+ #if defined(NDEBUG) && defined(OS_CHROMEOS)
+ #define NOTREACHED() \
+ LOG(ERROR) << "NOTREACHED() hit in " << __FUNCTION__ << ". "
+@@ -560,10 +578,14 @@ const LogSeverity LOG_DCHECK = LOG_INFO;
+ #define NOTREACHED() DCHECK(false)
+ #endif
+
++#if !defined(USING_GOOGLE3_INCLUDES)
++
+ // Redefine the standard assert to use our nice log files
+ #undef assert
+ #define assert(x) DLOG_ASSERT(x)
+
++#endif // !USING_GOOGLE3_INCLUDES
++
+ // This class more or less represents a particular log message. You
+ // create an instance of LogMessage and then stream stuff to it.
+ // When you finish streaming to it, ~LogMessage is called and the
+@@ -706,6 +728,8 @@ inline std::ostream& operator<<(std::ostream& out, const std::wstring& wstr) {
+ return out << wstr.c_str();
+ }
+
++#if !defined(USING_GOOGLE3_INCLUDES)
++
+ // The NOTIMPLEMENTED() macro annotates codepaths which have
+ // not been implemented yet.
+ //
+@@ -755,6 +779,8 @@ inline std::ostream& operator<<(std::ostream& out, const std::wstring& wstr) {
+ EAT_STREAM_PARAMETERS
+ #endif
+
++#endif // !USING_GOOGLE3_INCLUDES
++
+ #endif // !USING_CHROMIUM_INCLUDES
+
+ #endif // CEF_INCLUDE_BASE_CEF_LOGGING_H_
+diff --git include/base/cef_macros.h include/base/cef_macros.h
+index e714529cd..67588c615 100644
+--- include/base/cef_macros.h
++++ include/base/cef_macros.h
+@@ -35,8 +35,10 @@
+ #if defined(USING_CHROMIUM_INCLUDES)
+ // When building CEF include the Chromium header directly.
+ #include "base/macros.h"
+-
+-#else // !USING_CHROMIUM_INCLUDES
++#elif defined(USING_GOOGLE3_INCLUDES)
++// When building CEF in google3, use the google3 header directly.
++#include "base/macros.h"
++#else // !USING_GOOGLE3_INCLUDES
+ // The following is substantially similar to the Chromium implementation.
+ // If the Chromium implementation diverges the below implementation should be
+ // updated to match.
+diff --git include/base/cef_platform_thread.h include/base/cef_platform_thread.h
+index d3fdd798e..15cb0951b 100644
+--- include/base/cef_platform_thread.h
++++ include/base/cef_platform_thread.h
+@@ -35,7 +35,7 @@
+ #ifndef CEF_INCLUDE_BASE_PLATFORM_THREAD_H_
+ #define CEF_INCLUDE_BASE_PLATFORM_THREAD_H_
+
+-#if defined(BASE_THREADING_PLATFORM_THREAD_H_)
++#if defined(BASE_THREADING_PLATFORM_THREAD_H_) && !defined(USING_GOOGLE3_INCLUDES)
+ // Do nothing if the Chromium header has already been included.
+ // This can happen in cases where Chromium code is used directly by the
+ // client application. When using Chromium code directly always include
+diff --git include/base/cef_ref_counted.h include/base/cef_ref_counted.h
+index 7a687070c..93d8cbeaa 100644
+--- include/base/cef_ref_counted.h
++++ include/base/cef_ref_counted.h
+@@ -33,7 +33,7 @@
+ #define CEF_INCLUDE_BASE_CEF_REF_COUNTED_H_
+ #pragma once
+
+-#if defined(BASE_MEMORY_REF_COUNTED_H_)
++#if defined(BASE_MEMORY_REF_COUNTED_H_) && !defined(USING_GOOGLE3_INCLUDES)
+ // Do nothing if the Chromium header has already been included.
+ // This can happen in cases where Chromium code is used directly by the
+ // client application. When using Chromium code directly always include
+diff --git include/base/cef_scoped_ptr.h include/base/cef_scoped_ptr.h
+index eb9e0e29b..6efc7ca85 100644
+--- include/base/cef_scoped_ptr.h
++++ include/base/cef_scoped_ptr.h
+@@ -114,7 +114,7 @@
+ #define CEF_INCLUDE_BASE_CEF_MEMORY_SCOPED_PTR_H_
+ #pragma once
+
+-#if defined(BASE_MEMORY_SCOPED_PTR_H_)
++#if defined(BASE_MEMORY_SCOPED_PTR_H_) && !defined(USING_GOOGLE3_INCLUDES)
+ // Do nothing if the Chromium header has already been included.
+ // This can happen in cases where Chromium code is used directly by the
+ // client application. When using Chromium code directly always include
+diff --git include/base/cef_string16.h include/base/cef_string16.h
+index 6afcb79bd..e5cbaa861 100644
+--- include/base/cef_string16.h
++++ include/base/cef_string16.h
+@@ -32,7 +32,7 @@
+ #define CEF_INCLUDE_BASE_CEF_STRING16_H_
+ #pragma once
+
+-#if defined(BASE_STRINGS_STRING16_H_)
++#if defined(BASE_STRINGS_STRING16_H_) && !defined(USING_GOOGLE3_INCLUDES)
+ // Do nothing if the Chromium header has already been included.
+ // This can happen in cases where Chromium code is used directly by the
+ // client application. When using Chromium code directly always include
+diff --git include/base/cef_template_util.h include/base/cef_template_util.h
+index 38fa5839c..6c70dd2ac 100644
+--- include/base/cef_template_util.h
++++ include/base/cef_template_util.h
+@@ -32,7 +32,7 @@
+ #define CEF_INCLUDE_BASE_CEF_TEMPLATE_UTIL_H_
+ #pragma once
+
+-#if defined(BASE_TEMPLATE_UTIL_H_)
++#if defined(BASE_TEMPLATE_UTIL_H_) && !defined(USING_GOOGLE3_INCLUDES)
+ // Do nothing if the Chromium header has already been included.
+ // This can happen in cases where Chromium code is used directly by the
+ // client application. When using Chromium code directly always include
+diff --git include/base/cef_thread_checker.h include/base/cef_thread_checker.h
+index e48c8d033..c582e1377 100644
+--- include/base/cef_thread_checker.h
++++ include/base/cef_thread_checker.h
+@@ -32,7 +32,7 @@
+ #define CEF_INCLUDE_BASE_THREAD_CHECKER_H_
+ #pragma once
+
+-#if defined(BASE_THREADING_THREAD_CHECKER_H_)
++#if defined(BASE_THREADING_THREAD_CHECKER_H_) && !defined(USING_GOOGLE3_INCLUDES)
+ // Do nothing if the Chromium header has already been included.
+ // This can happen in cases where Chromium code is used directly by the
+ // client application. When using Chromium code directly always include
+diff --git include/base/cef_tuple.h include/base/cef_tuple.h
+index aeb6e9cea..f6b86167f 100644
+--- include/base/cef_tuple.h
++++ include/base/cef_tuple.h
+@@ -56,7 +56,7 @@
+ #define CEF_INCLUDE_BASE_CEF_TUPLE_H_
+ #pragma once
+
+-#if defined(BASE_TUPLE_H_)
++#if defined(BASE_TUPLE_H_) && !defined(USING_GOOGLE3_INCLUDES)
+ // Do nothing if the Chromium header has already been included.
+ // This can happen in cases where Chromium code is used directly by the
+ // client application. When using Chromium code directly always include
+diff --git include/base/cef_weak_ptr.h include/base/cef_weak_ptr.h
+index 1ba34b9db..2cf2f1787 100644
+--- include/base/cef_weak_ptr.h
++++ include/base/cef_weak_ptr.h
+@@ -96,7 +96,7 @@
+ #define CEF_INCLUDE_BASE_CEF_WEAK_PTR_H_
+ #pragma once
+
+-#if defined(BASE_MEMORY_WEAK_PTR_H_)
++#if defined(BASE_MEMORY_WEAK_PTR_H_) && !defined(USING_GOOGLE3_INCLUDES)
+ // Do nothing if the Chromium header has already been included.
+ // This can happen in cases where Chromium code is used directly by the
+ // client application. When using Chromium code directly always include
diff --git a/patch/patches/mac_toolchain_creds.patch b/patch/patches/mac_toolchain_creds.patch
new file mode 100644
index 0000000..c6a53bb
--- /dev/null
+++ b/patch/patches/mac_toolchain_creds.patch
@@ -0,0 +1,18 @@
+diff --git build/mac_toolchain.py build/mac_toolchain.py
+index 866b5f8..56f640c 100755
+--- build/mac_toolchain.py
++++ build/mac_toolchain.py
+@@ -107,6 +107,13 @@
+ 'cipd', 'ensure', '-root', binaries_root, '-ensure-file', '-'
+ ]
+
++ # Buildbot slaves need to use explicit credentials. LUCI bots should NOT set
++ # this variable. This is temporary code used to make official Xcode bots
++ # happy. https://crbug.com/986488
++ creds = os.environ.get('MAC_TOOLCHAIN_CREDS')
++ if creds:
++ args.extend(['--service-account-json', creds])
++
+ p = subprocess.Popen(
+ args, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
diff --git a/patch/patches/private_hermetic_xcode.patch b/patch/patches/private_hermetic_xcode.patch
new file mode 100644
index 0000000..dffc6f4
--- /dev/null
+++ b/patch/patches/private_hermetic_xcode.patch
@@ -0,0 +1,17 @@
+diff --git BUILD.gn BUILD.gn
+index cd202499..6858350a 100644
+--- BUILD.gn
++++ BUILD.gn
+@@ -169,12 +169,6 @@ if (is_mac) {
+ "$target_gen_dir/$target_name/{{source_name_part}}.$_output_extension",
+ root_build_dir),
+ ]
+- if (!use_system_xcode) {
+- args += [
+- "--developer_dir",
+- hermetic_xcode_path,
+- ]
+- }
+ args += ibtool_flags
+ }
+ }
diff --git a/src/.gitignore b/src/.gitignore
new file mode 100644
index 0000000..c2f0cec
--- /dev/null
+++ b/src/.gitignore
@@ -0,0 +1,56 @@
+*.gypcmd
+*.mk
+*.ncb
+*.opensdf
+*.props
+*.pyc
+*.rules
+*.sdf
+*.sln
+*.sublime-project
+*.sublime-workspace
+*.suo
+*.targets
+*.user
+*.vcproj
+*.vcxproj
+*.vcxproj.filters
+*.vpj
+*.vpw
+*.vpwhistu
+*.vtg
+*.xcodeproj
+*.xcworkspace
+*_proto.xml
+*_proto_cpp.xml
+*~
+!Android.mk
+.*.sw?
+.DS_Store
+.classpath
+.cproject
+.gdb_history
+.gdbinit
+.landmines
+.metadata
+.project
+.pydevproject
+.vscode
+# Settings directory for eclipse
+/.settings
+.checkstyle
+cscope.*
+Session.vim
+tags
+Thumbs.db
+# IDE's
+.vs/
+.kdev4/
+*.kdev4
+# CEF generated directories
+/binary_distrib
+/docs
+# CEF generated files
+/include/cef_config.h
+/include/cef_version.h
+.ccls-cache/
diff --git a/src/.style.cfg b/src/.style.cfg
new file mode 100644
index 0000000..f39eb03
--- /dev/null
+++ b/src/.style.cfg
@@ -0,0 +1,9 @@
+# Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
+# reserved. Use of this source code is governed by a BSD-style license that
+# can be found in the LICENSE file
+
+# Configuration settings for tools/fix_style.py
+{
+ # Directories containing these path components will be ignored.
+ 'ignore_directories': ['yapf'],
+}
diff --git a/src/.style.yapf b/src/.style.yapf
new file mode 100644
index 0000000..de0c6a7
--- /dev/null
+++ b/src/.style.yapf
@@ -0,0 +1,2 @@
+[style]
+based_on_style = chromium
diff --git a/src/AUTHORS.txt b/src/AUTHORS.txt
new file mode 100644
index 0000000..a5dced5
--- /dev/null
+++ b/src/AUTHORS.txt
@@ -0,0 +1,35 @@
+# This file is an addendum to the Chromium AUTHORS file. It lists authors
+# through March 16, 2015 when Git was introduced for source code management.
+# A list of additional authors added after that date can be found by executing
+# this command on a local Git checkout:
+# git log --all --format="%aN <%aE>" | sort -u
+
+Marshall Greenblatt <magreenblatt@gmail.com>
+Jamie Kirkpatrick <jkp@spotify.com>
+Johan Lindström <johanl@spotify.com>
+Igor Pavlov <igor.arabesc.pavlov@gmail.com>
+Yanko Yankov <yyankov@gmail.com>
+Emerick Rogul <emerick@gmail.com>
+Valve Corporation <mac@valvesoftware.com>
+Anthony Taranto <anthony.taranto@gmail.com>
+Joe Andrieu <joe@joeandrieu.com>
+Keith Poole <platima@gmail.com>
+Aviv Rind <avivrind@gmail.com>
+Michael Kaminski <mikeyk730@gmail.com>
+ADInstruments Ltd. <dev.team@adinstruments.com>
+Gus Verdun <gusverdun@gmail.com>
+Joinerysoft Ltd. <cpinfold@joinerysoft.com>
+Johan Björk <phb@spotify.com>
+Dmitry Azaraev <dmitry.azaraev@gmail.com>
+David Xue <ddxue27@gmail.com>
+Russell (Rusty) Richards <fe3o4y@gmail.com>
+Brian Power <powerbf.it@gmail.com>
+Corey Lucier <clucier@adobe.com>
+Mihai Tica <mitica@adobe.com>
+Czarek Tomczak <czarek.tomczak@gmail.com>
+Felix Bruns <felixbruns@spotify.com>
+YuTeh Shen <shenyute@gmail.com>
+Andrei Kurushin <ajax16384@gmail.com>
+Gonzo Berman <gberman@factset.com>
+Jakub Trzebiatowski <kuba.trzebiatowski@gmail.com>
+Nishant Kaushik <nishantk@adobe.com>
diff --git a/src/BUILD.gn b/src/BUILD.gn
new file mode 100644
index 0000000..2722b23
--- /dev/null
+++ b/src/BUILD.gn
@@ -0,0 +1,2382 @@
+# Copyright 2016 The Chromium Embedded Framework Authors. Portions copyright
+# 2014 the Chromium Authors. All rights reserved. Use of this source code is
+# governed by a BSD-style license that can be found in the LICENSE file.
+#
+# This file provides the GN configuration for the CEF project. This is not a
+# stand-alone configuration -- it must be built from inside the Chromium source
+# tree. See https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
+# for complete CEF build instructions. See below for links to additional GN
+# documentation.
+#
+# GN Setup:
+#
+# Optionally configure GN by setting the `GN_DEFINES` and/or `GN_ARGUMENTS`
+# environment variables.
+#
+# Example A: Create an official build on Windows:
+#
+# > set GN_DEFINES=is_official_build=true
+#
+# Example B: Generate VS2017 project files in addition to the default Ninja
+# build files on Windows:
+#
+# > set GN_ARGUMENTS=--ide=vs2017 --sln=cef --filters=//cef/*
+#
+# After completing the "GN Automated Build" or "GN Manual Build" section
+# open "out\<build_dir>\cef.sln" for editing and debugging. Building must
+# still be performed using the Ninja command-line.
+#
+# GN Automated Build:
+#
+# Run the `automate-git.py` script as described on the BranchesAndBuilding
+# Wiki page. GN, unlike GYP, supports parallel build configurations. The
+# following command-line flags have special meaning with GN builds:
+#
+# --x64-build Perform an x64 build if specified (requires out/*_GN_x64
+# directories), otherwise perform an x86 build (requires
+# out/*_GN_x86 directories).
+#
+# Directories are created subject to your platform and `GN_DEFINES` settings.
+# See Step 1B in the "GN Manual Build" section below for details.
+#
+# GN Manual Build:
+#
+# 1. Run the `cef_create_projects.[bin|sh]` script. Upon successful completion
+# proceed to Step 2.
+#
+# The `cef_create_projects.[bin|sh]` script will automatically do all of the
+# following:
+#
+# A. Apply patch files to the Chromium source tree. This includes
+# `patch/patches/gn_config.patch` which is required for GN integration.
+#
+# B. Create multiple build output directories appropriate to your platform
+# and `GN_DEFINES` settings. For example:
+#
+# x86 debug build -> out/Debug_GN_x86
+# x86 release build -> out/Release_GN_x86
+# x64 debug build -> out/Debug_GN_x64
+# x64 release build -> out/Release_GN_x64
+#
+# Build output directories will be created subject to the following rules
+# (defined in `tools/gn_args.py` GetAllPlatformConfigs):
+#
+# - Debug and Release directories will be created on all platforms by
+# default. Debug directories will not be created when `is_asan=true`.
+# - x64 directories will always be created on all platforms.
+# - x86 directories will always be created on Windows.
+# - x86 directories will be created on Linux when `use_sysroot=true`.
+#
+# C. Write the `args.gn` file for each build output directory using the
+# `tools/gn_args.py` script to determine the GN arguments. Some arguments
+# are required and some are optional. See script output for details in
+# case of conflicts or recommendations.
+#
+# D. Run `gn gen` for each build output directory to generate project files.
+# Ninja files will be generated by default. Additional command-line
+# arguments (including other project formats) can be specified via the
+# `GN_ARGUMENTS` environment variable. Run `gn gen --help` for a list of
+# supported arguments.
+#
+# 2. Run Ninja from the command-line to build. If the build configuration has
+# changed it will automatically re-run `gn gen` with the same arguments.
+#
+# > ninja -C out/<build_dir> cefclient cefsimple ceftests
+#
+# GN Manual Packaging:
+#
+# Run the `make_distrib.[bat|sh]` script as described on the
+# BranchesAndBuilding Wiki page.
+#
+# Additional GN documentation:
+# http://www.chromium.org/developers/gn-build-configuration
+# https://chromium.googlesource.com/chromium/src/+/master/tools/gn/docs/language.md
+#
+
+import("//base/allocator/allocator.gni")
+import("//build/config/features.gni")
+import("//build/config/locales.gni")
+import("//build/config/sanitizers/sanitizers.gni")
+import("//build/config/ui.gni")
+import("//cef/cef_repack_locales.gni")
+import("//chrome/common/features.gni")
+import("//content/public/app/mac_helpers.gni")
+import("//extensions/buildflags/buildflags.gni")
+import("//media/media_options.gni")
+import("//mojo/public/tools/bindings/mojom.gni")
+import("//ppapi/buildflags/buildflags.gni")
+import("//printing/buildflags/buildflags.gni")
+import("//testing/test.gni")
+import("//third_party/icu/config.gni")
+import("//third_party/widevine/cdm/widevine.gni")
+import("//tools/grit/repack.gni")
+import("//tools/grit/grit_rule.gni")
+import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
+import("//ui/gl/features.gni")
+import("//v8/gni/v8.gni")
+if (is_clang) {
+ import("//build/config/clang/clang.gni")
+}
+if (is_linux) {
+ import("//build/config/linux/pkg_config.gni")
+ import("//third_party/fontconfig/fontconfig.gni")
+}
+if (is_mac) {
+ import("//build/config/mac/rules.gni")
+ import("//build/mac/tweak_info_plist.gni")
+ import("//build/util/version.gni")
+ import("//media/cdm/library_cdm/cdm_paths.gni")
+ import("//build/config/mac/base_rules.gni")
+
+ # Template to compile .xib and .storyboard files.
+ #
+ # Arguments
+ #
+ # sources:
+ # list of string, sources to compile
+ #
+ # ibtool_flags:
+ # (optional) list of string, additional flags to pass to the ibtool
+ template("compile_ib_files") {
+ action_foreach(target_name) {
+ forward_variables_from(invoker,
+ [
+ "testonly",
+ "visibility",
+ ])
+ assert(defined(invoker.sources),
+ "sources must be specified for $target_name")
+ assert(defined(invoker.output_extension),
+ "output_extension must be specified for $target_name")
+
+ ibtool_flags = []
+ if (defined(invoker.ibtool_flags)) {
+ ibtool_flags = invoker.ibtool_flags
+ }
+
+ _output_extension = invoker.output_extension
+
+ script = "//cef/tools/compile_ib_files.py"
+ sources = invoker.sources
+ outputs = [
+ "$target_gen_dir/$target_name/{{source_name_part}}.$_output_extension",
+ ]
+ args = [
+ "--input",
+ "{{source}}",
+ "--output",
+ rebase_path(
+ "$target_gen_dir/$target_name/{{source_name_part}}.$_output_extension",
+ root_build_dir),
+ ]
+ if (!use_system_xcode) {
+ args += [
+ "--developer_dir",
+ hermetic_xcode_path,
+ ]
+ }
+ args += ibtool_flags
+ }
+ }
+
+ # Template to compile and package Mac XIB files as bundle data.
+ #
+ # Arguments
+ #
+ # sources:
+ # list of string, sources to comiple
+ #
+ # output_path:
+ # (optional) string, the path to use for the outputs list in the
+ # bundle_data step. If unspecified, defaults to bundle_resources_dir.
+ template("mac_xib_bundle_data") {
+ _target_name = target_name
+ _compile_target_name = _target_name + "_compile_ibtool"
+
+ compile_ib_files(_compile_target_name) {
+ forward_variables_from(invoker, [ "testonly" ])
+ visibility = [ ":$_target_name" ]
+ sources = invoker.sources
+ output_extension = "nib"
+ ibtool_flags = [
+ "--minimum-deployment-target",
+ mac_deployment_target,
+
+ # TODO(rsesek): Enable this once all the bots are on Xcode 7+.
+ # "--target-device",
+ # "mac",
+ ]
+ }
+
+ bundle_data(_target_name) {
+ forward_variables_from(invoker,
+ [
+ "testonly",
+ "visibility",
+ ])
+
+ public_deps = [
+ ":$_compile_target_name",
+ ]
+ sources = get_target_outputs(":$_compile_target_name")
+
+ _output_path = "{{bundle_resources_dir}}"
+ if (defined(invoker.output_path)) {
+ _output_path = invoker.output_path
+ }
+
+ outputs = [
+ "$_output_path/{{source_file_part}}",
+ ]
+ }
+ }
+}
+if (is_win) {
+ import("//build/config/win/console_app.gni")
+ import("//build/config/win/manifest.gni")
+}
+
+if (is_linux) {
+ declare_args() {
+ # The cefclient target depends on GTK packages that are not available in the
+ # default sysroot environment. So we should only use them when we are not
+ # using the sysroot. Alternatively, the developer might not want to use the
+ # GTK dependencies at all, in which case they can set `cef_use_gtk=false`.
+ cef_use_gtk = !use_sysroot
+ }
+}
+
+#
+# Verify required global arguments configured via `gn args`.
+# Set by GetRequiredArgs() in //cef/tools/gn_args.py.
+#
+
+# Set ENABLE_PRINTING=1 ENABLE_BASIC_PRINTING=1.
+assert(enable_basic_printing)
+assert(enable_print_preview)
+
+# Enable support for Widevine CDM.
+assert(enable_widevine)
+
+if (is_clang) {
+ # Don't use the chrome style plugin.
+ assert(!clang_use_chrome_plugins)
+}
+
+if (is_mac) {
+ # Always generate dSYM files. The make_distrib script will fail if
+ # enable_dsyms=true is not explicitly set when is_official_build=false.
+ assert(enable_dsyms)
+}
+
+
+#
+# Local variables.
+#
+
+if (is_mac) {
+ # The tweak_info_plist.py script requires a version number with 4 parts. CEF
+ # uses a version number with 3 parts so just set the last part to 0.
+ cef_plist_version = exec_script(
+ "//cef/tools/cef_version.py", [ "plist" ], "trim string", [])
+
+ # Need to be creative to match dylib version formatting requirements.
+ cef_dylib_version = exec_script(
+ "//cef/tools/cef_version.py", [ "dylib" ], "trim string", [])
+}
+
+# Read file lists from gypi files. The gypi_to_gn.py script does not support
+# variable references so all required variables must be explicitly specified in
+# the below configurations.
+gypi_paths = exec_script("//cef/tools/gypi_to_gn.py",
+ [ rebase_path("cef_paths.gypi") ],
+ "scope",
+ [ "cef_paths.gypi" ])
+gypi_paths2 = exec_script("//cef/tools/gypi_to_gn.py",
+ [ rebase_path("cef_paths2.gypi") ],
+ "scope",
+ [ "cef_paths2.gypi" ])
+
+includes_common = gypi_paths2.includes_common + gypi_paths2.includes_common_capi
+includes_mac = gypi_paths2.includes_mac + gypi_paths2.includes_mac_capi
+includes_linux = gypi_paths2.includes_linux + gypi_paths2.includes_linux_capi
+includes_win = gypi_paths2.includes_win + gypi_paths2.includes_win_capi
+
+#
+# Targets that will be built when depending on "//cef".
+#
+
+group("cef") {
+ testonly = true
+ deps = [
+ ":cefsimple",
+ ":ceftests",
+ ":libcef_static_unittests",
+ ]
+
+ if (!is_linux || use_x11) {
+ deps += [ ":cefclient" ]
+ }
+}
+
+
+#
+# libcef static target.
+#
+
+if (is_win) {
+ # Target for building code that accesses chrome_elf internals. Included from
+ # the //chrome_elf:crash target. Defined as a static_library instead of a
+ # source_set because (a) the source files don't export any symbols and (b)
+ # *_switches.cc duplication otherwise causes linker errors.
+ static_library("chrome_elf_set") {
+ sources = [
+ "libcef/common/crash_reporter_client.cc",
+ "libcef/common/crash_reporter_client.h",
+
+ # Required for crash_keys::GetChromeCrashKeys.
+ # Otherwise we need to copy this array into CEF, which would be difficult
+ # to maintain.
+ "//chrome/common/crash_keys.cc",
+ "//chrome/common/chrome_switches.cc",
+ "//components/flags_ui/flags_ui_switches.cc",
+ "//content/public/common/content_switches.cc",
+ ]
+
+ configs += [
+ "libcef/features:config",
+ "//build/config:precompiled_headers",
+ ]
+
+ if (is_component_build) {
+ # Avoid linker errors with content_switches.cc in component build by not
+ # defining CONTENT_EXPORT.
+ defines = ["COMPILE_CONTENT_STATICALLY"]
+ }
+
+ deps = [
+ "//components/crash/core/common", # crash_keys
+
+ # Required by chrome_switches.cc
+ "//chrome/common:buildflags",
+ "//ppapi/buildflags:buildflags",
+ "//printing/buildflags:buildflags",
+ "//ui/base:buildflags",
+
+ # Required by content_switches.cc
+ "//media:media_buildflags",
+ ]
+ }
+}
+
+# libcef_static source files that have unit tests.
+source_set("libcef_static_unittested") {
+ sources = [
+ "libcef/browser/devtools/devtools_util.cc",
+ "libcef/browser/devtools/devtools_util.h",
+ ]
+
+ deps = [
+ "//base",
+ ]
+
+ configs += [
+ "libcef/features:config",
+ "//build/config:precompiled_headers",
+ ]
+}
+
+# Executable target for libcef_static unit tests.
+test("libcef_static_unittests") {
+ sources = [
+ "libcef/browser/devtools/devtools_util_unittest.cc",
+ ]
+
+ deps = [
+ ":libcef_static_unittested",
+ "//base/test:run_all_unittests",
+ "//testing/gtest",
+ ]
+
+ configs += [
+ "libcef/features:config",
+ "//build/config:precompiled_headers",
+ ]
+}
+
+static_library("libcef_static") {
+ sources = includes_common +
+ gypi_paths.autogen_cpp_includes + [
+ "libcef/browser/audio_capturer.cc",
+ "libcef/browser/audio_capturer.h",
+ "libcef/browser/browser_context.cc",
+ "libcef/browser/browser_context.h",
+ "libcef/browser/browser_context_keyed_service_factories.cc",
+ "libcef/browser/browser_context_keyed_service_factories.h",
+ "libcef/browser/browser_host_impl.cc",
+ "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_platform_delegate.cc",
+ "libcef/browser/browser_platform_delegate.h",
+ "libcef/browser/browser_platform_delegate_create.cc",
+ "libcef/browser/browser_util.cc",
+ "libcef/browser/browser_util.h",
+ "libcef/browser/chrome_browser_process_stub.cc",
+ "libcef/browser/chrome_browser_process_stub.h",
+ "libcef/browser/chrome_crash_reporter_client_stub.cc",
+ "libcef/browser/chrome_profile_manager_stub.cc",
+ "libcef/browser/chrome_profile_manager_stub.h",
+ "libcef/browser/chrome_profile_stub.cc",
+ "libcef/browser/chrome_profile_stub.h",
+ "libcef/browser/content_browser_client.cc",
+ "libcef/browser/content_browser_client.h",
+ "libcef/browser/context.cc",
+ "libcef/browser/context.h",
+ "libcef/browser/context_menu_params_impl.cc",
+ "libcef/browser/context_menu_params_impl.h",
+ "libcef/browser/devtools/devtools_controller.cc",
+ "libcef/browser/devtools/devtools_controller.h",
+ "libcef/browser/devtools/devtools_file_manager.cc",
+ "libcef/browser/devtools/devtools_file_manager.h",
+ "libcef/browser/devtools/devtools_frontend.cc",
+ "libcef/browser/devtools/devtools_frontend.h",
+ "libcef/browser/devtools/devtools_manager.cc",
+ "libcef/browser/devtools/devtools_manager.h",
+ "libcef/browser/devtools/devtools_manager_delegate.cc",
+ "libcef/browser/devtools/devtools_manager_delegate.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/extension_impl.cc",
+ "libcef/browser/extension_impl.h",
+ "libcef/browser/extensions/api/storage/sync_value_store_cache.cc",
+ "libcef/browser/extensions/api/storage/sync_value_store_cache.h",
+ "libcef/browser/extensions/api/tabs/tabs_api.cc",
+ "libcef/browser/extensions/api/tabs/tabs_api.h",
+ "libcef/browser/extensions/browser_extensions_util.cc",
+ "libcef/browser/extensions/browser_extensions_util.h",
+ "libcef/browser/extensions/browser_platform_delegate_background.cc",
+ "libcef/browser/extensions/browser_platform_delegate_background.h",
+ "libcef/browser/extensions/chrome_api_registration.cc",
+ "libcef/browser/extensions/chrome_api_registration.h",
+ "libcef/browser/extensions/component_extension_resource_manager.cc",
+ "libcef/browser/extensions/component_extension_resource_manager.h",
+ "libcef/browser/extensions/extensions_api_client.cc",
+ "libcef/browser/extensions/extensions_api_client.h",
+ "libcef/browser/extensions/extensions_browser_api_provider.cc",
+ "libcef/browser/extensions/extensions_browser_api_provider.h",
+ "libcef/browser/extensions/extensions_browser_client.cc",
+ "libcef/browser/extensions/extensions_browser_client.h",
+ "libcef/browser/extensions/extension_background_host.cc",
+ "libcef/browser/extensions/extension_background_host.h",
+ "libcef/browser/extensions/extension_function_details.cc",
+ "libcef/browser/extensions/extension_function_details.h",
+ "libcef/browser/extensions/extension_host_delegate.cc",
+ "libcef/browser/extensions/extension_host_delegate.h",
+ "libcef/browser/extensions/extension_system.cc",
+ "libcef/browser/extensions/extension_system.h",
+ "libcef/browser/extensions/extension_system_factory.cc",
+ "libcef/browser/extensions/extension_system_factory.h",
+ "libcef/browser/extensions/extension_view_host.cc",
+ "libcef/browser/extensions/extension_view_host.h",
+ "libcef/browser/extensions/extension_web_contents_observer.cc",
+ "libcef/browser/extensions/extension_web_contents_observer.h",
+ "libcef/browser/extensions/mime_handler_view_guest_delegate.cc",
+ "libcef/browser/extensions/mime_handler_view_guest_delegate.h",
+ "libcef/browser/extensions/pdf_extension_util.cc",
+ "libcef/browser/extensions/pdf_extension_util.h",
+ "libcef/browser/extensions/pdf_web_contents_helper_client.cc",
+ "libcef/browser/extensions/pdf_web_contents_helper_client.h",
+ "libcef/browser/extensions/value_store/cef_value_store.cc",
+ "libcef/browser/extensions/value_store/cef_value_store.h",
+ "libcef/browser/extensions/value_store/cef_value_store_factory.cc",
+ "libcef/browser/extensions/value_store/cef_value_store_factory.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/image_impl.cc",
+ "libcef/browser/image_impl.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/media_router/media_route_impl.cc",
+ "libcef/browser/media_router/media_route_impl.h",
+ "libcef/browser/media_router/media_router_impl.cc",
+ "libcef/browser/media_router/media_router_impl.h",
+ "libcef/browser/media_router/media_router_manager.cc",
+ "libcef/browser/media_router/media_router_manager.h",
+ "libcef/browser/media_router/media_sink_impl.cc",
+ "libcef/browser/media_router/media_sink_impl.h",
+ "libcef/browser/media_router/media_source_impl.cc",
+ "libcef/browser/media_router/media_source_impl.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/crlset_file_util_impl.cc",
+ "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/scheme_handler.cc",
+ "libcef/browser/net/scheme_handler.h",
+ "libcef/browser/net_service/browser_urlrequest_impl.cc",
+ "libcef/browser/net_service/browser_urlrequest_impl.h",
+ "libcef/browser/net_service/cookie_helper.cc",
+ "libcef/browser/net_service/cookie_helper.h",
+ "libcef/browser/net_service/cookie_manager_impl.cc",
+ "libcef/browser/net_service/cookie_manager_impl.h",
+ "libcef/browser/net_service/login_delegate.cc",
+ "libcef/browser/net_service/login_delegate.h",
+ "libcef/browser/net_service/proxy_url_loader_factory.cc",
+ "libcef/browser/net_service/proxy_url_loader_factory.h",
+ "libcef/browser/net_service/resource_handler_wrapper.cc",
+ "libcef/browser/net_service/resource_handler_wrapper.h",
+ "libcef/browser/net_service/resource_request_handler_wrapper.cc",
+ "libcef/browser/net_service/resource_request_handler_wrapper.h",
+ "libcef/browser/net_service/response_filter_wrapper.cc",
+ "libcef/browser/net_service/response_filter_wrapper.h",
+ "libcef/browser/net_service/stream_reader_url_loader.cc",
+ "libcef/browser/net_service/stream_reader_url_loader.h",
+ "libcef/browser/net_service/url_loader_factory_getter.cc",
+ "libcef/browser/net_service/url_loader_factory_getter.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/host_display_client_osr.cc",
+ "libcef/browser/osr/host_display_client_osr.h",
+ "libcef/browser/osr/motion_event_osr.cc",
+ "libcef/browser/osr/motion_event_osr.h",
+ "libcef/browser/osr/osr_accessibility_util.cc",
+ "libcef/browser/osr/osr_accessibility_util.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/synthetic_gesture_target_osr.cc",
+ "libcef/browser/osr/synthetic_gesture_target_osr.h",
+ "libcef/browser/osr/video_consumer_osr.cc",
+ "libcef/browser/osr/video_consumer_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/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/pref_store.cc",
+ "libcef/browser/prefs/pref_store.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/constrained_window_views_client.cc",
+ "libcef/browser/printing/constrained_window_views_client.h",
+ "libcef/browser/printing/printing_message_filter.cc",
+ "libcef/browser/printing/printing_message_filter.h",
+ "libcef/browser/printing/print_view_manager.cc",
+ "libcef/browser/printing/print_view_manager.h",
+ "libcef/browser/process_util_impl.cc",
+ "libcef/browser/resource_context.cc",
+ "libcef/browser/resource_context.h",
+ "libcef/browser/request_context_handler_map.cc",
+ "libcef/browser/request_context_handler_map.h",
+ "libcef/browser/request_context_impl.cc",
+ "libcef/browser/request_context_impl.h",
+ "libcef/browser/scheme_impl.cc",
+ "libcef/browser/server_impl.cc",
+ "libcef/browser/server_impl.h",
+ "libcef/browser/speech_recognition_manager_delegate.cc",
+ "libcef/browser/speech_recognition_manager_delegate.h",
+ "libcef/browser/ssl_host_state_delegate.cc",
+ "libcef/browser/ssl_host_state_delegate.h",
+ "libcef/browser/ssl_info_impl.cc",
+ "libcef/browser/ssl_info_impl.h",
+ "libcef/browser/ssl_status_impl.cc",
+ "libcef/browser/ssl_status_impl.h",
+ "libcef/browser/stream_impl.cc",
+ "libcef/browser/stream_impl.h",
+ "libcef/browser/trace_impl.cc",
+ "libcef/browser/trace_subscriber.cc",
+ "libcef/browser/trace_subscriber.h",
+ "libcef/browser/thread_util.h",
+ "libcef/browser/web_contents_dialog_helper.cc",
+ "libcef/browser/web_contents_dialog_helper.h",
+ "libcef/browser/web_plugin_impl.cc",
+ "libcef/browser/web_plugin_impl.h",
+ "libcef/browser/x509_certificate_impl.cc",
+ "libcef/browser/x509_certificate_impl.h",
+ "libcef/browser/x509_cert_principal_impl.cc",
+ "libcef/browser/x509_cert_principal_impl.h",
+ "libcef/browser/xml_reader_impl.cc",
+ "libcef/browser/xml_reader_impl.h",
+ "libcef/browser/zip_reader_impl.cc",
+ "libcef/browser/zip_reader_impl.h",
+ "libcef/common/base_impl.cc",
+ "libcef/common/cef_message_generator.cc",
+ "libcef/common/cef_message_generator.h",
+ "libcef/common/cef_messages.cc",
+ "libcef/common/cef_messages.h",
+ "libcef/common/cef_switches.cc",
+ "libcef/common/cef_switches.h",
+ "libcef/common/command_line_impl.cc",
+ "libcef/common/command_line_impl.h",
+ "libcef/common/content_client.cc",
+ "libcef/common/content_client.h",
+ "libcef/common/crash_reporter_client.cc",
+ "libcef/common/crash_reporter_client.h",
+ "libcef/common/crash_reporting.cc",
+ "libcef/common/crash_reporting.h",
+ "libcef/common/drag_data_impl.cc",
+ "libcef/common/drag_data_impl.h",
+ "libcef/common/extensions/chrome_generated_schemas.cc",
+ "libcef/common/extensions/chrome_generated_schemas.h",
+ "libcef/common/extensions/extensions_api_provider.cc",
+ "libcef/common/extensions/extensions_api_provider.h",
+ "libcef/common/extensions/extensions_client.cc",
+ "libcef/common/extensions/extensions_client.h",
+ "libcef/common/extensions/extensions_util.cc",
+ "libcef/common/extensions/extensions_util.h",
+ "libcef/common/file_util_impl.cc",
+ "libcef/common/frame_util.cc",
+ "libcef/common/frame_util.h",
+ "libcef/common/json_impl.cc",
+ "libcef/common/main_delegate.cc",
+ "libcef/common/main_delegate.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/net_service/net_service_util.cc",
+ "libcef/common/net_service/net_service_util.h",
+ "libcef/common/parser_impl.cc",
+ "libcef/common/process_message_impl.cc",
+ "libcef/common/process_message_impl.h",
+ "libcef/common/request_impl.cc",
+ "libcef/common/request_impl.h",
+ "libcef/common/resource_bundle_delegate.cc",
+ "libcef/common/resource_bundle_delegate.h",
+ "libcef/common/resource_bundle_impl.cc",
+ "libcef/common/resource_bundle_impl.h",
+ "libcef/common/response_impl.cc",
+ "libcef/common/response_impl.h",
+ "libcef/common/response_manager.cc",
+ "libcef/common/response_manager.h",
+ "libcef/common/scheme_registrar_impl.cc",
+ "libcef/common/scheme_registrar_impl.h",
+ "libcef/common/string_list_impl.cc",
+ "libcef/common/string_map_impl.cc",
+ "libcef/common/string_multimap_impl.cc",
+ "libcef/common/string_types_impl.cc",
+ "libcef/common/task_impl.cc",
+ "libcef/common/task_runner_impl.cc",
+ "libcef/common/task_runner_impl.h",
+ "libcef/common/test/translator_test_impl.cc",
+ "libcef/common/thread_impl.cc",
+ "libcef/common/thread_impl.h",
+ "libcef/common/time_impl.cc",
+ "libcef/common/time_util.h",
+ "libcef/common/tracker.cc",
+ "libcef/common/tracker.h",
+ "libcef/common/urlrequest_impl.cc",
+ "libcef/common/value_base.cc",
+ "libcef/common/value_base.h",
+ "libcef/common/values_impl.cc",
+ "libcef/common/values_impl.h",
+ "libcef/common/waitable_event_impl.cc",
+ "libcef/common/waitable_event_impl.h",
+ "libcef/common/widevine_loader.cc",
+ "libcef/common/widevine_loader.h",
+ "libcef/renderer/browser_impl.cc",
+ "libcef/renderer/browser_impl.h",
+ "libcef/renderer/content_renderer_client.cc",
+ "libcef/renderer/content_renderer_client.h",
+ "libcef/renderer/dom_document_impl.cc",
+ "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_render_frame_helper_delegate.cc",
+ "libcef/renderer/extensions/print_render_frame_helper_delegate.h",
+ "libcef/renderer/frame_impl.cc",
+ "libcef/renderer/frame_impl.h",
+ "libcef/renderer/render_frame_observer.cc",
+ "libcef/renderer/render_frame_observer.h",
+ "libcef/renderer/render_frame_util.cc",
+ "libcef/renderer/render_frame_util.h",
+ "libcef/renderer/render_thread_observer.cc",
+ "libcef/renderer/render_thread_observer.h",
+ "libcef/renderer/render_urlrequest_impl.cc",
+ "libcef/renderer/render_urlrequest_impl.h",
+ "libcef/renderer/thread_util.h",
+ "libcef/renderer/url_loader_throttle_provider_impl.cc",
+ "libcef/renderer/url_loader_throttle_provider_impl.h",
+ "libcef/renderer/v8_impl.cc",
+ "libcef/renderer/v8_impl.h",
+ ]
+
+ configs += [
+ "libcef/features:config",
+ "//build/config:precompiled_headers",
+
+ # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
+ "//build/config/compiler:no_size_t_to_int_warning",
+ ]
+
+ public_configs = [
+ "libcef/features:config",
+ ]
+
+ include_dirs = [
+ # Crashpad code uses paths relative to this directory.
+ "//third_party/crashpad/crashpad",
+ ]
+
+ public_deps = [
+ # Bring in feature flag defines.
+ "//cef/libcef/features",
+ ]
+
+ deps = [
+ ":cef_make_headers",
+ ":cef_service_manifests",
+
+ ":libcef_static_unittested",
+
+ # Generate API bindings for extensions.
+ # TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
+ # libcef/common/extensions/api/README.txt for details.
+ #"libcef/common/extensions/api",
+ #"libcef/common/extensions/api:api_registration",
+ "libcef/common/extensions/api:extensions_features",
+
+ # Normal build dependencies. Should be sorted alphabetically.
+ "//base",
+ "//base:base_static",
+ "//base/third_party/dynamic_annotations",
+ "//cc",
+ "//chrome/browser",
+ "//chrome/child",
+ "//chrome/common",
+ "//chrome/renderer",
+ "//chrome/services/printing:lib",
+ "//chrome/utility",
+ "//components/cdm/renderer",
+ "//components/certificate_transparency",
+ "//components/content_settings/core/browser",
+ "//components/content_settings/core/common",
+ "//components/crx_file",
+ "//components/data_use_measurement/core",
+ "//components/google/core/common",
+ "//components/keyed_service/content:content",
+ "//components/keyed_service/core:core",
+ "//components/navigation_interception",
+ "//components/network_session_configurator/browser",
+ "//components/pdf/browser",
+ "//components/pdf/renderer",
+ "//components/plugins/renderer",
+ "//components/pref_registry",
+ "//components/printing/browser",
+ "//components/printing/common",
+ "//components/printing/renderer",
+ "//components/proxy_config",
+ "//components/safe_browsing/core/db:test_database_manager",
+ "//components/services/print_compositor/public/cpp",
+ "//components/services/print_compositor/public/mojom",
+ "//components/update_client",
+ "//components/url_formatter",
+ "//components/user_prefs",
+ "//components/version_info",
+ "//components/visitedlink/browser",
+ "//components/visitedlink/common",
+ "//components/visitedlink/renderer",
+ "//components/viz/service",
+ "//components/web_cache/renderer",
+ "//content/public/app:both",
+ "//content/public/browser",
+ "//content/public/child",
+ "//content/public/common",
+ "//content/public/gpu",
+ "//content/public/renderer",
+ "//content/public/utility",
+ "//crypto",
+ "//device/base",
+ "//extensions/browser",
+ "//extensions/browser:core_api_provider",
+ "//extensions/buildflags",
+ "//extensions/common/api",
+ "//extensions/common:core_api_provider",
+ "//extensions/renderer",
+ "//gpu",
+ "//ipc",
+ "//media",
+ "//media/blink",
+ "//net",
+ "//pdf",
+ "//ppapi/buildflags",
+ "//printing/buildflags",
+ "//services/network:network_service",
+ "//services/network/public/cpp",
+ "//services/service_manager/embedder",
+ "//services/service_manager/public/cpp",
+ "//skia",
+ "//storage/browser",
+ "//third_party/blink/public:blink",
+ "//third_party/brotli:dec",
+ "//third_party/cld_3/src/src:cld_3",
+ "//third_party/hunspell",
+ "//third_party/leveldatabase",
+ "//third_party/libxml:libxml",
+ "//third_party/widevine/cdm:headers",
+ "//third_party/widevine/cdm",
+ "//third_party/icu",
+ "//third_party/zlib:minizip",
+ "//ui/base",
+ "//ui/base/ime",
+ "//ui/events:events_base",
+ "//ui/gfx",
+ "//ui/gfx/geometry",
+ "//ui/gfx/ipc",
+ "//ui/gfx/ipc/geometry",
+ "//ui/gfx/ipc/skia",
+ "//ui/gl",
+ "//url",
+ "//v8",
+ ]
+
+ if (is_win) {
+ sources += includes_win + [
+ "libcef/browser/browser_main_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",
+
+ # Part of //chrome/utility.
+ "//chrome/utility/printing_handler.cc",
+ "//chrome/utility/printing_handler.h",
+ ]
+
+ deps += [
+ "//chrome/install_static:secondary_module",
+ "//chrome/chrome_elf",
+ ]
+
+ if (is_component_build) {
+ deps += [ "//content:sandbox_helper_win" ]
+ }
+
+ libs = [
+ "comctl32.lib",
+ # For D3D11_DECODER_PROFILE_H264_VLD_NOFGT.
+ "dxguid.lib",
+ ]
+
+ data_deps = [
+ "//chrome/elevation_service",
+ ]
+ }
+
+ if (is_linux) {
+ sources += includes_linux + [
+ "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",
+ ]
+
+ if (use_x11) {
+ sources += [
+ "libcef/browser/native/window_x11.cc",
+ "libcef/browser/native/window_x11.h",
+ ]
+ }
+
+ deps += [
+ "//build/config/freetype",
+ "//third_party/fontconfig",
+ ]
+
+ if (is_linux && !use_x11) {
+ deps += [
+ "//third_party/angle:libEGL",
+ ]
+ }
+ }
+
+ if (is_mac) {
+ sources += includes_mac + [
+ "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/common/util_mac.h",
+ "libcef/common/util_mac.mm",
+ ]
+ }
+
+ if (is_win || is_mac) {
+ deps += [ "//third_party/crashpad/crashpad/handler" ]
+ }
+
+ if (use_x11) {
+ deps += [ "//ui/events/devices/x11" ]
+ }
+
+ if (is_posix && !is_mac) {
+ sources += [
+ "libcef/common/cef_crash_report_utils.cc",
+ "libcef/common/cef_crash_report_utils.h",
+ ]
+
+ deps += [
+ "//components/crash/core/app",
+ "//components/crash/content/browser",
+ ]
+ }
+
+ if (v8_use_external_startup_data && use_v8_context_snapshot) {
+ deps += [ "//tools/v8_context_snapshot" ]
+ }
+
+ if (toolkit_views) {
+ deps += [
+ "//ui/views",
+ ]
+ }
+
+ if (use_aura) {
+ sources += [
+ "libcef/browser/native/window_delegate_view.cc",
+ "libcef/browser/native/window_delegate_view.h",
+ "libcef/browser/views/basic_label_button_impl.cc",
+ "libcef/browser/views/basic_label_button_impl.h",
+ "libcef/browser/views/basic_label_button_view.cc",
+ "libcef/browser/views/basic_label_button_view.h",
+ "libcef/browser/views/basic_panel_impl.cc",
+ "libcef/browser/views/basic_panel_impl.h",
+ "libcef/browser/views/basic_panel_view.cc",
+ "libcef/browser/views/basic_panel_view.h",
+ "libcef/browser/views/box_layout_impl.cc",
+ "libcef/browser/views/box_layout_impl.h",
+ "libcef/browser/views/browser_platform_delegate_views.cc",
+ "libcef/browser/views/browser_platform_delegate_views.h",
+ "libcef/browser/views/browser_view_impl.cc",
+ "libcef/browser/views/browser_view_impl.h",
+ "libcef/browser/views/browser_view_view.cc",
+ "libcef/browser/views/browser_view_view.h",
+ "libcef/browser/views/button_impl.h",
+ "libcef/browser/views/button_view.h",
+ "libcef/browser/views/display_impl.cc",
+ "libcef/browser/views/display_impl.h",
+ "libcef/browser/views/fill_layout_impl.cc",
+ "libcef/browser/views/fill_layout_impl.h",
+ "libcef/browser/views/label_button_impl.h",
+ "libcef/browser/views/label_button_view.h",
+ "libcef/browser/views/layout_impl.h",
+ "libcef/browser/views/layout_adapter.cc",
+ "libcef/browser/views/layout_adapter.h",
+ "libcef/browser/views/layout_util.cc",
+ "libcef/browser/views/layout_util.h",
+ "libcef/browser/views/menu_button_impl.cc",
+ "libcef/browser/views/menu_button_impl.h",
+ "libcef/browser/views/menu_button_view.cc",
+ "libcef/browser/views/menu_button_view.h",
+ "libcef/browser/views/menu_runner_views.cc",
+ "libcef/browser/views/menu_runner_views.h",
+ "libcef/browser/views/panel_impl.h",
+ "libcef/browser/views/panel_view.h",
+ "libcef/browser/views/scroll_view_impl.cc",
+ "libcef/browser/views/scroll_view_impl.h",
+ "libcef/browser/views/scroll_view_view.cc",
+ "libcef/browser/views/scroll_view_view.h",
+ "libcef/browser/views/textfield_impl.cc",
+ "libcef/browser/views/textfield_impl.h",
+ "libcef/browser/views/textfield_view.cc",
+ "libcef/browser/views/textfield_view.h",
+ "libcef/browser/views/view_adapter.cc",
+ "libcef/browser/views/view_adapter.h",
+ "libcef/browser/views/view_impl.h",
+ "libcef/browser/views/view_util.cc",
+ "libcef/browser/views/view_util.h",
+ "libcef/browser/views/view_view.h",
+ "libcef/browser/views/window_impl.cc",
+ "libcef/browser/views/window_impl.h",
+ "libcef/browser/views/window_view.cc",
+ "libcef/browser/views/window_view.h",
+
+ # Part of //ui/views:test_support which is testingonly.
+ "//ui/views/test/desktop_test_views_delegate.h",
+ "//ui/views/test/desktop_test_views_delegate_aura.cc",
+ "//ui/views/test/test_views_delegate.h",
+ "//ui/views/test/test_views_delegate_aura.cc",
+
+ # Support for UI input events.
+ # Part of //ui/base:test_support which is testingonly.
+ "//ui/base/test/ui_controls.h",
+ "//ui/base/test/ui_controls_aura.cc",
+ "//ui/aura/test/ui_controls_factory_aura.h",
+ ]
+
+ if (is_linux && !use_x11) {
+ sources += [
+ "//ui/aura/test/ui_controls_factory_ozone.cc",
+ "//ui/events/test/events_test_utils.cc"
+ ]
+ }
+
+ deps += [
+ "//ui/aura",
+ "//ui/events",
+ "//ui/strings",
+ "//ui/wm",
+ "//ui/wm/public",
+ ]
+
+ if (toolkit_views) {
+ deps += [
+ "//ui/views/controls/webview",
+ ]
+ }
+
+ if (is_win) {
+ sources += [
+ # Support for UI input events.
+ # Part of //base/test:test_config which is testingonly.
+ "//base/test/test_switches.cc",
+ "//base/test/test_switches.h",
+ "//base/test/test_timeouts.cc",
+ "//base/test/test_timeouts.h",
+ # Part of //ui/aura:test_support which is testingonly.
+ "//ui/aura/test/ui_controls_factory_aurawin.cc",
+ # Part of //ui/base:test_support which is testingonly.
+ "//ui/base/test/ui_controls_internal_win.cc",
+ "//ui/base/test/ui_controls_internal_win.h",
+ ]
+ }
+
+ if (is_linux) {
+ sources += [
+ # Support for UI input events.
+ # Part of //ui/aura:test_support which is testingonly.
+ "//ui/aura/test/aura_test_utils.cc",
+ "//ui/aura/test/aura_test_utils.h",
+ # Part of //ui/events:test_support which is testingonly.
+ "//ui/events/test/x11_event_waiter.cc",
+ "//ui/events/test/x11_event_waiter.h",
+ ]
+
+ if (use_x11) {
+ sources += [
+ # Support for UI input events.
+ # Part of //ui/aura:test_support which is testingonly.
+ "//ui/aura/test/ui_controls_factory_aurax11.cc",
+ "//ui/aura/test/x11_event_sender.cc",
+ "//ui/aura/test/x11_event_sender.h",
+ # Part of //ui/views:test_support which is testingonly.
+ "//ui/views/test/ui_controls_factory_desktop_aurax11.cc",
+ "//ui/views/test/ui_controls_factory_desktop_aurax11.h",
+ ]
+ }
+ }
+
+ if (is_win || is_linux) {
+ sources += [
+ "libcef/browser/native/browser_platform_delegate_native_aura.cc",
+ "libcef/browser/native/browser_platform_delegate_native_aura.h",
+ ]
+ }
+ } else {
+ sources += [
+ # Provides stub implementations for the views static methods.
+ "libcef_dll/views_stub.cc",
+ ]
+ }
+}
+
+
+#
+# libcef_dll_wrapper static targets.
+#
+
+# Configuration that will be applied to all targets that depend on
+# libcef_dll_wrapper.
+config("libcef_dll_wrapper_config") {
+ include_dirs = [
+ # CEF sources use include paths relative to the CEF root directory.
+ ".",
+ # CEF generates some header files that also need to be discoverable.
+ # They will be copied to the include/ directory in the binary distribution.
+ "$root_out_dir/includes",
+ ]
+}
+
+# libcef_dll_wrapper target.
+static_library("libcef_dll_wrapper") {
+ sources = includes_common +
+ gypi_paths.autogen_cpp_includes +
+ gypi_paths2.includes_capi +
+ gypi_paths.autogen_capi_includes +
+ gypi_paths2.includes_wrapper +
+ gypi_paths2.libcef_dll_wrapper_sources_base +
+ gypi_paths2.libcef_dll_wrapper_sources_common +
+ gypi_paths.autogen_client_side
+
+ if (is_mac) {
+ sources += gypi_paths2.libcef_dll_wrapper_sources_mac
+ }
+
+ defines = [ "WRAPPING_CEF_SHARED" ]
+
+ configs += [ ":libcef_dll_wrapper_config" ]
+ public_configs = [ ":libcef_dll_wrapper_config" ]
+}
+
+
+#
+# cef_sandbox target.
+#
+
+if (is_win) {
+ static_library("cef_sandbox") {
+ sources = [ "libcef_dll/sandbox/sandbox_win.cc" ]
+ # CEF sources use include paths relative to the CEF root directory.
+ include_dirs = [ "." ]
+ deps = [ "//sandbox" ]
+ }
+}
+
+if (is_mac) {
+ static_library("cef_sandbox") {
+ sources = [ "libcef_dll/sandbox/sandbox_mac.mm" ]
+ # CEF sources use include paths relative to the CEF root directory.
+ include_dirs = [ "." ]
+ deps = [ "//sandbox/mac:seatbelt" ]
+ }
+}
+
+#
+# Service manifests.
+#
+
+source_set("cef_content_browser_overlay_manifest") {
+ sources = [
+ "libcef/common/service_manifests/cef_content_browser_overlay_manifest.cc",
+ "libcef/common/service_manifests/cef_content_browser_overlay_manifest.h",
+ ]
+
+ configs += [
+ "libcef/features:config"
+ ]
+
+ deps = [
+ "//base",
+ "//extensions/buildflags",
+ "//extensions/common:mojom",
+ "//extensions/common/api:mojom",
+ "//services/service_manager/public/cpp",
+ "//third_party/blink/public/common",
+ ]
+}
+
+source_set("cef_content_renderer_overlay_manifest") {
+ sources = [
+ "libcef/common/service_manifests/cef_content_renderer_overlay_manifest.h",
+ ]
+
+ configs += [
+ "libcef/features:config"
+ ]
+
+ deps = [
+ "//base",
+ "//components/subresource_filter/content/mojom",
+ "//extensions/buildflags",
+ "//extensions/common:mojom",
+ "//services/service_manager/public/cpp",
+ "//third_party/blink/public/common",
+ ]
+}
+
+source_set("cef_service_manifests") {
+ public_deps = [
+ ":cef_content_browser_overlay_manifest",
+ ":cef_content_renderer_overlay_manifest",
+ ]
+}
+
+#
+# Resource grit/pack targets.
+#
+
+# Helper for generating scaled resource packs.
+template("cef_pak_scaled") {
+ percent = invoker.percent
+
+ repack("pak_${target_name}") {
+ # Each input pak file should also have a deps line for completeness.
+ # Add associated .h files in the make_pack_header("resources") target.
+ sources = [
+ "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
+ "$root_gen_dir/components/components_resources_${percent}_percent.pak",
+ "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
+ "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak",
+ "$root_gen_dir/third_party/blink/public/resources/blink_scaled_resources_${percent}_percent.pak",
+ "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
+ ]
+
+ # Use public_deps so that generated grit headers are discoverable from
+ # the libcef_static target. Grit deps that generate .cc files must be
+ # listed both here and in the libcef_static target.
+ public_deps = [
+ "//chrome/renderer:resources",
+ "//components/resources:components_scaled_resources",
+ "//content/app/resources",
+ "//extensions:extensions_browser_resources",
+ "//third_party/blink/public:scaled_resources",
+ "//ui/resources:ui_resources_grd",
+ ]
+
+ deps = [
+ # This repack target generates the blink_scaled_resources_*_percent.pak
+ # file but doesn't expose the public_deps required by make_pack_header.
+ "//third_party/blink/public:scaled_resources_${percent}_percent",
+ ]
+
+ if (toolkit_views) {
+ sources += [
+ "$root_gen_dir/ui/views/resources/views_resources_${percent}_percent.pak"
+ ]
+
+ public_deps += [
+ "//ui/views/resources:resources_grd"
+ ]
+ }
+
+ output = "$root_out_dir/cef_${percent}_percent.pak"
+ }
+}
+
+# Generate cef_100_percent.pak.
+cef_pak_scaled("100_percent") {
+ percent = "100"
+}
+
+# Generate cef_200_percent.pak.
+cef_pak_scaled("200_percent") {
+ percent = "200"
+}
+
+# Generate devtools_resources.pak.
+repack("pak_devtools") {
+ # Each input pak file should also have a deps line for completeness.
+ # Add associated .h files in the make_pack_header("resources") target.
+ sources = [
+ "$root_gen_dir/content/browser/devtools/devtools_resources.pak",
+ ]
+
+ # Use public_deps so that generated grit headers are discoverable from
+ # the libcef_static target. Grit deps that generate .cc files must be
+ # listed both here and in the libcef_static target.
+ public_deps = [
+ "//content/browser/devtools:resources",
+ ]
+
+ output = "$root_out_dir/devtools_resources.pak"
+}
+
+# Generate cef_extensions.pak.
+repack("pak_extensions") {
+ # Each input pak file should also have a deps line for completeness.
+ # Add associated .h files in the make_pack_header("resources") target.
+ sources = [
+ "$root_gen_dir/chrome/component_extension_resources.pak",
+ "$root_gen_dir/content/browser/resources/media/media_internals_resources.pak",
+ "$root_gen_dir/content/browser/webrtc/resources/webrtc_internals_resources.pak",
+ "$root_gen_dir/extensions/extensions_renderer_resources.pak",
+ "$root_gen_dir/extensions/extensions_resources.pak",
+ "$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
+ "$root_gen_dir/ui/resources/webui_resources.pak",
+ ]
+
+ # Use public_deps so that generated grit headers are discoverable from
+ # the libcef_static target. Grit deps that generate .cc files must be
+ # listed both here and in the libcef_static target.
+ public_deps = [
+ "//chrome/browser/resources:component_extension_resources",
+ "//content/browser/resources/media:media_internals_resources",
+ "//content/browser/webrtc/resources",
+ "//extensions:extensions_renderer_resources",
+ "//extensions:extensions_resources_grd",
+ "//mojo/public/js:resources",
+ "//ui/resources:webui_resources_grd",
+ ]
+
+ output = "$root_out_dir/cef_extensions.pak"
+}
+
+grit("cef_strings") {
+ visibility = [ ":*" ]
+
+ source = "libcef/resources/cef_strings.grd"
+ outputs = [
+ "grit/cef_strings.h",
+ ]
+ all_locales = locales + [ "fake-bidi" ]
+ foreach(locale, all_locales) {
+ outputs += [ "cef_strings_${locale}.pak" ]
+ }
+}
+
+# Generate locales/<locale>.pak.
+# See cef_repack_locales.gni for the list of input pak files and deps.
+cef_repack_locales("repack_locales_pack") {
+ visibility = [ ":*" ]
+
+ input_locales = locales
+
+ if (is_mac) {
+ output_locales = locales_as_mac_outputs
+ } else {
+ output_locales = locales
+ }
+}
+
+grit("cef_resources") {
+ visibility = [ ":*" ]
+ source = "libcef/resources/cef_resources.grd"
+ outputs = [
+ "grit/cef_resources.h",
+ "cef_resources.pak",
+ ]
+ grit_flags = [
+ "-E",
+ "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
+ ]
+}
+
+# Generate cef.pak.
+repack("pak") {
+ # Each input pak file should also have a deps line for completeness.
+ # Add associated .h files in the make_pack_header("resources") target.
+ sources = [
+ "$root_gen_dir/chrome/browser_resources.pak",
+ "$root_gen_dir/chrome/dev_ui_browser_resources.pak",
+ "$root_gen_dir/chrome/net_internals_resources.pak",
+ "$root_gen_dir/chrome/print_preview_resources.pak",
+ "$root_gen_dir/chrome/common_resources.pak",
+ "$root_gen_dir/components/components_resources.pak",
+ "$root_gen_dir/components/dev_ui_components_resources.pak",
+ "$root_gen_dir/cef/cef_resources.pak",
+ "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
+ "$root_gen_dir/content/content_resources.pak",
+ "$root_gen_dir/content/dev_ui_content_resources.pak",
+ "$root_gen_dir/net/net_resources.pak",
+ "$root_gen_dir/third_party/blink/public/resources/blink_resources.pak",
+ ]
+
+ # Use public_deps so that generated grit headers are discoverable from
+ # the libcef_static target. Grit deps that generate .cc files must be
+ # listed both here and in the libcef_static target.
+ public_deps = [
+ "//chrome/browser:dev_ui_browser_resources",
+ "//chrome/browser:resources",
+ "//chrome/browser/resources/net_internals:net_internals_resources",
+ "//chrome/browser/resources:print_preview_resources",
+ "//chrome/common:resources",
+ "//components/resources:components_resources",
+ "//components/resources:dev_ui_components_resources",
+ ":cef_resources",
+ "//content/browser/tracing:resources",
+ "//content:content_resources",
+ "//content:dev_ui_content_resources",
+ "//net:net_resources",
+ "//third_party/blink/public:resources",
+ ]
+
+ output = "$root_out_dir/cef.pak"
+}
+
+# Helper for generating pack header files.
+template("make_pack_header") {
+ assert(defined(invoker.header))
+ assert(defined(invoker.inputs))
+
+ action("make_pack_header_${target_name}") {
+ script = "tools/make_pack_header.py"
+
+ inputs = invoker.inputs
+ outputs = [ invoker.header ]
+
+ args = rebase_path(outputs, root_build_dir) +
+ rebase_path(inputs, root_build_dir)
+
+ deps = [
+ # List all targets that generate pack files here. The grit targets that
+ # generate |inputs| will be picked up via public_deps.
+ ":pak",
+ ":pak_100_percent",
+ ":pak_200_percent",
+ ":pak_devtools",
+ ":pak_extensions",
+ ":repack_locales_pack",
+ ]
+ }
+}
+
+# Generate cef_pack_resources.h.
+make_pack_header("resources") {
+ header = "$root_out_dir/includes/include/cef_pack_resources.h"
+ inputs = [
+ "$root_gen_dir/cef/grit/cef_resources.h",
+ "$root_gen_dir/chrome/grit/browser_resources.h",
+ "$root_gen_dir/chrome/grit/common_resources.h",
+ "$root_gen_dir/chrome/grit/component_extension_resources.h",
+ "$root_gen_dir/chrome/grit/dev_ui_browser_resources.h",
+ "$root_gen_dir/chrome/grit/net_internals_resources.h",
+ "$root_gen_dir/chrome/grit/renderer_resources.h",
+ "$root_gen_dir/components/grit/components_resources.h",
+ "$root_gen_dir/components/grit/dev_ui_components_resources.h",
+ "$root_gen_dir/content/browser/devtools/grit/devtools_resources.h",
+ "$root_gen_dir/content/browser/tracing/grit/tracing_resources.h",
+ "$root_gen_dir/content/grit/content_resources.h",
+ "$root_gen_dir/content/grit/dev_ui_content_resources.h",
+ "$root_gen_dir/extensions/grit/extensions_browser_resources.h",
+ "$root_gen_dir/extensions/grit/extensions_renderer_resources.h",
+ "$root_gen_dir/extensions/grit/extensions_resources.h",
+ "$root_gen_dir/net/grit/net_resources.h",
+ "$root_gen_dir/third_party/blink/public/resources/grit/blink_resources.h",
+ "$root_gen_dir/ui/resources/grit/ui_resources.h",
+ "$root_gen_dir/ui/resources/grit/webui_resources.h",
+ "$root_gen_dir/ui/views/resources/grit/views_resources.h",
+ ]
+}
+
+# Generate cef_pack_strings.h.
+make_pack_header("strings") {
+ header = "$root_out_dir/includes/include/cef_pack_strings.h"
+ inputs = [
+ "$root_gen_dir/cef/grit/cef_strings.h",
+ "$root_gen_dir/chrome/grit/chromium_strings.h",
+ "$root_gen_dir/chrome/grit/generated_resources.h",
+ "$root_gen_dir/chrome/grit/locale_settings.h",
+ "$root_gen_dir/chrome/grit/platform_locale_settings.h",
+ "$root_gen_dir/components/strings/grit/components_strings.h",
+ "$root_gen_dir/extensions/strings/grit/extensions_strings.h",
+ "$root_gen_dir/services/strings/grit/services_strings.h",
+ "$root_gen_dir/third_party/blink/public/strings/grit/blink_strings.h",
+ "$root_gen_dir/ui/strings/grit/ui_strings.h",
+ ]
+}
+
+# Generate cef_api_hash.h.
+action("make_api_hash_header") {
+ script = "tools/make_api_hash_header.py"
+
+ # List of all C API files that will be checked for changes by cef_api_hash.py.
+ inputs = gypi_paths2.includes_common_capi +
+ gypi_paths2.includes_linux_capi +
+ gypi_paths2.includes_mac_capi +
+ gypi_paths2.includes_win_capi +
+ gypi_paths2.includes_capi +
+ gypi_paths.autogen_capi_includes
+ include_dir = [ "include" ]
+ outputs = [ "$root_out_dir/includes/include/cef_api_hash.h" ]
+
+ args = rebase_path(outputs + include_dir, root_build_dir)
+}
+
+# Generate pack files and associated CEF header files.
+group("cef_make_headers") {
+ deps = [
+ ":make_pack_header_resources",
+ ":make_pack_header_strings",
+ ":make_api_hash_header",
+ ]
+}
+
+
+#
+# libcef dll/framework target.
+#
+
+if (is_mac) {
+ cef_framework_name = "Chromium Embedded Framework"
+
+ tweak_info_plist("cef_framework_plist") {
+ info_plist = "libcef/resources/framework-Info.plist"
+ args = [
+ "--breakpad=0",
+ "--keystone=0",
+ "--scm=1",
+ "--version",
+ cef_plist_version,
+ "--branding",
+ cef_framework_name,
+ ]
+ }
+
+ bundle_data("cef_framework_locales") {
+ sources = []
+ foreach(locale, locales_as_mac_outputs) {
+ sources += [ "$root_gen_dir/repack/locales/$locale.pak" ]
+ }
+
+ public_deps = [
+ ":repack_locales_pack",
+ ]
+
+ outputs = [
+ "{{bundle_resources_dir}}/{{source_name_part}}.lproj/locale.pak",
+ ]
+ }
+
+ bundle_data("cef_framework_resources") {
+ sources = [
+ "$root_out_dir/cef.pak",
+ "$root_out_dir/cef_100_percent.pak",
+ "$root_out_dir/cef_200_percent.pak",
+ "$root_out_dir/cef_extensions.pak",
+ "$root_out_dir/devtools_resources.pak",
+ ]
+
+ public_deps = [
+ ":pak",
+ ":pak_100_percent",
+ ":pak_200_percent",
+ ":pak_devtools",
+ ":pak_extensions",
+ ]
+
+ if (icu_use_data_file) {
+ sources += [ "$root_out_dir/icudtl.dat" ]
+ public_deps += [ "//third_party/icu:icudata", ]
+ }
+
+ if (v8_use_external_startup_data) {
+ sources += [
+ "$root_out_dir/snapshot_blob.bin",
+ ]
+ public_deps += [ "//v8" ]
+ if (use_v8_context_snapshot) {
+ sources += [ "$root_out_dir/v8_context_snapshot.bin" ]
+ public_deps += [ "//tools/v8_context_snapshot" ]
+ }
+ }
+
+ outputs = [
+ "{{bundle_resources_dir}}/{{source_file_part}}",
+ ]
+ }
+
+ if (use_egl) {
+ # Add the ANGLE .dylibs in the MODULE_DIR of the Framework app bundle.
+ bundle_data("cef_framework_angle_binaries") {
+ sources = [
+ "$root_out_dir/egl_intermediates/libEGL.dylib",
+ "$root_out_dir/egl_intermediates/libGLESv2.dylib",
+ ]
+ outputs = [
+ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
+ ]
+ public_deps = [
+ "//ui/gl:angle_library_copy",
+ ]
+ }
+
+ # Add the SwiftShader .dylibs in the MODULE_DIR of the Framework app bundle.
+ bundle_data("cef_framework_swiftshader_binaries") {
+ sources = [
+ "$root_out_dir/egl_intermediates/libswiftshader_libEGL.dylib",
+ "$root_out_dir/egl_intermediates/libswiftshader_libGLESv2.dylib",
+ "$root_out_dir/vk_intermediates/libvk_swiftshader.dylib",
+ "$root_out_dir/vk_intermediates/vk_swiftshader_icd.json",
+ ]
+ outputs = [
+ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
+ ]
+ public_deps = [
+ "//ui/gl:swiftshader_egl_library_copy",
+ "//ui/gl:swiftshader_vk_library_copy",
+ ]
+ }
+ }
+
+ group("cef_framework_angle_library") {
+ if (use_egl) {
+ deps = [
+ ":cef_framework_angle_binaries",
+ ]
+ }
+ }
+
+ group("cef_framework_swiftshader_library") {
+ if (use_egl) {
+ deps = [
+ ":cef_framework_swiftshader_binaries",
+ ]
+ }
+ }
+
+ mac_framework_bundle("cef_framework") {
+ output_name = cef_framework_name
+
+ framework_version = "A"
+ framework_contents = [
+ "Libraries",
+ "Resources",
+ ]
+
+ sources = includes_common +
+ includes_mac +
+ gypi_paths.autogen_cpp_includes +
+ gypi_paths2.includes_capi +
+ gypi_paths.autogen_capi_includes +
+ gypi_paths2.libcef_sources_common +
+ gypi_paths.autogen_library_side
+
+ # TODO(rsesek): Handle these missing pieces:
+ # - crash_inspector
+ # - crash_report_sender.app
+
+ deps = [
+ ":cef_framework_angle_library",
+ ":cef_framework_locales",
+ ":cef_framework_resources",
+ ":cef_framework_swiftshader_library",
+ ":libcef_static",
+ ]
+
+ # We don't link the framework so just use the path from the main executable.
+ ldflags = [
+ "-Wl,-install_name,@executable_path/../Frameworks/$output_name.framework/$output_name",
+ "-compatibility_version",
+ cef_dylib_version,
+ "-current_version",
+ cef_dylib_version,
+ ]
+
+ if (is_component_build) {
+ # Set up the rpath for the framework so that it can find dylibs in the
+ # root output directory. The framework is at
+ # $app_name.app/Contents/Frameworks/$output_name.framework/Versions/A/$output_name
+ # so use loader_path to go back to the root output directory.
+ ldflags += [
+ "-rpath",
+ "@loader_path/../../../../../..",
+ ]
+ }
+
+ info_plist_target = ":cef_framework_plist"
+ }
+} else {
+ shared_library("libcef") {
+ sources = includes_common +
+ gypi_paths.autogen_cpp_includes +
+ gypi_paths2.includes_capi +
+ gypi_paths.autogen_capi_includes +
+ gypi_paths2.libcef_sources_common +
+ gypi_paths.autogen_library_side
+
+ deps = [
+ ":libcef_static",
+ ]
+
+ if (is_win) {
+ sources += includes_win + [
+ "libcef_dll/libcef_dll.rc",
+ ]
+
+ deps += [
+ # Bring in ui_unscaled_resources.rc which contains custom cursors.
+ # TODO(cef): Remove this once custom cursors can be loaded via
+ # ResourceBundle. See crbug.com/147663.
+ "//ui/resources:ui_unscaled_resources_grd",
+ ]
+ }
+
+ if (is_linux && !is_debug && use_allocator=="none") {
+ # Only export necessary symbols from libcef.so.
+ # Don't do this in Debug builds because it causes the resulting
+ # application to crash.
+ # Also need to do this for ASAN builds to work around
+ # https://crbug.com/832808.
+ ldflags = [ "-Wl,--version-script=" +
+ rebase_path("//cef/libcef_dll/libcef.lst") ]
+ }
+ }
+}
+
+
+#
+# Executable/app targets.
+#
+
+if (is_mac) {
+ # Helper for generating the CEF app bundle.
+ template("cef_app") {
+ assert(defined(invoker.helper_info_plist))
+ assert(defined(invoker.helper_sources))
+ assert(defined(invoker.info_plist))
+ assert(defined(invoker.sources))
+
+ app_name = target_name
+ app_helper_name = "$app_name Helper"
+ app_testonly = defined(invoker.testonly) && invoker.testonly
+
+ tweak_info_plist("${app_name}_helper_plist") {
+ testonly = app_testonly
+ info_plist = invoker.helper_info_plist
+ args = [
+ "--breakpad=0",
+ "--keystone=0",
+ "--scm=0",
+ "--version",
+ cef_plist_version,
+ ]
+ }
+
+ template("cef_helper_app") {
+ mac_app_bundle(target_name) {
+ assert(defined(invoker.helper_sources))
+ assert(defined(invoker.helper_name_suffix))
+ assert(defined(invoker.helper_bundle_id_suffix))
+
+ testonly = app_testonly
+ output_name = app_helper_name + invoker.helper_name_suffix
+
+ sources = invoker.helper_sources
+
+ extra_substitutions = [
+ "BUNDLE_ID_SUFFIX=${invoker.helper_bundle_id_suffix}",
+ ]
+
+ deps = [
+ ":cef_make_headers",
+ ":cef_sandbox",
+ ":libcef_dll_wrapper",
+ ]
+ if (defined(invoker.helper_deps)) {
+ deps += invoker.helper_deps
+ }
+
+ ldflags = [
+ # The helper is in $app_name.app/Contents/Frameworks/$app_name Helper.app/Contents/MacOS/
+ # so set rpath up to the base.
+ "-rpath",
+ "@executable_path/../../../../../..",
+ ]
+
+ info_plist_target = ":${app_name}_helper_plist"
+
+ if (defined(invoker.helper_defines)) {
+ defines = invoker.helper_defines
+ }
+ }
+ }
+
+ foreach(helper_params, content_mac_helpers) {
+ _helper_target = helper_params[0]
+ _helper_bundle_id = helper_params[1]
+ _helper_suffix = helper_params[2]
+ cef_helper_app("${app_name}_helper_app_${_helper_target}") {
+ helper_sources = invoker.helper_sources
+ if (defined(invoker.helper_deps)) {
+ helper_deps = invoker.helper_deps
+ }
+ if (defined(invoker.helper_defines)) {
+ helper_defines = invoker.helper_defines
+ }
+
+ helper_name_suffix = _helper_suffix
+ helper_bundle_id_suffix = _helper_bundle_id
+ }
+ }
+
+ bundle_data("${app_name}_framework_bundle_data") {
+ testonly = app_testonly
+ sources = [
+ "$root_out_dir/$cef_framework_name.framework",
+ ]
+
+ public_deps = [
+ ":cef_framework",
+ ]
+
+ foreach(helper_params, content_mac_helpers) {
+ sources += [
+ "$root_out_dir/${app_helper_name}${helper_params[2]}.app",
+ ]
+ public_deps += [ ":${app_name}_helper_app_${helper_params[0]}" ]
+ }
+
+ outputs = [
+ "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}",
+ ]
+ }
+
+ tweak_info_plist("${app_name}_plist") {
+ testonly = app_testonly
+ info_plist = invoker.info_plist
+ args = [
+ "--scm=1",
+ "--version",
+ cef_plist_version,
+ ]
+ }
+
+ mac_app_bundle(app_name) {
+ testonly = app_testonly
+ output_name = app_name
+
+ sources = invoker.sources
+
+ deps = [
+ ":libcef_dll_wrapper",
+ ":${app_name}_framework_bundle_data",
+ ]
+ if (defined(invoker.deps)) {
+ deps += invoker.deps
+ }
+
+ if (defined(invoker.libs)) {
+ libs = invoker.libs
+ }
+
+ if (defined(invoker.defines)) {
+ defines = invoker.defines
+ }
+
+ info_plist_target = ":${app_name}_plist"
+ }
+ }
+
+
+ #
+ # cefclient app targets.
+ #
+
+ bundle_data("cefclient_resources_bundle_data") {
+ sources = gypi_paths2.shared_sources_resources +
+ gypi_paths2.cefclient_sources_resources + [
+ "tests/cefclient/resources/mac/cefclient.icns",
+ ]
+
+ outputs = [
+ "{{bundle_resources_dir}}/{{source_file_part}}",
+ ]
+ }
+
+ bundle_data("cefclient_resources_bundle_data_extensions_set_page_color") {
+ sources = gypi_paths2.cefclient_sources_resources_extensions_set_page_color
+ outputs = [
+ "{{bundle_resources_dir}}/extensions/set_page_color/{{source_file_part}}",
+ ]
+ }
+
+ bundle_data("cefclient_resources_bundle_data_english") {
+ sources = [
+ "tests/cefclient/resources/mac/English.lproj/InfoPlist.strings",
+ ]
+
+ outputs = [
+ "{{bundle_resources_dir}}/English.lproj/{{source_file_part}}",
+ ]
+ }
+
+ mac_xib_bundle_data("cefclient_xibs") {
+ sources = [
+ "tests/cefclient/resources/mac/English.lproj/MainMenu.xib",
+ ]
+
+ output_path = "{{bundle_resources_dir}}/English.lproj"
+ }
+
+ cef_app("cefclient") {
+ helper_info_plist = "tests/cefclient/resources/mac/helper-Info.plist"
+ helper_sources = includes_common +
+ includes_mac +
+ gypi_paths2.includes_wrapper +
+ gypi_paths2.includes_wrapper_mac +
+ gypi_paths2.shared_sources_common +
+ gypi_paths2.shared_sources_renderer +
+ gypi_paths2.shared_sources_mac_helper +
+ gypi_paths2.cefclient_sources_common +
+ gypi_paths2.cefclient_sources_renderer
+ helper_defines = [
+ "CEF_USE_SANDBOX",
+ ]
+
+ info_plist = "tests/cefclient/resources/mac/Info.plist"
+ sources = includes_common +
+ includes_mac +
+ gypi_paths2.includes_wrapper +
+ gypi_paths2.includes_wrapper_mac +
+ gypi_paths2.shared_sources_browser +
+ gypi_paths2.shared_sources_common +
+ gypi_paths2.shared_sources_mac +
+ gypi_paths2.cefclient_sources_browser +
+ gypi_paths2.cefclient_sources_common +
+ gypi_paths2.cefclient_sources_mac
+ deps = [
+ ":cefclient_resources_bundle_data",
+ ":cefclient_resources_bundle_data_extensions_set_page_color",
+ ":cefclient_resources_bundle_data_english",
+ ":cefclient_xibs",
+ ]
+ libs = [
+ "AppKit.framework",
+ "OpenGL.framework",
+ ]
+ defines = [
+ "CEF_USE_SANDBOX",
+ ]
+ }
+
+
+ #
+ # cefsimple app targets.
+ #
+
+ bundle_data("cefsimple_resources_bundle_data") {
+ sources = [
+ "tests/cefsimple/mac/cefsimple.icns",
+ ]
+
+ outputs = [
+ "{{bundle_resources_dir}}/{{source_file_part}}",
+ ]
+ }
+
+ bundle_data("cefsimple_resources_bundle_data_english") {
+ sources = [
+ "tests/cefsimple/mac/English.lproj/InfoPlist.strings",
+ ]
+
+ outputs = [
+ "{{bundle_resources_dir}}/English.lproj/{{source_file_part}}",
+ ]
+ }
+
+ mac_xib_bundle_data("cefsimple_xibs") {
+ sources = [
+ "tests/cefsimple/mac/English.lproj/MainMenu.xib",
+ ]
+ output_path = "{{bundle_resources_dir}}/English.lproj"
+ }
+
+ cef_app("cefsimple") {
+ helper_info_plist = "tests/cefsimple/mac/helper-Info.plist"
+ helper_sources = includes_common +
+ includes_mac +
+ gypi_paths2.includes_wrapper +
+ gypi_paths2.includes_wrapper_mac +
+ gypi_paths2.cefsimple_sources_mac_helper
+ helper_defines = [
+ "CEF_USE_SANDBOX",
+ ]
+
+ info_plist = "tests/cefsimple/mac/Info.plist"
+ sources = includes_common +
+ includes_mac +
+ gypi_paths2.includes_wrapper +
+ gypi_paths2.includes_wrapper_mac +
+ gypi_paths2.cefsimple_sources_common +
+ gypi_paths2.cefsimple_sources_mac
+ deps = [
+ ":cefsimple_resources_bundle_data",
+ ":cefsimple_resources_bundle_data_english",
+ ":cefsimple_xibs",
+ ]
+ libs = [
+ "AppKit.framework",
+ ]
+ defines = [
+ "CEF_USE_SANDBOX",
+ ]
+ }
+
+
+ #
+ # ceftests app targets.
+ #
+
+ bundle_data("ceftests_resources_bundle_data") {
+ sources = gypi_paths2.shared_sources_resources + [
+ "tests/ceftests/resources/mac/ceftests.icns",
+ ]
+
+ outputs = [
+ "{{bundle_resources_dir}}/{{source_file_part}}",
+ ]
+ }
+
+ bundle_data("ceftests_resources_bundle_data_english") {
+ sources = [
+ "tests/ceftests/resources/mac/English.lproj/InfoPlist.strings",
+ ]
+
+ outputs = [
+ "{{bundle_resources_dir}}/English.lproj/{{source_file_part}}",
+ ]
+ }
+
+ mac_xib_bundle_data("ceftests_xibs") {
+ sources = [
+ "tests/ceftests/resources/mac/English.lproj/MainMenu.xib",
+ ]
+ output_path = "{{bundle_resources_dir}}/English.lproj"
+ }
+
+ cef_app("ceftests") {
+ testonly = true
+
+ helper_info_plist = "tests/ceftests/resources/mac/helper-Info.plist"
+ helper_sources = gypi_paths2.shared_sources_common +
+ gypi_paths2.shared_sources_renderer +
+ gypi_paths2.shared_sources_mac_helper +
+ gypi_paths2.ceftests_sources_mac_helper
+ helper_deps = [
+ "//testing/gtest",
+ ]
+ helper_defines = [
+ "CEF_USE_SANDBOX",
+ ]
+
+ info_plist = "tests/ceftests/resources/mac/Info.plist"
+ sources = includes_common +
+ includes_mac +
+ gypi_paths2.includes_wrapper +
+ gypi_paths2.includes_wrapper_mac +
+ gypi_paths2.shared_sources_browser +
+ gypi_paths2.shared_sources_common +
+ gypi_paths2.shared_sources_mac +
+ gypi_paths2.ceftests_sources_common +
+ gypi_paths2.ceftests_sources_mac
+ deps = [
+ ":ceftests_resources_bundle_data",
+ ":ceftests_resources_bundle_data_english",
+ ":ceftests_xibs",
+ "//testing/gtest",
+ ]
+ libs = [
+ "AppKit.framework",
+ ]
+ defines = [
+ "CEF_USE_SANDBOX",
+ ]
+ }
+} else {
+ #
+ # cefclient targets.
+ #
+
+ # The cefclient target depends on packages that are not available in the
+ # default sysroot environment.
+ if (is_linux && !use_sysroot) {
+ pkg_config("glib") {
+ packages = [
+ "glib-2.0",
+ ]
+ }
+ }
+
+ if (is_linux && cef_use_gtk) {
+ pkg_config("gtk") {
+ packages = [
+ "gmodule-2.0",
+ "gtk+-2.0",
+ "gthread-2.0",
+ "gtk+-unix-print-2.0",
+ "xi",
+ ]
+ }
+
+ pkg_config("gtkglext") {
+ packages = [
+ "gtkglext-1.0",
+ ]
+ }
+ }
+
+ if (is_linux) {
+ copy("copy_cefclient_files") {
+ sources = gypi_paths2.shared_sources_resources +
+ gypi_paths2.cefclient_sources_resources
+ outputs = [ "${root_out_dir}/cefclient_files/{{source_file_part}}" ]
+ }
+
+ copy("copy_cefclient_files_extensions_set_page_color") {
+ sources = gypi_paths2.cefclient_sources_resources_extensions_set_page_color
+ outputs = [ "${root_out_dir}/cefclient_files/extensions/set_page_color/{{source_file_part}}" ]
+ }
+ }
+
+ executable("cefclient") {
+ sources = includes_common +
+ gypi_paths2.includes_wrapper +
+ gypi_paths2.shared_sources_browser +
+ gypi_paths2.shared_sources_common +
+ gypi_paths2.shared_sources_renderer +
+ gypi_paths2.cefclient_sources_browser +
+ gypi_paths2.cefclient_sources_common +
+ gypi_paths2.cefclient_sources_renderer
+
+ deps = [
+ ":libcef",
+ ":libcef_dll_wrapper",
+ ]
+
+ defines = [
+ "CEF_USE_SANDBOX",
+ ]
+
+ if (is_win) {
+ sources += includes_win +
+ gypi_paths2.shared_sources_win +
+ gypi_paths2.cefclient_sources_win
+
+ # Set /SUBSYSTEM:WINDOWS.
+ configs -= [ "//build/config/win:console" ]
+ configs += [ "//build/config/win:windowed" ]
+
+ defines += [
+ "CEF_USE_ATL",
+ ]
+
+ deps += [
+ ":cef_sandbox",
+ "//build/win:default_exe_manifest",
+ ]
+
+ libs = [
+ "comctl32.lib",
+ "d3d11.lib",
+ "imm32.lib",
+ "oleacc.lib",
+ "rpcrt4.lib",
+ "shlwapi.lib",
+ ]
+
+ if (target_cpu != "arm64") {
+ libs += [
+ "opengl32.lib",
+ "glu32.lib"
+ ]
+ }
+ }
+
+ if (is_linux) {
+ sources += includes_linux +
+ gypi_paths2.shared_sources_linux +
+ gypi_paths2.cefclient_sources_linux
+
+ deps += [
+ ":copy_cefclient_files",
+ ":copy_cefclient_files_extensions_set_page_color",
+ ]
+
+ libs = [
+ "X11",
+ ]
+
+ if (cef_use_gtk) {
+ configs += [
+ ":gtk",
+ ":gtkglext",
+ ]
+ }
+
+ if (is_component_build) {
+ if (use_allocator=="tcmalloc") {
+ # Link to base to initialize tcmalloc allocator shims, otherwise
+ # base::allocator::IsAllocatorInitialized check fails
+ deps += [ "//base" ]
+ }
+ } else {
+ # Set rpath to find our own libfreetype even in a non-component build.
+ configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
+ }
+ }
+ }
+
+
+ #
+ # cefsimple targets.
+ #
+
+ executable("cefsimple") {
+ sources = includes_common +
+ gypi_paths2.includes_wrapper +
+ gypi_paths2.cefsimple_sources_common
+
+ deps = [
+ ":libcef",
+ ":libcef_dll_wrapper",
+ ]
+
+ defines = [
+ "CEF_USE_SANDBOX",
+ ]
+
+ if (is_win) {
+ sources += includes_win +
+ gypi_paths2.cefsimple_sources_win
+
+ # Set /SUBSYSTEM:WINDOWS.
+ configs -= [ "//build/config/win:console" ]
+ configs += [ "//build/config/win:windowed" ]
+
+ deps += [
+ ":cef_sandbox",
+ "//build/win:default_exe_manifest",
+ ]
+
+ libs = [
+ "comctl32.lib",
+ "shlwapi.lib",
+ "rpcrt4.lib",
+ ]
+ }
+
+ if (is_linux) {
+ sources += includes_linux +
+ gypi_paths2.cefsimple_sources_linux
+
+ if (use_x11) {
+ libs = [
+ "X11",
+ ]
+ }
+
+ if (!is_component_build) {
+ # Set rpath to find our own libfreetype even in a non-component build.
+ configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
+ }
+ }
+ }
+
+
+ #
+ # ceftests targets.
+ #
+
+ if (is_linux) {
+ copy("copy_ceftests_files") {
+ sources = gypi_paths2.shared_sources_resources
+ outputs = [ "${root_out_dir}/ceftests_files/{{source_file_part}}" ]
+ }
+ }
+
+ executable("ceftests") {
+ testonly = true
+
+ sources = includes_common +
+ gypi_paths2.includes_wrapper +
+ gypi_paths2.shared_sources_browser +
+ gypi_paths2.shared_sources_common +
+ gypi_paths2.shared_sources_renderer +
+ gypi_paths2.ceftests_sources_common +
+ gypi_paths2.ceftests_sources_views
+
+ deps = [
+ ":libcef",
+ ":libcef_dll_wrapper",
+ "//testing/gtest",
+ ]
+
+ defines = [
+ "CEF_USE_SANDBOX",
+ ]
+
+ if (is_win) {
+ sources += gypi_paths2.shared_sources_win +
+ gypi_paths2.ceftests_sources_win
+
+ deps += [
+ ":cef_sandbox",
+ "//build/win:default_exe_manifest",
+ ]
+ }
+
+ if (is_linux) {
+ sources += gypi_paths2.shared_sources_linux +
+ gypi_paths2.ceftests_sources_linux
+
+ if (use_x11) {
+ libs = [
+ "X11",
+ ]
+ } else {
+ if (!use_sysroot) {
+ configs += [ ":glib" ]
+ }
+ }
+
+ deps += [
+ ":copy_ceftests_files",
+ ]
+ }
+
+ if (is_linux && !is_component_build) {
+ # Set rpath to find our own libfreetype even in a non-component build.
+ configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
+ }
+ }
+}
diff --git a/src/CHROMIUM_BUILD_COMPATIBILITY.txt b/src/CHROMIUM_BUILD_COMPATIBILITY.txt
new file mode 100644
index 0000000..a9d0b66
--- /dev/null
+++ b/src/CHROMIUM_BUILD_COMPATIBILITY.txt
@@ -0,0 +1,12 @@
+# The Chromium Embedded Framework (CEF) project is built on top of the Chromium
+# project source tree. Chromium should be updated to the URL and revision listed
+# below before building CEF. Chromium compatibility information for older CEF
+# revisions is available by viewing this file's change history.
+#
+# Instructions for building CEF are available at:
+# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
+
+{
+ 'chromium_checkout': 'refs/tags/83.0.4103.106',
+ 'depot_tools_checkout': 'fc5e103221'
+}
diff --git a/src/CHROMIUM_UPDATE.txt b/src/CHROMIUM_UPDATE.txt
new file mode 100644
index 0000000..4c31f4e
--- /dev/null
+++ b/src/CHROMIUM_UPDATE.txt
@@ -0,0 +1,68 @@
+# The Chromium Embedded Framework (CEF) project is built on top of the Chromium
+# project source tree. When updating Chromium to a new version certain files and
+# patterns should be observed for changes. If changes are detected then the CEF
+# source code or patch files will likely need to be updated.
+#
+# Add `--log-chromium-changes` to the automate-git.py command-line to output
+# the following files in the <download-dir>:
+#
+# * chromium_update_changes.diff
+# Files in the chromium/src directory that have changed. See the 'files'
+# section below.
+#
+# * chromium_update_patterns.txt
+# Files in the chromium/src directory that contain invalid/unexpected
+# patterns. See the 'patterns' section below. Failure of this step is
+# considered a fatal error during update.
+#
+# * chromium_update_patches.txt
+# Output from attempting to update existing Chromium patch files using the
+# patch_updater.py tool. Failure of this step is considered a fatal error
+# during update.
+#
+# For complete update instructions see:
+# https://bitbucket.org/chromiumembedded/cef/wiki/ChromiumUpdate.md
+
+{
+ # Files in the chromium/src directory that should be evaluated for changes.
+ # Similar changes may need to be applied to the CEF source code.
+ 'files': [
+ 'chrome/app/chrome_*_manifest.*',
+ 'chrome/app/chrome_*_manifests.*',
+ 'chrome/browser/browser_process.h',
+ 'chrome/browser/extensions/api/tabs/tabs_api.*',
+ 'chrome/browser/extensions/chrome_component_extension_resource_manager.*',
+ 'chrome/browser/extensions/chrome_extension_web_contents_observer.*',
+ 'chrome/browser/extensions/component_loader.*',
+ 'chrome/browser/extensions/extension_service.*',
+ 'chrome/browser/printing/print_view_manager*',
+ 'chrome/browser/printing/printing_message_filter*',
+ 'chrome/browser/profiles/profile.h',
+ 'chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.*',
+ 'chrome/common/extensions/api/*_features.json',
+ 'chrome/renderer/chrome_content_renderer_client.*',
+ 'chrome/renderer/extensions/chrome_extensions_renderer_client.*',
+ 'content/browser/renderer_host/render_widget_host_view_base.*',
+ 'content/public/browser/content_browser_client.*',
+ 'content/public/browser/render_widget_host_view.h',
+ 'content/public/browser/storage_partition.h',
+ 'content/public/browser/web_contents_delegate.h',
+ 'content/public/common/content_features.cc',
+ 'content/shell/BUILD.gn',
+ 'content/shell/app/*',
+ 'content/shell/browser/shell_*',
+ 'content/shell/browser/renderer_host/shell_*',
+ 'content/shell/common/shell_*',
+ 'content/shell/gpu/shell_*',
+ 'content/shell/renderer/shell_*',
+ 'content/shell/utility/shell_*',
+ 'extensions/shell/*',
+ 'net/base/features.cc',
+ 'net/cookies/cookie_store.h',
+ 'services/network/public/cpp/features.cc',
+ 'ui/base/ui_base_features.cc',
+ ],
+ # Patterns that should not be found in the chromium/src directory after
+ # applying patch files.
+ 'patterns': [],
+}
diff --git a/src/CMakeLists.txt.in b/src/CMakeLists.txt.in
new file mode 100644
index 0000000..120db2b
--- /dev/null
+++ b/src/CMakeLists.txt.in
@@ -0,0 +1,213 @@
+# Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
+# reserved. Use of this source code is governed by a BSD-style license that
+# can be found in the LICENSE file.
+
+# OVERVIEW
+#
+# CMake is a cross-platform open-source build system that can generate project
+# files in many different formats. It can be downloaded from
+# http://www.cmake.org or installed via a platform package manager.
+#
+# CMake-generated project formats that have been tested with this CEF binary
+# distribution include:
+#
+# Linux: Ninja, Unix Makefiles
+# Mac OS X: Ninja, Xcode 5+
+# Windows: Ninja, Visual Studio 2010+
+#
+# Ninja is a cross-platform open-source tool for running fast builds using
+# pre-installed platform toolchains (GNU, clang, Xcode or MSVC). It can be
+# downloaded from http://martine.github.io/ninja/ or installed via a platform
+# package manager.
+#
+# CMAKE STRUCTURE
+#
+# This CEF binary distribution includes the following CMake files:
+#
+# CMakeLists.txt Bootstrap that sets up the CMake environment.
+# cmake/*.cmake CEF configuration files shared by all targets.
+# libcef_dll/CMakeLists.txt Defines the libcef_dll_wrapper target.
+# tests/*/CMakeLists.txt Defines the test application target.
+#
+# See the "TODO:" comments below for guidance on how to integrate this CEF
+# binary distribution into a new or existing CMake project.
+#
+# BUILD REQUIREMENTS
+#
+# The below requirements must be met to build this CEF binary distribution.
+#
+# - CMake version 2.8.12.1 or newer.
+#
+# - Linux requirements:
+# Currently supported distributions include Debian Wheezy, Ubuntu Precise, and
+# related. Ubuntu 14.04 64-bit is recommended. Newer versions will likely also
+# work but may not have been tested.
+# Required packages include:
+# build-essential
+# libgtk2.0-dev (required by the cefclient target only)
+# libgtkglext1-dev (required by the cefclient target only)
+#
+# - Mac OS X requirements:
+# Xcode 5 or newer building on Mac OS X 10.9 (Mavericks) or newer. Xcode 8.3
+# and OS X 10.12 are recommended. The Xcode command-line tools must also be
+# installed. Only 64-bit builds are supported on OS X.
+#
+# - Windows requirements:
+# Visual Studio 2010 or newer building on Windows 7 or newer. Visual Studio
+# 2015 Update 3 and Windows 10 64-bit are recommended.
+#
+# BUILD EXAMPLES
+#
+# The below commands will generate project files and create a Debug build of all
+# CEF targets using CMake and the platform toolchain.
+#
+# Start by creating and entering the CMake build output directory:
+# > cd path/to/cef_binary_*
+# > mkdir build && cd build
+#
+# To perform a Linux build using a 32-bit CEF binary distribution on a 32-bit
+# Linux platform or a 64-bit CEF binary distribution on a 64-bit Linux platform:
+# Using Unix Makefiles:
+# > cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ..
+# > make -j4 cefclient cefsimple
+#
+# Using Ninja:
+# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
+# > ninja cefclient cefsimple
+#
+# To perform a Mac OS X build using a 64-bit CEF binary distribution:
+# Using the Xcode IDE:
+# > cmake -G "Xcode" -DPROJECT_ARCH="x86_64" ..
+# Open build\cef.xcodeproj in Xcode and select Product > Build.
+#
+# Using Ninja:
+# > cmake -G "Ninja" -DPROJECT_ARCH="x86_64" -DCMAKE_BUILD_TYPE=Debug ..
+# > ninja cefclient cefsimple
+#
+# To perform a Windows build using a 32-bit CEF binary distribution:
+# Using the Visual Studio 2015 IDE:
+# > cmake -G "Visual Studio 14" ..
+# Open build\cef.sln in Visual Studio and select Build > Build Solution.
+#
+# Using Ninja with Visual Studio 2015 command-line tools:
+# (this path may be different depending on your Visual Studio installation)
+# > "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat"
+# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
+# > ninja cefclient cefsimple
+#
+# To perform a Windows build using a 64-bit CEF binary distribution:
+# Using the Visual Studio 2015 IDE:
+# > cmake -G "Visual Studio 14 Win64" ..
+# Open build\cef.sln in Visual Studio and select Build > Build Solution.
+#
+# Using Ninja with Visual Studio 2015 command-line tools:
+# (this path may be different depending on your Visual Studio installation)
+# > "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
+# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
+# > ninja cefclient cefsimple
+
+#
+# Global setup.
+#
+
+cmake_minimum_required(VERSION 2.8.12.1)
+
+# Only generate Debug and Release configuration types.
+set(CMAKE_CONFIGURATION_TYPES Debug Release)
+
+# Project name.
+# TODO: Change this line to match your project name when you copy this file.
+project(cef)
+
+# Use folders in the resulting project files.
+set_property(GLOBAL PROPERTY OS_FOLDERS ON)
+
+
+#
+# CEF_ROOT setup.
+# This variable must be set to locate the binary distribution.
+# TODO: Choose one of the below examples and comment out the rest.
+#
+
+# Example 1: The current directory contains both the complete binary
+# distribution and your project.
+# A. Comment in these lines:
+#
+set(CEF_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CEF_ROOT}/cmake")
+
+# Example 2: The binary distribution is in a separate directory from your
+# project. Locate the binary distribution using the CEF_ROOT CMake
+# variable.
+# A. Create a directory structure for your project like the following:
+# myproject/
+# CMakeLists.txt <= top-level CMake configuration
+# mytarget/
+# CMakeLists.txt <= CMake configuration for `mytarget`
+# ... other `mytarget` source files
+# B. Copy this file to "myproject/CMakeLists.txt" as the top-level CMake
+# configuration.
+# C. Create the target-specific "myproject/mytarget/CMakeLists.txt" file for
+# your application. See the included cefclient and cefsimple CMakeLists.txt
+# files as an example.
+# D. Comment in these lines:
+#
+# set(CEF_ROOT "c:/path/to/cef_binary_3.2704.xxxx.gyyyyyyy_windows32")
+# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CEF_ROOT}/cmake")
+
+# Example 3: The binary distribution is in a separate directory from your
+# project. Locate the binary distribution using the CEF_ROOT
+# environment variable.
+# A. Create a directory structure for your project like the following:
+# myproject/
+# CMakeLists.txt <= top-level CMake configuration
+# cmake/
+# FindCEF.cmake <= CEF CMake configuration entry point
+# mytarget/
+# CMakeLists.txt <= CMake configuration for `mytarget`
+# ... other `mytarget` source files
+# B. Copy this file to "myproject/CMakeLists.txt" as the top-level CMake
+# configuration.
+# C. Copy the cmake/FindCEF.cmake file to "myproject/cmake/FindCEF.cmake".
+# D. Create the target-specific "myproject/mytarget/CMakeLists.txt" file for
+# your application. See the included cefclient and cefsimple CMakeLists.txt
+# files as an example.
+# E. Set the CEF_ROOT environment variable before executing CMake. For example:
+# > set CEF_ROOT=c:\path\to\cef_binary_3.2704.xxxx.gyyyyyyy_windows32
+# F. Comment in these lines:
+#
+# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+
+
+#
+# Load the CEF configuration.
+#
+
+# Execute FindCEF.cmake which must exist in CMAKE_MODULE_PATH.
+find_package(CEF REQUIRED)
+
+
+#
+# Define CEF-based targets.
+#
+
+# Include the libcef_dll_wrapper target.
+# Comes from the libcef_dll/CMakeLists.txt file in the binary distribution
+# directory.
+add_subdirectory(${CEF_LIBCEF_DLL_WRAPPER_PATH} libcef_dll_wrapper)
+
+# Include application targets.
+# Comes from the <target>/CMakeLists.txt file in the current directory.
+# TODO: Change these lines to match your project target when you copy this file.
+if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
+ add_subdirectory(tests/cefsimple)
+ add_subdirectory(tests/gtest)
+ add_subdirectory(tests/ceftests)
+endif()
+
+if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/cefclient")
+ add_subdirectory(tests/cefclient)
+endif()
+
+# Display configuration settings.
+PRINT_CEF_CONFIG()
diff --git a/src/DEPS b/src/DEPS
new file mode 100644
index 0000000..0a7dc22
--- /dev/null
+++ b/src/DEPS
@@ -0,0 +1,7 @@
+hooks = [
+ {
+ # A change to a .gyp, .gypi, or to GYP itself should run the generator.
+ "pattern": ".",
+ "action": ["python", "src/cef/tools/gclient_hook.py"],
+ },
+]
diff --git a/src/LICENSE.txt b/src/LICENSE.txt
new file mode 100644
index 0000000..b55d613
--- /dev/null
+++ b/src/LICENSE.txt
@@ -0,0 +1,29 @@
+// Copyright (c) 2008-2020 Marshall A. Greenblatt. Portions Copyright (c)
+// 2006-2009 Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/src/README.md b/src/README.md
new file mode 100644
index 0000000..9b69d59
--- /dev/null
+++ b/src/README.md
@@ -0,0 +1,87 @@
+The Chromium Embedded Framework (CEF) is a simple framework for embedding Chromium-based browsers in other applications.
+
+# Quick Links
+
+* 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
+* Announcements - https://groups.google.com/forum/#!forum/cef-announce
+* Support Forum - http://www.magpcss.org/ceforum/
+* CEF1 C++ API Docs - http://magpcss.org/ceforum/apidocs/
+* CEF3 C++ API Docs - http://magpcss.org/ceforum/apidocs3/
+* Downloads - http://opensource.spotify.com/cefbuilds/index.html
+* Donations - http://www.magpcss.org/ceforum/donate.php
+
+# Introduction
+
+CEF is a BSD-licensed open source project founded by Marshall Greenblatt in 2008 and based on the [Google Chromium](http://www.chromium.org/Home) project. Unlike the Chromium project itself, which focuses mainly on Google Chrome application development, CEF focuses on facilitating embedded browser use cases in third-party applications. CEF insulates the user from the underlying Chromium and Blink code complexity by offering production-quality stable APIs, release branches tracking specific Chromium releases, and binary distributions. Most features in CEF have default implementations that provide rich functionality while requiring little or no integration work from the user. There are currently over 100 million installed instances of CEF around the world embedded in products from a wide range of companies and industries. A partial list of companies and products using CEF is available on the [CEF Wikipedia page](http://en.wikipedia.org/wiki/Chromium_Embedded_Framework#Applications_using_CEF). Some use cases for CEF include:
+
+* Embedding an HTML5-compliant Web browser control in an existing native application.
+* Creating a light-weight native “shell” application that hosts a user interface developed primarily using Web technologies.
+* Rendering Web content “off-screen” in applications that have their own custom drawing frameworks.
+* Acting as a host for automated testing of existing Web properties and applications.
+
+CEF supports a wide range of programming languages and operating systems and can be easily integrated into both new and existing applications. It was designed from the ground up with both performance and ease of use in mind. The base framework includes C and C++ programming interfaces exposed via native libraries that insulate the host application from Chromium and Blink implementation details. It provides close integration between the browser and the host application including support for custom plugins, protocols, JavaScript objects and JavaScript extensions. The host application can optionally control resource loading, navigation, context menus, printing and more, while taking advantage of the same performance and HTML5 technologies available in the Google Chrome Web browser.
+
+Numerous individuals and organizations contribute time and resources to support CEF development, but more involvement from the community is always welcome. This includes support for both the core CEF project and external projects that integrate CEF with additional programming languages and frameworks (see the "External Projects" section below). If you are interested in donating time to help with CEF development please see the "Helping Out" section below. If you are interested in donating money to support general CEF development and infrastructure efforts please visit the [CEF Donations](http://www.magpcss.org/ceforum/donate.php) page.
+
+# Getting Started
+
+Users new to CEF development should start by reading the [Tutorial](https://bitbucket.org/chromiumembedded/cef/wiki/Tutorial) Wiki page for an overview of CEF usage and then proceed to the [GeneralUsage](https://bitbucket.org/chromiumembedded/cef/wiki/GeneralUsage) Wiki page for a more in-depth discussion or architectural and usage issues. Complete API documentation is available [here](http://magpcss.org/ceforum/apidocs3/). CEF support and related discussion is available on the [CEF Forum](http://www.magpcss.org/ceforum/).
+
+# Binary Distributions
+
+Binary distributions, which include all files necessary to build a CEF-based application, are available on the [Downloads](http://opensource.spotify.com/cefbuilds/index.html) page. Binary distributions are stand-alone and do not require the download of CEF or Chromium source code. Symbol files for debugging binary distributions of libcef can also be downloaded from the above links.
+
+# Source Distributions
+
+The CEF project is an extension of the Chromium project. CEF maintains development and release branches that track Chromium branches. CEF source code can be downloaded, built and packaged manually or with automated tools. Visit the [BranchesAndBuilding](https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding) Wiki page for more information.
+
+# External Projects
+
+The base CEF framework includes support for the C and C++ programming languages. Thanks to the hard work of external maintainers CEF can integrate with a number of other programming languages and frameworks. These external projects are not maintained by CEF so please contact the respective project maintainer if you have any questions or issues.
+
+* .Net (CEF3) - https://github.com/cefsharp/CefSharp
+* .Net (CEF1) - https://bitbucket.org/fddima/cefglue
+* .Net/Mono (CEF3) - https://bitbucket.org/xilium/xilium.cefglue
+* .Net (CEF3) - https://bitbucket.org/chromiumfx/chromiumfx
+* Delphi (CEF1) - http://code.google.com/p/delphichromiumembedded/
+* Delphi (CEF3) - https://github.com/hgourvest/dcef3
+* Delphi (CEF3) - https://github.com/salvadordf/CEF4Delphi
+* Go - https://github.com/richardwilkes/cef
+* Go - https://github.com/CzarekTomczak/cef2go
+* Java - https://bitbucket.org/chromiumembedded/java-cef
+* Java - http://code.google.com/p/javacef/
+* Python - http://code.google.com/p/cefpython/
+
+If you're the maintainer of a project not listed above and would like your project listed here please either post to the [CEF Forum](http://www.magpcss.org/ceforum/) or contact Marshall directly.
+
+# Helping Out
+
+CEF is still very much a work in progress. Some ways that you can help out:
+
+\- Vote for issues in the [CEF issue tracker](https://bitbucket.org/chromiumembedded/cef/issues?status=new&status=open) that are important to you. This helps with development prioritization.
+
+\- Report any bugs that you find or feature requests that are important to you. Make sure to first search for existing issues before creating new ones. Please use the [CEF Forum](http://magpcss.org/ceforum) and not the issue tracker for usage questions. Each CEF issue should:
+
+* Include the CEF revision or binary distribution version.
+* Include information about your OS and compiler version.
+* If the issue is a bug please provide detailed reproduction information.
+* If the issue is a feature please describe why the feature is beneficial.
+
+\- Write unit tests for new or existing functionality.
+
+\- Pull requests and patches are welcome. View open issues in the [CEF issue tracker](https://bitbucket.org/chromiumembedded/cef/issues?status=new&status=open) or search for TODO(cef) in the source code for ideas.
+
+If you would like to contribute source code changes to CEF please follow the below guidelines:
+
+\- Create or find an appropriate issue for each distinct bug, feature or change.
+
+\- Submit a [pull request](https://bitbucket.org/chromiumembedded/cef/wiki/ContributingWithGit) or create a patch with your changes and attach it to the CEF issue. Changes should:
+
+* Be submitted against the current [CEF master branch](https://bitbucket.org/chromiumembedded/cef/src/?at=master) unless explicitly fixing a bug in a CEF release branch.
+* Follow the style of existing CEF source files. In general CEF uses the [Chromium coding style](http://www.chromium.org/developers/coding-style).
+* Include new or modified unit tests as appropriate to the functionality.
+* Not include unnecessary or unrelated changes.
diff --git a/src/VERSION.in b/src/VERSION.in
new file mode 100644
index 0000000..2ecb980
--- /dev/null
+++ b/src/VERSION.in
@@ -0,0 +1 @@
+CEF_MAJOR=3
diff --git a/src/cef_create_projects.bat b/src/cef_create_projects.bat
new file mode 100644
index 0000000..8dc7784
--- /dev/null
+++ b/src/cef_create_projects.bat
@@ -0,0 +1,2 @@
+@echo off
+python.bat tools\gclient_hook.py
diff --git a/src/cef_create_projects.sh b/src/cef_create_projects.sh
new file mode 100755
index 0000000..a9c94cd
--- /dev/null
+++ b/src/cef_create_projects.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+python tools/gclient_hook.py
diff --git a/src/cef_paths.gypi b/src/cef_paths.gypi
new file mode 100644
index 0000000..a972dea
--- /dev/null
+++ b/src/cef_paths.gypi
@@ -0,0 +1,831 @@
+# Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
+# reserved. Use of this source code is governed by a BSD-style license that
+# can be found in the LICENSE file.
+#
+# ---------------------------------------------------------------------------
+#
+# This file was generated by the CEF translator tool and should not edited
+# by hand. See the translator.README.txt file in the tools directory for
+# more information.
+#
+# $hash=72268a78a76d7d91b8ad47f6b6e9f6d9cb04d9cf$
+#
+
+{
+ 'variables': {
+ 'autogen_cpp_includes': [
+ 'include/cef_accessibility_handler.h',
+ 'include/cef_app.h',
+ 'include/cef_audio_handler.h',
+ 'include/cef_auth_callback.h',
+ 'include/cef_browser.h',
+ 'include/cef_browser_process_handler.h',
+ 'include/cef_callback.h',
+ 'include/cef_client.h',
+ 'include/cef_command_line.h',
+ 'include/cef_context_menu_handler.h',
+ 'include/cef_cookie.h',
+ 'include/cef_crash_util.h',
+ 'include/cef_devtools_message_observer.h',
+ 'include/cef_dialog_handler.h',
+ 'include/cef_display_handler.h',
+ 'include/cef_dom.h',
+ 'include/cef_download_handler.h',
+ 'include/cef_download_item.h',
+ 'include/cef_drag_data.h',
+ 'include/cef_drag_handler.h',
+ 'include/cef_extension.h',
+ 'include/cef_extension_handler.h',
+ 'include/cef_file_util.h',
+ 'include/cef_find_handler.h',
+ 'include/cef_focus_handler.h',
+ 'include/cef_frame.h',
+ 'include/cef_image.h',
+ 'include/cef_jsdialog_handler.h',
+ 'include/cef_keyboard_handler.h',
+ 'include/cef_life_span_handler.h',
+ 'include/cef_load_handler.h',
+ 'include/cef_media_router.h',
+ 'include/cef_menu_model.h',
+ 'include/cef_menu_model_delegate.h',
+ 'include/cef_navigation_entry.h',
+ 'include/cef_origin_whitelist.h',
+ 'include/cef_parser.h',
+ 'include/cef_path_util.h',
+ 'include/cef_print_handler.h',
+ 'include/cef_print_settings.h',
+ 'include/cef_process_message.h',
+ 'include/cef_process_util.h',
+ 'include/cef_registration.h',
+ 'include/cef_render_handler.h',
+ 'include/cef_render_process_handler.h',
+ 'include/cef_request.h',
+ 'include/cef_request_callback.h',
+ 'include/cef_request_context.h',
+ 'include/cef_request_context_handler.h',
+ 'include/cef_request_handler.h',
+ 'include/cef_resource_bundle.h',
+ 'include/cef_resource_bundle_handler.h',
+ 'include/cef_resource_handler.h',
+ 'include/cef_resource_request_handler.h',
+ 'include/cef_response.h',
+ 'include/cef_response_filter.h',
+ 'include/cef_scheme.h',
+ 'include/cef_server.h',
+ 'include/cef_ssl_info.h',
+ 'include/cef_ssl_status.h',
+ 'include/cef_stream.h',
+ 'include/cef_string_visitor.h',
+ 'include/cef_task.h',
+ 'include/cef_thread.h',
+ 'include/cef_trace.h',
+ 'include/cef_urlrequest.h',
+ 'include/cef_v8.h',
+ 'include/cef_values.h',
+ 'include/cef_waitable_event.h',
+ 'include/cef_web_plugin.h',
+ 'include/cef_x509_certificate.h',
+ 'include/cef_xml_reader.h',
+ 'include/cef_zip_reader.h',
+ 'include/test/cef_test_helpers.h',
+ 'include/test/cef_translator_test.h',
+ 'include/views/cef_box_layout.h',
+ 'include/views/cef_browser_view.h',
+ 'include/views/cef_browser_view_delegate.h',
+ 'include/views/cef_button.h',
+ 'include/views/cef_button_delegate.h',
+ 'include/views/cef_display.h',
+ 'include/views/cef_fill_layout.h',
+ 'include/views/cef_label_button.h',
+ 'include/views/cef_layout.h',
+ 'include/views/cef_menu_button.h',
+ 'include/views/cef_menu_button_delegate.h',
+ 'include/views/cef_panel.h',
+ 'include/views/cef_panel_delegate.h',
+ 'include/views/cef_scroll_view.h',
+ 'include/views/cef_textfield.h',
+ 'include/views/cef_textfield_delegate.h',
+ 'include/views/cef_view.h',
+ 'include/views/cef_view_delegate.h',
+ 'include/views/cef_window.h',
+ 'include/views/cef_window_delegate.h',
+ ],
+ 'autogen_capi_includes': [
+ 'include/capi/cef_accessibility_handler_capi.h',
+ 'include/capi/cef_app_capi.h',
+ 'include/capi/cef_audio_handler_capi.h',
+ 'include/capi/cef_auth_callback_capi.h',
+ 'include/capi/cef_browser_capi.h',
+ 'include/capi/cef_browser_process_handler_capi.h',
+ 'include/capi/cef_callback_capi.h',
+ 'include/capi/cef_client_capi.h',
+ 'include/capi/cef_command_line_capi.h',
+ 'include/capi/cef_context_menu_handler_capi.h',
+ 'include/capi/cef_cookie_capi.h',
+ 'include/capi/cef_crash_util_capi.h',
+ 'include/capi/cef_devtools_message_observer_capi.h',
+ 'include/capi/cef_dialog_handler_capi.h',
+ 'include/capi/cef_display_handler_capi.h',
+ 'include/capi/cef_dom_capi.h',
+ 'include/capi/cef_download_handler_capi.h',
+ 'include/capi/cef_download_item_capi.h',
+ 'include/capi/cef_drag_data_capi.h',
+ 'include/capi/cef_drag_handler_capi.h',
+ 'include/capi/cef_extension_capi.h',
+ 'include/capi/cef_extension_handler_capi.h',
+ 'include/capi/cef_file_util_capi.h',
+ 'include/capi/cef_find_handler_capi.h',
+ 'include/capi/cef_focus_handler_capi.h',
+ 'include/capi/cef_frame_capi.h',
+ 'include/capi/cef_image_capi.h',
+ 'include/capi/cef_jsdialog_handler_capi.h',
+ 'include/capi/cef_keyboard_handler_capi.h',
+ 'include/capi/cef_life_span_handler_capi.h',
+ 'include/capi/cef_load_handler_capi.h',
+ 'include/capi/cef_media_router_capi.h',
+ 'include/capi/cef_menu_model_capi.h',
+ 'include/capi/cef_menu_model_delegate_capi.h',
+ 'include/capi/cef_navigation_entry_capi.h',
+ 'include/capi/cef_origin_whitelist_capi.h',
+ 'include/capi/cef_parser_capi.h',
+ 'include/capi/cef_path_util_capi.h',
+ 'include/capi/cef_print_handler_capi.h',
+ 'include/capi/cef_print_settings_capi.h',
+ 'include/capi/cef_process_message_capi.h',
+ 'include/capi/cef_process_util_capi.h',
+ 'include/capi/cef_registration_capi.h',
+ 'include/capi/cef_render_handler_capi.h',
+ 'include/capi/cef_render_process_handler_capi.h',
+ 'include/capi/cef_request_capi.h',
+ 'include/capi/cef_request_callback_capi.h',
+ 'include/capi/cef_request_context_capi.h',
+ 'include/capi/cef_request_context_handler_capi.h',
+ 'include/capi/cef_request_handler_capi.h',
+ 'include/capi/cef_resource_bundle_capi.h',
+ 'include/capi/cef_resource_bundle_handler_capi.h',
+ 'include/capi/cef_resource_handler_capi.h',
+ 'include/capi/cef_resource_request_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_server_capi.h',
+ 'include/capi/cef_ssl_info_capi.h',
+ 'include/capi/cef_ssl_status_capi.h',
+ 'include/capi/cef_stream_capi.h',
+ 'include/capi/cef_string_visitor_capi.h',
+ 'include/capi/cef_task_capi.h',
+ 'include/capi/cef_thread_capi.h',
+ 'include/capi/cef_trace_capi.h',
+ 'include/capi/cef_urlrequest_capi.h',
+ 'include/capi/cef_v8_capi.h',
+ 'include/capi/cef_values_capi.h',
+ 'include/capi/cef_waitable_event_capi.h',
+ 'include/capi/cef_web_plugin_capi.h',
+ 'include/capi/cef_x509_certificate_capi.h',
+ 'include/capi/cef_xml_reader_capi.h',
+ 'include/capi/cef_zip_reader_capi.h',
+ 'include/capi/test/cef_test_helpers_capi.h',
+ 'include/capi/test/cef_translator_test_capi.h',
+ 'include/capi/views/cef_box_layout_capi.h',
+ 'include/capi/views/cef_browser_view_capi.h',
+ 'include/capi/views/cef_browser_view_delegate_capi.h',
+ 'include/capi/views/cef_button_capi.h',
+ 'include/capi/views/cef_button_delegate_capi.h',
+ 'include/capi/views/cef_display_capi.h',
+ 'include/capi/views/cef_fill_layout_capi.h',
+ 'include/capi/views/cef_label_button_capi.h',
+ 'include/capi/views/cef_layout_capi.h',
+ 'include/capi/views/cef_menu_button_capi.h',
+ 'include/capi/views/cef_menu_button_delegate_capi.h',
+ 'include/capi/views/cef_panel_capi.h',
+ 'include/capi/views/cef_panel_delegate_capi.h',
+ 'include/capi/views/cef_scroll_view_capi.h',
+ 'include/capi/views/cef_textfield_capi.h',
+ 'include/capi/views/cef_textfield_delegate_capi.h',
+ 'include/capi/views/cef_view_capi.h',
+ 'include/capi/views/cef_view_delegate_capi.h',
+ 'include/capi/views/cef_window_capi.h',
+ 'include/capi/views/cef_window_delegate_capi.h',
+ ],
+ 'autogen_library_side': [
+ 'libcef_dll/ctocpp/accessibility_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/accessibility_handler_ctocpp.h',
+ 'libcef_dll/ctocpp/app_ctocpp.cc',
+ 'libcef_dll/ctocpp/app_ctocpp.h',
+ 'libcef_dll/ctocpp/audio_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/audio_handler_ctocpp.h',
+ 'libcef_dll/cpptoc/auth_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/auth_callback_cpptoc.h',
+ 'libcef_dll/cpptoc/before_download_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/before_download_callback_cpptoc.h',
+ 'libcef_dll/cpptoc/binary_value_cpptoc.cc',
+ 'libcef_dll/cpptoc/binary_value_cpptoc.h',
+ 'libcef_dll/cpptoc/views/box_layout_cpptoc.cc',
+ 'libcef_dll/cpptoc/views/box_layout_cpptoc.h',
+ 'libcef_dll/cpptoc/browser_cpptoc.cc',
+ 'libcef_dll/cpptoc/browser_cpptoc.h',
+ 'libcef_dll/cpptoc/browser_host_cpptoc.cc',
+ 'libcef_dll/cpptoc/browser_host_cpptoc.h',
+ 'libcef_dll/ctocpp/browser_process_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/browser_process_handler_ctocpp.h',
+ 'libcef_dll/cpptoc/views/browser_view_cpptoc.cc',
+ 'libcef_dll/cpptoc/views/browser_view_cpptoc.h',
+ 'libcef_dll/ctocpp/views/browser_view_delegate_ctocpp.cc',
+ 'libcef_dll/ctocpp/views/browser_view_delegate_ctocpp.h',
+ 'libcef_dll/cpptoc/views/button_cpptoc.cc',
+ 'libcef_dll/cpptoc/views/button_cpptoc.h',
+ 'libcef_dll/ctocpp/views/button_delegate_ctocpp.cc',
+ 'libcef_dll/ctocpp/views/button_delegate_ctocpp.h',
+ 'libcef_dll/cpptoc/callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/callback_cpptoc.h',
+ 'libcef_dll/ctocpp/client_ctocpp.cc',
+ 'libcef_dll/ctocpp/client_ctocpp.h',
+ 'libcef_dll/cpptoc/command_line_cpptoc.cc',
+ 'libcef_dll/cpptoc/command_line_cpptoc.h',
+ 'libcef_dll/ctocpp/completion_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/completion_callback_ctocpp.h',
+ 'libcef_dll/ctocpp/context_menu_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/context_menu_handler_ctocpp.h',
+ 'libcef_dll/cpptoc/context_menu_params_cpptoc.cc',
+ 'libcef_dll/cpptoc/context_menu_params_cpptoc.h',
+ 'libcef_dll/ctocpp/cookie_access_filter_ctocpp.cc',
+ 'libcef_dll/ctocpp/cookie_access_filter_ctocpp.h',
+ 'libcef_dll/cpptoc/cookie_manager_cpptoc.cc',
+ 'libcef_dll/cpptoc/cookie_manager_cpptoc.h',
+ 'libcef_dll/ctocpp/cookie_visitor_ctocpp.cc',
+ 'libcef_dll/ctocpp/cookie_visitor_ctocpp.h',
+ 'libcef_dll/cpptoc/domdocument_cpptoc.cc',
+ 'libcef_dll/cpptoc/domdocument_cpptoc.h',
+ 'libcef_dll/cpptoc/domnode_cpptoc.cc',
+ 'libcef_dll/cpptoc/domnode_cpptoc.h',
+ 'libcef_dll/ctocpp/domvisitor_ctocpp.cc',
+ 'libcef_dll/ctocpp/domvisitor_ctocpp.h',
+ 'libcef_dll/ctocpp/delete_cookies_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/delete_cookies_callback_ctocpp.h',
+ 'libcef_dll/ctocpp/dev_tools_message_observer_ctocpp.cc',
+ 'libcef_dll/ctocpp/dev_tools_message_observer_ctocpp.h',
+ 'libcef_dll/ctocpp/dialog_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/dialog_handler_ctocpp.h',
+ 'libcef_dll/cpptoc/dictionary_value_cpptoc.cc',
+ 'libcef_dll/cpptoc/dictionary_value_cpptoc.h',
+ 'libcef_dll/cpptoc/views/display_cpptoc.cc',
+ 'libcef_dll/cpptoc/views/display_cpptoc.h',
+ 'libcef_dll/ctocpp/display_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/display_handler_ctocpp.h',
+ 'libcef_dll/ctocpp/download_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/download_handler_ctocpp.h',
+ 'libcef_dll/ctocpp/download_image_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/download_image_callback_ctocpp.h',
+ 'libcef_dll/cpptoc/download_item_cpptoc.cc',
+ 'libcef_dll/cpptoc/download_item_cpptoc.h',
+ 'libcef_dll/cpptoc/download_item_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/download_item_callback_cpptoc.h',
+ 'libcef_dll/cpptoc/drag_data_cpptoc.cc',
+ 'libcef_dll/cpptoc/drag_data_cpptoc.h',
+ 'libcef_dll/ctocpp/drag_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/drag_handler_ctocpp.h',
+ 'libcef_dll/ctocpp/end_tracing_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/end_tracing_callback_ctocpp.h',
+ 'libcef_dll/cpptoc/extension_cpptoc.cc',
+ 'libcef_dll/cpptoc/extension_cpptoc.h',
+ 'libcef_dll/ctocpp/extension_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/extension_handler_ctocpp.h',
+ 'libcef_dll/cpptoc/file_dialog_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/file_dialog_callback_cpptoc.h',
+ 'libcef_dll/cpptoc/views/fill_layout_cpptoc.cc',
+ 'libcef_dll/cpptoc/views/fill_layout_cpptoc.h',
+ 'libcef_dll/ctocpp/find_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/find_handler_ctocpp.h',
+ 'libcef_dll/ctocpp/focus_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/focus_handler_ctocpp.h',
+ 'libcef_dll/cpptoc/frame_cpptoc.cc',
+ 'libcef_dll/cpptoc/frame_cpptoc.h',
+ 'libcef_dll/cpptoc/get_extension_resource_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/get_extension_resource_callback_cpptoc.h',
+ 'libcef_dll/cpptoc/image_cpptoc.cc',
+ 'libcef_dll/cpptoc/image_cpptoc.h',
+ 'libcef_dll/cpptoc/jsdialog_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/jsdialog_callback_cpptoc.h',
+ 'libcef_dll/ctocpp/jsdialog_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/jsdialog_handler_ctocpp.h',
+ 'libcef_dll/ctocpp/keyboard_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/keyboard_handler_ctocpp.h',
+ 'libcef_dll/cpptoc/views/label_button_cpptoc.cc',
+ 'libcef_dll/cpptoc/views/label_button_cpptoc.h',
+ 'libcef_dll/cpptoc/views/layout_cpptoc.cc',
+ 'libcef_dll/cpptoc/views/layout_cpptoc.h',
+ 'libcef_dll/ctocpp/life_span_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/life_span_handler_ctocpp.h',
+ 'libcef_dll/cpptoc/list_value_cpptoc.cc',
+ 'libcef_dll/cpptoc/list_value_cpptoc.h',
+ 'libcef_dll/ctocpp/load_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/load_handler_ctocpp.h',
+ 'libcef_dll/ctocpp/media_observer_ctocpp.cc',
+ 'libcef_dll/ctocpp/media_observer_ctocpp.h',
+ 'libcef_dll/cpptoc/media_route_cpptoc.cc',
+ 'libcef_dll/cpptoc/media_route_cpptoc.h',
+ 'libcef_dll/ctocpp/media_route_create_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/media_route_create_callback_ctocpp.h',
+ 'libcef_dll/cpptoc/media_router_cpptoc.cc',
+ 'libcef_dll/cpptoc/media_router_cpptoc.h',
+ 'libcef_dll/cpptoc/media_sink_cpptoc.cc',
+ 'libcef_dll/cpptoc/media_sink_cpptoc.h',
+ 'libcef_dll/ctocpp/media_sink_device_info_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/media_sink_device_info_callback_ctocpp.h',
+ 'libcef_dll/cpptoc/media_source_cpptoc.cc',
+ 'libcef_dll/cpptoc/media_source_cpptoc.h',
+ 'libcef_dll/cpptoc/views/menu_button_cpptoc.cc',
+ 'libcef_dll/cpptoc/views/menu_button_cpptoc.h',
+ 'libcef_dll/ctocpp/views/menu_button_delegate_ctocpp.cc',
+ 'libcef_dll/ctocpp/views/menu_button_delegate_ctocpp.h',
+ 'libcef_dll/cpptoc/views/menu_button_pressed_lock_cpptoc.cc',
+ 'libcef_dll/cpptoc/views/menu_button_pressed_lock_cpptoc.h',
+ 'libcef_dll/cpptoc/menu_model_cpptoc.cc',
+ 'libcef_dll/cpptoc/menu_model_cpptoc.h',
+ 'libcef_dll/ctocpp/menu_model_delegate_ctocpp.cc',
+ 'libcef_dll/ctocpp/menu_model_delegate_ctocpp.h',
+ 'libcef_dll/cpptoc/navigation_entry_cpptoc.cc',
+ 'libcef_dll/cpptoc/navigation_entry_cpptoc.h',
+ 'libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.cc',
+ 'libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.h',
+ 'libcef_dll/cpptoc/views/panel_cpptoc.cc',
+ 'libcef_dll/cpptoc/views/panel_cpptoc.h',
+ 'libcef_dll/ctocpp/views/panel_delegate_ctocpp.cc',
+ 'libcef_dll/ctocpp/views/panel_delegate_ctocpp.h',
+ 'libcef_dll/ctocpp/pdf_print_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/pdf_print_callback_ctocpp.h',
+ 'libcef_dll/cpptoc/post_data_cpptoc.cc',
+ 'libcef_dll/cpptoc/post_data_cpptoc.h',
+ 'libcef_dll/cpptoc/post_data_element_cpptoc.cc',
+ 'libcef_dll/cpptoc/post_data_element_cpptoc.h',
+ 'libcef_dll/cpptoc/print_dialog_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/print_dialog_callback_cpptoc.h',
+ 'libcef_dll/ctocpp/print_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/print_handler_ctocpp.h',
+ 'libcef_dll/cpptoc/print_job_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/print_job_callback_cpptoc.h',
+ 'libcef_dll/cpptoc/print_settings_cpptoc.cc',
+ 'libcef_dll/cpptoc/print_settings_cpptoc.h',
+ 'libcef_dll/cpptoc/process_message_cpptoc.cc',
+ 'libcef_dll/cpptoc/process_message_cpptoc.h',
+ 'libcef_dll/ctocpp/read_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/read_handler_ctocpp.h',
+ 'libcef_dll/ctocpp/register_cdm_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/register_cdm_callback_ctocpp.h',
+ 'libcef_dll/cpptoc/registration_cpptoc.cc',
+ 'libcef_dll/cpptoc/registration_cpptoc.h',
+ 'libcef_dll/ctocpp/render_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/render_handler_ctocpp.h',
+ 'libcef_dll/ctocpp/render_process_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/render_process_handler_ctocpp.h',
+ 'libcef_dll/cpptoc/request_cpptoc.cc',
+ 'libcef_dll/cpptoc/request_cpptoc.h',
+ 'libcef_dll/cpptoc/request_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/request_callback_cpptoc.h',
+ 'libcef_dll/cpptoc/request_context_cpptoc.cc',
+ 'libcef_dll/cpptoc/request_context_cpptoc.h',
+ 'libcef_dll/ctocpp/request_context_handler_ctocpp.cc',
+ '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',
+ 'libcef_dll/ctocpp/resource_bundle_handler_ctocpp.h',
+ 'libcef_dll/ctocpp/resource_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/resource_handler_ctocpp.h',
+ 'libcef_dll/cpptoc/resource_read_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/resource_read_callback_cpptoc.h',
+ 'libcef_dll/ctocpp/resource_request_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/resource_request_handler_ctocpp.h',
+ 'libcef_dll/cpptoc/resource_skip_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/resource_skip_callback_cpptoc.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',
+ 'libcef_dll/ctocpp/run_file_dialog_callback_ctocpp.h',
+ 'libcef_dll/cpptoc/sslinfo_cpptoc.cc',
+ 'libcef_dll/cpptoc/sslinfo_cpptoc.h',
+ 'libcef_dll/cpptoc/sslstatus_cpptoc.cc',
+ 'libcef_dll/cpptoc/sslstatus_cpptoc.h',
+ 'libcef_dll/ctocpp/scheme_handler_factory_ctocpp.cc',
+ 'libcef_dll/ctocpp/scheme_handler_factory_ctocpp.h',
+ 'libcef_dll/cpptoc/scheme_registrar_cpptoc.cc',
+ 'libcef_dll/cpptoc/scheme_registrar_cpptoc.h',
+ 'libcef_dll/cpptoc/views/scroll_view_cpptoc.cc',
+ 'libcef_dll/cpptoc/views/scroll_view_cpptoc.h',
+ 'libcef_dll/cpptoc/select_client_certificate_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/select_client_certificate_callback_cpptoc.h',
+ 'libcef_dll/cpptoc/server_cpptoc.cc',
+ 'libcef_dll/cpptoc/server_cpptoc.h',
+ 'libcef_dll/ctocpp/server_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/server_handler_ctocpp.h',
+ 'libcef_dll/ctocpp/set_cookie_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/set_cookie_callback_ctocpp.h',
+ 'libcef_dll/cpptoc/stream_reader_cpptoc.cc',
+ 'libcef_dll/cpptoc/stream_reader_cpptoc.h',
+ 'libcef_dll/cpptoc/stream_writer_cpptoc.cc',
+ 'libcef_dll/cpptoc/stream_writer_cpptoc.h',
+ 'libcef_dll/ctocpp/string_visitor_ctocpp.cc',
+ 'libcef_dll/ctocpp/string_visitor_ctocpp.h',
+ 'libcef_dll/ctocpp/task_ctocpp.cc',
+ 'libcef_dll/ctocpp/task_ctocpp.h',
+ 'libcef_dll/cpptoc/task_runner_cpptoc.cc',
+ 'libcef_dll/cpptoc/task_runner_cpptoc.h',
+ 'libcef_dll/cpptoc/views/textfield_cpptoc.cc',
+ 'libcef_dll/cpptoc/views/textfield_cpptoc.h',
+ 'libcef_dll/ctocpp/views/textfield_delegate_ctocpp.cc',
+ 'libcef_dll/ctocpp/views/textfield_delegate_ctocpp.h',
+ 'libcef_dll/cpptoc/thread_cpptoc.cc',
+ 'libcef_dll/cpptoc/thread_cpptoc.h',
+ 'libcef_dll/cpptoc/test/translator_test_cpptoc.cc',
+ 'libcef_dll/cpptoc/test/translator_test_cpptoc.h',
+ 'libcef_dll/ctocpp/test/translator_test_ref_ptr_client_ctocpp.cc',
+ 'libcef_dll/ctocpp/test/translator_test_ref_ptr_client_ctocpp.h',
+ 'libcef_dll/ctocpp/test/translator_test_ref_ptr_client_child_ctocpp.cc',
+ 'libcef_dll/ctocpp/test/translator_test_ref_ptr_client_child_ctocpp.h',
+ 'libcef_dll/cpptoc/test/translator_test_ref_ptr_library_cpptoc.cc',
+ 'libcef_dll/cpptoc/test/translator_test_ref_ptr_library_cpptoc.h',
+ 'libcef_dll/cpptoc/test/translator_test_ref_ptr_library_child_cpptoc.cc',
+ 'libcef_dll/cpptoc/test/translator_test_ref_ptr_library_child_cpptoc.h',
+ 'libcef_dll/cpptoc/test/translator_test_ref_ptr_library_child_child_cpptoc.cc',
+ 'libcef_dll/cpptoc/test/translator_test_ref_ptr_library_child_child_cpptoc.h',
+ 'libcef_dll/ctocpp/test/translator_test_scoped_client_ctocpp.cc',
+ 'libcef_dll/ctocpp/test/translator_test_scoped_client_ctocpp.h',
+ 'libcef_dll/ctocpp/test/translator_test_scoped_client_child_ctocpp.cc',
+ 'libcef_dll/ctocpp/test/translator_test_scoped_client_child_ctocpp.h',
+ 'libcef_dll/cpptoc/test/translator_test_scoped_library_cpptoc.cc',
+ 'libcef_dll/cpptoc/test/translator_test_scoped_library_cpptoc.h',
+ 'libcef_dll/cpptoc/test/translator_test_scoped_library_child_cpptoc.cc',
+ 'libcef_dll/cpptoc/test/translator_test_scoped_library_child_cpptoc.h',
+ 'libcef_dll/cpptoc/test/translator_test_scoped_library_child_child_cpptoc.cc',
+ 'libcef_dll/cpptoc/test/translator_test_scoped_library_child_child_cpptoc.h',
+ 'libcef_dll/cpptoc/urlrequest_cpptoc.cc',
+ 'libcef_dll/cpptoc/urlrequest_cpptoc.h',
+ 'libcef_dll/ctocpp/urlrequest_client_ctocpp.cc',
+ 'libcef_dll/ctocpp/urlrequest_client_ctocpp.h',
+ 'libcef_dll/ctocpp/v8accessor_ctocpp.cc',
+ 'libcef_dll/ctocpp/v8accessor_ctocpp.h',
+ 'libcef_dll/ctocpp/v8array_buffer_release_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/v8array_buffer_release_callback_ctocpp.h',
+ 'libcef_dll/cpptoc/v8context_cpptoc.cc',
+ 'libcef_dll/cpptoc/v8context_cpptoc.h',
+ 'libcef_dll/cpptoc/v8exception_cpptoc.cc',
+ 'libcef_dll/cpptoc/v8exception_cpptoc.h',
+ 'libcef_dll/ctocpp/v8handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/v8handler_ctocpp.h',
+ 'libcef_dll/ctocpp/v8interceptor_ctocpp.cc',
+ 'libcef_dll/ctocpp/v8interceptor_ctocpp.h',
+ 'libcef_dll/cpptoc/v8stack_frame_cpptoc.cc',
+ 'libcef_dll/cpptoc/v8stack_frame_cpptoc.h',
+ 'libcef_dll/cpptoc/v8stack_trace_cpptoc.cc',
+ 'libcef_dll/cpptoc/v8stack_trace_cpptoc.h',
+ 'libcef_dll/cpptoc/v8value_cpptoc.cc',
+ 'libcef_dll/cpptoc/v8value_cpptoc.h',
+ 'libcef_dll/cpptoc/value_cpptoc.cc',
+ 'libcef_dll/cpptoc/value_cpptoc.h',
+ 'libcef_dll/cpptoc/views/view_cpptoc.cc',
+ 'libcef_dll/cpptoc/views/view_cpptoc.h',
+ 'libcef_dll/ctocpp/views/view_delegate_ctocpp.cc',
+ 'libcef_dll/ctocpp/views/view_delegate_ctocpp.h',
+ 'libcef_dll/cpptoc/waitable_event_cpptoc.cc',
+ 'libcef_dll/cpptoc/waitable_event_cpptoc.h',
+ 'libcef_dll/cpptoc/web_plugin_info_cpptoc.cc',
+ 'libcef_dll/cpptoc/web_plugin_info_cpptoc.h',
+ 'libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.cc',
+ 'libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.h',
+ 'libcef_dll/ctocpp/web_plugin_unstable_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/web_plugin_unstable_callback_ctocpp.h',
+ 'libcef_dll/cpptoc/views/window_cpptoc.cc',
+ 'libcef_dll/cpptoc/views/window_cpptoc.h',
+ 'libcef_dll/ctocpp/views/window_delegate_ctocpp.cc',
+ 'libcef_dll/ctocpp/views/window_delegate_ctocpp.h',
+ 'libcef_dll/ctocpp/write_handler_ctocpp.cc',
+ 'libcef_dll/ctocpp/write_handler_ctocpp.h',
+ 'libcef_dll/cpptoc/x509cert_principal_cpptoc.cc',
+ 'libcef_dll/cpptoc/x509cert_principal_cpptoc.h',
+ 'libcef_dll/cpptoc/x509certificate_cpptoc.cc',
+ 'libcef_dll/cpptoc/x509certificate_cpptoc.h',
+ 'libcef_dll/cpptoc/xml_reader_cpptoc.cc',
+ 'libcef_dll/cpptoc/xml_reader_cpptoc.h',
+ 'libcef_dll/cpptoc/zip_reader_cpptoc.cc',
+ 'libcef_dll/cpptoc/zip_reader_cpptoc.h',
+ ],
+ 'autogen_client_side': [
+ 'libcef_dll/cpptoc/accessibility_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/accessibility_handler_cpptoc.h',
+ 'libcef_dll/cpptoc/app_cpptoc.cc',
+ 'libcef_dll/cpptoc/app_cpptoc.h',
+ 'libcef_dll/cpptoc/audio_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/audio_handler_cpptoc.h',
+ 'libcef_dll/ctocpp/auth_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/auth_callback_ctocpp.h',
+ 'libcef_dll/ctocpp/before_download_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/before_download_callback_ctocpp.h',
+ 'libcef_dll/ctocpp/binary_value_ctocpp.cc',
+ 'libcef_dll/ctocpp/binary_value_ctocpp.h',
+ 'libcef_dll/ctocpp/views/box_layout_ctocpp.cc',
+ 'libcef_dll/ctocpp/views/box_layout_ctocpp.h',
+ 'libcef_dll/ctocpp/browser_ctocpp.cc',
+ 'libcef_dll/ctocpp/browser_ctocpp.h',
+ 'libcef_dll/ctocpp/browser_host_ctocpp.cc',
+ 'libcef_dll/ctocpp/browser_host_ctocpp.h',
+ 'libcef_dll/cpptoc/browser_process_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/browser_process_handler_cpptoc.h',
+ 'libcef_dll/ctocpp/views/browser_view_ctocpp.cc',
+ 'libcef_dll/ctocpp/views/browser_view_ctocpp.h',
+ 'libcef_dll/cpptoc/views/browser_view_delegate_cpptoc.cc',
+ 'libcef_dll/cpptoc/views/browser_view_delegate_cpptoc.h',
+ 'libcef_dll/ctocpp/views/button_ctocpp.cc',
+ 'libcef_dll/ctocpp/views/button_ctocpp.h',
+ 'libcef_dll/cpptoc/views/button_delegate_cpptoc.cc',
+ 'libcef_dll/cpptoc/views/button_delegate_cpptoc.h',
+ 'libcef_dll/ctocpp/callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/callback_ctocpp.h',
+ 'libcef_dll/cpptoc/client_cpptoc.cc',
+ 'libcef_dll/cpptoc/client_cpptoc.h',
+ 'libcef_dll/ctocpp/command_line_ctocpp.cc',
+ 'libcef_dll/ctocpp/command_line_ctocpp.h',
+ 'libcef_dll/cpptoc/completion_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/completion_callback_cpptoc.h',
+ 'libcef_dll/cpptoc/context_menu_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/context_menu_handler_cpptoc.h',
+ 'libcef_dll/ctocpp/context_menu_params_ctocpp.cc',
+ 'libcef_dll/ctocpp/context_menu_params_ctocpp.h',
+ 'libcef_dll/cpptoc/cookie_access_filter_cpptoc.cc',
+ 'libcef_dll/cpptoc/cookie_access_filter_cpptoc.h',
+ 'libcef_dll/ctocpp/cookie_manager_ctocpp.cc',
+ 'libcef_dll/ctocpp/cookie_manager_ctocpp.h',
+ 'libcef_dll/cpptoc/cookie_visitor_cpptoc.cc',
+ 'libcef_dll/cpptoc/cookie_visitor_cpptoc.h',
+ 'libcef_dll/ctocpp/domdocument_ctocpp.cc',
+ 'libcef_dll/ctocpp/domdocument_ctocpp.h',
+ 'libcef_dll/ctocpp/domnode_ctocpp.cc',
+ 'libcef_dll/ctocpp/domnode_ctocpp.h',
+ 'libcef_dll/cpptoc/domvisitor_cpptoc.cc',
+ 'libcef_dll/cpptoc/domvisitor_cpptoc.h',
+ 'libcef_dll/cpptoc/delete_cookies_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/delete_cookies_callback_cpptoc.h',
+ 'libcef_dll/cpptoc/dev_tools_message_observer_cpptoc.cc',
+ 'libcef_dll/cpptoc/dev_tools_message_observer_cpptoc.h',
+ 'libcef_dll/cpptoc/dialog_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/dialog_handler_cpptoc.h',
+ 'libcef_dll/ctocpp/dictionary_value_ctocpp.cc',
+ 'libcef_dll/ctocpp/dictionary_value_ctocpp.h',
+ 'libcef_dll/ctocpp/views/display_ctocpp.cc',
+ 'libcef_dll/ctocpp/views/display_ctocpp.h',
+ 'libcef_dll/cpptoc/display_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/display_handler_cpptoc.h',
+ 'libcef_dll/cpptoc/download_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/download_handler_cpptoc.h',
+ 'libcef_dll/cpptoc/download_image_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/download_image_callback_cpptoc.h',
+ 'libcef_dll/ctocpp/download_item_ctocpp.cc',
+ 'libcef_dll/ctocpp/download_item_ctocpp.h',
+ 'libcef_dll/ctocpp/download_item_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/download_item_callback_ctocpp.h',
+ 'libcef_dll/ctocpp/drag_data_ctocpp.cc',
+ 'libcef_dll/ctocpp/drag_data_ctocpp.h',
+ 'libcef_dll/cpptoc/drag_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/drag_handler_cpptoc.h',
+ 'libcef_dll/cpptoc/end_tracing_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/end_tracing_callback_cpptoc.h',
+ 'libcef_dll/ctocpp/extension_ctocpp.cc',
+ 'libcef_dll/ctocpp/extension_ctocpp.h',
+ 'libcef_dll/cpptoc/extension_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/extension_handler_cpptoc.h',
+ 'libcef_dll/ctocpp/file_dialog_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/file_dialog_callback_ctocpp.h',
+ 'libcef_dll/ctocpp/views/fill_layout_ctocpp.cc',
+ 'libcef_dll/ctocpp/views/fill_layout_ctocpp.h',
+ 'libcef_dll/cpptoc/find_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/find_handler_cpptoc.h',
+ 'libcef_dll/cpptoc/focus_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/focus_handler_cpptoc.h',
+ 'libcef_dll/ctocpp/frame_ctocpp.cc',
+ 'libcef_dll/ctocpp/frame_ctocpp.h',
+ 'libcef_dll/ctocpp/get_extension_resource_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/get_extension_resource_callback_ctocpp.h',
+ 'libcef_dll/ctocpp/image_ctocpp.cc',
+ 'libcef_dll/ctocpp/image_ctocpp.h',
+ 'libcef_dll/ctocpp/jsdialog_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/jsdialog_callback_ctocpp.h',
+ 'libcef_dll/cpptoc/jsdialog_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/jsdialog_handler_cpptoc.h',
+ 'libcef_dll/cpptoc/keyboard_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/keyboard_handler_cpptoc.h',
+ 'libcef_dll/ctocpp/views/label_button_ctocpp.cc',
+ 'libcef_dll/ctocpp/views/label_button_ctocpp.h',
+ 'libcef_dll/ctocpp/views/layout_ctocpp.cc',
+ 'libcef_dll/ctocpp/views/layout_ctocpp.h',
+ 'libcef_dll/cpptoc/life_span_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/life_span_handler_cpptoc.h',
+ 'libcef_dll/ctocpp/list_value_ctocpp.cc',
+ 'libcef_dll/ctocpp/list_value_ctocpp.h',
+ 'libcef_dll/cpptoc/load_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/load_handler_cpptoc.h',
+ 'libcef_dll/cpptoc/media_observer_cpptoc.cc',
+ 'libcef_dll/cpptoc/media_observer_cpptoc.h',
+ 'libcef_dll/ctocpp/media_route_ctocpp.cc',
+ 'libcef_dll/ctocpp/media_route_ctocpp.h',
+ 'libcef_dll/cpptoc/media_route_create_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/media_route_create_callback_cpptoc.h',
+ 'libcef_dll/ctocpp/media_router_ctocpp.cc',
+ 'libcef_dll/ctocpp/media_router_ctocpp.h',
+ 'libcef_dll/ctocpp/media_sink_ctocpp.cc',
+ 'libcef_dll/ctocpp/media_sink_ctocpp.h',
+ 'libcef_dll/cpptoc/media_sink_device_info_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/media_sink_device_info_callback_cpptoc.h',
+ 'libcef_dll/ctocpp/media_source_ctocpp.cc',
+ 'libcef_dll/ctocpp/media_source_ctocpp.h',
+ 'libcef_dll/ctocpp/views/menu_button_ctocpp.cc',
+ 'libcef_dll/ctocpp/views/menu_button_ctocpp.h',
+ 'libcef_dll/cpptoc/views/menu_button_delegate_cpptoc.cc',
+ 'libcef_dll/cpptoc/views/menu_button_delegate_cpptoc.h',
+ 'libcef_dll/ctocpp/views/menu_button_pressed_lock_ctocpp.cc',
+ 'libcef_dll/ctocpp/views/menu_button_pressed_lock_ctocpp.h',
+ 'libcef_dll/ctocpp/menu_model_ctocpp.cc',
+ 'libcef_dll/ctocpp/menu_model_ctocpp.h',
+ 'libcef_dll/cpptoc/menu_model_delegate_cpptoc.cc',
+ 'libcef_dll/cpptoc/menu_model_delegate_cpptoc.h',
+ 'libcef_dll/ctocpp/navigation_entry_ctocpp.cc',
+ 'libcef_dll/ctocpp/navigation_entry_ctocpp.h',
+ 'libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.cc',
+ 'libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.h',
+ 'libcef_dll/ctocpp/views/panel_ctocpp.cc',
+ 'libcef_dll/ctocpp/views/panel_ctocpp.h',
+ 'libcef_dll/cpptoc/views/panel_delegate_cpptoc.cc',
+ 'libcef_dll/cpptoc/views/panel_delegate_cpptoc.h',
+ 'libcef_dll/cpptoc/pdf_print_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/pdf_print_callback_cpptoc.h',
+ 'libcef_dll/ctocpp/post_data_ctocpp.cc',
+ 'libcef_dll/ctocpp/post_data_ctocpp.h',
+ 'libcef_dll/ctocpp/post_data_element_ctocpp.cc',
+ 'libcef_dll/ctocpp/post_data_element_ctocpp.h',
+ 'libcef_dll/ctocpp/print_dialog_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/print_dialog_callback_ctocpp.h',
+ 'libcef_dll/cpptoc/print_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/print_handler_cpptoc.h',
+ 'libcef_dll/ctocpp/print_job_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/print_job_callback_ctocpp.h',
+ 'libcef_dll/ctocpp/print_settings_ctocpp.cc',
+ 'libcef_dll/ctocpp/print_settings_ctocpp.h',
+ 'libcef_dll/ctocpp/process_message_ctocpp.cc',
+ 'libcef_dll/ctocpp/process_message_ctocpp.h',
+ 'libcef_dll/cpptoc/read_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/read_handler_cpptoc.h',
+ 'libcef_dll/cpptoc/register_cdm_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/register_cdm_callback_cpptoc.h',
+ 'libcef_dll/ctocpp/registration_ctocpp.cc',
+ 'libcef_dll/ctocpp/registration_ctocpp.h',
+ 'libcef_dll/cpptoc/render_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/render_handler_cpptoc.h',
+ 'libcef_dll/cpptoc/render_process_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/render_process_handler_cpptoc.h',
+ 'libcef_dll/ctocpp/request_ctocpp.cc',
+ 'libcef_dll/ctocpp/request_ctocpp.h',
+ 'libcef_dll/ctocpp/request_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/request_callback_ctocpp.h',
+ 'libcef_dll/ctocpp/request_context_ctocpp.cc',
+ 'libcef_dll/ctocpp/request_context_ctocpp.h',
+ 'libcef_dll/cpptoc/request_context_handler_cpptoc.cc',
+ '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',
+ 'libcef_dll/cpptoc/resource_bundle_handler_cpptoc.h',
+ 'libcef_dll/cpptoc/resource_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/resource_handler_cpptoc.h',
+ 'libcef_dll/ctocpp/resource_read_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/resource_read_callback_ctocpp.h',
+ 'libcef_dll/cpptoc/resource_request_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/resource_request_handler_cpptoc.h',
+ 'libcef_dll/ctocpp/resource_skip_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/resource_skip_callback_ctocpp.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',
+ 'libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.h',
+ 'libcef_dll/ctocpp/sslinfo_ctocpp.cc',
+ 'libcef_dll/ctocpp/sslinfo_ctocpp.h',
+ 'libcef_dll/ctocpp/sslstatus_ctocpp.cc',
+ 'libcef_dll/ctocpp/sslstatus_ctocpp.h',
+ 'libcef_dll/cpptoc/scheme_handler_factory_cpptoc.cc',
+ 'libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h',
+ 'libcef_dll/ctocpp/scheme_registrar_ctocpp.cc',
+ 'libcef_dll/ctocpp/scheme_registrar_ctocpp.h',
+ 'libcef_dll/ctocpp/views/scroll_view_ctocpp.cc',
+ 'libcef_dll/ctocpp/views/scroll_view_ctocpp.h',
+ 'libcef_dll/ctocpp/select_client_certificate_callback_ctocpp.cc',
+ 'libcef_dll/ctocpp/select_client_certificate_callback_ctocpp.h',
+ 'libcef_dll/ctocpp/server_ctocpp.cc',
+ 'libcef_dll/ctocpp/server_ctocpp.h',
+ 'libcef_dll/cpptoc/server_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/server_handler_cpptoc.h',
+ 'libcef_dll/cpptoc/set_cookie_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/set_cookie_callback_cpptoc.h',
+ 'libcef_dll/ctocpp/stream_reader_ctocpp.cc',
+ 'libcef_dll/ctocpp/stream_reader_ctocpp.h',
+ 'libcef_dll/ctocpp/stream_writer_ctocpp.cc',
+ 'libcef_dll/ctocpp/stream_writer_ctocpp.h',
+ 'libcef_dll/cpptoc/string_visitor_cpptoc.cc',
+ 'libcef_dll/cpptoc/string_visitor_cpptoc.h',
+ 'libcef_dll/cpptoc/task_cpptoc.cc',
+ 'libcef_dll/cpptoc/task_cpptoc.h',
+ 'libcef_dll/ctocpp/task_runner_ctocpp.cc',
+ 'libcef_dll/ctocpp/task_runner_ctocpp.h',
+ 'libcef_dll/ctocpp/views/textfield_ctocpp.cc',
+ 'libcef_dll/ctocpp/views/textfield_ctocpp.h',
+ 'libcef_dll/cpptoc/views/textfield_delegate_cpptoc.cc',
+ 'libcef_dll/cpptoc/views/textfield_delegate_cpptoc.h',
+ 'libcef_dll/ctocpp/thread_ctocpp.cc',
+ 'libcef_dll/ctocpp/thread_ctocpp.h',
+ 'libcef_dll/ctocpp/test/translator_test_ctocpp.cc',
+ 'libcef_dll/ctocpp/test/translator_test_ctocpp.h',
+ 'libcef_dll/cpptoc/test/translator_test_ref_ptr_client_cpptoc.cc',
+ 'libcef_dll/cpptoc/test/translator_test_ref_ptr_client_cpptoc.h',
+ 'libcef_dll/cpptoc/test/translator_test_ref_ptr_client_child_cpptoc.cc',
+ 'libcef_dll/cpptoc/test/translator_test_ref_ptr_client_child_cpptoc.h',
+ 'libcef_dll/ctocpp/test/translator_test_ref_ptr_library_ctocpp.cc',
+ 'libcef_dll/ctocpp/test/translator_test_ref_ptr_library_ctocpp.h',
+ 'libcef_dll/ctocpp/test/translator_test_ref_ptr_library_child_ctocpp.cc',
+ 'libcef_dll/ctocpp/test/translator_test_ref_ptr_library_child_ctocpp.h',
+ 'libcef_dll/ctocpp/test/translator_test_ref_ptr_library_child_child_ctocpp.cc',
+ 'libcef_dll/ctocpp/test/translator_test_ref_ptr_library_child_child_ctocpp.h',
+ 'libcef_dll/cpptoc/test/translator_test_scoped_client_cpptoc.cc',
+ 'libcef_dll/cpptoc/test/translator_test_scoped_client_cpptoc.h',
+ 'libcef_dll/cpptoc/test/translator_test_scoped_client_child_cpptoc.cc',
+ 'libcef_dll/cpptoc/test/translator_test_scoped_client_child_cpptoc.h',
+ 'libcef_dll/ctocpp/test/translator_test_scoped_library_ctocpp.cc',
+ 'libcef_dll/ctocpp/test/translator_test_scoped_library_ctocpp.h',
+ 'libcef_dll/ctocpp/test/translator_test_scoped_library_child_ctocpp.cc',
+ 'libcef_dll/ctocpp/test/translator_test_scoped_library_child_ctocpp.h',
+ 'libcef_dll/ctocpp/test/translator_test_scoped_library_child_child_ctocpp.cc',
+ 'libcef_dll/ctocpp/test/translator_test_scoped_library_child_child_ctocpp.h',
+ 'libcef_dll/ctocpp/urlrequest_ctocpp.cc',
+ 'libcef_dll/ctocpp/urlrequest_ctocpp.h',
+ 'libcef_dll/cpptoc/urlrequest_client_cpptoc.cc',
+ 'libcef_dll/cpptoc/urlrequest_client_cpptoc.h',
+ 'libcef_dll/cpptoc/v8accessor_cpptoc.cc',
+ 'libcef_dll/cpptoc/v8accessor_cpptoc.h',
+ 'libcef_dll/cpptoc/v8array_buffer_release_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/v8array_buffer_release_callback_cpptoc.h',
+ 'libcef_dll/ctocpp/v8context_ctocpp.cc',
+ 'libcef_dll/ctocpp/v8context_ctocpp.h',
+ 'libcef_dll/ctocpp/v8exception_ctocpp.cc',
+ 'libcef_dll/ctocpp/v8exception_ctocpp.h',
+ 'libcef_dll/cpptoc/v8handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/v8handler_cpptoc.h',
+ 'libcef_dll/cpptoc/v8interceptor_cpptoc.cc',
+ 'libcef_dll/cpptoc/v8interceptor_cpptoc.h',
+ 'libcef_dll/ctocpp/v8stack_frame_ctocpp.cc',
+ 'libcef_dll/ctocpp/v8stack_frame_ctocpp.h',
+ 'libcef_dll/ctocpp/v8stack_trace_ctocpp.cc',
+ 'libcef_dll/ctocpp/v8stack_trace_ctocpp.h',
+ 'libcef_dll/ctocpp/v8value_ctocpp.cc',
+ 'libcef_dll/ctocpp/v8value_ctocpp.h',
+ 'libcef_dll/ctocpp/value_ctocpp.cc',
+ 'libcef_dll/ctocpp/value_ctocpp.h',
+ 'libcef_dll/ctocpp/views/view_ctocpp.cc',
+ 'libcef_dll/ctocpp/views/view_ctocpp.h',
+ 'libcef_dll/cpptoc/views/view_delegate_cpptoc.cc',
+ 'libcef_dll/cpptoc/views/view_delegate_cpptoc.h',
+ 'libcef_dll/ctocpp/waitable_event_ctocpp.cc',
+ 'libcef_dll/ctocpp/waitable_event_ctocpp.h',
+ 'libcef_dll/ctocpp/web_plugin_info_ctocpp.cc',
+ 'libcef_dll/ctocpp/web_plugin_info_ctocpp.h',
+ 'libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.cc',
+ 'libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.h',
+ 'libcef_dll/cpptoc/web_plugin_unstable_callback_cpptoc.cc',
+ 'libcef_dll/cpptoc/web_plugin_unstable_callback_cpptoc.h',
+ 'libcef_dll/ctocpp/views/window_ctocpp.cc',
+ 'libcef_dll/ctocpp/views/window_ctocpp.h',
+ 'libcef_dll/cpptoc/views/window_delegate_cpptoc.cc',
+ 'libcef_dll/cpptoc/views/window_delegate_cpptoc.h',
+ 'libcef_dll/cpptoc/write_handler_cpptoc.cc',
+ 'libcef_dll/cpptoc/write_handler_cpptoc.h',
+ 'libcef_dll/ctocpp/x509cert_principal_ctocpp.cc',
+ 'libcef_dll/ctocpp/x509cert_principal_ctocpp.h',
+ 'libcef_dll/ctocpp/x509certificate_ctocpp.cc',
+ 'libcef_dll/ctocpp/x509certificate_ctocpp.h',
+ 'libcef_dll/ctocpp/xml_reader_ctocpp.cc',
+ 'libcef_dll/ctocpp/xml_reader_ctocpp.h',
+ 'libcef_dll/ctocpp/zip_reader_ctocpp.cc',
+ 'libcef_dll/ctocpp/zip_reader_ctocpp.h',
+ ],
+ },
+}
diff --git a/src/cef_paths2.gypi b/src/cef_paths2.gypi
new file mode 100644
index 0000000..0d5d3c3
--- /dev/null
+++ b/src/cef_paths2.gypi
@@ -0,0 +1,610 @@
+# Copyright (c) 2011 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.
+
+{
+ 'variables': {
+ 'includes_common': [
+ 'include/base/cef_atomic_ref_count.h',
+ 'include/base/cef_atomicops.h',
+ 'include/base/cef_basictypes.h',
+ 'include/base/cef_bind.h',
+ 'include/base/cef_bind_helpers.h',
+ 'include/base/cef_build.h',
+ 'include/base/cef_callback.h',
+ 'include/base/cef_callback_forward.h',
+ 'include/base/cef_callback_helpers.h',
+ 'include/base/cef_callback_list.h',
+ 'include/base/cef_cancelable_callback.h',
+ 'include/base/cef_lock.h',
+ 'include/base/cef_logging.h',
+ 'include/base/cef_macros.h',
+ 'include/base/cef_move.h',
+ 'include/base/cef_platform_thread.h',
+ 'include/base/cef_ref_counted.h',
+ 'include/base/cef_scoped_ptr.h',
+ 'include/base/cef_string16.h',
+ 'include/base/cef_template_util.h',
+ 'include/base/cef_thread_checker.h',
+ 'include/base/cef_trace_event.h',
+ 'include/base/cef_tuple.h',
+ 'include/base/cef_weak_ptr.h',
+ 'include/base/internal/cef_bind_internal.h',
+ 'include/base/internal/cef_callback_internal.h',
+ 'include/base/internal/cef_lock_impl.h',
+ 'include/base/internal/cef_raw_scoped_refptr_mismatch_checker.h',
+ 'include/base/internal/cef_thread_checker_impl.h',
+ 'include/cef_api_hash.h',
+ 'include/cef_base.h',
+ 'include/cef_config.h',
+ 'include/cef_version.h',
+ 'include/internal/cef_export.h',
+ 'include/internal/cef_ptr.h',
+ 'include/internal/cef_string_wrappers.h',
+ 'include/internal/cef_types_wrappers.h',
+ ],
+ 'includes_common_capi': [
+ 'include/internal/cef_logging_internal.h',
+ 'include/internal/cef_string.h',
+ 'include/internal/cef_string_list.h',
+ 'include/internal/cef_string_map.h',
+ 'include/internal/cef_string_multimap.h',
+ 'include/internal/cef_string_types.h',
+ 'include/internal/cef_thread_internal.h',
+ 'include/internal/cef_time.h',
+ 'include/internal/cef_trace_event_internal.h',
+ 'include/internal/cef_types.h',
+ ],
+ 'includes_capi': [
+ 'include/capi/cef_base_capi.h',
+ ],
+ 'includes_wrapper': [
+ 'include/wrapper/cef_byte_read_handler.h',
+ 'include/wrapper/cef_closure_task.h',
+ 'include/wrapper/cef_helpers.h',
+ 'include/wrapper/cef_message_router.h',
+ 'include/wrapper/cef_resource_manager.h',
+ 'include/wrapper/cef_scoped_temp_dir.h',
+ 'include/wrapper/cef_stream_resource_handler.h',
+ 'include/wrapper/cef_xml_object.h',
+ 'include/wrapper/cef_zip_archive.h',
+ ],
+ 'includes_wrapper_mac': [
+ 'include/wrapper/cef_library_loader.h',
+ ],
+ 'includes_win': [
+ 'include/base/internal/cef_atomicops_arm64_msvc.h',
+ 'include/base/internal/cef_atomicops_x86_msvc.h',
+ 'include/base/internal/cef_bind_internal_win.h',
+ 'include/cef_sandbox_win.h',
+ 'include/internal/cef_win.h',
+ ],
+ 'includes_win_capi': [
+ 'include/internal/cef_types_win.h',
+ ],
+ 'includes_mac': [
+ 'include/base/internal/cef_atomicops_atomicword_compat.h',
+ 'include/base/internal/cef_atomicops_mac.h',
+ 'include/cef_application_mac.h',
+ 'include/cef_sandbox_mac.h',
+ 'include/internal/cef_mac.h',
+ ],
+ 'includes_mac_capi': [
+ 'include/internal/cef_types_mac.h',
+ ],
+ 'includes_linux': [
+ 'include/base/internal/cef_atomicops_atomicword_compat.h',
+ 'include/base/internal/cef_atomicops_arm_gcc.h',
+ 'include/base/internal/cef_atomicops_arm64_gcc.h',
+ 'include/base/internal/cef_atomicops_x86_gcc.h',
+ 'include/internal/cef_linux.h',
+ ],
+ 'includes_linux_capi': [
+ 'include/internal/cef_types_linux.h',
+ ],
+ 'libcef_sources_common': [
+ 'libcef_dll/cpptoc/cpptoc_ref_counted.h',
+ 'libcef_dll/cpptoc/cpptoc_scoped.h',
+ 'libcef_dll/ctocpp/base_ref_counted_ctocpp.cc',
+ 'libcef_dll/ctocpp/base_ref_counted_ctocpp.h',
+ 'libcef_dll/ctocpp/base_scoped_ctocpp.cc',
+ 'libcef_dll/ctocpp/base_scoped_ctocpp.h',
+ 'libcef_dll/ctocpp/ctocpp_ref_counted.h',
+ 'libcef_dll/ctocpp/ctocpp_scoped.h',
+ 'libcef_dll/libcef_dll.cc',
+ 'libcef_dll/libcef_dll2.cc',
+ 'libcef_dll/ptr_util.h',
+ 'libcef_dll/resource.h',
+ 'libcef_dll/shutdown_checker.cc',
+ 'libcef_dll/shutdown_checker.h',
+ 'libcef_dll/transfer_util.cc',
+ 'libcef_dll/transfer_util.h',
+ 'libcef_dll/wrapper_types.h',
+ ],
+ 'libcef_dll_wrapper_sources_base': [
+ 'libcef_dll/base/cef_atomicops_x86_gcc.cc',
+ 'libcef_dll/base/cef_bind_helpers.cc',
+ 'libcef_dll/base/cef_callback_helpers.cc',
+ 'libcef_dll/base/cef_callback_internal.cc',
+ 'libcef_dll/base/cef_lock.cc',
+ 'libcef_dll/base/cef_lock_impl.cc',
+ 'libcef_dll/base/cef_logging.cc',
+ 'libcef_dll/base/cef_ref_counted.cc',
+ 'libcef_dll/base/cef_string16.cc',
+ 'libcef_dll/base/cef_thread_checker_impl.cc',
+ 'libcef_dll/base/cef_weak_ptr.cc',
+ ],
+ 'libcef_dll_wrapper_sources_common': [
+ 'libcef_dll/cpptoc/base_ref_counted_cpptoc.cc',
+ 'libcef_dll/cpptoc/base_ref_counted_cpptoc.h',
+ 'libcef_dll/cpptoc/base_scoped_cpptoc.cc',
+ 'libcef_dll/cpptoc/base_scoped_cpptoc.h',
+ 'libcef_dll/cpptoc/cpptoc_ref_counted.h',
+ 'libcef_dll/cpptoc/cpptoc_scoped.h',
+ 'libcef_dll/ctocpp/ctocpp_ref_counted.h',
+ 'libcef_dll/ctocpp/ctocpp_scoped.h',
+ 'libcef_dll/ptr_util.h',
+ 'libcef_dll/shutdown_checker.cc',
+ 'libcef_dll/shutdown_checker.h',
+ 'libcef_dll/transfer_util.cc',
+ 'libcef_dll/transfer_util.h',
+ 'libcef_dll/wrapper_types.h',
+ 'libcef_dll/wrapper/cef_browser_info_map.h',
+ 'libcef_dll/wrapper/cef_byte_read_handler.cc',
+ 'libcef_dll/wrapper/cef_closure_task.cc',
+ 'libcef_dll/wrapper/cef_message_router.cc',
+ 'libcef_dll/wrapper/cef_resource_manager.cc',
+ 'libcef_dll/wrapper/cef_scoped_temp_dir.cc',
+ 'libcef_dll/wrapper/cef_stream_resource_handler.cc',
+ 'libcef_dll/wrapper/cef_xml_object.cc',
+ 'libcef_dll/wrapper/cef_zip_archive.cc',
+ 'libcef_dll/wrapper/libcef_dll_wrapper.cc',
+ 'libcef_dll/wrapper/libcef_dll_wrapper2.cc',
+ ],
+ 'libcef_dll_wrapper_sources_mac': [
+ 'libcef_dll/wrapper/cef_library_loader_mac.mm',
+ 'libcef_dll/wrapper/libcef_dll_dylib.cc',
+ ],
+ 'shared_sources_browser': [
+ 'tests/shared/browser/client_app_browser.cc',
+ 'tests/shared/browser/client_app_browser.h',
+ 'tests/shared/browser/extension_util.cc',
+ 'tests/shared/browser/extension_util.h',
+ 'tests/shared/browser/file_util.cc',
+ 'tests/shared/browser/file_util.h',
+ 'tests/shared/browser/geometry_util.cc',
+ 'tests/shared/browser/geometry_util.h',
+ 'tests/shared/browser/main_message_loop.cc',
+ 'tests/shared/browser/main_message_loop.h',
+ 'tests/shared/browser/main_message_loop_external_pump.cc',
+ 'tests/shared/browser/main_message_loop_external_pump.h',
+ 'tests/shared/browser/main_message_loop_std.cc',
+ 'tests/shared/browser/main_message_loop_std.h',
+ 'tests/shared/browser/resource_util.h',
+ ],
+ 'shared_sources_common': [
+ 'tests/shared/common/client_app.cc',
+ 'tests/shared/common/client_app.h',
+ 'tests/shared/common/client_app_other.cc',
+ 'tests/shared/common/client_app_other.h',
+ 'tests/shared/common/client_switches.cc',
+ 'tests/shared/common/client_switches.h',
+ ],
+ 'shared_sources_renderer': [
+ 'tests/shared/renderer/client_app_renderer.cc',
+ 'tests/shared/renderer/client_app_renderer.h',
+ ],
+ 'shared_sources_resources': [
+ 'tests/shared/resources/osr_test.html',
+ 'tests/shared/resources/pdf.html',
+ 'tests/shared/resources/pdf.pdf',
+ 'tests/shared/resources/window_icon.1x.png',
+ 'tests/shared/resources/window_icon.2x.png',
+ ],
+ 'shared_sources_linux': [
+ 'tests/shared/browser/main_message_loop_external_pump_linux.cc',
+ 'tests/shared/browser/resource_util_posix.cc',
+ ],
+ 'shared_sources_mac': [
+ 'tests/shared/browser/main_message_loop_external_pump_mac.mm',
+ 'tests/shared/browser/resource_util_mac.mm',
+ 'tests/shared/browser/resource_util_posix.cc',
+ ],
+ 'shared_sources_mac_helper': [
+ 'tests/shared/process_helper_mac.cc',
+ ],
+ 'shared_sources_win': [
+ 'tests/shared/browser/main_message_loop_external_pump_win.cc',
+ 'tests/shared/browser/resource_util_win.cc',
+ 'tests/shared/browser/util_win.cc',
+ 'tests/shared/browser/util_win.h',
+ ],
+ 'cefclient_sources_browser': [
+ 'tests/cefclient/browser/binding_test.cc',
+ 'tests/cefclient/browser/binding_test.h',
+ 'tests/cefclient/browser/browser_window.cc',
+ 'tests/cefclient/browser/browser_window.h',
+ 'tests/cefclient/browser/bytes_write_handler.cc',
+ 'tests/cefclient/browser/bytes_write_handler.h',
+ 'tests/cefclient/browser/client_app_delegates_browser.cc',
+ 'tests/cefclient/browser/client_browser.cc',
+ 'tests/cefclient/browser/client_browser.h',
+ 'tests/cefclient/browser/client_handler.cc',
+ 'tests/cefclient/browser/client_handler.h',
+ 'tests/cefclient/browser/client_handler_osr.cc',
+ 'tests/cefclient/browser/client_handler_osr.h',
+ 'tests/cefclient/browser/client_handler_std.cc',
+ 'tests/cefclient/browser/client_handler_std.h',
+ 'tests/cefclient/browser/client_types.h',
+ 'tests/cefclient/browser/dialog_test.cc',
+ 'tests/cefclient/browser/dialog_test.h',
+ 'tests/cefclient/browser/drm_test.cc',
+ 'tests/cefclient/browser/drm_test.h',
+ 'tests/cefclient/browser/image_cache.cc',
+ 'tests/cefclient/browser/image_cache.h',
+ 'tests/cefclient/browser/main_context.cc',
+ 'tests/cefclient/browser/main_context.h',
+ 'tests/cefclient/browser/main_context_impl.cc',
+ 'tests/cefclient/browser/main_context_impl.h',
+ 'tests/cefclient/browser/media_router_test.cc',
+ 'tests/cefclient/browser/media_router_test.h',
+ 'tests/cefclient/browser/osr_dragdrop_events.h',
+ 'tests/cefclient/browser/osr_renderer.h',
+ 'tests/cefclient/browser/osr_renderer.cc',
+ 'tests/cefclient/browser/osr_renderer_settings.h',
+ 'tests/cefclient/browser/preferences_test.cc',
+ 'tests/cefclient/browser/preferences_test.h',
+ 'tests/cefclient/browser/resource.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_create.cc',
+ 'tests/cefclient/browser/root_window_manager.cc',
+ 'tests/cefclient/browser/root_window_manager.h',
+ 'tests/cefclient/browser/scheme_test.cc',
+ 'tests/cefclient/browser/scheme_test.h',
+ 'tests/cefclient/browser/server_test.cc',
+ 'tests/cefclient/browser/server_test.h',
+ 'tests/cefclient/browser/temp_window.h',
+ 'tests/cefclient/browser/test_runner.cc',
+ 'tests/cefclient/browser/test_runner.h',
+ 'tests/cefclient/browser/urlrequest_test.cc',
+ 'tests/cefclient/browser/urlrequest_test.h',
+ 'tests/cefclient/browser/window_test.cc',
+ 'tests/cefclient/browser/window_test.h',
+ 'tests/cefclient/browser/window_test_runner.cc',
+ 'tests/cefclient/browser/window_test_runner.h',
+ ],
+ 'cefclient_sources_common': [
+ 'tests/cefclient/common/client_app_delegates_common.cc',
+ 'tests/cefclient/common/scheme_test_common.cc',
+ 'tests/cefclient/common/scheme_test_common.h',
+ ],
+ 'cefclient_sources_renderer': [
+ 'tests/cefclient/renderer/client_app_delegates_renderer.cc',
+ 'tests/cefclient/renderer/client_renderer.cc',
+ 'tests/cefclient/renderer/client_renderer.h',
+ 'tests/cefclient/renderer/performance_test.cc',
+ 'tests/cefclient/renderer/performance_test.h',
+ 'tests/cefclient/renderer/performance_test_setup.h',
+ 'tests/cefclient/renderer/performance_test_tests.cc',
+ ],
+ 'cefclient_sources_resources': [
+ 'tests/cefclient/resources/binding.html',
+ 'tests/cefclient/resources/dialogs.html',
+ 'tests/cefclient/resources/draggable.html',
+ 'tests/cefclient/resources/drm.html',
+ 'tests/cefclient/resources/localstorage.html',
+ 'tests/cefclient/resources/logo.png',
+ 'tests/cefclient/resources/media_router.html',
+ 'tests/cefclient/resources/menu_icon.1x.png',
+ 'tests/cefclient/resources/menu_icon.2x.png',
+ 'tests/cefclient/resources/other_tests.html',
+ 'tests/cefclient/resources/performance.html',
+ 'tests/cefclient/resources/performance2.html',
+ 'tests/cefclient/resources/preferences.html',
+ 'tests/cefclient/resources/response_filter.html',
+ 'tests/cefclient/resources/server.html',
+ 'tests/cefclient/resources/transparency.html',
+ 'tests/cefclient/resources/urlrequest.html',
+ 'tests/cefclient/resources/websocket.html',
+ 'tests/cefclient/resources/window.html',
+ 'tests/cefclient/resources/xmlhttprequest.html',
+ ],
+ 'cefclient_sources_resources_extensions_set_page_color': [
+ 'tests/cefclient/resources/extensions/set_page_color/icon.png',
+ 'tests/cefclient/resources/extensions/set_page_color/manifest.json',
+ 'tests/cefclient/resources/extensions/set_page_color/popup.html',
+ 'tests/cefclient/resources/extensions/set_page_color/popup.js',
+ 'tests/cefclient/resources/extensions/set_page_color/README.md',
+ ],
+ 'cefclient_sources_win': [
+ 'tests/cefclient/browser/browser_window_osr_win.cc',
+ 'tests/cefclient/browser/browser_window_osr_win.h',
+ 'tests/cefclient/browser/browser_window_std_win.cc',
+ 'tests/cefclient/browser/browser_window_std_win.h',
+ 'tests/cefclient/browser/main_context_impl_win.cc',
+ 'tests/cefclient/browser/main_message_loop_multithreaded_win.cc',
+ 'tests/cefclient/browser/main_message_loop_multithreaded_win.h',
+ 'tests/cefclient/browser/osr_accessibility_helper.cc',
+ 'tests/cefclient/browser/osr_accessibility_helper.h',
+ 'tests/cefclient/browser/osr_accessibility_node.cc',
+ 'tests/cefclient/browser/osr_accessibility_node.h',
+ 'tests/cefclient/browser/osr_accessibility_node_win.cc',
+ 'tests/cefclient/browser/osr_dragdrop_win.cc',
+ 'tests/cefclient/browser/osr_dragdrop_win.h',
+ 'tests/cefclient/browser/osr_ime_handler_win.cc',
+ 'tests/cefclient/browser/osr_ime_handler_win.h',
+ 'tests/cefclient/browser/osr_d3d11_win.cc',
+ 'tests/cefclient/browser/osr_d3d11_win.h',
+ 'tests/cefclient/browser/osr_render_handler_win.cc',
+ 'tests/cefclient/browser/osr_render_handler_win.h',
+ 'tests/cefclient/browser/osr_render_handler_win_d3d11.cc',
+ 'tests/cefclient/browser/osr_render_handler_win_d3d11.h',
+ 'tests/cefclient/browser/osr_render_handler_win_gl.cc',
+ 'tests/cefclient/browser/osr_render_handler_win_gl.h',
+ 'tests/cefclient/browser/osr_window_win.cc',
+ 'tests/cefclient/browser/osr_window_win.h',
+ 'tests/cefclient/browser/resource_util_win_idmap.cc',
+ 'tests/cefclient/browser/root_window_views.cc',
+ 'tests/cefclient/browser/root_window_views.h',
+ 'tests/cefclient/browser/root_window_win.cc',
+ 'tests/cefclient/browser/root_window_win.h',
+ 'tests/cefclient/browser/temp_window_win.cc',
+ 'tests/cefclient/browser/temp_window_win.h',
+ 'tests/cefclient/browser/views_menu_bar.cc',
+ 'tests/cefclient/browser/views_menu_bar.h',
+ 'tests/cefclient/browser/views_style.cc',
+ 'tests/cefclient/browser/views_style.h',
+ 'tests/cefclient/browser/views_window.cc',
+ 'tests/cefclient/browser/views_window.h',
+ 'tests/cefclient/browser/window_test_runner_views.cc',
+ 'tests/cefclient/browser/window_test_runner_views.h',
+ 'tests/cefclient/browser/window_test_runner_win.cc',
+ 'tests/cefclient/browser/window_test_runner_win.h',
+ 'tests/cefclient/cefclient_win.cc',
+ 'tests/cefclient/resources/win/cefclient.rc',
+ ],
+ 'cefclient_sources_resources_win': [
+ 'tests/cefclient/resources/win/cefclient.exe.manifest',
+ 'tests/cefclient/resources/win/cefclient.ico',
+ 'tests/cefclient/resources/win/small.ico',
+ ],
+ 'cefclient_sources_mac': [
+ 'tests/cefclient/browser/browser_window_osr_mac.h',
+ 'tests/cefclient/browser/browser_window_osr_mac.mm',
+ 'tests/cefclient/browser/browser_window_std_mac.h',
+ 'tests/cefclient/browser/browser_window_std_mac.mm',
+ 'tests/cefclient/browser/main_context_impl_posix.cc',
+ 'tests/cefclient/browser/osr_accessibility_helper.cc',
+ 'tests/cefclient/browser/osr_accessibility_helper.h',
+ 'tests/cefclient/browser/osr_accessibility_node.cc',
+ 'tests/cefclient/browser/osr_accessibility_node.h',
+ 'tests/cefclient/browser/osr_accessibility_node_mac.mm',
+ 'tests/cefclient/browser/root_window_mac.h',
+ 'tests/cefclient/browser/root_window_mac.mm',
+ 'tests/cefclient/browser/temp_window_mac.h',
+ 'tests/cefclient/browser/temp_window_mac.mm',
+ 'tests/cefclient/browser/text_input_client_osr_mac.h',
+ 'tests/cefclient/browser/text_input_client_osr_mac.mm',
+ 'tests/cefclient/browser/window_test_runner_mac.h',
+ 'tests/cefclient/browser/window_test_runner_mac.mm',
+ 'tests/cefclient/cefclient_mac.mm',
+ ],
+ 'cefclient_bundle_resources_mac': [
+ 'tests/cefclient/resources/mac/cefclient.icns',
+ 'tests/cefclient/resources/mac/English.lproj/InfoPlist.strings',
+ 'tests/cefclient/resources/mac/English.lproj/MainMenu.xib',
+ 'tests/cefclient/resources/mac/Info.plist',
+ ],
+ 'cefclient_sources_linux': [
+ 'tests/cefclient/browser/browser_window_osr_gtk.cc',
+ 'tests/cefclient/browser/browser_window_osr_gtk.h',
+ 'tests/cefclient/browser/browser_window_std_gtk.cc',
+ 'tests/cefclient/browser/browser_window_std_gtk.h',
+ 'tests/cefclient/browser/dialog_handler_gtk.cc',
+ 'tests/cefclient/browser/dialog_handler_gtk.h',
+ 'tests/cefclient/browser/main_context_impl_posix.cc',
+ 'tests/cefclient/browser/main_message_loop_multithreaded_gtk.cc',
+ 'tests/cefclient/browser/main_message_loop_multithreaded_gtk.h',
+ 'tests/cefclient/browser/print_handler_gtk.cc',
+ 'tests/cefclient/browser/print_handler_gtk.h',
+ 'tests/cefclient/browser/resource_util_linux.cc',
+ 'tests/cefclient/browser/root_window_gtk.cc',
+ 'tests/cefclient/browser/root_window_gtk.h',
+ 'tests/cefclient/browser/root_window_views.cc',
+ 'tests/cefclient/browser/root_window_views.h',
+ 'tests/cefclient/browser/temp_window_x11.cc',
+ 'tests/cefclient/browser/temp_window_x11.h',
+ 'tests/cefclient/browser/util_gtk.cc',
+ 'tests/cefclient/browser/util_gtk.h',
+ 'tests/cefclient/browser/views_menu_bar.cc',
+ 'tests/cefclient/browser/views_menu_bar.h',
+ 'tests/cefclient/browser/views_style.cc',
+ 'tests/cefclient/browser/views_style.h',
+ 'tests/cefclient/browser/views_window.cc',
+ 'tests/cefclient/browser/views_window.h',
+ 'tests/cefclient/browser/window_test_runner_gtk.cc',
+ 'tests/cefclient/browser/window_test_runner_gtk.h',
+ 'tests/cefclient/browser/window_test_runner_views.cc',
+ 'tests/cefclient/browser/window_test_runner_views.h',
+ 'tests/cefclient/cefclient_gtk.cc',
+ ],
+ 'cefsimple_sources_common': [
+ 'tests/cefsimple/simple_app.cc',
+ 'tests/cefsimple/simple_app.h',
+ 'tests/cefsimple/simple_handler.cc',
+ 'tests/cefsimple/simple_handler.h',
+ ],
+ 'cefsimple_sources_win': [
+ 'tests/cefsimple/cefsimple.rc',
+ 'tests/cefsimple/cefsimple_win.cc',
+ 'tests/cefsimple/simple_handler_win.cc',
+ 'tests/cefsimple/resource.h',
+ ],
+ 'cefsimple_sources_resources_win': [
+ 'tests/cefsimple/cefsimple.exe.manifest',
+ 'tests/cefsimple/res/cefsimple.ico',
+ 'tests/cefsimple/res/small.ico',
+ ],
+ 'cefsimple_sources_mac': [
+ 'tests/cefsimple/cefsimple_mac.mm',
+ 'tests/cefsimple/simple_handler_mac.mm',
+ ],
+ 'cefsimple_sources_mac_helper': [
+ 'tests/cefsimple/process_helper_mac.cc',
+ ],
+ 'cefsimple_bundle_resources_mac': [
+ 'tests/cefsimple/mac/cefsimple.icns',
+ 'tests/cefsimple/mac/English.lproj/InfoPlist.strings',
+ 'tests/cefsimple/mac/English.lproj/MainMenu.xib',
+ 'tests/cefsimple/mac/Info.plist',
+ ],
+ 'cefsimple_sources_linux': [
+ 'tests/cefsimple/cefsimple_linux.cc',
+ 'tests/cefsimple/simple_handler_linux.cc',
+ ],
+ 'ceftests_sources_common': [
+ 'tests/ceftests/audio_output_unittest.cc',
+ 'tests/ceftests/browser_info_map_unittest.cc',
+ 'tests/ceftests/command_line_unittest.cc',
+ 'tests/ceftests/cookie_unittest.cc',
+ 'tests/ceftests/devtools_message_unittest.cc',
+ 'tests/ceftests/dialog_unittest.cc',
+ 'tests/ceftests/display_unittest.cc',
+ 'tests/ceftests/dom_unittest.cc',
+ 'tests/ceftests/download_unittest.cc',
+ 'tests/ceftests/draggable_regions_unittest.cc',
+ 'tests/ceftests/extensions/background_unittest.cc',
+ 'tests/ceftests/extensions/chrome_alarms_unittest.cc',
+ 'tests/ceftests/extensions/chrome_storage_unittest.cc',
+ 'tests/ceftests/extensions/chrome_tabs_unittest.cc',
+ 'tests/ceftests/extensions/extension_test_handler.cc',
+ 'tests/ceftests/extensions/extension_test_handler.h',
+ 'tests/ceftests/extensions/view_unittest.cc',
+ 'tests/ceftests/file_util_unittest.cc',
+ 'tests/ceftests/frame_unittest.cc',
+ 'tests/ceftests/image_unittest.cc',
+ 'tests/ceftests/image_util.cc',
+ 'tests/ceftests/image_util.h',
+ 'tests/ceftests/jsdialog_unittest.cc',
+ 'tests/ceftests/life_span_unittest.cc',
+ 'tests/ceftests/message_router_unittest.cc',
+ 'tests/ceftests/navigation_unittest.cc',
+ 'tests/ceftests/os_rendering_unittest.cc',
+ 'tests/ceftests/osr_accessibility_unittest.cc',
+ 'tests/ceftests/osr_display_unittest.cc',
+ 'tests/ceftests/parser_unittest.cc',
+ 'tests/ceftests/plugin_unittest.cc',
+ 'tests/ceftests/preference_unittest.cc',
+ 'tests/ceftests/print_unittest.cc',
+ 'tests/ceftests/process_message_unittest.cc',
+ 'tests/ceftests/request_context_unittest.cc',
+ 'tests/ceftests/request_handler_unittest.cc',
+ 'tests/ceftests/request_unittest.cc',
+ 'tests/ceftests/response_unittest.cc',
+ 'tests/ceftests/resource.h',
+ 'tests/ceftests/resource_manager_unittest.cc',
+ 'tests/ceftests/resource_request_handler_unittest.cc',
+ 'tests/ceftests/routing_test_handler.cc',
+ 'tests/ceftests/routing_test_handler.h',
+ 'tests/ceftests/run_all_unittests.cc',
+ 'tests/ceftests/scheme_handler_unittest.cc',
+ 'tests/ceftests/scoped_temp_dir_unittest.cc',
+ 'tests/ceftests/server_unittest.cc',
+ 'tests/ceftests/stream_unittest.cc',
+ 'tests/ceftests/stream_resource_handler_unittest.cc',
+ 'tests/ceftests/string_unittest.cc',
+ 'tests/ceftests/client_app_delegates.cc',
+ 'tests/ceftests/task_unittest.cc',
+ 'tests/ceftests/test_handler.cc',
+ 'tests/ceftests/test_handler.h',
+ 'tests/ceftests/test_suite.cc',
+ 'tests/ceftests/test_suite.h',
+ 'tests/ceftests/test_util.cc',
+ 'tests/ceftests/test_util.h',
+ 'tests/ceftests/thread_helper.cc',
+ 'tests/ceftests/thread_helper.h',
+ 'tests/ceftests/thread_unittest.cc',
+ 'tests/ceftests/tracing_unittest.cc',
+ 'tests/ceftests/translator_unittest.cc',
+ 'tests/ceftests/urlrequest_unittest.cc',
+ 'tests/ceftests/v8_unittest.cc',
+ 'tests/ceftests/values_unittest.cc',
+ 'tests/ceftests/version_unittest.cc',
+ 'tests/ceftests/waitable_event_unittest.cc',
+ 'tests/ceftests/webui_unittest.cc',
+ 'tests/ceftests/xml_reader_unittest.cc',
+ 'tests/ceftests/zip_reader_unittest.cc',
+ ],
+ 'ceftests_sources_views': [
+ 'tests/ceftests/views/button_unittest.cc',
+ 'tests/ceftests/views/panel_unittest.cc',
+ 'tests/ceftests/views/scroll_view_unittest.cc',
+ 'tests/ceftests/views/test_window_delegate.cc',
+ 'tests/ceftests/views/test_window_delegate.h',
+ 'tests/ceftests/views/textfield_unittest.cc',
+ 'tests/ceftests/views/window_unittest.cc',
+ ],
+ 'ceftests_sources_win': [
+ 'tests/ceftests/resource_util_win_idmap.cc',
+ 'tests/ceftests/resources/win/ceftests.rc',
+ ],
+ 'ceftests_sources_resources_win': [
+ 'tests/ceftests/resources/win/ceftests.exe.manifest',
+ 'tests/ceftests/resources/win/ceftests.ico',
+ 'tests/ceftests/resources/win/small.ico',
+ ],
+ 'ceftests_sources_mac': [
+ 'tests/ceftests/os_rendering_unittest_mac.h',
+ 'tests/ceftests/os_rendering_unittest_mac.mm',
+ 'tests/ceftests/run_all_unittests_mac.mm',
+ ],
+ 'ceftests_sources_mac_helper': [
+ 'tests/shared/browser/file_util.cc',
+ 'tests/shared/browser/file_util.h',
+ 'tests/shared/browser/resource_util.h',
+ 'tests/shared/browser/resource_util_mac.mm',
+ 'tests/shared/browser/resource_util_posix.cc',
+ 'tests/ceftests/audio_output_unittest.cc',
+ 'tests/ceftests/client_app_delegates.cc',
+ 'tests/ceftests/cookie_unittest.cc',
+ 'tests/ceftests/dom_unittest.cc',
+ 'tests/ceftests/frame_unittest.cc',
+ 'tests/ceftests/message_router_unittest.cc',
+ 'tests/ceftests/navigation_unittest.cc',
+ 'tests/ceftests/plugin_unittest.cc',
+ 'tests/ceftests/preference_unittest.cc',
+ 'tests/ceftests/process_message_unittest.cc',
+ 'tests/ceftests/request_handler_unittest.cc',
+ 'tests/ceftests/request_unittest.cc',
+ 'tests/ceftests/response_unittest.cc',
+ 'tests/ceftests/resource_request_handler_unittest.cc',
+ 'tests/ceftests/routing_test_handler.cc',
+ 'tests/ceftests/routing_test_handler.h',
+ 'tests/ceftests/scheme_handler_unittest.cc',
+ 'tests/ceftests/urlrequest_unittest.cc',
+ 'tests/ceftests/test_handler.cc',
+ 'tests/ceftests/test_handler.h',
+ 'tests/ceftests/test_suite.cc',
+ 'tests/ceftests/test_suite.h',
+ 'tests/ceftests/test_util.cc',
+ 'tests/ceftests/test_util.h',
+ 'tests/ceftests/thread_helper.cc',
+ 'tests/ceftests/thread_helper.h',
+ 'tests/ceftests/thread_unittest.cc',
+ 'tests/ceftests/tracing_unittest.cc',
+ 'tests/ceftests/v8_unittest.cc',
+ ],
+ 'ceftests_bundle_resources_mac': [
+ 'tests/ceftests/resources/mac/ceftests.icns',
+ 'tests/ceftests/resources/mac/English.lproj/InfoPlist.strings',
+ 'tests/ceftests/resources/mac/English.lproj/MainMenu.xib',
+ 'tests/ceftests/resources/mac/Info.plist',
+ ],
+ 'ceftests_sources_linux': [
+ 'tests/ceftests/resource_util_linux.cc',
+ ],
+ },
+}
diff --git a/src/cef_repack_locales.gni b/src/cef_repack_locales.gni
new file mode 100644
index 0000000..51e9189
--- /dev/null
+++ b/src/cef_repack_locales.gni
@@ -0,0 +1,132 @@
+# Copyright 2016 The Chromium Embedded Framework Authors. Portions copyright
+# 2014 the Chromium Authors. All rights reserved. Use of this source code is
+# governed by a BSD-style license that can be found in the LICENSE file.
+#
+# This is a copy of src/chrome/chrome_repack_locales.gni with the necessary
+# modifications to meet CEF's requirements.
+
+import("//build/config/chrome_build.gni")
+import("//build/config/features.gni")
+import("//build/config/ui.gni")
+import("//tools/grit/repack.gni")
+
+# Arguments:
+#
+# locale
+# Internal name of locale. e.g. "pt-BR"
+#
+# output
+# Output file name.
+#
+# visibility
+# Normal meaning.
+template("_repack_one_locale") {
+ locale = invoker.locale
+
+ repack(target_name) {
+ visibility = invoker.visibility
+
+ # Each input pak file should also have a deps line for completeness.
+ # Add associated .h files in the make_pack_header("strings") target.
+ sources = [
+ "${root_gen_dir}/cef/cef_strings_${locale}.pak",
+ "${root_gen_dir}/chrome/chromium_strings_${locale}.pak",
+ "${root_gen_dir}/chrome/generated_resources_${locale}.pak",
+ "${root_gen_dir}/chrome/locale_settings_${locale}.pak",
+ "${root_gen_dir}/chrome/platform_locale_settings_${locale}.pak",
+ "${root_gen_dir}/components/strings/components_locale_settings_${locale}.pak",
+ "${root_gen_dir}/components/strings/components_strings_${locale}.pak",
+ "${root_gen_dir}/extensions/strings/extensions_strings_${locale}.pak",
+ "${root_gen_dir}/services/strings/services_strings_${locale}.pak",
+ "${root_gen_dir}/third_party/blink/public/strings/blink_strings_${locale}.pak",
+ "${root_gen_dir}/ui/strings/app_locale_settings_${locale}.pak",
+ "${root_gen_dir}/ui/strings/ui_strings_${locale}.pak",
+ ]
+
+ # Use public_deps so that generated grit headers are discoverable from
+ # the libcef_static target. Grit deps that generate .cc files must be
+ # listed both here and in the libcef_static target.
+ public_deps = [
+ ":cef_strings",
+ "//chrome/app:chromium_strings",
+ "//chrome/app:generated_resources",
+ "//chrome/app/resources:locale_settings",
+ "//chrome/app/resources:platform_locale_settings",
+ "//components/strings:components_locale_settings",
+ "//components/strings:components_strings",
+ "//extensions/strings",
+ "//services/strings",
+ "//third_party/blink/public/strings",
+ "//ui/strings:app_locale_settings",
+ "//ui/strings:ui_strings",
+ ]
+
+ output = invoker.output
+ }
+}
+
+# Creates an action to call the repack_locales script.
+#
+# The GYP version generates the locales in the "gen" directory and then copies
+# it to the root build directory. This isn't easy to express in a GN copy
+# rule since the files on Mac have a complex structure. So we generate the
+# files into the final place and skip the "gen" directory.
+#
+# This template uses GN's looping constructs to avoid the complex call to
+# chrome/tools/build/repack_locales.py which wraps the repack commands in the
+# GYP build.
+#
+# Arguments
+#
+# input_locales
+# List of locale names to use as inputs.
+#
+# output_locales
+# A list containing the corresponding output names for each of the
+# input names. Mac uses different names in some cases.
+#
+# visibility
+template("cef_repack_locales") {
+ # This is the name of the group below that will collect all the invidual
+ # locale targets. External targets will depend on this.
+ group_target_name = target_name
+
+ # GN's subscript is too stupid to do invoker.output_locales[foo] so we need
+ # to make a copy and do output_locales[foo].
+ output_locales = invoker.output_locales
+
+ # Collects all targets the loop generates.
+ locale_targets = []
+
+ # This loop iterates over the input locales and also keeps a counter so it
+ # can simultaneously iterate over the output locales (using GN's very
+ # limited looping capabilities).
+ current_index = 0
+ foreach(input_locale, invoker.input_locales) {
+ output_locale = output_locales[current_index]
+
+ # Compute the name of the target for the current file. Save it for the deps.
+ current_name = "${target_name}_${input_locale}"
+ locale_targets += [ ":$current_name" ]
+
+ _repack_one_locale(current_name) {
+ visibility = [ ":$group_target_name" ]
+ locale = input_locale
+
+ # Compute the output name. Mac uses a different location.
+ if (is_mac || is_ios) {
+ output = "${root_gen_dir}/repack/locales/${output_locale}.pak"
+ } else {
+ output = "${root_out_dir}/locales/${output_locale}.pak"
+ }
+ }
+
+ current_index = current_index + 1
+ }
+
+ # The group that external targets depend on which collects all deps.
+ group(group_target_name) {
+ forward_variables_from(invoker, [ "visibility" ])
+ public_deps = locale_targets
+ }
+}
diff --git a/src/cmake/FindCEF.cmake.in b/src/cmake/FindCEF.cmake.in
new file mode 100644
index 0000000..cd33a7d
--- /dev/null
+++ b/src/cmake/FindCEF.cmake.in
@@ -0,0 +1,39 @@
+# Copyright (c) 2016 The Chromium Embedded Framework Authors. All rights
+# reserved. Use of this source code is governed by a BSD-style license that
+# can be found in the LICENSE file.
+
+#
+# This file is the CEF CMake configuration entry point and should be loaded
+# using `find_package(CEF REQUIRED)`. See the top-level CMakeLists.txt file
+# included with the CEF binary distribution for usage information.
+#
+
+# Find the CEF binary distribution root directory.
+set(_CEF_ROOT "")
+if(CEF_ROOT AND IS_DIRECTORY "${CEF_ROOT}")
+ set(_CEF_ROOT "${CEF_ROOT}")
+ set(_CEF_ROOT_EXPLICIT 1)
+else()
+ set(_ENV_CEF_ROOT "")
+ if(DEFINED ENV{CEF_ROOT})
+ file(TO_CMAKE_PATH "$ENV{CEF_ROOT}" _ENV_CEF_ROOT)
+ endif()
+ if(_ENV_CEF_ROOT AND IS_DIRECTORY "${_ENV_CEF_ROOT}")
+ set(_CEF_ROOT "${_ENV_CEF_ROOT}")
+ set(_CEF_ROOT_EXPLICIT 1)
+ endif()
+ unset(_ENV_CEF_ROOT)
+endif()
+
+if(NOT DEFINED _CEF_ROOT_EXPLICIT)
+ message(FATAL_ERROR "Must specify a CEF_ROOT value via CMake or environment variable.")
+endif()
+
+if(NOT IS_DIRECTORY "${_CEF_ROOT}/cmake")
+ message(FATAL_ERROR "No CMake bootstrap found for CEF binary distribution at: ${CEF_ROOT}.")
+endif()
+
+# Execute additional cmake files from the CEF binary distribution.
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${_CEF_ROOT}/cmake")
+include("cef_variables")
+include("cef_macros")
diff --git a/src/cmake/cef_macros.cmake.in b/src/cmake/cef_macros.cmake.in
new file mode 100644
index 0000000..1b667e1
--- /dev/null
+++ b/src/cmake/cef_macros.cmake.in
@@ -0,0 +1,366 @@
+# Copyright (c) 2016 The Chromium Embedded Framework Authors. All rights
+# reserved. Use of this source code is governed by a BSD-style license that
+# can be found in the LICENSE file.
+
+# Must be loaded via FindCEF.cmake.
+if(NOT DEFINED _CEF_ROOT_EXPLICIT)
+ message(FATAL_ERROR "Use find_package(CEF) to load this file.")
+endif()
+
+
+#
+# Shared macros.
+#
+
+# Print the current CEF configuration.
+macro(PRINT_CEF_CONFIG)
+ message(STATUS "*** CEF CONFIGURATION SETTINGS ***")
+ message(STATUS "Generator: ${CMAKE_GENERATOR}")
+ message(STATUS "Platform: ${CMAKE_SYSTEM_NAME}")
+ message(STATUS "Project architecture: ${PROJECT_ARCH}")
+
+ if(GEN_NINJA OR GEN_MAKEFILES)
+ message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
+ endif()
+
+ message(STATUS "Binary distribution root: ${_CEF_ROOT}")
+
+ if(OS_MACOSX)
+ message(STATUS "Base SDK: ${CMAKE_OSX_SYSROOT}")
+ message(STATUS "Target SDK: ${CEF_TARGET_SDK}")
+ endif()
+
+ if(OS_WINDOWS)
+ message(STATUS "Visual Studio ATL support: ${USE_ATL}")
+ endif()
+
+ message(STATUS "CEF sandbox: ${USE_SANDBOX}")
+
+ set(_libraries ${CEF_STANDARD_LIBS})
+ if(OS_WINDOWS AND USE_SANDBOX)
+ list(APPEND _libraries ${CEF_SANDBOX_STANDARD_LIBS})
+ endif()
+ message(STATUS "Standard libraries: ${_libraries}")
+
+ message(STATUS "Compile defines: ${CEF_COMPILER_DEFINES}")
+ message(STATUS "Compile defines (Debug): ${CEF_COMPILER_DEFINES_DEBUG}")
+ message(STATUS "Compile defines (Release): ${CEF_COMPILER_DEFINES_RELEASE}")
+ message(STATUS "C compile flags: ${CEF_COMPILER_FLAGS} ${CEF_C_COMPILER_FLAGS}")
+ message(STATUS "C compile flags (Debug): ${CEF_COMPILER_FLAGS_DEBUG} ${CEF_C_COMPILER_FLAGS_DEBUG}")
+ message(STATUS "C compile flags (Release): ${CEF_COMPILER_FLAGS_RELEASE} ${CEF_C_COMPILER_FLAGS_RELEASE}")
+ message(STATUS "C++ compile flags: ${CEF_COMPILER_FLAGS} ${CEF_CXX_COMPILER_FLAGS}")
+ message(STATUS "C++ compile flags (Debug): ${CEF_COMPILER_FLAGS_DEBUG} ${CEF_CXX_COMPILER_FLAGS_DEBUG}")
+ message(STATUS "C++ compile flags (Release): ${CEF_COMPILER_FLAGS_RELEASE} ${CEF_CXX_COMPILER_FLAGS_RELEASE}")
+ message(STATUS "Exe link flags: ${CEF_LINKER_FLAGS} ${CEF_EXE_LINKER_FLAGS}")
+ message(STATUS "Exe link flags (Debug): ${CEF_LINKER_FLAGS_DEBUG} ${CEF_EXE_LINKER_FLAGS_DEBUG}")
+ message(STATUS "Exe link flags (Release): ${CEF_LINKER_FLAGS_RELEASE} ${CEF_EXE_LINKER_FLAGS_RELEASE}")
+ message(STATUS "Shared link flags: ${CEF_LINKER_FLAGS} ${CEF_SHARED_LINKER_FLAGS}")
+ message(STATUS "Shared link flags (Debug): ${CEF_LINKER_FLAGS_DEBUG} ${CEF_SHARED_LINKER_FLAGS_DEBUG}")
+ message(STATUS "Shared link flags (Release): ${CEF_LINKER_FLAGS_RELEASE} ${CEF_SHARED_LINKER_FLAGS_RELEASE}")
+
+ if(OS_LINUX OR OS_WINDOWS)
+ message(STATUS "CEF Binary files: ${CEF_BINARY_FILES}")
+ message(STATUS "CEF Resource files: ${CEF_RESOURCE_FILES}")
+ endif()
+endmacro()
+
+# Append platform specific sources to a list of sources.
+macro(APPEND_PLATFORM_SOURCES name_of_list)
+ if(OS_LINUX AND ${name_of_list}_LINUX)
+ list(APPEND ${name_of_list} ${${name_of_list}_LINUX})
+ endif()
+ if(OS_POSIX AND ${name_of_list}_POSIX)
+ list(APPEND ${name_of_list} ${${name_of_list}_POSIX})
+ endif()
+ if(OS_WINDOWS AND ${name_of_list}_WINDOWS)
+ list(APPEND ${name_of_list} ${${name_of_list}_WINDOWS})
+ endif()
+ if(OS_MACOSX AND ${name_of_list}_MACOSX)
+ list(APPEND ${name_of_list} ${${name_of_list}_MACOSX})
+ endif()
+endmacro()
+
+# Determine the target output directory based on platform and generator.
+macro(SET_CEF_TARGET_OUT_DIR)
+ if(GEN_NINJA OR GEN_MAKEFILES)
+ # By default Ninja and Make builds don't create a subdirectory named after
+ # the configuration.
+ set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}")
+
+ # Output binaries (executables, libraries) to the correct directory.
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CEF_TARGET_OUT_DIR})
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CEF_TARGET_OUT_DIR})
+ else()
+ set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
+ endif()
+endmacro()
+
+# Copy a list of files from one directory to another. Relative files paths are maintained.
+# The path component of the source |file_list| will be removed.
+macro(COPY_FILES target file_list source_dir target_dir)
+ foreach(FILENAME ${file_list})
+ set(source_file ${source_dir}/${FILENAME})
+ get_filename_component(target_name ${FILENAME} NAME)
+ set(target_file ${target_dir}/${target_name})
+
+ string(FIND ${source_file} "$<CONFIGURATION>" _pos)
+ if(NOT ${_pos} EQUAL -1)
+ # Must test with an actual configuration directory.
+ string(REPLACE "$<CONFIGURATION>" "Release" existing_source_file ${source_file})
+ if(NOT EXISTS ${existing_source_file})
+ string(REPLACE "$<CONFIGURATION>" "Debug" existing_source_file ${source_file})
+ endif()
+ else()
+ set(existing_source_file ${source_file})
+ endif()
+
+ if(IS_DIRECTORY ${existing_source_file})
+ add_custom_command(
+ TARGET ${target}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_directory "${source_file}" "${target_file}"
+ VERBATIM
+ )
+ else()
+ add_custom_command(
+ TARGET ${target}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different "${source_file}" "${target_file}"
+ VERBATIM
+ )
+ endif()
+ endforeach()
+endmacro()
+
+
+#
+# Linux macros.
+#
+
+if(OS_LINUX)
+
+# Use pkg-config to find Linux libraries and update compiler/linker variables.
+macro(FIND_LINUX_LIBRARIES libraries)
+ # Read pkg-config info into variables.
+ execute_process(COMMAND pkg-config --cflags ${libraries} OUTPUT_VARIABLE FLL_CFLAGS)
+ execute_process(COMMAND pkg-config --libs-only-L --libs-only-other ${libraries} OUTPUT_VARIABLE FLL_LDFLAGS)
+ execute_process(COMMAND pkg-config --libs-only-l ${libraries} OUTPUT_VARIABLE FLL_LIBS)
+
+ # Strip leading and trailing whitepspace.
+ STRING(STRIP "${FLL_CFLAGS}" FLL_CFLAGS)
+ STRING(STRIP "${FLL_LDFLAGS}" FLL_LDFLAGS)
+ STRING(STRIP "${FLL_LIBS}" FLL_LIBS)
+
+ # Convert to a list.
+ separate_arguments(FLL_CFLAGS)
+ separate_arguments(FLL_LDFLAGS)
+ separate_arguments(FLL_LIBS)
+
+ # Update build variables.
+ list(APPEND CEF_C_COMPILER_FLAGS ${FLL_CFLAGS})
+ list(APPEND CEF_CXX_COMPILER_FLAGS ${FLL_CFLAGS})
+ list(APPEND CEF_EXE_LINKER_FLAGS ${FLL_LDFLAGS})
+ list(APPEND CEF_SHARED_LINKER_FLAGS ${FLL_LDFLAGS})
+ list(APPEND CEF_STANDARD_LIBS ${FLL_LIBS})
+endmacro()
+
+# Set SUID permissions on the specified executable.
+macro(SET_LINUX_SUID_PERMISSIONS target executable)
+ add_custom_command(
+ TARGET ${target}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E echo ""
+ COMMAND ${CMAKE_COMMAND} -E echo "*** Run the following command manually to set SUID permissions ***"
+ COMMAND ${CMAKE_COMMAND} -E echo "EXE=\"${executable}\" && sudo -- chown root:root $EXE && sudo -- chmod 4755 $EXE"
+ COMMAND ${CMAKE_COMMAND} -E echo ""
+ VERBATIM
+ )
+endmacro()
+
+endif(OS_LINUX)
+
+
+#
+# Mac OS X macros.
+#
+
+if(OS_MACOSX)
+
+# Manually process and copy over resource files.
+macro(COPY_MACOSX_RESOURCES resource_list prefix_list target source_dir app_path)
+ foreach(FILENAME ${resource_list})
+ # Remove one or more prefixes from the source paths.
+ set(TARGET_FILENAME "${FILENAME}")
+ foreach(PREFIX ${prefix_list})
+ string(REGEX REPLACE "^.*${PREFIX}" "" TARGET_FILENAME ${TARGET_FILENAME})
+ endforeach()
+
+ # Determine the absolute source and target paths.
+ set(TARGET_PATH "${app_path}/Contents/Resources/${TARGET_FILENAME}")
+ if(IS_ABSOLUTE ${FILENAME})
+ set(SOURCE_PATH ${FILENAME})
+ else()
+ set(SOURCE_PATH "${source_dir}/${FILENAME}")
+ endif()
+
+ if(${FILENAME} MATCHES ".xib$")
+ # Change the target file extension.
+ string(REGEX REPLACE ".xib$" ".nib" TARGET_PATH ${TARGET_PATH})
+
+ get_filename_component(TARGET_DIRECTORY ${TARGET_PATH} PATH)
+ add_custom_command(
+ TARGET ${target}
+ POST_BUILD
+ # Create the target directory.
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${TARGET_DIRECTORY}"
+ # Compile the XIB file to a NIB.
+ COMMAND /usr/bin/ibtool --output-format binary1 --compile "${TARGET_PATH}" "${SOURCE_PATH}"
+ VERBATIM
+ )
+ elseif(NOT ${TARGET_FILENAME} STREQUAL "Info.plist")
+ # Copy the file as-is.
+ add_custom_command(
+ TARGET ${target}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_PATH}" "${TARGET_PATH}"
+ VERBATIM
+ )
+ endif()
+ endforeach()
+endmacro()
+
+endif(OS_MACOSX)
+
+
+#
+# Windows macros.
+#
+
+if(OS_WINDOWS)
+
+# Add custom manifest files to an executable target.
+macro(ADD_WINDOWS_MANIFEST manifest_path target extension)
+ add_custom_command(
+ TARGET ${target}
+ POST_BUILD
+ COMMAND "mt.exe" -nologo
+ -manifest \"${manifest_path}/${target}.${extension}.manifest\" \"${manifest_path}/compatibility.manifest\"
+ -outputresource:"${CEF_TARGET_OUT_DIR}/${target}.${extension}"\;\#1
+ COMMENT "Adding manifest..."
+ )
+endmacro()
+
+endif(OS_WINDOWS)
+
+
+#
+# Target configuration macros.
+#
+
+# Add a logical target that can be used to link the specified libraries into an
+# executable target.
+macro(ADD_LOGICAL_TARGET target debug_lib release_lib)
+ add_library(${target} ${CEF_LIBTYPE} IMPORTED)
+ set_target_properties(${target} PROPERTIES
+ IMPORTED_LOCATION "${release_lib}"
+ IMPORTED_LOCATION_DEBUG "${debug_lib}"
+ IMPORTED_LOCATION_RELEASE "${release_lib}"
+ )
+endmacro()
+
+# Set common target properties. Use SET_LIBRARY_TARGET_PROPERTIES() or
+# SET_EXECUTABLE_TARGET_PROPERTIES() instead of calling this macro directly.
+macro(SET_COMMON_TARGET_PROPERTIES target)
+ # Compile flags.
+ target_compile_options(${target} PRIVATE ${CEF_COMPILER_FLAGS} ${CEF_CXX_COMPILER_FLAGS})
+ target_compile_options(${target} PRIVATE $<$<CONFIG:Debug>:${CEF_COMPILER_FLAGS_DEBUG} ${CEF_CXX_COMPILER_FLAGS_DEBUG}>)
+ target_compile_options(${target} PRIVATE $<$<CONFIG:Release>:${CEF_COMPILER_FLAGS_RELEASE} ${CEF_CXX_COMPILER_FLAGS_RELEASE}>)
+
+ # Compile definitions.
+ target_compile_definitions(${target} PRIVATE ${CEF_COMPILER_DEFINES})
+ target_compile_definitions(${target} PRIVATE $<$<CONFIG:Debug>:${CEF_COMPILER_DEFINES_DEBUG}>)
+ target_compile_definitions(${target} PRIVATE $<$<CONFIG:Release>:${CEF_COMPILER_DEFINES_RELEASE}>)
+
+ # Include directories.
+ target_include_directories(${target} PRIVATE ${CEF_INCLUDE_PATH})
+
+ # Linker flags.
+ if(CEF_LINKER_FLAGS)
+ string(REPLACE ";" " " _flags_str "${CEF_LINKER_FLAGS}")
+ set_property(TARGET ${target} PROPERTY LINK_FLAGS ${_flags_str})
+ endif()
+ if(CEF_LINKER_FLAGS_DEBUG)
+ string(REPLACE ";" " " _flags_str "${CEF_LINKER_FLAGS_DEBUG}")
+ set_property(TARGET ${target} PROPERTY LINK_FLAGS_DEBUG ${_flags_str})
+ endif()
+ if(CEF_LINKER_FLAGS_RELEASE)
+ string(REPLACE ";" " " _flags_str "${CEF_LINKER_FLAGS_RELEASE}")
+ set_property(TARGET ${target} PROPERTY LINK_FLAGS_RELEASE ${_flags_str})
+ endif()
+
+ if(OS_MACOSX)
+ # Set Xcode target properties.
+ set_target_properties(${target} PROPERTIES
+ XCODE_ATTRIBUTE_ALWAYS_SEARCH_USER_PATHS NO
+ XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "gnu++11" # -std=gnu++11
+ XCODE_ATTRIBUTE_CLANG_LINK_OBJC_RUNTIME NO # -fno-objc-link-runtime
+ XCODE_ATTRIBUTE_CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS YES # -Wobjc-missing-property-synthesis
+ XCODE_ATTRIBUTE_COPY_PHASE_STRIP NO
+ XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING[variant=Release] YES # -Wl,-dead_strip
+ XCODE_ATTRIBUTE_GCC_C_LANGUAGE_STANDARD "c99" # -std=c99
+ XCODE_ATTRIBUTE_GCC_CW_ASM_SYNTAX NO # No -fasm-blocks
+ XCODE_ATTRIBUTE_GCC_DYNAMIC_NO_PIC NO
+ XCODE_ATTRIBUTE_GCC_ENABLE_CPP_EXCEPTIONS NO # -fno-exceptions
+ XCODE_ATTRIBUTE_GCC_ENABLE_CPP_RTTI NO # -fno-rtti
+ XCODE_ATTRIBUTE_GCC_ENABLE_PASCAL_STRINGS NO # No -mpascal-strings
+ XCODE_ATTRIBUTE_GCC_INLINES_ARE_PRIVATE_EXTERN YES # -fvisibility-inlines-hidden
+ XCODE_ATTRIBUTE_GCC_OBJC_CALL_CXX_CDTORS YES # -fobjc-call-cxx-cdtors
+ XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES # -fvisibility=hidden
+ XCODE_ATTRIBUTE_GCC_THREADSAFE_STATICS NO # -fno-threadsafe-statics
+ XCODE_ATTRIBUTE_GCC_TREAT_WARNINGS_AS_ERRORS YES # -Werror
+ XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvm.clang.1_0"
+ XCODE_ATTRIBUTE_GCC_WARN_ABOUT_MISSING_NEWLINE YES # -Wnewline-eof
+ XCODE_ATTRIBUTE_USE_HEADERMAP NO
+ OSX_ARCHITECTURES_DEBUG "${CMAKE_OSX_ARCHITECTURES}"
+ OSX_ARCHITECTURES_RELEASE "${CMAKE_OSX_ARCHITECTURES}"
+ )
+ endif()
+endmacro()
+
+# Set library-specific properties.
+macro(SET_LIBRARY_TARGET_PROPERTIES target)
+ SET_COMMON_TARGET_PROPERTIES(${target})
+
+ # Shared library linker flags.
+ if(CEF_SHARED_LINKER_FLAGS)
+ string(REPLACE ";" " " _flags_str "${CEF_SHARED_LINKER_FLAGS}")
+ set_property(TARGET ${target} PROPERTY LINK_FLAGS ${_flags_str})
+ endif()
+ if(CEF_SHARED_LINKER_FLAGS_DEBUG)
+ string(REPLACE ";" " " _flags_str "${CEF_SHARED_LINKER_FLAGS_DEBUG}")
+ set_property(TARGET ${target} PROPERTY LINK_FLAGS_DEBUG ${_flags_str})
+ endif()
+ if(CEF_SHARED_LINKER_FLAGS_RELEASE)
+ string(REPLACE ";" " " _flags_str "${CEF_SHARED_LINKER_FLAGS_RELEASE}")
+ set_property(TARGET ${target} PROPERTY LINK_FLAGS_RELEASE ${_flags_str})
+ endif()
+endmacro()
+
+# Set executable-specific properties.
+macro(SET_EXECUTABLE_TARGET_PROPERTIES target)
+ SET_COMMON_TARGET_PROPERTIES(${target})
+
+ # Executable linker flags.
+ if(CEF_EXE_LINKER_FLAGS)
+ string(REPLACE ";" " " _flags_str "${CEF_EXE_LINKER_FLAGS}")
+ set_property(TARGET ${target} PROPERTY LINK_FLAGS ${_flags_str})
+ endif()
+ if(CEF_EXE_LINKER_FLAGS_DEBUG)
+ string(REPLACE ";" " " _flags_str "${CEF_EXE_LINKER_FLAGS_DEBUG}")
+ set_property(TARGET ${target} PROPERTY LINK_FLAGS_DEBUG ${_flags_str})
+ endif()
+ if(CEF_EXE_LINKER_FLAGS_RELEASE)
+ string(REPLACE ";" " " _flags_str "${CEF_EXE_LINKER_FLAGS_RELEASE}")
+ set_property(TARGET ${target} PROPERTY LINK_FLAGS_RELEASE ${_flags_str})
+ endif()
+endmacro()
diff --git a/src/cmake/cef_variables.cmake.in b/src/cmake/cef_variables.cmake.in
new file mode 100644
index 0000000..4b3b58d
--- /dev/null
+++ b/src/cmake/cef_variables.cmake.in
@@ -0,0 +1,555 @@
+# Copyright (c) 2016 The Chromium Embedded Framework Authors. All rights
+# reserved. Use of this source code is governed by a BSD-style license that
+# can be found in the LICENSE file.
+
+# Must be loaded via FindCEF.cmake.
+if(NOT DEFINED _CEF_ROOT_EXPLICIT)
+ message(FATAL_ERROR "Use find_package(CEF) to load this file.")
+endif()
+
+
+#
+# Shared configuration.
+#
+
+# Determine the platform.
+if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
+ set(OS_MACOSX 1)
+ set(OS_POSIX 1)
+elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
+ set(OS_LINUX 1)
+ set(OS_POSIX 1)
+elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
+ set(OS_WINDOWS 1)
+endif()
+
+# Determine the project architecture.
+if(NOT DEFINED PROJECT_ARCH)
+ if(CMAKE_SIZEOF_VOID_P MATCHES 8)
+ set(PROJECT_ARCH "x86_64")
+ else()
+ set(PROJECT_ARCH "x86")
+ endif()
+
+ if(OS_MACOSX)
+ # PROJECT_ARCH should be specified on Mac OS X.
+ message(WARNING "No PROJECT_ARCH value specified, using ${PROJECT_ARCH}")
+ endif()
+endif()
+
+if(${CMAKE_GENERATOR} STREQUAL "Ninja")
+ set(GEN_NINJA 1)
+elseif(${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
+ set(GEN_MAKEFILES 1)
+endif()
+
+# Determine the build type.
+if(NOT CMAKE_BUILD_TYPE AND (GEN_NINJA OR GEN_MAKEFILES))
+ # CMAKE_BUILD_TYPE should be specified when using Ninja or Unix Makefiles.
+ set(CMAKE_BUILD_TYPE Release)
+ message(WARNING "No CMAKE_BUILD_TYPE value selected, using ${CMAKE_BUILD_TYPE}")
+endif()
+
+
+# Path to the include directory.
+set(CEF_INCLUDE_PATH "${_CEF_ROOT}")
+
+# Path to the libcef_dll_wrapper target.
+set(CEF_LIBCEF_DLL_WRAPPER_PATH "${_CEF_ROOT}/libcef_dll")
+
+
+# Shared compiler/linker flags.
+list(APPEND CEF_COMPILER_DEFINES
+ # Allow C++ programs to use stdint.h macros specified in the C99 standard that aren't
+ # in the C++ standard (e.g. UINT8_MAX, INT64_MIN, etc)
+ __STDC_CONSTANT_MACROS __STDC_FORMAT_MACROS
+ )
+
+
+# Configure use of the sandbox.
+option(USE_SANDBOX "Enable or disable use of the sandbox." ON)
+
+
+#
+# Linux configuration.
+#
+
+if(OS_LINUX)
+ # Platform-specific compiler/linker flags.
+ set(CEF_LIBTYPE SHARED)
+ list(APPEND CEF_COMPILER_FLAGS
+ -fno-strict-aliasing # Avoid assumptions regarding non-aliasing of objects of different types
+ -fPIC # Generate position-independent code for shared libraries
+ -fstack-protector # Protect some vulnerable functions from stack-smashing (security feature)
+ -funwind-tables # Support stack unwinding for backtrace()
+ -fvisibility=hidden # Give hidden visibility to declarations that are not explicitly marked as visible
+ --param=ssp-buffer-size=4 # Set the minimum buffer size protected by SSP (security feature, related to stack-protector)
+ -pipe # Use pipes rather than temporary files for communication between build stages
+ -pthread # Use the pthread library
+ -Wall # Enable all warnings
+ -Werror # Treat warnings as errors
+ -Wno-missing-field-initializers # Don't warn about missing field initializers
+ -Wno-unused-parameter # Don't warn about unused parameters
+ -Wno-error=comment # Don't warn about code in comments
+ -Wno-comment # Don't warn about code in comments
+ )
+ list(APPEND CEF_C_COMPILER_FLAGS
+ -std=c99 # Use the C99 language standard
+ )
+ list(APPEND CEF_CXX_COMPILER_FLAGS
+ -fno-exceptions # Disable exceptions
+ -fno-rtti # Disable real-time type information
+ -fno-threadsafe-statics # Don't generate thread-safe statics
+ -fvisibility-inlines-hidden # Give hidden visibility to inlined class member functions
+ -std=gnu++11 # Use the C++11 language standard including GNU extensions
+ -Wsign-compare # Warn about mixed signed/unsigned type comparisons
+ )
+ list(APPEND CEF_COMPILER_FLAGS_DEBUG
+ -O0 # Disable optimizations
+ -g # Generate debug information
+ )
+ list(APPEND CEF_COMPILER_FLAGS_RELEASE
+ -O2 # Optimize for maximum speed
+ -fdata-sections # Enable linker optimizations to improve locality of reference for data sections
+ -ffunction-sections # Enable linker optimizations to improve locality of reference for function sections
+ -fno-ident # Ignore the #ident directive
+ -U_FORTIFY_SOURCE # Undefine _FORTIFY_SOURCE in case it was previously defined
+ -D_FORTIFY_SOURCE=2 # Add memory and string function protection (security feature, related to stack-protector)
+ )
+ list(APPEND CEF_LINKER_FLAGS
+ -fPIC # Generate position-independent code for shared libraries
+ -pthread # Use the pthread library
+ -Wl,--disable-new-dtags # Don't generate new-style dynamic tags in ELF
+ -Wl,--fatal-warnings # Treat warnings as errors
+ -Wl,-rpath,. # Set rpath so that libraries can be placed next to the executable
+ -Wl,-z,noexecstack # Mark the stack as non-executable (security feature)
+ -Wl,-z,now # Resolve symbols on program start instead of on first use (security feature)
+ -Wl,-z,relro # Mark relocation sections as read-only (security feature)
+ )
+ list(APPEND CEF_LINKER_FLAGS_RELEASE
+ -Wl,-O1 # Enable linker optimizations
+ -Wl,--as-needed # Only link libraries that export symbols used by the binary
+ -Wl,--gc-sections # Remove unused code resulting from -fdata-sections and -function-sections
+ )
+ list(APPEND CEF_COMPILER_DEFINES
+ _FILE_OFFSET_BITS=64 # Allow the Large File Support (LFS) interface to replace the old interface
+ )
+ list(APPEND CEF_COMPILER_DEFINES_RELEASE
+ NDEBUG # Not a debug build
+ )
+
+ include(CheckCCompilerFlag)
+ include(CheckCXXCompilerFlag)
+
+ CHECK_CXX_COMPILER_FLAG(-Wno-undefined-var-template COMPILER_SUPPORTS_NO_UNDEFINED_VAR_TEMPLATE)
+ if(COMPILER_SUPPORTS_NO_UNDEFINED_VAR_TEMPLATE)
+ list(APPEND CEF_CXX_COMPILER_FLAGS
+ -Wno-undefined-var-template # Don't warn about potentially uninstantiated static members
+ )
+ endif()
+
+ CHECK_C_COMPILER_FLAG(-Wno-unused-local-typedefs COMPILER_SUPPORTS_NO_UNUSED_LOCAL_TYPEDEFS)
+ if(COMPILER_SUPPORTS_NO_UNUSED_LOCAL_TYPEDEFS)
+ list(APPEND CEF_C_COMPILER_FLAGS
+ -Wno-unused-local-typedefs # Don't warn about unused local typedefs
+ )
+ endif()
+
+ CHECK_CXX_COMPILER_FLAG(-Wno-literal-suffix COMPILER_SUPPORTS_NO_LITERAL_SUFFIX)
+ if(COMPILER_SUPPORTS_NO_LITERAL_SUFFIX)
+ list(APPEND CEF_CXX_COMPILER_FLAGS
+ -Wno-literal-suffix # Don't warn about invalid suffixes on literals
+ )
+ endif()
+
+ CHECK_CXX_COMPILER_FLAG(-Wno-narrowing COMPILER_SUPPORTS_NO_NARROWING)
+ if(COMPILER_SUPPORTS_NO_NARROWING)
+ list(APPEND CEF_CXX_COMPILER_FLAGS
+ -Wno-narrowing # Don't warn about type narrowing
+ )
+ endif()
+
+ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
+ list(APPEND CEF_CXX_COMPILER_FLAGS
+ -Wno-attributes # The cfi-icall attribute is not supported by the GNU C++ compiler
+ )
+ endif()
+
+ if(PROJECT_ARCH STREQUAL "x86_64")
+ # 64-bit architecture.
+ list(APPEND CEF_COMPILER_FLAGS
+ -m64
+ -march=x86-64
+ )
+ list(APPEND CEF_LINKER_FLAGS
+ -m64
+ )
+ elseif(PROJECT_ARCH STREQUAL "x86")
+ # 32-bit architecture.
+ list(APPEND CEF_COMPILER_FLAGS
+ -msse2
+ -mfpmath=sse
+ -mmmx
+ -m32
+ )
+ list(APPEND CEF_LINKER_FLAGS
+ -m32
+ )
+ endif()
+
+ # Standard libraries.
+ set(CEF_STANDARD_LIBS
+ X11
+ )
+
+ # CEF directory paths.
+ set(CEF_RESOURCE_DIR "${_CEF_ROOT}/Resources")
+ set(CEF_BINARY_DIR "${_CEF_ROOT}/${CMAKE_BUILD_TYPE}")
+ set(CEF_BINARY_DIR_DEBUG "${_CEF_ROOT}/Debug")
+ set(CEF_BINARY_DIR_RELEASE "${_CEF_ROOT}/Release")
+
+ # CEF library paths.
+ set(CEF_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/libcef.so")
+ set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/libcef.so")
+
+ # List of CEF binary files.
+ set(CEF_BINARY_FILES
+ chrome-sandbox
+ libcef.so
+ libEGL.so
+ libGLESv2.so
+ snapshot_blob.bin
+ v8_context_snapshot.bin
+ swiftshader
+ )
+
+ # List of CEF resource files.
+ set(CEF_RESOURCE_FILES
+ cef.pak
+ cef_100_percent.pak
+ cef_200_percent.pak
+ cef_extensions.pak
+ devtools_resources.pak
+ icudtl.dat
+ locales
+ )
+
+ if(USE_SANDBOX)
+ list(APPEND CEF_COMPILER_DEFINES
+ CEF_USE_SANDBOX # Used by apps to test if the sandbox is enabled
+ )
+ endif()
+endif()
+
+
+#
+# Mac OS X configuration.
+#
+
+if(OS_MACOSX)
+ # Platform-specific compiler/linker flags.
+ # See also Xcode target properties in cef_macros.cmake.
+ set(CEF_LIBTYPE SHARED)
+ list(APPEND CEF_COMPILER_FLAGS
+ -fno-strict-aliasing # Avoid assumptions regarding non-aliasing of objects of different types
+ -fstack-protector # Protect some vulnerable functions from stack-smashing (security feature)
+ -funwind-tables # Support stack unwinding for backtrace()
+ -fvisibility=hidden # Give hidden visibility to declarations that are not explicitly marked as visible
+ -Wall # Enable all warnings
+ -Werror # Treat warnings as errors
+ -Wextra # Enable additional warnings
+ -Wendif-labels # Warn whenever an #else or an #endif is followed by text
+ -Wnewline-eof # Warn about no newline at end of file
+ -Wno-missing-field-initializers # Don't warn about missing field initializers
+ -Wno-unused-parameter # Don't warn about unused parameters
+ )
+ list(APPEND CEF_C_COMPILER_FLAGS
+ -std=c99 # Use the C99 language standard
+ )
+ list(APPEND CEF_CXX_COMPILER_FLAGS
+ -fno-exceptions # Disable exceptions
+ -fno-rtti # Disable real-time type information
+ -fno-threadsafe-statics # Don't generate thread-safe statics
+ -fobjc-call-cxx-cdtors # Call the constructor/destructor of C++ instance variables in ObjC objects
+ -fvisibility-inlines-hidden # Give hidden visibility to inlined class member functions
+ -std=gnu++11 # Use the C++11 language standard including GNU extensions
+ -Wno-narrowing # Don't warn about type narrowing
+ -Wsign-compare # Warn about mixed signed/unsigned type comparisons
+ )
+ list(APPEND CEF_COMPILER_FLAGS_DEBUG
+ -O0 # Disable optimizations
+ -g # Generate debug information
+ )
+ list(APPEND CEF_COMPILER_FLAGS_RELEASE
+ -O3 # Optimize for maximum speed plus a few extras
+ )
+ list(APPEND CEF_LINKER_FLAGS
+ -Wl,-search_paths_first # Search for static or shared library versions in the same pass
+ -Wl,-ObjC # Support creation of ObjC static libraries
+ -Wl,-pie # Generate position-independent code suitable for executables only
+ )
+ list(APPEND CEF_LINKER_FLAGS_RELEASE
+ -Wl,-dead_strip # Strip dead code
+ )
+
+ include(CheckCXXCompilerFlag)
+
+ CHECK_CXX_COMPILER_FLAG(-Wno-undefined-var-template COMPILER_SUPPORTS_NO_UNDEFINED_VAR_TEMPLATE)
+ if(COMPILER_SUPPORTS_NO_UNDEFINED_VAR_TEMPLATE)
+ list(APPEND CEF_CXX_COMPILER_FLAGS
+ -Wno-undefined-var-template # Don't warn about potentially uninstantiated static members
+ )
+ endif()
+
+ # Standard libraries.
+ set(CEF_STANDARD_LIBS
+ -lpthread
+ "-framework Cocoa"
+ "-framework AppKit"
+ )
+
+ # Find the newest available base SDK.
+ execute_process(COMMAND xcode-select --print-path OUTPUT_VARIABLE XCODE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
+ foreach(OS_VERSION 10.11 10.10 10.9)
+ set(SDK "${XCODE_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${OS_VERSION}.sdk")
+ if(NOT "${CMAKE_OSX_SYSROOT}" AND EXISTS "${SDK}" AND IS_DIRECTORY "${SDK}")
+ set(CMAKE_OSX_SYSROOT ${SDK})
+ endif()
+ endforeach()
+
+ # Target SDK.
+ set(CEF_TARGET_SDK "10.9")
+ list(APPEND CEF_COMPILER_FLAGS
+ -mmacosx-version-min=${CEF_TARGET_SDK}
+ )
+ set(CMAKE_OSX_DEPLOYMENT_TARGET ${CEF_TARGET_SDK})
+
+ # Target architecture.
+ if(PROJECT_ARCH STREQUAL "x86_64")
+ set(CMAKE_OSX_ARCHITECTURES "x86_64")
+ else()
+ set(CMAKE_OSX_ARCHITECTURES "i386")
+ endif()
+
+ # Prevent Xcode 11 from doing automatic codesigning.
+ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
+
+ # CEF directory paths.
+ set(CEF_BINARY_DIR "${_CEF_ROOT}/$<CONFIGURATION>")
+ set(CEF_BINARY_DIR_DEBUG "${_CEF_ROOT}/Debug")
+ set(CEF_BINARY_DIR_RELEASE "${_CEF_ROOT}/Release")
+
+ if(USE_SANDBOX)
+ list(APPEND CEF_COMPILER_DEFINES
+ CEF_USE_SANDBOX # Used by apps to test if the sandbox is enabled
+ )
+
+ # CEF sandbox library paths.
+ set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.a")
+ set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.a")
+ endif()
+
+ # CEF Helper app suffixes.
+ # Format is "<name suffix>:<target suffix>:<plist suffix>".
+ set(CEF_HELPER_APP_SUFFIXES
+ "::"
+ " (GPU):_gpu:.gpu"
+ " (Plugin):_plugin:.plugin"
+ " (Renderer):_renderer:.renderer"
+ )
+endif()
+
+
+#
+# Windows configuration.
+#
+
+if(OS_WINDOWS)
+ if (GEN_NINJA)
+ # When using the Ninja generator clear the CMake defaults to avoid excessive
+ # console warnings (see issue #2120).
+ set(CMAKE_CXX_FLAGS "")
+ set(CMAKE_CXX_FLAGS_DEBUG "")
+ set(CMAKE_CXX_FLAGS_RELEASE "")
+ endif()
+
+ if(USE_SANDBOX)
+ # Check if the current MSVC version is compatible with the cef_sandbox.lib
+ # static library. For a list of all version numbers see
+ # https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B#Internal_version_numbering
+ list(APPEND supported_msvc_versions
+ 1900 # VS2015 and updates 1, 2, & 3
+ 1910 # VS2017 version 15.1 & 15.2
+ 1911 # VS2017 version 15.3 & 15.4
+ 1912 # VS2017 version 15.5
+ 1913 # VS2017 version 15.6
+ 1914 # VS2017 version 15.7
+ 1915 # VS2017 version 15.8
+ 1916 # VS2017 version 15.9
+ 1920 # VS2019 version 16.0
+ 1921 # VS2019 version 16.1
+ 1922 # VS2019 version 16.2
+ 1923 # VS2019 version 16.3
+ 1924 # VS2019 version 16.4
+ )
+ list(FIND supported_msvc_versions ${MSVC_VERSION} _index)
+ if (${_index} EQUAL -1)
+ message(WARNING "CEF sandbox is not compatible with the current MSVC version (${MSVC_VERSION})")
+ set(USE_SANDBOX OFF)
+ endif()
+ endif()
+
+ # 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")
+
+ # Consumers using different runtime types may want to pass different flags
+ set(CEF_RUNTIME_LIBRARY_FLAG "/MT" CACHE STRING "Optional flag specifying which runtime to use")
+ if (CEF_RUNTIME_LIBRARY_FLAG)
+ list(APPEND CEF_COMPILER_FLAGS_DEBUG ${CEF_RUNTIME_LIBRARY_FLAG}d)
+ list(APPEND CEF_COMPILER_FLAGS_RELEASE ${CEF_RUNTIME_LIBRARY_FLAG})
+ endif()
+
+ # Platform-specific compiler/linker flags.
+ set(CEF_LIBTYPE STATIC)
+ list(APPEND CEF_COMPILER_FLAGS
+ /MP # Multiprocess compilation
+ /Gy # Enable function-level linking
+ /GR- # Disable run-time type information
+ /W4 # Warning level 4
+ /WX # Treat warnings as errors
+ /wd4100 # Ignore "unreferenced formal parameter" warning
+ /wd4127 # Ignore "conditional expression is constant" warning
+ /wd4244 # Ignore "conversion possible loss of data" warning
+ /wd4481 # Ignore "nonstandard extension used: override" warning
+ /wd4512 # Ignore "assignment operator could not be generated" warning
+ /wd4701 # Ignore "potentially uninitialized local variable" warning
+ /wd4702 # Ignore "unreachable code" warning
+ /wd4996 # Ignore "function or variable may be unsafe" warning
+ ${CEF_DEBUG_INFO_FLAG}
+ )
+ list(APPEND CEF_COMPILER_FLAGS_DEBUG
+ /RTC1 # Disable optimizations
+ /Od # Enable basic run-time checks
+ )
+ list(APPEND CEF_COMPILER_FLAGS_RELEASE
+ /O2 # Optimize for maximum speed
+ /Ob2 # Inline any suitable function
+ /GF # Enable string pooling
+ )
+ list(APPEND CEF_LINKER_FLAGS_DEBUG
+ /DEBUG # Generate debug information
+ )
+ list(APPEND CEF_EXE_LINKER_FLAGS
+ /MANIFEST:NO # No default manifest (see ADD_WINDOWS_MANIFEST macro usage)
+ /LARGEADDRESSAWARE # Allow 32-bit processes to access 3GB of RAM
+ )
+ list(APPEND CEF_COMPILER_DEFINES
+ WIN32 _WIN32 _WINDOWS # Windows platform
+ UNICODE _UNICODE # Unicode build
+ WINVER=0x0601 _WIN32_WINNT=0x601 # Targeting Windows 7
+ NOMINMAX # Use the standard's templated min/max
+ WIN32_LEAN_AND_MEAN # Exclude less common API declarations
+ _HAS_EXCEPTIONS=0 # Disable exceptions
+ )
+ list(APPEND CEF_COMPILER_DEFINES_RELEASE
+ NDEBUG _NDEBUG # Not a debug build
+ )
+
+ # Standard libraries.
+ set(CEF_STANDARD_LIBS
+ comctl32.lib
+ rpcrt4.lib
+ shlwapi.lib
+ ws2_32.lib
+ )
+
+ # CEF directory paths.
+ set(CEF_RESOURCE_DIR "${_CEF_ROOT}/Resources")
+ set(CEF_BINARY_DIR "${_CEF_ROOT}/$<CONFIGURATION>")
+ set(CEF_BINARY_DIR_DEBUG "${_CEF_ROOT}/Debug")
+ set(CEF_BINARY_DIR_RELEASE "${_CEF_ROOT}/Release")
+
+ # CEF library paths.
+ set(CEF_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/libcef.lib")
+ set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/libcef.lib")
+
+ # List of CEF binary files.
+ set(CEF_BINARY_FILES
+ chrome_elf.dll
+ d3dcompiler_47.dll
+ libcef.dll
+ libEGL.dll
+ libGLESv2.dll
+ snapshot_blob.bin
+ v8_context_snapshot.bin
+ swiftshader
+ )
+
+ # List of CEF resource files.
+ set(CEF_RESOURCE_FILES
+ cef.pak
+ cef_100_percent.pak
+ cef_200_percent.pak
+ cef_extensions.pak
+ devtools_resources.pak
+ icudtl.dat
+ locales
+ )
+
+ if(USE_SANDBOX)
+ list(APPEND CEF_COMPILER_DEFINES
+ PSAPI_VERSION=1 # Required by cef_sandbox.lib
+ CEF_USE_SANDBOX # Used by apps to test if the sandbox is enabled
+ )
+
+ # Libraries required by cef_sandbox.lib.
+ set(CEF_SANDBOX_STANDARD_LIBS
+ dbghelp.lib
+ Delayimp.lib
+ PowrProf.lib
+ Propsys.lib
+ psapi.lib
+ SetupAPI.lib
+ version.lib
+ wbemuuid.lib
+ winmm.lib
+ )
+
+ # CEF sandbox library paths.
+ set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.lib")
+ set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.lib")
+ endif()
+
+ # Configure use of ATL.
+ option(USE_ATL "Enable or disable use of ATL." ON)
+ if(USE_ATL)
+ # Locate the atlmfc directory if it exists. It may be at any depth inside
+ # the VC directory. The cl.exe path returned by CMAKE_CXX_COMPILER may also
+ # be at different depths depending on the toolchain version
+ # (e.g. "VC/bin/cl.exe", "VC/bin/amd64_x86/cl.exe",
+ # "VC/Tools/MSVC/14.10.25017/bin/HostX86/x86/cl.exe", etc).
+ set(HAS_ATLMFC 0)
+ get_filename_component(VC_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
+ get_filename_component(VC_DIR_NAME ${VC_DIR} NAME)
+ while(NOT ${VC_DIR_NAME} STREQUAL "VC")
+ get_filename_component(VC_DIR ${VC_DIR} DIRECTORY)
+ if(IS_DIRECTORY "${VC_DIR}/atlmfc")
+ set(HAS_ATLMFC 1)
+ break()
+ endif()
+ get_filename_component(VC_DIR_NAME ${VC_DIR} NAME)
+ endwhile()
+
+ # Determine if the Visual Studio install supports ATL.
+ if(NOT HAS_ATLMFC)
+ message(WARNING "ATL is not supported by your VC installation.")
+ set(USE_ATL OFF)
+ endif()
+ endif()
+
+ if(USE_ATL)
+ list(APPEND CEF_COMPILER_DEFINES
+ CEF_USE_ATL # Used by apps to test if ATL support is enabled
+ )
+ endif()
+endif()
diff --git a/src/include/base/cef_atomic_ref_count.h b/src/include/base/cef_atomic_ref_count.h
new file mode 100644
index 0000000..4d67779
--- /dev/null
+++ b/src/include/base/cef_atomic_ref_count.h
@@ -0,0 +1,165 @@
+// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
+// Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// This is a low level implementation of atomic semantics for reference
+// counting. Please use cef_ref_counted.h directly instead.
+//
+// The Chromium implementation includes annotations to avoid some false
+// positives when using data race detection tools. Annotations are not
+// currently supported by the CEF implementation.
+
+#ifndef CEF_INCLUDE_BASE_CEF_ATOMIC_REF_COUNT_H_
+#define CEF_INCLUDE_BASE_CEF_ATOMIC_REF_COUNT_H_
+#pragma once
+
+#if defined(USING_CHROMIUM_INCLUDES)
+// When building CEF include the Chromium header directly.
+#include "base/atomic_ref_count.h"
+
+// Used when declaring a base::AtomicRefCount value. This is an object type with
+// Chromium headers.
+#define ATOMIC_DECLARATION (0)
+
+// Maintaining compatibility with AtompicRefCount* functions that were removed
+// from Chromium in http://crrev.com/ee96d561.
+namespace base {
+
+// Increment a reference count by 1.
+inline void AtomicRefCountInc(volatile AtomicRefCount* ptr) {
+ const_cast<AtomicRefCount*>(ptr)->Increment();
+}
+
+// Decrement a reference count by 1 and return whether the result is non-zero.
+// Insert barriers to ensure that state written before the reference count
+// became zero will be visible to a thread that has just made the count zero.
+inline bool AtomicRefCountDec(volatile AtomicRefCount* ptr) {
+ return const_cast<AtomicRefCount*>(ptr)->Decrement();
+}
+
+// Return whether the reference count is one. If the reference count is used
+// in the conventional way, a refrerence count of 1 implies that the current
+// thread owns the reference and no other thread shares it. This call performs
+// the test for a reference count of one, and performs the memory barrier
+// needed for the owning thread to act on the object, knowing that it has
+// exclusive access to the object.
+inline bool AtomicRefCountIsOne(volatile AtomicRefCount* ptr) {
+ return const_cast<AtomicRefCount*>(ptr)->IsOne();
+}
+
+// Return whether the reference count is zero. With conventional object
+// referencing counting, the object will be destroyed, so the reference count
+// should never be zero. Hence this is generally used for a debug check.
+inline bool AtomicRefCountIsZero(volatile AtomicRefCount* ptr) {
+ return const_cast<AtomicRefCount*>(ptr)->IsZero();
+}
+
+} // namespace base
+
+#else // !USING_CHROMIUM_INCLUDES
+// The following is substantially similar to the Chromium implementation.
+// If the Chromium implementation diverges the below implementation should be
+// updated to match.
+
+#include "include/base/cef_atomicops.h"
+
+// Annotations are not currently supported.
+#define ANNOTATE_HAPPENS_BEFORE(obj) /* empty */
+#define ANNOTATE_HAPPENS_AFTER(obj) /* empty */
+
+// Used when declaring a base::AtomicRefCount value. This is an integer/ptr type
+// with CEF headers.
+#define ATOMIC_DECLARATION = 0
+
+namespace base {
+
+typedef subtle::Atomic32 AtomicRefCount;
+
+// Increment a reference count by "increment", which must exceed 0.
+inline void AtomicRefCountIncN(volatile AtomicRefCount* ptr,
+ AtomicRefCount increment) {
+ subtle::NoBarrier_AtomicIncrement(ptr, increment);
+}
+
+// Decrement a reference count by "decrement", which must exceed 0,
+// and return whether the result is non-zero.
+// Insert barriers to ensure that state written before the reference count
+// became zero will be visible to a thread that has just made the count zero.
+inline bool AtomicRefCountDecN(volatile AtomicRefCount* ptr,
+ AtomicRefCount decrement) {
+ ANNOTATE_HAPPENS_BEFORE(ptr);
+ bool res = (subtle::Barrier_AtomicIncrement(ptr, -decrement) != 0);
+ if (!res) {
+ ANNOTATE_HAPPENS_AFTER(ptr);
+ }
+ return res;
+}
+
+// Increment a reference count by 1.
+inline void AtomicRefCountInc(volatile AtomicRefCount* ptr) {
+ base::AtomicRefCountIncN(ptr, 1);
+}
+
+// Decrement a reference count by 1 and return whether the result is non-zero.
+// Insert barriers to ensure that state written before the reference count
+// became zero will be visible to a thread that has just made the count zero.
+inline bool AtomicRefCountDec(volatile AtomicRefCount* ptr) {
+ return base::AtomicRefCountDecN(ptr, 1);
+}
+
+// Return whether the reference count is one. If the reference count is used
+// in the conventional way, a refrerence count of 1 implies that the current
+// thread owns the reference and no other thread shares it. This call performs
+// the test for a reference count of one, and performs the memory barrier
+// needed for the owning thread to act on the object, knowing that it has
+// exclusive access to the object.
+inline bool AtomicRefCountIsOne(volatile AtomicRefCount* ptr) {
+ bool res = (subtle::Acquire_Load(ptr) == 1);
+ if (res) {
+ ANNOTATE_HAPPENS_AFTER(ptr);
+ }
+ return res;
+}
+
+// Return whether the reference count is zero. With conventional object
+// referencing counting, the object will be destroyed, so the reference count
+// should never be zero. Hence this is generally used for a debug check.
+inline bool AtomicRefCountIsZero(volatile AtomicRefCount* ptr) {
+ bool res = (subtle::Acquire_Load(ptr) == 0);
+ if (res) {
+ ANNOTATE_HAPPENS_AFTER(ptr);
+ }
+ return res;
+}
+
+} // namespace base
+
+#endif // !USING_CHROMIUM_INCLUDES
+
+#endif // CEF_INCLUDE_BASE_CEF_ATOMIC_REF_COUNT_H_
diff --git a/src/include/base/cef_atomicops.h b/src/include/base/cef_atomicops.h
new file mode 100644
index 0000000..a5b6459
--- /dev/null
+++ b/src/include/base/cef_atomicops.h
@@ -0,0 +1,203 @@
+// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012
+// Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// For atomic operations on reference counts, see cef_atomic_ref_count.h.
+
+// The routines exported by this module are subtle. If you use them, even if
+// you get the code right, it will depend on careful reasoning about atomicity
+// and memory ordering; it will be less readable, and harder to maintain. If
+// you plan to use these routines, you should have a good reason, such as solid
+// evidence that performance would otherwise suffer, or there being no
+// alternative. You should assume only properties explicitly guaranteed by the
+// specifications in this file. You are almost certainly _not_ writing code
+// just for the x86; if you assume x86 semantics, x86 hardware bugs and
+// implementations on other archtectures will cause your code to break. If you
+// do not know what you are doing, avoid these routines, and use a Mutex.
+//
+// It is incorrect to make direct assignments to/from an atomic variable.
+// You should use one of the Load or Store routines. The NoBarrier
+// versions are provided when no barriers are needed:
+// NoBarrier_Store()
+// NoBarrier_Load()
+// Although there are currently no compiler enforcement, you are encouraged
+// to use these.
+//
+
+#ifndef CEF_INCLUDE_BASE_CEF_ATOMICOPS_H_
+#define CEF_INCLUDE_BASE_CEF_ATOMICOPS_H_
+#pragma once
+
+#if defined(BASE_ATOMICOPS_H_)
+// Do nothing if the Chromium header has already been included.
+// 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.
+#elif defined(USING_CHROMIUM_INCLUDES)
+// When building CEF include the Chromium header directly.
+#include "base/atomicops.h"
+#else // !USING_CHROMIUM_INCLUDES
+// The following is substantially similar to the Chromium implementation.
+// If the Chromium implementation diverges the below implementation should be
+// updated to match.
+
+#include <stdint.h>
+
+#include "include/base/cef_build.h"
+
+#if defined(OS_WIN) && defined(ARCH_CPU_64_BITS)
+// windows.h #defines this (only on x64). This causes problems because the
+// public API also uses MemoryBarrier at the public name for this fence. So, on
+// X64, undef it, and call its documented
+// (http://msdn.microsoft.com/en-us/library/windows/desktop/ms684208.aspx)
+// implementation directly.
+#undef MemoryBarrier
+#endif
+
+namespace base {
+namespace subtle {
+
+typedef int32_t Atomic32;
+#ifdef ARCH_CPU_64_BITS
+// We need to be able to go between Atomic64 and AtomicWord implicitly. This
+// means Atomic64 and AtomicWord should be the same type on 64-bit.
+#if defined(__ILP32__) || defined(OS_NACL)
+// NaCl's intptr_t is not actually 64-bits on 64-bit!
+// http://code.google.com/p/nativeclient/issues/detail?id=1162
+typedef int64_t Atomic64;
+#else
+typedef intptr_t Atomic64;
+#endif
+#endif
+
+// Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or
+// Atomic64 routines below, depending on your architecture.
+typedef intptr_t AtomicWord;
+
+// Atomically execute:
+// result = *ptr;
+// if (*ptr == old_value)
+// *ptr = new_value;
+// return result;
+//
+// I.e., replace "*ptr" with "new_value" if "*ptr" used to be "old_value".
+// Always return the old value of "*ptr"
+//
+// This routine implies no memory barriers.
+Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value);
+
+// Atomically store new_value into *ptr, returning the previous value held in
+// *ptr. This routine implies no memory barriers.
+Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, Atomic32 new_value);
+
+// Atomically increment *ptr by "increment". Returns the new value of
+// *ptr with the increment applied. This routine implies no memory barriers.
+Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, Atomic32 increment);
+
+Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, Atomic32 increment);
+
+// These following lower-level operations are typically useful only to people
+// implementing higher-level synchronization operations like spinlocks,
+// mutexes, and condition-variables. They combine CompareAndSwap(), a load, or
+// a store with appropriate memory-ordering instructions. "Acquire" operations
+// ensure that no later memory access can be reordered ahead of the operation.
+// "Release" operations ensure that no previous memory access can be reordered
+// after the operation. "Barrier" operations have both "Acquire" and "Release"
+// semantics. A MemoryBarrier() has "Barrier" semantics, but does no memory
+// access.
+Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value);
+Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
+ Atomic32 old_value,
+ Atomic32 new_value);
+
+void MemoryBarrier();
+void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value);
+void Acquire_Store(volatile Atomic32* ptr, Atomic32 value);
+void Release_Store(volatile Atomic32* ptr, Atomic32 value);
+
+Atomic32 NoBarrier_Load(volatile const Atomic32* ptr);
+Atomic32 Acquire_Load(volatile const Atomic32* ptr);
+Atomic32 Release_Load(volatile const Atomic32* ptr);
+
+// 64-bit atomic operations (only available on 64-bit processors).
+#ifdef ARCH_CPU_64_BITS
+Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value);
+Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, Atomic64 new_value);
+Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment);
+Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment);
+
+Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value);
+Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value);
+void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value);
+void Acquire_Store(volatile Atomic64* ptr, Atomic64 value);
+void Release_Store(volatile Atomic64* ptr, Atomic64 value);
+Atomic64 NoBarrier_Load(volatile const Atomic64* ptr);
+Atomic64 Acquire_Load(volatile const Atomic64* ptr);
+Atomic64 Release_Load(volatile const Atomic64* ptr);
+#endif // ARCH_CPU_64_BITS
+
+} // namespace subtle
+} // namespace base
+
+// Include our platform specific implementation.
+#if defined(OS_WIN) && defined(COMPILER_MSVC) && defined(ARCH_CPU_X86_FAMILY)
+#include "include/base/internal/cef_atomicops_x86_msvc.h"
+#elif defined(OS_WIN) && (defined(__ARM_ARCH_ISA_A64) || defined(_M_ARM64))
+#include "include/base/internal/cef_atomicops_arm64_msvc.h"
+#elif defined(OS_MACOSX)
+#include "include/base/internal/cef_atomicops_mac.h"
+#elif defined(COMPILER_GCC) && defined(ARCH_CPU_X86_FAMILY)
+#include "include/base/internal/cef_atomicops_x86_gcc.h"
+#elif defined(COMPILER_GCC) && defined(__ARM_ARCH_ISA_A64)
+#include "include/base/internal/cef_atomicops_arm64_gcc.h"
+#elif defined(COMPILER_GCC) && defined(__ARM_ARCH)
+#include "include/base/internal/cef_atomicops_arm_gcc.h"
+#else
+#error "Atomic operations are not supported on your platform"
+#endif
+
+// On some platforms we need additional declarations to make
+// AtomicWord compatible with our other Atomic* types.
+#if defined(OS_MACOSX) || defined(OS_OPENBSD)
+#include "include/base/internal/cef_atomicops_atomicword_compat.h"
+#endif
+
+#endif // !USING_CHROMIUM_INCLUDES
+
+#endif // CEF_INCLUDE_BASE_CEF_ATOMICOPS_H_
diff --git a/src/include/base/cef_basictypes.h b/src/include/base/cef_basictypes.h
new file mode 100644
index 0000000..e38f4f7
--- /dev/null
+++ b/src/include/base/cef_basictypes.h
@@ -0,0 +1,87 @@
+// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012
+// Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef CEF_INCLUDE_BASE_CEF_BASICTYPES_H_
+#define CEF_INCLUDE_BASE_CEF_BASICTYPES_H_
+#pragma once
+
+#include <limits.h> // For UINT_MAX
+#include <stddef.h> // For size_t
+
+#include "include/base/cef_build.h"
+
+// The NSPR system headers define 64-bit as |long| when possible, except on
+// Mac OS X. In order to not have typedef mismatches, we do the same on LP64.
+//
+// On Mac OS X, |long long| is used for 64-bit types for compatibility with
+// <inttypes.h> format macros even in the LP64 model.
+#if defined(__LP64__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
+typedef long int64;
+typedef unsigned long uint64;
+#else
+typedef long long int64;
+typedef unsigned long long uint64;
+#endif
+
+// TODO: Remove these type guards. These are to avoid conflicts with
+// obsolete/protypes.h in the Gecko SDK.
+#ifndef _INT32
+#define _INT32
+typedef int int32;
+#endif
+
+// TODO: Remove these type guards. These are to avoid conflicts with
+// obsolete/protypes.h in the Gecko SDK.
+#ifndef _UINT32
+#define _UINT32
+typedef unsigned int uint32;
+#endif
+
+#ifndef _INT16
+#define _INT16
+typedef short int16;
+#endif
+
+#ifndef _UINT16
+#define _UINT16
+typedef unsigned short uint16;
+#endif
+
+// UTF-16 character type.
+// This should be kept synchronized with base/strings/string16.h
+#ifndef char16
+#if defined(WCHAR_T_IS_UTF16)
+typedef wchar_t char16;
+#elif defined(WCHAR_T_IS_UTF32)
+typedef unsigned short char16;
+#endif
+#endif
+
+#endif // CEF_INCLUDE_BASE_CEF_BASICTYPES_H_
diff --git a/src/include/base/cef_bind.h b/src/include/base/cef_bind.h
new file mode 100644
index 0000000..77c9c55
--- /dev/null
+++ b/src/include/base/cef_bind.h
@@ -0,0 +1,575 @@
+// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
+// Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef CEF_INCLUDE_BASE_CEF_BIND_H_
+#define CEF_INCLUDE_BASE_CEF_BIND_H_
+#pragma once
+
+#if defined(BASE_BIND_H_)
+// Do nothing if the Chromium header has already been included.
+// 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.
+#elif defined(USING_CHROMIUM_INCLUDES)
+// When building CEF include the Chromium header directly.
+#include "base/bind.h"
+#else // !USING_CHROMIUM_INCLUDES
+// The following is substantially similar to the Chromium implementation.
+// If the Chromium implementation diverges the below implementation should be
+// updated to match.
+
+#include "include/base/internal/cef_bind_internal.h"
+#include "include/base/internal/cef_callback_internal.h"
+
+// -----------------------------------------------------------------------------
+// Usage documentation
+// -----------------------------------------------------------------------------
+//
+// See base/cef_callback.h for documentation.
+//
+//
+// -----------------------------------------------------------------------------
+// Implementation notes
+// -----------------------------------------------------------------------------
+//
+// If you're reading the implementation, before proceeding further, you should
+// read the top comment of base/bind_internal.h for a definition of common
+// terms and concepts.
+//
+// RETURN TYPES
+//
+// Though Bind()'s result is meant to be stored in a Callback<> type, it
+// cannot actually return the exact type without requiring a large amount
+// of extra template specializations. The problem is that in order to
+// discern the correct specialization of Callback<>, Bind would need to
+// unwrap the function signature to determine the signature's arity, and
+// whether or not it is a method.
+//
+// Each unique combination of (arity, function_type, num_prebound) where
+// function_type is one of {function, method, const_method} would require
+// one specialization. We eventually have to do a similar number of
+// specializations anyways in the implementation (see the Invoker<>,
+// classes). However, it is avoidable in Bind if we return the result
+// via an indirection like we do below.
+//
+// TODO(ajwong): We might be able to avoid this now, but need to test.
+//
+// It is possible to move most of the COMPILE_ASSERT asserts into BindState<>,
+// but it feels a little nicer to have the asserts here so people do not
+// need to crack open bind_internal.h. On the other hand, it makes Bind()
+// harder to read.
+
+namespace base {
+
+template <typename Functor>
+base::Callback<typename cef_internal::BindState<
+ typename cef_internal::FunctorTraits<Functor>::RunnableType,
+ typename cef_internal::FunctorTraits<Functor>::RunType,
+ void()>::UnboundRunType>
+Bind(Functor functor) {
+ // Typedefs for how to store and run the functor.
+ typedef
+ typename cef_internal::FunctorTraits<Functor>::RunnableType RunnableType;
+ typedef typename cef_internal::FunctorTraits<Functor>::RunType RunType;
+
+ typedef cef_internal::BindState<RunnableType, RunType, void()> BindState;
+
+ return Callback<typename BindState::UnboundRunType>(
+ new BindState(cef_internal::MakeRunnable(functor)));
+}
+
+template <typename Functor, typename P1>
+base::Callback<typename cef_internal::BindState<
+ typename cef_internal::FunctorTraits<Functor>::RunnableType,
+ typename cef_internal::FunctorTraits<Functor>::RunType,
+ void(typename cef_internal::CallbackParamTraits<P1>::StorageType)>::
+ UnboundRunType>
+Bind(Functor functor, const P1& p1) {
+ // Typedefs for how to store and run the functor.
+ typedef
+ typename cef_internal::FunctorTraits<Functor>::RunnableType RunnableType;
+ typedef typename cef_internal::FunctorTraits<Functor>::RunType RunType;
+
+ // Use RunnableType::RunType instead of RunType above because our
+ // checks should below for bound references need to know what the actual
+ // functor is going to interpret the argument as.
+ typedef cef_internal::FunctionTraits<typename RunnableType::RunType>
+ BoundFunctorTraits;
+
+ // Do not allow binding a non-const reference parameter. Non-const reference
+ // parameters are disallowed by the Google style guide. Also, binding a
+ // non-const reference parameter can make for subtle bugs because the
+ // invoked function will receive a reference to the stored copy of the
+ // argument and not the original.
+ COMPILE_ASSERT(
+ !(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value),
+ do_not_bind_functions_with_nonconst_ref);
+
+ // For methods, we need to be careful for parameter 1. We do not require
+ // a scoped_refptr because BindState<> itself takes care of AddRef() for
+ // methods. We also disallow binding of an array as the method's target
+ // object.
+ COMPILE_ASSERT(cef_internal::HasIsMethodTag<RunnableType>::value ||
+ !cef_internal::NeedsScopedRefptrButGetsRawPtr<P1>::value,
+ p1_is_refcounted_type_and_needs_scoped_refptr);
+ COMPILE_ASSERT(!cef_internal::HasIsMethodTag<RunnableType>::value ||
+ !is_array<P1>::value,
+ first_bound_argument_to_method_cannot_be_array);
+ typedef cef_internal::BindState<
+ RunnableType, RunType,
+ void(typename cef_internal::CallbackParamTraits<P1>::StorageType)>
+ BindState;
+
+ return Callback<typename BindState::UnboundRunType>(
+ new BindState(cef_internal::MakeRunnable(functor), p1));
+}
+
+template <typename Functor, typename P1, typename P2>
+base::Callback<typename cef_internal::BindState<
+ typename cef_internal::FunctorTraits<Functor>::RunnableType,
+ typename cef_internal::FunctorTraits<Functor>::RunType,
+ void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
+ typename cef_internal::CallbackParamTraits<P2>::StorageType)>::
+ UnboundRunType>
+Bind(Functor functor, const P1& p1, const P2& p2) {
+ // Typedefs for how to store and run the functor.
+ typedef
+ typename cef_internal::FunctorTraits<Functor>::RunnableType RunnableType;
+ typedef typename cef_internal::FunctorTraits<Functor>::RunType RunType;
+
+ // Use RunnableType::RunType instead of RunType above because our
+ // checks should below for bound references need to know what the actual
+ // functor is going to interpret the argument as.
+ typedef cef_internal::FunctionTraits<typename RunnableType::RunType>
+ BoundFunctorTraits;
+
+ // Do not allow binding a non-const reference parameter. Non-const reference
+ // parameters are disallowed by the Google style guide. Also, binding a
+ // non-const reference parameter can make for subtle bugs because the
+ // invoked function will receive a reference to the stored copy of the
+ // argument and not the original.
+ COMPILE_ASSERT(
+ !(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value ||
+ is_non_const_reference<typename BoundFunctorTraits::A2Type>::value),
+ do_not_bind_functions_with_nonconst_ref);
+
+ // For methods, we need to be careful for parameter 1. We do not require
+ // a scoped_refptr because BindState<> itself takes care of AddRef() for
+ // methods. We also disallow binding of an array as the method's target
+ // object.
+ COMPILE_ASSERT(cef_internal::HasIsMethodTag<RunnableType>::value ||
+ !cef_internal::NeedsScopedRefptrButGetsRawPtr<P1>::value,
+ p1_is_refcounted_type_and_needs_scoped_refptr);
+ COMPILE_ASSERT(!cef_internal::HasIsMethodTag<RunnableType>::value ||
+ !is_array<P1>::value,
+ first_bound_argument_to_method_cannot_be_array);
+ COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P2>::value,
+ p2_is_refcounted_type_and_needs_scoped_refptr);
+ typedef cef_internal::BindState<
+ RunnableType, RunType,
+ void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
+ typename cef_internal::CallbackParamTraits<P2>::StorageType)>
+ BindState;
+
+ return Callback<typename BindState::UnboundRunType>(
+ new BindState(cef_internal::MakeRunnable(functor), p1, p2));
+}
+
+template <typename Functor, typename P1, typename P2, typename P3>
+base::Callback<typename cef_internal::BindState<
+ typename cef_internal::FunctorTraits<Functor>::RunnableType,
+ typename cef_internal::FunctorTraits<Functor>::RunType,
+ void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
+ typename cef_internal::CallbackParamTraits<P2>::StorageType,
+ typename cef_internal::CallbackParamTraits<P3>::StorageType)>::
+ UnboundRunType>
+Bind(Functor functor, const P1& p1, const P2& p2, const P3& p3) {
+ // Typedefs for how to store and run the functor.
+ typedef
+ typename cef_internal::FunctorTraits<Functor>::RunnableType RunnableType;
+ typedef typename cef_internal::FunctorTraits<Functor>::RunType RunType;
+
+ // Use RunnableType::RunType instead of RunType above because our
+ // checks should below for bound references need to know what the actual
+ // functor is going to interpret the argument as.
+ typedef cef_internal::FunctionTraits<typename RunnableType::RunType>
+ BoundFunctorTraits;
+
+ // Do not allow binding a non-const reference parameter. Non-const reference
+ // parameters are disallowed by the Google style guide. Also, binding a
+ // non-const reference parameter can make for subtle bugs because the
+ // invoked function will receive a reference to the stored copy of the
+ // argument and not the original.
+ COMPILE_ASSERT(
+ !(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value ||
+ is_non_const_reference<typename BoundFunctorTraits::A2Type>::value ||
+ is_non_const_reference<typename BoundFunctorTraits::A3Type>::value),
+ do_not_bind_functions_with_nonconst_ref);
+
+ // For methods, we need to be careful for parameter 1. We do not require
+ // a scoped_refptr because BindState<> itself takes care of AddRef() for
+ // methods. We also disallow binding of an array as the method's target
+ // object.
+ COMPILE_ASSERT(cef_internal::HasIsMethodTag<RunnableType>::value ||
+ !cef_internal::NeedsScopedRefptrButGetsRawPtr<P1>::value,
+ p1_is_refcounted_type_and_needs_scoped_refptr);
+ COMPILE_ASSERT(!cef_internal::HasIsMethodTag<RunnableType>::value ||
+ !is_array<P1>::value,
+ first_bound_argument_to_method_cannot_be_array);
+ COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P2>::value,
+ p2_is_refcounted_type_and_needs_scoped_refptr);
+ COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P3>::value,
+ p3_is_refcounted_type_and_needs_scoped_refptr);
+ typedef cef_internal::BindState<
+ RunnableType, RunType,
+ void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
+ typename cef_internal::CallbackParamTraits<P2>::StorageType,
+ typename cef_internal::CallbackParamTraits<P3>::StorageType)>
+ BindState;
+
+ return Callback<typename BindState::UnboundRunType>(
+ new BindState(cef_internal::MakeRunnable(functor), p1, p2, p3));
+}
+
+template <typename Functor, typename P1, typename P2, typename P3, typename P4>
+base::Callback<typename cef_internal::BindState<
+ typename cef_internal::FunctorTraits<Functor>::RunnableType,
+ typename cef_internal::FunctorTraits<Functor>::RunType,
+ void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
+ typename cef_internal::CallbackParamTraits<P2>::StorageType,
+ typename cef_internal::CallbackParamTraits<P3>::StorageType,
+ typename cef_internal::CallbackParamTraits<P4>::StorageType)>::
+ UnboundRunType>
+Bind(Functor functor, const P1& p1, const P2& p2, const P3& p3, const P4& p4) {
+ // Typedefs for how to store and run the functor.
+ typedef
+ typename cef_internal::FunctorTraits<Functor>::RunnableType RunnableType;
+ typedef typename cef_internal::FunctorTraits<Functor>::RunType RunType;
+
+ // Use RunnableType::RunType instead of RunType above because our
+ // checks should below for bound references need to know what the actual
+ // functor is going to interpret the argument as.
+ typedef cef_internal::FunctionTraits<typename RunnableType::RunType>
+ BoundFunctorTraits;
+
+ // Do not allow binding a non-const reference parameter. Non-const reference
+ // parameters are disallowed by the Google style guide. Also, binding a
+ // non-const reference parameter can make for subtle bugs because the
+ // invoked function will receive a reference to the stored copy of the
+ // argument and not the original.
+ COMPILE_ASSERT(
+ !(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value ||
+ is_non_const_reference<typename BoundFunctorTraits::A2Type>::value ||
+ is_non_const_reference<typename BoundFunctorTraits::A3Type>::value ||
+ is_non_const_reference<typename BoundFunctorTraits::A4Type>::value),
+ do_not_bind_functions_with_nonconst_ref);
+
+ // For methods, we need to be careful for parameter 1. We do not require
+ // a scoped_refptr because BindState<> itself takes care of AddRef() for
+ // methods. We also disallow binding of an array as the method's target
+ // object.
+ COMPILE_ASSERT(cef_internal::HasIsMethodTag<RunnableType>::value ||
+ !cef_internal::NeedsScopedRefptrButGetsRawPtr<P1>::value,
+ p1_is_refcounted_type_and_needs_scoped_refptr);
+ COMPILE_ASSERT(!cef_internal::HasIsMethodTag<RunnableType>::value ||
+ !is_array<P1>::value,
+ first_bound_argument_to_method_cannot_be_array);
+ COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P2>::value,
+ p2_is_refcounted_type_and_needs_scoped_refptr);
+ COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P3>::value,
+ p3_is_refcounted_type_and_needs_scoped_refptr);
+ COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P4>::value,
+ p4_is_refcounted_type_and_needs_scoped_refptr);
+ typedef cef_internal::BindState<
+ RunnableType, RunType,
+ void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
+ typename cef_internal::CallbackParamTraits<P2>::StorageType,
+ typename cef_internal::CallbackParamTraits<P3>::StorageType,
+ typename cef_internal::CallbackParamTraits<P4>::StorageType)>
+ BindState;
+
+ return Callback<typename BindState::UnboundRunType>(
+ new BindState(cef_internal::MakeRunnable(functor), p1, p2, p3, p4));
+}
+
+template <typename Functor,
+ typename P1,
+ typename P2,
+ typename P3,
+ typename P4,
+ typename P5>
+base::Callback<typename cef_internal::BindState<
+ typename cef_internal::FunctorTraits<Functor>::RunnableType,
+ typename cef_internal::FunctorTraits<Functor>::RunType,
+ void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
+ typename cef_internal::CallbackParamTraits<P2>::StorageType,
+ typename cef_internal::CallbackParamTraits<P3>::StorageType,
+ typename cef_internal::CallbackParamTraits<P4>::StorageType,
+ typename cef_internal::CallbackParamTraits<P5>::StorageType)>::
+ UnboundRunType>
+Bind(Functor functor,
+ const P1& p1,
+ const P2& p2,
+ const P3& p3,
+ const P4& p4,
+ const P5& p5) {
+ // Typedefs for how to store and run the functor.
+ typedef
+ typename cef_internal::FunctorTraits<Functor>::RunnableType RunnableType;
+ typedef typename cef_internal::FunctorTraits<Functor>::RunType RunType;
+
+ // Use RunnableType::RunType instead of RunType above because our
+ // checks should below for bound references need to know what the actual
+ // functor is going to interpret the argument as.
+ typedef cef_internal::FunctionTraits<typename RunnableType::RunType>
+ BoundFunctorTraits;
+
+ // Do not allow binding a non-const reference parameter. Non-const reference
+ // parameters are disallowed by the Google style guide. Also, binding a
+ // non-const reference parameter can make for subtle bugs because the
+ // invoked function will receive a reference to the stored copy of the
+ // argument and not the original.
+ COMPILE_ASSERT(
+ !(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value ||
+ is_non_const_reference<typename BoundFunctorTraits::A2Type>::value ||
+ is_non_const_reference<typename BoundFunctorTraits::A3Type>::value ||
+ is_non_const_reference<typename BoundFunctorTraits::A4Type>::value ||
+ is_non_const_reference<typename BoundFunctorTraits::A5Type>::value),
+ do_not_bind_functions_with_nonconst_ref);
+
+ // For methods, we need to be careful for parameter 1. We do not require
+ // a scoped_refptr because BindState<> itself takes care of AddRef() for
+ // methods. We also disallow binding of an array as the method's target
+ // object.
+ COMPILE_ASSERT(cef_internal::HasIsMethodTag<RunnableType>::value ||
+ !cef_internal::NeedsScopedRefptrButGetsRawPtr<P1>::value,
+ p1_is_refcounted_type_and_needs_scoped_refptr);
+ COMPILE_ASSERT(!cef_internal::HasIsMethodTag<RunnableType>::value ||
+ !is_array<P1>::value,
+ first_bound_argument_to_method_cannot_be_array);
+ COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P2>::value,
+ p2_is_refcounted_type_and_needs_scoped_refptr);
+ COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P3>::value,
+ p3_is_refcounted_type_and_needs_scoped_refptr);
+ COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P4>::value,
+ p4_is_refcounted_type_and_needs_scoped_refptr);
+ COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P5>::value,
+ p5_is_refcounted_type_and_needs_scoped_refptr);
+ typedef cef_internal::BindState<
+ RunnableType, RunType,
+ void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
+ typename cef_internal::CallbackParamTraits<P2>::StorageType,
+ typename cef_internal::CallbackParamTraits<P3>::StorageType,
+ typename cef_internal::CallbackParamTraits<P4>::StorageType,
+ typename cef_internal::CallbackParamTraits<P5>::StorageType)>
+ BindState;
+
+ return Callback<typename BindState::UnboundRunType>(
+ new BindState(cef_internal::MakeRunnable(functor), p1, p2, p3, p4, p5));
+}
+
+template <typename Functor,
+ typename P1,
+ typename P2,
+ typename P3,
+ typename P4,
+ typename P5,
+ typename P6>
+base::Callback<typename cef_internal::BindState<
+ typename cef_internal::FunctorTraits<Functor>::RunnableType,
+ typename cef_internal::FunctorTraits<Functor>::RunType,
+ void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
+ typename cef_internal::CallbackParamTraits<P2>::StorageType,
+ typename cef_internal::CallbackParamTraits<P3>::StorageType,
+ typename cef_internal::CallbackParamTraits<P4>::StorageType,
+ typename cef_internal::CallbackParamTraits<P5>::StorageType,
+ typename cef_internal::CallbackParamTraits<P6>::StorageType)>::
+ UnboundRunType>
+Bind(Functor functor,
+ const P1& p1,
+ const P2& p2,
+ const P3& p3,
+ const P4& p4,
+ const P5& p5,
+ const P6& p6) {
+ // Typedefs for how to store and run the functor.
+ typedef
+ typename cef_internal::FunctorTraits<Functor>::RunnableType RunnableType;
+ typedef typename cef_internal::FunctorTraits<Functor>::RunType RunType;
+
+ // Use RunnableType::RunType instead of RunType above because our
+ // checks should below for bound references need to know what the actual
+ // functor is going to interpret the argument as.
+ typedef cef_internal::FunctionTraits<typename RunnableType::RunType>
+ BoundFunctorTraits;
+
+ // Do not allow binding a non-const reference parameter. Non-const reference
+ // parameters are disallowed by the Google style guide. Also, binding a
+ // non-const reference parameter can make for subtle bugs because the
+ // invoked function will receive a reference to the stored copy of the
+ // argument and not the original.
+ COMPILE_ASSERT(
+ !(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value ||
+ is_non_const_reference<typename BoundFunctorTraits::A2Type>::value ||
+ is_non_const_reference<typename BoundFunctorTraits::A3Type>::value ||
+ is_non_const_reference<typename BoundFunctorTraits::A4Type>::value ||
+ is_non_const_reference<typename BoundFunctorTraits::A5Type>::value ||
+ is_non_const_reference<typename BoundFunctorTraits::A6Type>::value),
+ do_not_bind_functions_with_nonconst_ref);
+
+ // For methods, we need to be careful for parameter 1. We do not require
+ // a scoped_refptr because BindState<> itself takes care of AddRef() for
+ // methods. We also disallow binding of an array as the method's target
+ // object.
+ COMPILE_ASSERT(cef_internal::HasIsMethodTag<RunnableType>::value ||
+ !cef_internal::NeedsScopedRefptrButGetsRawPtr<P1>::value,
+ p1_is_refcounted_type_and_needs_scoped_refptr);
+ COMPILE_ASSERT(!cef_internal::HasIsMethodTag<RunnableType>::value ||
+ !is_array<P1>::value,
+ first_bound_argument_to_method_cannot_be_array);
+ COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P2>::value,
+ p2_is_refcounted_type_and_needs_scoped_refptr);
+ COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P3>::value,
+ p3_is_refcounted_type_and_needs_scoped_refptr);
+ COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P4>::value,
+ p4_is_refcounted_type_and_needs_scoped_refptr);
+ COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P5>::value,
+ p5_is_refcounted_type_and_needs_scoped_refptr);
+ COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P6>::value,
+ p6_is_refcounted_type_and_needs_scoped_refptr);
+ typedef cef_internal::BindState<
+ RunnableType, RunType,
+ void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
+ typename cef_internal::CallbackParamTraits<P2>::StorageType,
+ typename cef_internal::CallbackParamTraits<P3>::StorageType,
+ typename cef_internal::CallbackParamTraits<P4>::StorageType,
+ typename cef_internal::CallbackParamTraits<P5>::StorageType,
+ typename cef_internal::CallbackParamTraits<P6>::StorageType)>
+ BindState;
+
+ return Callback<typename BindState::UnboundRunType>(new BindState(
+ cef_internal::MakeRunnable(functor), p1, p2, p3, p4, p5, p6));
+}
+
+template <typename Functor,
+ typename P1,
+ typename P2,
+ typename P3,
+ typename P4,
+ typename P5,
+ typename P6,
+ typename P7>
+base::Callback<typename cef_internal::BindState<
+ typename cef_internal::FunctorTraits<Functor>::RunnableType,
+ typename cef_internal::FunctorTraits<Functor>::RunType,
+ void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
+ typename cef_internal::CallbackParamTraits<P2>::StorageType,
+ typename cef_internal::CallbackParamTraits<P3>::StorageType,
+ typename cef_internal::CallbackParamTraits<P4>::StorageType,
+ typename cef_internal::CallbackParamTraits<P5>::StorageType,
+ typename cef_internal::CallbackParamTraits<P6>::StorageType,
+ typename cef_internal::CallbackParamTraits<P7>::StorageType)>::
+ UnboundRunType>
+Bind(Functor functor,
+ const P1& p1,
+ const P2& p2,
+ const P3& p3,
+ const P4& p4,
+ const P5& p5,
+ const P6& p6,
+ const P7& p7) {
+ // Typedefs for how to store and run the functor.
+ typedef
+ typename cef_internal::FunctorTraits<Functor>::RunnableType RunnableType;
+ typedef typename cef_internal::FunctorTraits<Functor>::RunType RunType;
+
+ // Use RunnableType::RunType instead of RunType above because our
+ // checks should below for bound references need to know what the actual
+ // functor is going to interpret the argument as.
+ typedef cef_internal::FunctionTraits<typename RunnableType::RunType>
+ BoundFunctorTraits;
+
+ // Do not allow binding a non-const reference parameter. Non-const reference
+ // parameters are disallowed by the Google style guide. Also, binding a
+ // non-const reference parameter can make for subtle bugs because the
+ // invoked function will receive a reference to the stored copy of the
+ // argument and not the original.
+ COMPILE_ASSERT(
+ !(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value ||
+ is_non_const_reference<typename BoundFunctorTraits::A2Type>::value ||
+ is_non_const_reference<typename BoundFunctorTraits::A3Type>::value ||
+ is_non_const_reference<typename BoundFunctorTraits::A4Type>::value ||
+ is_non_const_reference<typename BoundFunctorTraits::A5Type>::value ||
+ is_non_const_reference<typename BoundFunctorTraits::A6Type>::value ||
+ is_non_const_reference<typename BoundFunctorTraits::A7Type>::value),
+ do_not_bind_functions_with_nonconst_ref);
+
+ // For methods, we need to be careful for parameter 1. We do not require
+ // a scoped_refptr because BindState<> itself takes care of AddRef() for
+ // methods. We also disallow binding of an array as the method's target
+ // object.
+ COMPILE_ASSERT(cef_internal::HasIsMethodTag<RunnableType>::value ||
+ !cef_internal::NeedsScopedRefptrButGetsRawPtr<P1>::value,
+ p1_is_refcounted_type_and_needs_scoped_refptr);
+ COMPILE_ASSERT(!cef_internal::HasIsMethodTag<RunnableType>::value ||
+ !is_array<P1>::value,
+ first_bound_argument_to_method_cannot_be_array);
+ COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P2>::value,
+ p2_is_refcounted_type_and_needs_scoped_refptr);
+ COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P3>::value,
+ p3_is_refcounted_type_and_needs_scoped_refptr);
+ COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P4>::value,
+ p4_is_refcounted_type_and_needs_scoped_refptr);
+ COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P5>::value,
+ p5_is_refcounted_type_and_needs_scoped_refptr);
+ COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P6>::value,
+ p6_is_refcounted_type_and_needs_scoped_refptr);
+ COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr<P7>::value,
+ p7_is_refcounted_type_and_needs_scoped_refptr);
+ typedef cef_internal::BindState<
+ RunnableType, RunType,
+ void(typename cef_internal::CallbackParamTraits<P1>::StorageType,
+ typename cef_internal::CallbackParamTraits<P2>::StorageType,
+ typename cef_internal::CallbackParamTraits<P3>::StorageType,
+ typename cef_internal::CallbackParamTraits<P4>::StorageType,
+ typename cef_internal::CallbackParamTraits<P5>::StorageType,
+ typename cef_internal::CallbackParamTraits<P6>::StorageType,
+ typename cef_internal::CallbackParamTraits<P7>::StorageType)>
+ BindState;
+
+ return Callback<typename BindState::UnboundRunType>(new BindState(
+ cef_internal::MakeRunnable(functor), p1, p2, p3, p4, p5, p6, p7));
+}
+
+} // namespace base
+
+#endif // !USING_CHROMIUM_INCLUDES
+
+#endif // CEF_INCLUDE_BASE_CEF_BIND_H_
diff --git a/src/include/base/cef_bind_helpers.h b/src/include/base/cef_bind_helpers.h
new file mode 100644
index 0000000..2b4798b
--- /dev/null
+++ b/src/include/base/cef_bind_helpers.h
@@ -0,0 +1,579 @@
+// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
+// Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// This defines a set of argument wrappers and related factory methods that
+// can be used specify the refcounting and reference semantics of arguments
+// that are bound by the Bind() function in base/bind.h.
+//
+// It also defines a set of simple functions and utilities that people want
+// when using Callback<> and Bind().
+//
+//
+// ARGUMENT BINDING WRAPPERS
+//
+// The wrapper functions are base::Unretained(), base::Owned(), base::Passed(),
+// base::ConstRef(), and base::IgnoreResult().
+//
+// Unretained() allows Bind() to bind a non-refcounted class, and to disable
+// refcounting on arguments that are refcounted objects.
+//
+// Owned() transfers ownership of an object to the Callback resulting from
+// bind; the object will be deleted when the Callback is deleted.
+//
+// Passed() is for transferring movable-but-not-copyable types (eg. scoped_ptr)
+// through a Callback. Logically, this signifies a destructive transfer of
+// the state of the argument into the target function. Invoking
+// Callback::Run() twice on a Callback that was created with a Passed()
+// argument will CHECK() because the first invocation would have already
+// transferred ownership to the target function.
+//
+// ConstRef() allows binding a constant reference to an argument rather
+// than a copy.
+//
+// IgnoreResult() is used to adapt a function or Callback with a return type to
+// one with a void return. This is most useful if you have a function with,
+// say, a pesky ignorable bool return that you want to use with PostTask or
+// something else that expect a Callback with a void return.
+//
+// EXAMPLE OF Unretained():
+//
+// class Foo {
+// public:
+// void func() { cout << "Foo:f" << endl; }
+// };
+//
+// // In some function somewhere.
+// Foo foo;
+// Closure foo_callback =
+// Bind(&Foo::func, Unretained(&foo));
+// foo_callback.Run(); // Prints "Foo:f".
+//
+// Without the Unretained() wrapper on |&foo|, the above call would fail
+// to compile because Foo does not support the AddRef() and Release() methods.
+//
+//
+// EXAMPLE OF Owned():
+//
+// void foo(int* arg) { cout << *arg << endl }
+//
+// int* pn = new int(1);
+// Closure foo_callback = Bind(&foo, Owned(pn));
+//
+// foo_callback.Run(); // Prints "1"
+// foo_callback.Run(); // Prints "1"
+// *n = 2;
+// foo_callback.Run(); // Prints "2"
+//
+// foo_callback.Reset(); // |pn| is deleted. Also will happen when
+// // |foo_callback| goes out of scope.
+//
+// Without Owned(), someone would have to know to delete |pn| when the last
+// reference to the Callback is deleted.
+//
+//
+// EXAMPLE OF ConstRef():
+//
+// void foo(int arg) { cout << arg << endl }
+//
+// int n = 1;
+// Closure no_ref = Bind(&foo, n);
+// Closure has_ref = Bind(&foo, ConstRef(n));
+//
+// no_ref.Run(); // Prints "1"
+// has_ref.Run(); // Prints "1"
+//
+// n = 2;
+// no_ref.Run(); // Prints "1"
+// has_ref.Run(); // Prints "2"
+//
+// Note that because ConstRef() takes a reference on |n|, |n| must outlive all
+// its bound callbacks.
+//
+//
+// EXAMPLE OF IgnoreResult():
+//
+// int DoSomething(int arg) { cout << arg << endl; }
+//
+// // Assign to a Callback with a void return type.
+// Callback<void(int)> cb = Bind(IgnoreResult(&DoSomething));
+// cb->Run(1); // Prints "1".
+//
+// // Prints "1" on |ml|.
+// ml->PostTask(FROM_HERE, Bind(IgnoreResult(&DoSomething), 1);
+//
+//
+// EXAMPLE OF Passed():
+//
+// void TakesOwnership(scoped_ptr<Foo> arg) { }
+// scoped_ptr<Foo> CreateFoo() { return scoped_ptr<Foo>(new Foo()); }
+//
+// scoped_ptr<Foo> f(new Foo());
+//
+// // |cb| is given ownership of Foo(). |f| is now NULL.
+// // You can use f.Pass() in place of &f, but it's more verbose.
+// Closure cb = Bind(&TakesOwnership, Passed(&f));
+//
+// // Run was never called so |cb| still owns Foo() and deletes
+// // it on Reset().
+// cb.Reset();
+//
+// // |cb| is given a new Foo created by CreateFoo().
+// cb = Bind(&TakesOwnership, Passed(CreateFoo()));
+//
+// // |arg| in TakesOwnership() is given ownership of Foo(). |cb|
+// // no longer owns Foo() and, if reset, would not delete Foo().
+// cb.Run(); // Foo() is now transferred to |arg| and deleted.
+// cb.Run(); // This CHECK()s since Foo() already been used once.
+//
+// Passed() is particularly useful with PostTask() when you are transferring
+// ownership of an argument into a task, but don't necessarily know if the
+// task will always be executed. This can happen if the task is cancellable
+// or if it is posted to a MessageLoopProxy.
+//
+//
+// SIMPLE FUNCTIONS AND UTILITIES.
+//
+// DoNothing() - Useful for creating a Closure that does nothing when called.
+// DeletePointer<T>() - Useful for creating a Closure that will delete a
+// pointer when invoked. Only use this when necessary.
+// In most cases MessageLoop::DeleteSoon() is a better
+// fit.
+
+#ifndef CEF_INCLUDE_BASE_CEF_BIND_HELPERS_H_
+#define CEF_INCLUDE_BASE_CEF_BIND_HELPERS_H_
+#pragma once
+
+#if defined(BASE_BIND_HELPERS_H_)
+// Do nothing if the Chromium header has already been included.
+// 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.
+#elif defined(USING_CHROMIUM_INCLUDES)
+// When building CEF include the Chromium header directly.
+#include "base/bind_helpers.h"
+#else // !USING_CHROMIUM_INCLUDES
+// The following is substantially similar to the Chromium implementation.
+// If the Chromium implementation diverges the below implementation should be
+// updated to match.
+
+#include "include/base/cef_basictypes.h"
+#include "include/base/cef_callback.h"
+#include "include/base/cef_template_util.h"
+#include "include/base/cef_weak_ptr.h"
+
+namespace base {
+namespace cef_internal {
+
+// Use the Substitution Failure Is Not An Error (SFINAE) trick to inspect T
+// for the existence of AddRef() and Release() functions of the correct
+// signature.
+//
+// http://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error
+// http://stackoverflow.com/questions/257288/is-it-possible-to-write-a-c-template-to-check-for-a-functions-existence
+// http://stackoverflow.com/questions/4358584/sfinae-approach-comparison
+// http://stackoverflow.com/questions/1966362/sfinae-to-check-for-inherited-member-functions
+//
+// The last link in particular show the method used below.
+//
+// For SFINAE to work with inherited methods, we need to pull some extra tricks
+// with multiple inheritance. In the more standard formulation, the overloads
+// of Check would be:
+//
+// template <typename C>
+// Yes NotTheCheckWeWant(Helper<&C::TargetFunc>*);
+//
+// template <typename C>
+// No NotTheCheckWeWant(...);
+//
+// static const bool value = sizeof(NotTheCheckWeWant<T>(0)) == sizeof(Yes);
+//
+// The problem here is that template resolution will not match
+// C::TargetFunc if TargetFunc does not exist directly in C. That is, if
+// TargetFunc in inherited from an ancestor, &C::TargetFunc will not match,
+// |value| will be false. This formulation only checks for whether or
+// not TargetFunc exist directly in the class being introspected.
+//
+// To get around this, we play a dirty trick with multiple inheritance.
+// First, We create a class BaseMixin that declares each function that we
+// want to probe for. Then we create a class Base that inherits from both T
+// (the class we wish to probe) and BaseMixin. Note that the function
+// signature in BaseMixin does not need to match the signature of the function
+// we are probing for; thus it's easiest to just use void(void).
+//
+// Now, if TargetFunc exists somewhere in T, then &Base::TargetFunc has an
+// ambiguous resolution between BaseMixin and T. This lets us write the
+// following:
+//
+// template <typename C>
+// No GoodCheck(Helper<&C::TargetFunc>*);
+//
+// template <typename C>
+// Yes GoodCheck(...);
+//
+// static const bool value = sizeof(GoodCheck<Base>(0)) == sizeof(Yes);
+//
+// Notice here that the variadic version of GoodCheck() returns Yes here
+// instead of No like the previous one. Also notice that we calculate |value|
+// by specializing GoodCheck() on Base instead of T.
+//
+// We've reversed the roles of the variadic, and Helper overloads.
+// GoodCheck(Helper<&C::TargetFunc>*), when C = Base, fails to be a valid
+// substitution if T::TargetFunc exists. Thus GoodCheck<Base>(0) will resolve
+// to the variadic version if T has TargetFunc. If T::TargetFunc does not
+// exist, then &C::TargetFunc is not ambiguous, and the overload resolution
+// will prefer GoodCheck(Helper<&C::TargetFunc>*).
+//
+// This method of SFINAE will correctly probe for inherited names, but it cannot
+// typecheck those names. It's still a good enough sanity check though.
+//
+// Works on gcc-4.2, gcc-4.4, and Visual Studio 2008.
+//
+// TODO(ajwong): Move to ref_counted.h or template_util.h when we've vetted
+// this works well.
+//
+// TODO(ajwong): Make this check for Release() as well.
+// See http://crbug.com/82038.
+template <typename T>
+class SupportsAddRefAndRelease {
+ typedef char Yes[1];
+ typedef char No[2];
+
+ struct BaseMixin {
+ void AddRef();
+ };
+
+// MSVC warns when you try to use Base if T has a private destructor, the
+// common pattern for refcounted types. It does this even though no attempt to
+// instantiate Base is made. We disable the warning for this definition.
+#if defined(OS_WIN)
+#pragma warning(push)
+#pragma warning(disable : 4624)
+#endif
+ struct Base : public T, public BaseMixin {};
+#if defined(OS_WIN)
+#pragma warning(pop)
+#endif
+
+ template <void (BaseMixin::*)(void)>
+ struct Helper {};
+
+ template <typename C>
+ static No& Check(Helper<&C::AddRef>*);
+
+ template <typename>
+ static Yes& Check(...);
+
+ public:
+ static const bool value = sizeof(Check<Base>(0)) == sizeof(Yes);
+};
+
+// Helpers to assert that arguments of a recounted type are bound with a
+// scoped_refptr.
+template <bool IsClasstype, typename T>
+struct UnsafeBindtoRefCountedArgHelper : false_type {};
+
+template <typename T>
+struct UnsafeBindtoRefCountedArgHelper<true, T>
+ : integral_constant<bool, SupportsAddRefAndRelease<T>::value> {};
+
+template <typename T>
+struct UnsafeBindtoRefCountedArg : false_type {};
+
+template <typename T>
+struct UnsafeBindtoRefCountedArg<T*>
+ : UnsafeBindtoRefCountedArgHelper<is_class<T>::value, T> {};
+
+template <typename T>
+class HasIsMethodTag {
+ typedef char Yes[1];
+ typedef char No[2];
+
+ template <typename U>
+ static Yes& Check(typename U::IsMethod*);
+
+ template <typename U>
+ static No& Check(...);
+
+ public:
+ static const bool value = sizeof(Check<T>(0)) == sizeof(Yes);
+};
+
+template <typename T>
+class UnretainedWrapper {
+ public:
+ explicit UnretainedWrapper(T* o) : ptr_(o) {}
+ T* get() const { return ptr_; }
+
+ private:
+ T* ptr_;
+};
+
+template <typename T>
+class ConstRefWrapper {
+ public:
+ explicit ConstRefWrapper(const T& o) : ptr_(&o) {}
+ const T& get() const { return *ptr_; }
+
+ private:
+ const T* ptr_;
+};
+
+template <typename T>
+struct IgnoreResultHelper {
+ explicit IgnoreResultHelper(T functor) : functor_(functor) {}
+
+ T functor_;
+};
+
+template <typename T>
+struct IgnoreResultHelper<Callback<T>> {
+ explicit IgnoreResultHelper(const Callback<T>& functor) : functor_(functor) {}
+
+ const Callback<T>& functor_;
+};
+
+// An alternate implementation is to avoid the destructive copy, and instead
+// specialize ParamTraits<> for OwnedWrapper<> to change the StorageType to
+// a class that is essentially a scoped_ptr<>.
+//
+// The current implementation has the benefit though of leaving ParamTraits<>
+// fully in callback_internal.h as well as avoiding type conversions during
+// storage.
+template <typename T>
+class OwnedWrapper {
+ public:
+ explicit OwnedWrapper(T* o) : ptr_(o) {}
+ ~OwnedWrapper() { delete ptr_; }
+ T* get() const { return ptr_; }
+ OwnedWrapper(const OwnedWrapper& other) {
+ ptr_ = other.ptr_;
+ other.ptr_ = NULL;
+ }
+
+ private:
+ mutable T* ptr_;
+};
+
+// PassedWrapper is a copyable adapter for a scoper that ignores const.
+//
+// It is needed to get around the fact that Bind() takes a const reference to
+// all its arguments. Because Bind() takes a const reference to avoid
+// unnecessary copies, it is incompatible with movable-but-not-copyable
+// types; doing a destructive "move" of the type into Bind() would violate
+// the const correctness.
+//
+// This conundrum cannot be solved without either C++11 rvalue references or
+// a O(2^n) blowup of Bind() templates to handle each combination of regular
+// types and movable-but-not-copyable types. Thus we introduce a wrapper type
+// that is copyable to transmit the correct type information down into
+// BindState<>. Ignoring const in this type makes sense because it is only
+// created when we are explicitly trying to do a destructive move.
+//
+// Two notes:
+// 1) PassedWrapper supports any type that has a "Pass()" function.
+// This is intentional. The whitelisting of which specific types we
+// support is maintained by CallbackParamTraits<>.
+// 2) is_valid_ is distinct from NULL because it is valid to bind a "NULL"
+// scoper to a Callback and allow the Callback to execute once.
+template <typename T>
+class PassedWrapper {
+ public:
+ explicit PassedWrapper(T scoper) : is_valid_(true), scoper_(scoper.Pass()) {}
+ PassedWrapper(const PassedWrapper& other)
+ : is_valid_(other.is_valid_), scoper_(other.scoper_.Pass()) {}
+ T Pass() const {
+ CHECK(is_valid_);
+ is_valid_ = false;
+ return scoper_.Pass();
+ }
+
+ private:
+ mutable bool is_valid_;
+ mutable T scoper_;
+};
+
+// Unwrap the stored parameters for the wrappers above.
+template <typename T>
+struct UnwrapTraits {
+ typedef const T& ForwardType;
+ static ForwardType Unwrap(const T& o) { return o; }
+};
+
+template <typename T>
+struct UnwrapTraits<UnretainedWrapper<T>> {
+ typedef T* ForwardType;
+ static ForwardType Unwrap(UnretainedWrapper<T> unretained) {
+ return unretained.get();
+ }
+};
+
+template <typename T>
+struct UnwrapTraits<ConstRefWrapper<T>> {
+ typedef const T& ForwardType;
+ static ForwardType Unwrap(ConstRefWrapper<T> const_ref) {
+ return const_ref.get();
+ }
+};
+
+template <typename T>
+struct UnwrapTraits<scoped_refptr<T>> {
+ typedef T* ForwardType;
+ static ForwardType Unwrap(const scoped_refptr<T>& o) { return o.get(); }
+};
+
+template <typename T>
+struct UnwrapTraits<WeakPtr<T>> {
+ typedef const WeakPtr<T>& ForwardType;
+ static ForwardType Unwrap(const WeakPtr<T>& o) { return o; }
+};
+
+template <typename T>
+struct UnwrapTraits<OwnedWrapper<T>> {
+ typedef T* ForwardType;
+ static ForwardType Unwrap(const OwnedWrapper<T>& o) { return o.get(); }
+};
+
+template <typename T>
+struct UnwrapTraits<PassedWrapper<T>> {
+ typedef T ForwardType;
+ static T Unwrap(PassedWrapper<T>& o) { return o.Pass(); }
+};
+
+// Utility for handling different refcounting semantics in the Bind()
+// function.
+template <bool is_method, typename T>
+struct MaybeRefcount;
+
+template <typename T>
+struct MaybeRefcount<false, T> {
+ static void AddRef(const T&) {}
+ static void Release(const T&) {}
+};
+
+template <typename T, size_t n>
+struct MaybeRefcount<false, T[n]> {
+ static void AddRef(const T*) {}
+ static void Release(const T*) {}
+};
+
+template <typename T>
+struct MaybeRefcount<true, T> {
+ static void AddRef(const T&) {}
+ static void Release(const T&) {}
+};
+
+template <typename T>
+struct MaybeRefcount<true, T*> {
+ static void AddRef(T* o) { o->AddRef(); }
+ static void Release(T* o) { o->Release(); }
+};
+
+// No need to additionally AddRef() and Release() since we are storing a
+// scoped_refptr<> inside the storage object already.
+template <typename T>
+struct MaybeRefcount<true, scoped_refptr<T>> {
+ static void AddRef(const scoped_refptr<T>& o) {}
+ static void Release(const scoped_refptr<T>& o) {}
+};
+
+template <typename T>
+struct MaybeRefcount<true, const T*> {
+ static void AddRef(const T* o) { o->AddRef(); }
+ static void Release(const T* o) { o->Release(); }
+};
+
+// IsWeakMethod is a helper that determine if we are binding a WeakPtr<> to a
+// method. It is used internally by Bind() to select the correct
+// InvokeHelper that will no-op itself in the event the WeakPtr<> for
+// the target object is invalidated.
+//
+// P1 should be the type of the object that will be received of the method.
+template <bool IsMethod, typename P1>
+struct IsWeakMethod : public false_type {};
+
+template <typename T>
+struct IsWeakMethod<true, WeakPtr<T>> : public true_type {};
+
+template <typename T>
+struct IsWeakMethod<true, ConstRefWrapper<WeakPtr<T>>> : public true_type {};
+
+} // namespace cef_internal
+
+template <typename T>
+static inline cef_internal::UnretainedWrapper<T> Unretained(T* o) {
+ return cef_internal::UnretainedWrapper<T>(o);
+}
+
+template <typename T>
+static inline cef_internal::ConstRefWrapper<T> ConstRef(const T& o) {
+ return cef_internal::ConstRefWrapper<T>(o);
+}
+
+template <typename T>
+static inline cef_internal::OwnedWrapper<T> Owned(T* o) {
+ return cef_internal::OwnedWrapper<T>(o);
+}
+
+// We offer 2 syntaxes for calling Passed(). The first takes a temporary and
+// is best suited for use with the return value of a function. The second
+// takes a pointer to the scoper and is just syntactic sugar to avoid having
+// to write Passed(scoper.Pass()).
+template <typename T>
+static inline cef_internal::PassedWrapper<T> Passed(T scoper) {
+ return cef_internal::PassedWrapper<T>(scoper.Pass());
+}
+template <typename T>
+static inline cef_internal::PassedWrapper<T> Passed(T* scoper) {
+ return cef_internal::PassedWrapper<T>(scoper->Pass());
+}
+
+template <typename T>
+static inline cef_internal::IgnoreResultHelper<T> IgnoreResult(T data) {
+ return cef_internal::IgnoreResultHelper<T>(data);
+}
+
+template <typename T>
+static inline cef_internal::IgnoreResultHelper<Callback<T>> IgnoreResult(
+ const Callback<T>& data) {
+ return cef_internal::IgnoreResultHelper<Callback<T>>(data);
+}
+
+void DoNothing();
+
+template <typename T>
+void DeletePointer(T* obj) {
+ delete obj;
+}
+
+} // namespace base
+
+#endif // !USING_CHROMIUM_INCLUDES
+
+#endif // CEF_INCLUDE_BASE_CEF_BIND_HELPERS_H_
diff --git a/src/include/base/cef_build.h b/src/include/base/cef_build.h
new file mode 100644
index 0000000..61dc317
--- /dev/null
+++ b/src/include/base/cef_build.h
@@ -0,0 +1,207 @@
+// Copyright (c) 2011 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.
+
+#ifndef CEF_INCLUDE_BASE_CEF_BUILD_H_
+#define CEF_INCLUDE_BASE_CEF_BUILD_H_
+#pragma once
+
+#if defined(USING_CHROMIUM_INCLUDES)
+// When building CEF include the Chromium header directly.
+#include "base/compiler_specific.h"
+#else // !USING_CHROMIUM_INCLUDES
+// The following is substantially similar to the Chromium implementation.
+// If the Chromium implementation diverges the below implementation should be
+// updated to match.
+
+#if defined(_WIN32)
+#ifndef OS_WIN
+#define OS_WIN 1
+#endif
+#elif defined(__APPLE__)
+#ifndef OS_MACOSX
+#define OS_MACOSX 1
+#endif
+#elif defined(__linux__)
+#ifndef OS_LINUX
+#define OS_LINUX 1
+#endif
+#else
+#error Please add support for your platform in cef_build.h
+#endif
+
+// For access to standard POSIXish features, use OS_POSIX instead of a
+// more specific macro.
+#if defined(OS_MACOSX) || defined(OS_LINUX)
+#ifndef OS_POSIX
+#define OS_POSIX 1
+#endif
+#endif
+
+// Compiler detection.
+#if defined(__GNUC__)
+#ifndef COMPILER_GCC
+#define COMPILER_GCC 1
+#endif
+#elif defined(_MSC_VER)
+#ifndef COMPILER_MSVC
+#define COMPILER_MSVC 1
+#endif
+#else
+#error Please add support for your compiler in cef_build.h
+#endif
+
+// Processor architecture detection. For more info on what's defined, see:
+// http://msdn.microsoft.com/en-us/library/b0084kay.aspx
+// http://www.agner.org/optimize/calling_conventions.pdf
+// or with gcc, run: "echo | gcc -E -dM -"
+#if defined(_M_X64) || defined(__x86_64__)
+#define ARCH_CPU_X86_FAMILY 1
+#define ARCH_CPU_X86_64 1
+#define ARCH_CPU_64_BITS 1
+#define ARCH_CPU_LITTLE_ENDIAN 1
+#elif defined(_M_IX86) || defined(__i386__)
+#define ARCH_CPU_X86_FAMILY 1
+#define ARCH_CPU_X86 1
+#define ARCH_CPU_32_BITS 1
+#define ARCH_CPU_LITTLE_ENDIAN 1
+#elif defined(__ARMEL__)
+#define ARCH_CPU_ARM_FAMILY 1
+#define ARCH_CPU_ARMEL 1
+#define ARCH_CPU_32_BITS 1
+#define ARCH_CPU_LITTLE_ENDIAN 1
+#elif defined(__aarch64__) || defined(_M_ARM64)
+#define ARCH_CPU_ARM_FAMILY 1
+#define ARCH_CPU_ARM64 1
+#define ARCH_CPU_64_BITS 1
+#define ARCH_CPU_LITTLE_ENDIAN 1
+#elif defined(__pnacl__)
+#define ARCH_CPU_32_BITS 1
+#define ARCH_CPU_LITTLE_ENDIAN 1
+#elif defined(__MIPSEL__)
+#define ARCH_CPU_MIPS_FAMILY 1
+#define ARCH_CPU_MIPSEL 1
+#define ARCH_CPU_32_BITS 1
+#define ARCH_CPU_LITTLE_ENDIAN 1
+#else
+#error Please add support for your architecture in cef_build.h
+#endif
+
+// Type detection for wchar_t.
+#if defined(OS_WIN)
+#define WCHAR_T_IS_UTF16
+#elif defined(OS_POSIX) && defined(COMPILER_GCC) && defined(__WCHAR_MAX__) && \
+ (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff)
+#define WCHAR_T_IS_UTF32
+#elif defined(OS_POSIX) && defined(COMPILER_GCC) && defined(__WCHAR_MAX__) && \
+ (__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff)
+// On Posix, we'll detect short wchar_t, but projects aren't guaranteed to
+// compile in this mode (in particular, Chrome doesn't). This is intended for
+// other projects using base who manage their own dependencies and make sure
+// short wchar works for them.
+#define WCHAR_T_IS_UTF16
+#else
+#error Please add support for your compiler in cef_build.h
+#endif
+
+// 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/macros.h>.
+#ifndef WARN_UNUSED_RESULT
+#if defined(COMPILER_GCC)
+#define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
+#else
+#define WARN_UNUSED_RESULT
+#endif
+#endif // WARN_UNUSED_RESULT
+
+// Annotate a typedef or function indicating it's ok if it's not used.
+// Use like:
+// typedef Foo Bar ALLOW_UNUSED_TYPE;
+#ifndef ALLOW_UNUSED_TYPE
+#if defined(COMPILER_GCC)
+#define ALLOW_UNUSED_TYPE __attribute__((unused))
+#else
+#define ALLOW_UNUSED_TYPE
+#endif
+#endif // ALLOW_UNUSED_TYPE
+
+// Annotate a variable indicating it's ok if the variable is not used.
+// (Typically used to silence a compiler warning when the assignment
+// is important for some other reason.)
+// Use like:
+// int x = ...;
+// ALLOW_UNUSED_LOCAL(x);
+#ifndef ALLOW_UNUSED_LOCAL
+#define ALLOW_UNUSED_LOCAL(x) false ? (void)x : (void)0
+#endif
+
+// Sanitizers annotations.
+#if defined(__has_attribute)
+#if __has_attribute(no_sanitize)
+#define NO_SANITIZE(what) __attribute__((no_sanitize(what)))
+#endif
+#endif
+#if !defined(NO_SANITIZE)
+#define NO_SANITIZE(what)
+#endif
+
+#endif // !USING_CHROMIUM_INCLUDES
+
+// Annotate a virtual method indicating it must be overriding a virtual method
+// in the parent class.
+// Use like:
+// void foo() OVERRIDE;
+// NOTE: This define should only be used in classes exposed to the client since
+// C++11 support may not be enabled in client applications. CEF internal classes
+// should use the `override` keyword directly.
+#ifndef OVERRIDE
+#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
+// GCC 4.7 supports explicit virtual overrides when C++11 support is enabled.
+#define OVERRIDE override
+#else
+#define OVERRIDE
+#endif
+#endif // OVERRIDE
+
+// Check for C++11 template alias support which was added in VS2013 and GCC4.7.
+// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf
+#if __cplusplus > 199711L || (defined(_MSC_VER) && _MSC_VER >= 1800) || \
+ (defined(__GNUC__) && \
+ (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ >= 40700))
+#define HAS_CPP11_TEMPLATE_ALIAS_SUPPORT
+#endif
+
+#endif // CEF_INCLUDE_BASE_CEF_BUILD_H_
diff --git a/src/include/base/cef_callback.h b/src/include/base/cef_callback.h
new file mode 100644
index 0000000..16e238a
--- /dev/null
+++ b/src/include/base/cef_callback.h
@@ -0,0 +1,801 @@
+// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012
+// Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef CEF_INCLUDE_BASE_CEF_CALLBACK_H_
+#define CEF_INCLUDE_BASE_CEF_CALLBACK_H_
+#pragma once
+
+#if defined(BASE_CALLBACK_H_)
+// Do nothing if the Chromium header has already been included.
+// 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.
+#elif defined(USING_CHROMIUM_INCLUDES)
+// When building CEF include the Chromium header directly.
+#include "base/callback.h"
+#else // !USING_CHROMIUM_INCLUDES
+// The following is substantially similar to the Chromium implementation.
+// If the Chromium implementation diverges the below implementation should be
+// updated to match.
+
+#include "include/base/cef_callback_forward.h"
+#include "include/base/cef_template_util.h"
+#include "include/base/internal/cef_callback_internal.h"
+
+// NOTE: Header files that do not require the full definition of Callback or
+// Closure should #include "base/cef_callback_forward.h" instead of this file.
+
+// -----------------------------------------------------------------------------
+// Introduction
+// -----------------------------------------------------------------------------
+//
+// The templated Callback class is a generalized function object. Together
+// with the Bind() function in bind.h, they provide a type-safe method for
+// performing partial application of functions.
+//
+// Partial application (or "currying") is the process of binding a subset of
+// a function's arguments to produce another function that takes fewer
+// arguments. This can be used to pass around a unit of delayed execution,
+// much like lexical closures are used in other languages. For example, it
+// is used in Chromium code to schedule tasks on different MessageLoops.
+//
+// A callback with no unbound input parameters (base::Callback<void(void)>)
+// is called a base::Closure. Note that this is NOT the same as what other
+// languages refer to as a closure -- it does not retain a reference to its
+// enclosing environment.
+//
+// MEMORY MANAGEMENT AND PASSING
+//
+// The Callback objects themselves should be passed by const-reference, and
+// stored by copy. They internally store their state via a refcounted class
+// and thus do not need to be deleted.
+//
+// The reason to pass via a const-reference is to avoid unnecessary
+// AddRef/Release pairs to the internal state.
+//
+//
+// -----------------------------------------------------------------------------
+// Quick reference for basic stuff
+// -----------------------------------------------------------------------------
+//
+// BINDING A BARE FUNCTION
+//
+// int Return5() { return 5; }
+// base::Callback<int(void)> func_cb = base::Bind(&Return5);
+// LOG(INFO) << func_cb.Run(); // Prints 5.
+//
+// BINDING A CLASS METHOD
+//
+// The first argument to bind is the member function to call, the second is
+// the object on which to call it.
+//
+// class Ref : public base::RefCountedThreadSafe<Ref> {
+// public:
+// int Foo() { return 3; }
+// void PrintBye() { LOG(INFO) << "bye."; }
+// };
+// scoped_refptr<Ref> ref = new Ref();
+// base::Callback<void(void)> ref_cb = base::Bind(&Ref::Foo, ref);
+// LOG(INFO) << ref_cb.Run(); // Prints out 3.
+//
+// By default the object must support RefCounted or you will get a compiler
+// error. If you're passing between threads, be sure it's
+// RefCountedThreadSafe! See "Advanced binding of member functions" below if
+// you don't want to use reference counting.
+//
+// RUNNING A CALLBACK
+//
+// Callbacks can be run with their "Run" method, which has the same
+// signature as the template argument to the callback.
+//
+// void DoSomething(const base::Callback<void(int, std::string)>& callback) {
+// callback.Run(5, "hello");
+// }
+//
+// Callbacks can be run more than once (they don't get deleted or marked when
+// run). However, this precludes using base::Passed (see below).
+//
+// void DoSomething(const base::Callback<double(double)>& callback) {
+// double myresult = callback.Run(3.14159);
+// myresult += callback.Run(2.71828);
+// }
+//
+// PASSING UNBOUND INPUT PARAMETERS
+//
+// Unbound parameters are specified at the time a callback is Run(). They are
+// specified in the Callback template type:
+//
+// void MyFunc(int i, const std::string& str) {}
+// base::Callback<void(int, const std::string&)> cb = base::Bind(&MyFunc);
+// cb.Run(23, "hello, world");
+//
+// PASSING BOUND INPUT PARAMETERS
+//
+// Bound parameters are specified when you create thee callback as arguments
+// to Bind(). They will be passed to the function and the Run()ner of the
+// callback doesn't see those values or even know that the function it's
+// calling.
+//
+// void MyFunc(int i, const std::string& str) {}
+// base::Callback<void(void)> cb = base::Bind(&MyFunc, 23, "hello world");
+// cb.Run();
+//
+// A callback with no unbound input parameters (base::Callback<void(void)>)
+// is called a base::Closure. So we could have also written:
+//
+// base::Closure cb = base::Bind(&MyFunc, 23, "hello world");
+//
+// When calling member functions, bound parameters just go after the object
+// pointer.
+//
+// base::Closure cb = base::Bind(&MyClass::MyFunc, this, 23, "hello world");
+//
+// PARTIAL BINDING OF PARAMETERS
+//
+// You can specify some parameters when you create the callback, and specify
+// the rest when you execute the callback.
+//
+// void MyFunc(int i, const std::string& str) {}
+// base::Callback<void(const std::string&)> cb = base::Bind(&MyFunc, 23);
+// cb.Run("hello world");
+//
+// When calling a function bound parameters are first, followed by unbound
+// parameters.
+//
+//
+// -----------------------------------------------------------------------------
+// Quick reference for advanced binding
+// -----------------------------------------------------------------------------
+//
+// BINDING A CLASS METHOD WITH WEAK POINTERS
+//
+// base::Bind(&MyClass::Foo, GetWeakPtr());
+//
+// The callback will not be run if the object has already been destroyed.
+// DANGER: weak pointers are not threadsafe, so don't use this
+// when passing between threads!
+//
+// BINDING A CLASS METHOD WITH MANUAL LIFETIME MANAGEMENT
+//
+// base::Bind(&MyClass::Foo, base::Unretained(this));
+//
+// This disables all lifetime management on the object. You're responsible
+// for making sure the object is alive at the time of the call. You break it,
+// you own it!
+//
+// BINDING A CLASS METHOD AND HAVING THE CALLBACK OWN THE CLASS
+//
+// MyClass* myclass = new MyClass;
+// base::Bind(&MyClass::Foo, base::Owned(myclass));
+//
+// The object will be deleted when the callback is destroyed, even if it's
+// not run (like if you post a task during shutdown). Potentially useful for
+// "fire and forget" cases.
+//
+// IGNORING RETURN VALUES
+//
+// Sometimes you want to call a function that returns a value in a callback
+// that doesn't expect a return value.
+//
+// int DoSomething(int arg) { cout << arg << endl; }
+// base::Callback<void<int>) cb =
+// base::Bind(base::IgnoreResult(&DoSomething));
+//
+//
+// -----------------------------------------------------------------------------
+// Quick reference for binding parameters to Bind()
+// -----------------------------------------------------------------------------
+//
+// Bound parameters are specified as arguments to Bind() and are passed to the
+// function. A callback with no parameters or no unbound parameters is called a
+// Closure (base::Callback<void(void)> and base::Closure are the same thing).
+//
+// PASSING PARAMETERS OWNED BY THE CALLBACK
+//
+// void Foo(int* arg) { cout << *arg << endl; }
+// int* pn = new int(1);
+// base::Closure foo_callback = base::Bind(&foo, base::Owned(pn));
+//
+// The parameter will be deleted when the callback is destroyed, even if it's
+// not run (like if you post a task during shutdown).
+//
+// PASSING PARAMETERS AS A scoped_ptr
+//
+// void TakesOwnership(scoped_ptr<Foo> arg) {}
+// scoped_ptr<Foo> f(new Foo);
+// // f becomes null during the following call.
+// base::Closure cb = base::Bind(&TakesOwnership, base::Passed(&f));
+//
+// Ownership of the parameter will be with the callback until the it is run,
+// when ownership is passed to the callback function. This means the callback
+// can only be run once. If the callback is never run, it will delete the
+// object when it's destroyed.
+//
+// PASSING PARAMETERS AS A scoped_refptr
+//
+// void TakesOneRef(scoped_refptr<Foo> arg) {}
+// scoped_refptr<Foo> f(new Foo)
+// base::Closure cb = base::Bind(&TakesOneRef, f);
+//
+// This should "just work." The closure will take a reference as long as it
+// is alive, and another reference will be taken for the called function.
+//
+// PASSING PARAMETERS BY REFERENCE
+//
+// Const references are *copied* unless ConstRef is used. Example:
+//
+// void foo(const int& arg) { printf("%d %p\n", arg, &arg); }
+// int n = 1;
+// base::Closure has_copy = base::Bind(&foo, n);
+// base::Closure has_ref = base::Bind(&foo, base::ConstRef(n));
+// n = 2;
+// foo(n); // Prints "2 0xaaaaaaaaaaaa"
+// has_copy.Run(); // Prints "1 0xbbbbbbbbbbbb"
+// has_ref.Run(); // Prints "2 0xaaaaaaaaaaaa"
+//
+// Normally parameters are copied in the closure. DANGER: ConstRef stores a
+// const reference instead, referencing the original parameter. This means
+// that you must ensure the object outlives the callback!
+//
+//
+// -----------------------------------------------------------------------------
+// Implementation notes
+// -----------------------------------------------------------------------------
+//
+// WHERE IS THIS DESIGN FROM:
+//
+// The design Callback and Bind is heavily influenced by C++'s
+// tr1::function/tr1::bind, and by the "Google Callback" system used inside
+// Google.
+//
+//
+// HOW THE IMPLEMENTATION WORKS:
+//
+// There are three main components to the system:
+// 1) The Callback classes.
+// 2) The Bind() functions.
+// 3) The arguments wrappers (e.g., Unretained() and ConstRef()).
+//
+// The Callback classes represent a generic function pointer. Internally,
+// it stores a refcounted piece of state that represents the target function
+// and all its bound parameters. Each Callback specialization has a templated
+// constructor that takes an BindState<>*. In the context of the constructor,
+// the static type of this BindState<> pointer uniquely identifies the
+// function it is representing, all its bound parameters, and a Run() method
+// that is capable of invoking the target.
+//
+// Callback's constructor takes the BindState<>* that has the full static type
+// and erases the target function type as well as the types of the bound
+// parameters. It does this by storing a pointer to the specific Run()
+// function, and upcasting the state of BindState<>* to a
+// BindStateBase*. This is safe as long as this BindStateBase pointer
+// is only used with the stored Run() pointer.
+//
+// To BindState<> objects are created inside the Bind() functions.
+// These functions, along with a set of internal templates, are responsible for
+//
+// - Unwrapping the function signature into return type, and parameters
+// - Determining the number of parameters that are bound
+// - Creating the BindState storing the bound parameters
+// - Performing compile-time asserts to avoid error-prone behavior
+// - Returning an Callback<> with an arity matching the number of unbound
+// parameters and that knows the correct refcounting semantics for the
+// target object if we are binding a method.
+//
+// The Bind functions do the above using type-inference, and template
+// specializations.
+//
+// By default Bind() will store copies of all bound parameters, and attempt
+// to refcount a target object if the function being bound is a class method.
+// These copies are created even if the function takes parameters as const
+// references. (Binding to non-const references is forbidden, see bind.h.)
+//
+// To change this behavior, we introduce a set of argument wrappers
+// (e.g., Unretained(), and ConstRef()). These are simple container templates
+// that are passed by value, and wrap a pointer to argument. See the
+// file-level comment in base/bind_helpers.h for more info.
+//
+// These types are passed to the Unwrap() functions, and the MaybeRefcount()
+// functions respectively to modify the behavior of Bind(). The Unwrap()
+// and MaybeRefcount() functions change behavior by doing partial
+// specialization based on whether or not a parameter is a wrapper type.
+//
+// ConstRef() is similar to tr1::cref. Unretained() is specific to Chromium.
+//
+//
+// WHY NOT TR1 FUNCTION/BIND?
+//
+// Direct use of tr1::function and tr1::bind was considered, but ultimately
+// rejected because of the number of copy constructors invocations involved
+// in the binding of arguments during construction, and the forwarding of
+// arguments during invocation. These copies will no longer be an issue in
+// C++0x because C++0x will support rvalue reference allowing for the compiler
+// to avoid these copies. However, waiting for C++0x is not an option.
+//
+// Measured with valgrind on gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5), the
+// tr1::bind call itself will invoke a non-trivial copy constructor three times
+// for each bound parameter. Also, each when passing a tr1::function, each
+// bound argument will be copied again.
+//
+// In addition to the copies taken at binding and invocation, copying a
+// tr1::function causes a copy to be made of all the bound parameters and
+// state.
+//
+// Furthermore, in Chromium, it is desirable for the Callback to take a
+// reference on a target object when representing a class method call. This
+// is not supported by tr1.
+//
+// Lastly, tr1::function and tr1::bind has a more general and flexible API.
+// This includes things like argument reordering by use of
+// tr1::bind::placeholder, support for non-const reference parameters, and some
+// limited amount of subtyping of the tr1::function object (e.g.,
+// tr1::function<int(int)> is convertible to tr1::function<void(int)>).
+//
+// These are not features that are required in Chromium. Some of them, such as
+// allowing for reference parameters, and subtyping of functions, may actually
+// become a source of errors. Removing support for these features actually
+// allows for a simpler implementation, and a terser Currying API.
+//
+//
+// WHY NOT GOOGLE CALLBACKS?
+//
+// The Google callback system also does not support refcounting. Furthermore,
+// its implementation has a number of strange edge cases with respect to type
+// conversion of its arguments. In particular, the argument's constness must
+// at times match exactly the function signature, or the type-inference might
+// break. Given the above, writing a custom solution was easier.
+//
+//
+// MISSING FUNCTIONALITY
+// - Invoking the return of Bind. Bind(&foo).Run() does not work;
+// - Binding arrays to functions that take a non-const pointer.
+// Example:
+// void Foo(const char* ptr);
+// void Bar(char* ptr);
+// Bind(&Foo, "test");
+// Bind(&Bar, "test"); // This fails because ptr is not const.
+
+namespace base {
+
+// First, we forward declare the Callback class template. This informs the
+// compiler that the template only has 1 type parameter which is the function
+// signature that the Callback is representing.
+//
+// After this, create template specializations for 0-7 parameters. Note that
+// even though the template typelist grows, the specialization still
+// only has one type: the function signature.
+//
+// If you are thinking of forward declaring Callback in your own header file,
+// please include "base/callback_forward.h" instead.
+template <typename Sig>
+class Callback;
+
+namespace cef_internal {
+template <typename Runnable, typename RunType, typename BoundArgsType>
+struct BindState;
+} // namespace cef_internal
+
+template <typename R>
+class Callback<R(void)> : public cef_internal::CallbackBase {
+ public:
+ typedef R(RunType)();
+
+ Callback() : CallbackBase(NULL) {}
+
+ // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
+ // return the exact Callback<> type. See base/bind.h for details.
+ template <typename Runnable, typename BindRunType, typename BoundArgsType>
+ Callback(
+ cef_internal::BindState<Runnable, BindRunType, BoundArgsType>* bind_state)
+ : CallbackBase(bind_state) {
+ // Force the assignment to a local variable of PolymorphicInvoke
+ // so the compiler will typecheck that the passed in Run() method has
+ // the correct type.
+ PolymorphicInvoke invoke_func =
+ &cef_internal::BindState<Runnable, BindRunType,
+ BoundArgsType>::InvokerType::Run;
+ polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
+ }
+
+ bool Equals(const Callback& other) const {
+ return CallbackBase::Equals(other);
+ }
+
+ R Run() const {
+ PolymorphicInvoke f =
+ reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
+
+ return f(bind_state_.get());
+ }
+
+ private:
+ typedef R (*PolymorphicInvoke)(cef_internal::BindStateBase*);
+};
+
+template <typename R, typename A1>
+class Callback<R(A1)> : public cef_internal::CallbackBase {
+ public:
+ typedef R(RunType)(A1);
+
+ Callback() : CallbackBase(NULL) {}
+
+ // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
+ // return the exact Callback<> type. See base/bind.h for details.
+ template <typename Runnable, typename BindRunType, typename BoundArgsType>
+ Callback(
+ cef_internal::BindState<Runnable, BindRunType, BoundArgsType>* bind_state)
+ : CallbackBase(bind_state) {
+ // Force the assignment to a local variable of PolymorphicInvoke
+ // so the compiler will typecheck that the passed in Run() method has
+ // the correct type.
+ PolymorphicInvoke invoke_func =
+ &cef_internal::BindState<Runnable, BindRunType,
+ BoundArgsType>::InvokerType::Run;
+ polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
+ }
+
+ bool Equals(const Callback& other) const {
+ return CallbackBase::Equals(other);
+ }
+
+ R Run(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1) const {
+ PolymorphicInvoke f =
+ reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
+
+ return f(bind_state_.get(), cef_internal::CallbackForward(a1));
+ }
+
+ private:
+ typedef R (*PolymorphicInvoke)(
+ cef_internal::BindStateBase*,
+ typename cef_internal::CallbackParamTraits<A1>::ForwardType);
+};
+
+template <typename R, typename A1, typename A2>
+class Callback<R(A1, A2)> : public cef_internal::CallbackBase {
+ public:
+ typedef R(RunType)(A1, A2);
+
+ Callback() : CallbackBase(NULL) {}
+
+ // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
+ // return the exact Callback<> type. See base/bind.h for details.
+ template <typename Runnable, typename BindRunType, typename BoundArgsType>
+ Callback(
+ cef_internal::BindState<Runnable, BindRunType, BoundArgsType>* bind_state)
+ : CallbackBase(bind_state) {
+ // Force the assignment to a local variable of PolymorphicInvoke
+ // so the compiler will typecheck that the passed in Run() method has
+ // the correct type.
+ PolymorphicInvoke invoke_func =
+ &cef_internal::BindState<Runnable, BindRunType,
+ BoundArgsType>::InvokerType::Run;
+ polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
+ }
+
+ bool Equals(const Callback& other) const {
+ return CallbackBase::Equals(other);
+ }
+
+ R Run(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
+ typename cef_internal::CallbackParamTraits<A2>::ForwardType a2) const {
+ PolymorphicInvoke f =
+ reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
+
+ return f(bind_state_.get(), cef_internal::CallbackForward(a1),
+ cef_internal::CallbackForward(a2));
+ }
+
+ private:
+ typedef R (*PolymorphicInvoke)(
+ cef_internal::BindStateBase*,
+ typename cef_internal::CallbackParamTraits<A1>::ForwardType,
+ typename cef_internal::CallbackParamTraits<A2>::ForwardType);
+};
+
+template <typename R, typename A1, typename A2, typename A3>
+class Callback<R(A1, A2, A3)> : public cef_internal::CallbackBase {
+ public:
+ typedef R(RunType)(A1, A2, A3);
+
+ Callback() : CallbackBase(NULL) {}
+
+ // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
+ // return the exact Callback<> type. See base/bind.h for details.
+ template <typename Runnable, typename BindRunType, typename BoundArgsType>
+ Callback(
+ cef_internal::BindState<Runnable, BindRunType, BoundArgsType>* bind_state)
+ : CallbackBase(bind_state) {
+ // Force the assignment to a local variable of PolymorphicInvoke
+ // so the compiler will typecheck that the passed in Run() method has
+ // the correct type.
+ PolymorphicInvoke invoke_func =
+ &cef_internal::BindState<Runnable, BindRunType,
+ BoundArgsType>::InvokerType::Run;
+ polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
+ }
+
+ bool Equals(const Callback& other) const {
+ return CallbackBase::Equals(other);
+ }
+
+ R Run(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
+ typename cef_internal::CallbackParamTraits<A2>::ForwardType a2,
+ typename cef_internal::CallbackParamTraits<A3>::ForwardType a3) const {
+ PolymorphicInvoke f =
+ reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
+
+ return f(bind_state_.get(), cef_internal::CallbackForward(a1),
+ cef_internal::CallbackForward(a2),
+ cef_internal::CallbackForward(a3));
+ }
+
+ private:
+ typedef R (*PolymorphicInvoke)(
+ cef_internal::BindStateBase*,
+ typename cef_internal::CallbackParamTraits<A1>::ForwardType,
+ typename cef_internal::CallbackParamTraits<A2>::ForwardType,
+ typename cef_internal::CallbackParamTraits<A3>::ForwardType);
+};
+
+template <typename R, typename A1, typename A2, typename A3, typename A4>
+class Callback<R(A1, A2, A3, A4)> : public cef_internal::CallbackBase {
+ public:
+ typedef R(RunType)(A1, A2, A3, A4);
+
+ Callback() : CallbackBase(NULL) {}
+
+ // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
+ // return the exact Callback<> type. See base/bind.h for details.
+ template <typename Runnable, typename BindRunType, typename BoundArgsType>
+ Callback(
+ cef_internal::BindState<Runnable, BindRunType, BoundArgsType>* bind_state)
+ : CallbackBase(bind_state) {
+ // Force the assignment to a local variable of PolymorphicInvoke
+ // so the compiler will typecheck that the passed in Run() method has
+ // the correct type.
+ PolymorphicInvoke invoke_func =
+ &cef_internal::BindState<Runnable, BindRunType,
+ BoundArgsType>::InvokerType::Run;
+ polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
+ }
+
+ bool Equals(const Callback& other) const {
+ return CallbackBase::Equals(other);
+ }
+
+ R Run(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
+ typename cef_internal::CallbackParamTraits<A2>::ForwardType a2,
+ typename cef_internal::CallbackParamTraits<A3>::ForwardType a3,
+ typename cef_internal::CallbackParamTraits<A4>::ForwardType a4) const {
+ PolymorphicInvoke f =
+ reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
+
+ return f(bind_state_.get(), cef_internal::CallbackForward(a1),
+ cef_internal::CallbackForward(a2),
+ cef_internal::CallbackForward(a3),
+ cef_internal::CallbackForward(a4));
+ }
+
+ private:
+ typedef R (*PolymorphicInvoke)(
+ cef_internal::BindStateBase*,
+ typename cef_internal::CallbackParamTraits<A1>::ForwardType,
+ typename cef_internal::CallbackParamTraits<A2>::ForwardType,
+ typename cef_internal::CallbackParamTraits<A3>::ForwardType,
+ typename cef_internal::CallbackParamTraits<A4>::ForwardType);
+};
+
+template <typename R,
+ typename A1,
+ typename A2,
+ typename A3,
+ typename A4,
+ typename A5>
+class Callback<R(A1, A2, A3, A4, A5)> : public cef_internal::CallbackBase {
+ public:
+ typedef R(RunType)(A1, A2, A3, A4, A5);
+
+ Callback() : CallbackBase(NULL) {}
+
+ // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
+ // return the exact Callback<> type. See base/bind.h for details.
+ template <typename Runnable, typename BindRunType, typename BoundArgsType>
+ Callback(
+ cef_internal::BindState<Runnable, BindRunType, BoundArgsType>* bind_state)
+ : CallbackBase(bind_state) {
+ // Force the assignment to a local variable of PolymorphicInvoke
+ // so the compiler will typecheck that the passed in Run() method has
+ // the correct type.
+ PolymorphicInvoke invoke_func =
+ &cef_internal::BindState<Runnable, BindRunType,
+ BoundArgsType>::InvokerType::Run;
+ polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
+ }
+
+ bool Equals(const Callback& other) const {
+ return CallbackBase::Equals(other);
+ }
+
+ R Run(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
+ typename cef_internal::CallbackParamTraits<A2>::ForwardType a2,
+ typename cef_internal::CallbackParamTraits<A3>::ForwardType a3,
+ typename cef_internal::CallbackParamTraits<A4>::ForwardType a4,
+ typename cef_internal::CallbackParamTraits<A5>::ForwardType a5) const {
+ PolymorphicInvoke f =
+ reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
+
+ return f(
+ bind_state_.get(), cef_internal::CallbackForward(a1),
+ cef_internal::CallbackForward(a2), cef_internal::CallbackForward(a3),
+ cef_internal::CallbackForward(a4), cef_internal::CallbackForward(a5));
+ }
+
+ private:
+ typedef R (*PolymorphicInvoke)(
+ cef_internal::BindStateBase*,
+ typename cef_internal::CallbackParamTraits<A1>::ForwardType,
+ typename cef_internal::CallbackParamTraits<A2>::ForwardType,
+ typename cef_internal::CallbackParamTraits<A3>::ForwardType,
+ typename cef_internal::CallbackParamTraits<A4>::ForwardType,
+ typename cef_internal::CallbackParamTraits<A5>::ForwardType);
+};
+
+template <typename R,
+ typename A1,
+ typename A2,
+ typename A3,
+ typename A4,
+ typename A5,
+ typename A6>
+class Callback<R(A1, A2, A3, A4, A5, A6)> : public cef_internal::CallbackBase {
+ public:
+ typedef R(RunType)(A1, A2, A3, A4, A5, A6);
+
+ Callback() : CallbackBase(NULL) {}
+
+ // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
+ // return the exact Callback<> type. See base/bind.h for details.
+ template <typename Runnable, typename BindRunType, typename BoundArgsType>
+ Callback(
+ cef_internal::BindState<Runnable, BindRunType, BoundArgsType>* bind_state)
+ : CallbackBase(bind_state) {
+ // Force the assignment to a local variable of PolymorphicInvoke
+ // so the compiler will typecheck that the passed in Run() method has
+ // the correct type.
+ PolymorphicInvoke invoke_func =
+ &cef_internal::BindState<Runnable, BindRunType,
+ BoundArgsType>::InvokerType::Run;
+ polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
+ }
+
+ bool Equals(const Callback& other) const {
+ return CallbackBase::Equals(other);
+ }
+
+ R Run(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
+ typename cef_internal::CallbackParamTraits<A2>::ForwardType a2,
+ typename cef_internal::CallbackParamTraits<A3>::ForwardType a3,
+ typename cef_internal::CallbackParamTraits<A4>::ForwardType a4,
+ typename cef_internal::CallbackParamTraits<A5>::ForwardType a5,
+ typename cef_internal::CallbackParamTraits<A6>::ForwardType a6) const {
+ PolymorphicInvoke f =
+ reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
+
+ return f(
+ bind_state_.get(), cef_internal::CallbackForward(a1),
+ cef_internal::CallbackForward(a2), cef_internal::CallbackForward(a3),
+ cef_internal::CallbackForward(a4), cef_internal::CallbackForward(a5),
+ cef_internal::CallbackForward(a6));
+ }
+
+ private:
+ typedef R (*PolymorphicInvoke)(
+ cef_internal::BindStateBase*,
+ typename cef_internal::CallbackParamTraits<A1>::ForwardType,
+ typename cef_internal::CallbackParamTraits<A2>::ForwardType,
+ typename cef_internal::CallbackParamTraits<A3>::ForwardType,
+ typename cef_internal::CallbackParamTraits<A4>::ForwardType,
+ typename cef_internal::CallbackParamTraits<A5>::ForwardType,
+ typename cef_internal::CallbackParamTraits<A6>::ForwardType);
+};
+
+template <typename R,
+ typename A1,
+ typename A2,
+ typename A3,
+ typename A4,
+ typename A5,
+ typename A6,
+ typename A7>
+class Callback<R(A1, A2, A3, A4, A5, A6, A7)>
+ : public cef_internal::CallbackBase {
+ public:
+ typedef R(RunType)(A1, A2, A3, A4, A5, A6, A7);
+
+ Callback() : CallbackBase(NULL) {}
+
+ // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
+ // return the exact Callback<> type. See base/bind.h for details.
+ template <typename Runnable, typename BindRunType, typename BoundArgsType>
+ Callback(
+ cef_internal::BindState<Runnable, BindRunType, BoundArgsType>* bind_state)
+ : CallbackBase(bind_state) {
+ // Force the assignment to a local variable of PolymorphicInvoke
+ // so the compiler will typecheck that the passed in Run() method has
+ // the correct type.
+ PolymorphicInvoke invoke_func =
+ &cef_internal::BindState<Runnable, BindRunType,
+ BoundArgsType>::InvokerType::Run;
+ polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
+ }
+
+ bool Equals(const Callback& other) const {
+ return CallbackBase::Equals(other);
+ }
+
+ R Run(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
+ typename cef_internal::CallbackParamTraits<A2>::ForwardType a2,
+ typename cef_internal::CallbackParamTraits<A3>::ForwardType a3,
+ typename cef_internal::CallbackParamTraits<A4>::ForwardType a4,
+ typename cef_internal::CallbackParamTraits<A5>::ForwardType a5,
+ typename cef_internal::CallbackParamTraits<A6>::ForwardType a6,
+ typename cef_internal::CallbackParamTraits<A7>::ForwardType a7) const {
+ PolymorphicInvoke f =
+ reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
+
+ return f(
+ bind_state_.get(), cef_internal::CallbackForward(a1),
+ cef_internal::CallbackForward(a2), cef_internal::CallbackForward(a3),
+ cef_internal::CallbackForward(a4), cef_internal::CallbackForward(a5),
+ cef_internal::CallbackForward(a6), cef_internal::CallbackForward(a7));
+ }
+
+ private:
+ typedef R (*PolymorphicInvoke)(
+ cef_internal::BindStateBase*,
+ typename cef_internal::CallbackParamTraits<A1>::ForwardType,
+ typename cef_internal::CallbackParamTraits<A2>::ForwardType,
+ typename cef_internal::CallbackParamTraits<A3>::ForwardType,
+ typename cef_internal::CallbackParamTraits<A4>::ForwardType,
+ typename cef_internal::CallbackParamTraits<A5>::ForwardType,
+ typename cef_internal::CallbackParamTraits<A6>::ForwardType,
+ typename cef_internal::CallbackParamTraits<A7>::ForwardType);
+};
+
+// Syntactic sugar to make Callbacks<void(void)> easier to declare since it
+// will be used in a lot of APIs with delayed execution.
+typedef Callback<void(void)> Closure;
+
+} // namespace base
+
+#endif // !USING_CHROMIUM_INCLUDES
+
+#endif // CEF_INCLUDE_BASE_CEF_CALLBACK_H_
diff --git a/src/include/base/cef_callback_forward.h b/src/include/base/cef_callback_forward.h
new file mode 100644
index 0000000..d604d7c
--- /dev/null
+++ b/src/include/base/cef_callback_forward.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
+// Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef INCLUDE_BASE_CEF_CALLBACK_FORWARD_H_
+#define INCLUDE_BASE_CEF_CALLBACK_FORWARD_H_
+#pragma once
+
+#if defined(BASE_CALLBACK_FORWARD_H_)
+// Do nothing if the Chromium header has already been included.
+// 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.
+#elif defined(USING_CHROMIUM_INCLUDES)
+// When building CEF include the Chromium header directly.
+#include "base/callback_forward.h"
+#else // !USING_CHROMIUM_INCLUDES
+// The following is substantially similar to the Chromium implementation.
+// If the Chromium implementation diverges the below implementation should be
+// updated to match.
+
+namespace base {
+
+template <typename Sig>
+class Callback;
+
+typedef Callback<void(void)> Closure;
+
+} // namespace base
+
+#endif // !!USING_CHROMIUM_INCLUDES
+
+#endif // INCLUDE_BASE_CEF_CALLBACK_FORWARD_H_
diff --git a/src/include/base/cef_callback_helpers.h b/src/include/base/cef_callback_helpers.h
new file mode 100644
index 0000000..ebe074a
--- /dev/null
+++ b/src/include/base/cef_callback_helpers.h
@@ -0,0 +1,93 @@
+// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012
+// Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// This defines helpful methods for dealing with Callbacks. Because Callbacks
+// are implemented using templates, with a class per callback signature, adding
+// methods to Callback<> itself is unattractive (lots of extra code gets
+// generated). Instead, consider adding methods here.
+//
+// ResetAndReturn(&cb) is like cb.Reset() but allows executing a callback (via a
+// copy) after the original callback is Reset(). This can be handy if Run()
+// reads/writes the variable holding the Callback.
+
+#ifndef CEF_INCLUDE_BASE_CEF_CALLBACK_HELPERS_H_
+#define CEF_INCLUDE_BASE_CEF_CALLBACK_HELPERS_H_
+#pragma once
+
+#if defined(BASE_CALLBACK_HELPERS_H_)
+// Do nothing if the Chromium header has already been included.
+// 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.
+#elif defined(USING_CHROMIUM_INCLUDES)
+// When building CEF include the Chromium header directly.
+#include "base/callback_helpers.h"
+#else // !USING_CHROMIUM_INCLUDES
+// The following is substantially similar to the Chromium implementation.
+// If the Chromium implementation diverges the below implementation should be
+// updated to match.
+
+#include "include/base/cef_basictypes.h"
+#include "include/base/cef_build.h"
+#include "include/base/cef_callback.h"
+#include "include/base/cef_macros.h"
+
+namespace base {
+
+template <typename Sig>
+base::Callback<Sig> ResetAndReturn(base::Callback<Sig>* cb) {
+ base::Callback<Sig> ret(*cb);
+ cb->Reset();
+ return ret;
+}
+
+// ScopedClosureRunner is akin to scoped_ptr for Closures. It ensures that the
+// Closure is executed and deleted no matter how the current scope exits.
+class ScopedClosureRunner {
+ public:
+ ScopedClosureRunner();
+ explicit ScopedClosureRunner(const Closure& closure);
+ ~ScopedClosureRunner();
+
+ void Reset();
+ void Reset(const Closure& closure);
+ Closure Release() WARN_UNUSED_RESULT;
+
+ private:
+ Closure closure_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedClosureRunner);
+};
+
+} // namespace base
+
+#endif // !USING_CHROMIUM_INCLUDES
+
+#endif // CEF_INCLUDE_BASE_CEF_CALLBACK_HELPERS_H_
diff --git a/src/include/base/cef_callback_list.h b/src/include/base/cef_callback_list.h
new file mode 100644
index 0000000..e0ef366
--- /dev/null
+++ b/src/include/base/cef_callback_list.h
@@ -0,0 +1,449 @@
+// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2013
+// Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef CEF_INCLUDE_BASE_CEF_CALLBACK_LIST_H_
+#define CEF_INCLUDE_BASE_CEF_CALLBACK_LIST_H_
+#pragma once
+
+#if defined(BASE_CALLBACK_LIST_H_)
+// Do nothing if the Chromium header has already been included.
+// 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.
+#elif defined(USING_CHROMIUM_INCLUDES)
+// When building CEF include the Chromium header directly.
+#include "base/callback_list.h"
+#else // !USING_CHROMIUM_INCLUDES
+// The following is substantially similar to the Chromium implementation.
+// If the Chromium implementation diverges the below implementation should be
+// updated to match.
+
+#include <list>
+
+#include "include/base/cef_basictypes.h"
+#include "include/base/cef_build.h"
+#include "include/base/cef_callback.h"
+#include "include/base/cef_logging.h"
+#include "include/base/cef_macros.h"
+#include "include/base/cef_scoped_ptr.h"
+#include "include/base/internal/cef_callback_internal.h"
+
+// OVERVIEW:
+//
+// A container for a list of callbacks. Unlike a normal STL vector or list,
+// this container can be modified during iteration without invalidating the
+// iterator. It safely handles the case of a callback removing itself
+// or another callback from the list while callbacks are being run.
+//
+// TYPICAL USAGE:
+//
+// class MyWidget {
+// public:
+// ...
+//
+// typedef base::Callback<void(const Foo&)> OnFooCallback;
+//
+// scoped_ptr<base::CallbackList<void(const Foo&)>::Subscription>
+// RegisterCallback(const OnFooCallback& cb) {
+// return callback_list_.Add(cb);
+// }
+//
+// private:
+// void NotifyFoo(const Foo& foo) {
+// callback_list_.Notify(foo);
+// }
+//
+// base::CallbackList<void(const Foo&)> callback_list_;
+//
+// DISALLOW_COPY_AND_ASSIGN(MyWidget);
+// };
+//
+//
+// class MyWidgetListener {
+// public:
+// MyWidgetListener::MyWidgetListener() {
+// foo_subscription_ = MyWidget::GetCurrent()->RegisterCallback(
+// base::Bind(&MyWidgetListener::OnFoo, this)));
+// }
+//
+// MyWidgetListener::~MyWidgetListener() {
+// // Subscription gets deleted automatically and will deregister
+// // the callback in the process.
+// }
+//
+// private:
+// void OnFoo(const Foo& foo) {
+// // Do something.
+// }
+//
+// scoped_ptr<base::CallbackList<void(const Foo&)>::Subscription>
+// foo_subscription_;
+//
+// DISALLOW_COPY_AND_ASSIGN(MyWidgetListener);
+// };
+
+namespace base {
+
+namespace cef_internal {
+
+template <typename CallbackType>
+class CallbackListBase {
+ public:
+ class Subscription {
+ public:
+ Subscription(CallbackListBase<CallbackType>* list,
+ typename std::list<CallbackType>::iterator iter)
+ : list_(list), iter_(iter) {}
+
+ ~Subscription() {
+ if (list_->active_iterator_count_) {
+ iter_->Reset();
+ } else {
+ list_->callbacks_.erase(iter_);
+ if (!list_->removal_callback_.is_null())
+ list_->removal_callback_.Run();
+ }
+ }
+
+ private:
+ CallbackListBase<CallbackType>* list_;
+ typename std::list<CallbackType>::iterator iter_;
+
+ DISALLOW_COPY_AND_ASSIGN(Subscription);
+ };
+
+ // Add a callback to the list. The callback will remain registered until the
+ // returned Subscription is destroyed, which must occur before the
+ // CallbackList is destroyed.
+ scoped_ptr<Subscription> Add(const CallbackType& cb) WARN_UNUSED_RESULT {
+ DCHECK(!cb.is_null());
+ return scoped_ptr<Subscription>(
+ new Subscription(this, callbacks_.insert(callbacks_.end(), cb)));
+ }
+
+ // Sets a callback which will be run when a subscription list is changed.
+ void set_removal_callback(const Closure& callback) {
+ removal_callback_ = callback;
+ }
+
+ // Returns true if there are no subscriptions. This is only valid to call when
+ // not looping through the list.
+ bool empty() {
+ DCHECK_EQ(0, active_iterator_count_);
+ return callbacks_.empty();
+ }
+
+ protected:
+ // An iterator class that can be used to access the list of callbacks.
+ class Iterator {
+ public:
+ explicit Iterator(CallbackListBase<CallbackType>* list)
+ : list_(list), list_iter_(list_->callbacks_.begin()) {
+ ++list_->active_iterator_count_;
+ }
+
+ Iterator(const Iterator& iter)
+ : list_(iter.list_), list_iter_(iter.list_iter_) {
+ ++list_->active_iterator_count_;
+ }
+
+ ~Iterator() {
+ if (list_ && --list_->active_iterator_count_ == 0) {
+ list_->Compact();
+ }
+ }
+
+ CallbackType* GetNext() {
+ while ((list_iter_ != list_->callbacks_.end()) && list_iter_->is_null())
+ ++list_iter_;
+
+ CallbackType* cb = NULL;
+ if (list_iter_ != list_->callbacks_.end()) {
+ cb = &(*list_iter_);
+ ++list_iter_;
+ }
+ return cb;
+ }
+
+ private:
+ CallbackListBase<CallbackType>* list_;
+ typename std::list<CallbackType>::iterator list_iter_;
+ };
+
+ CallbackListBase() : active_iterator_count_(0) {}
+
+ ~CallbackListBase() {
+ DCHECK_EQ(0, active_iterator_count_);
+ DCHECK_EQ(0U, callbacks_.size());
+ }
+
+ // Returns an instance of a CallbackListBase::Iterator which can be used
+ // to run callbacks.
+ Iterator GetIterator() { return Iterator(this); }
+
+ // Compact the list: remove any entries which were NULLed out during
+ // iteration.
+ void Compact() {
+ typename std::list<CallbackType>::iterator it = callbacks_.begin();
+ bool updated = false;
+ while (it != callbacks_.end()) {
+ if ((*it).is_null()) {
+ updated = true;
+ it = callbacks_.erase(it);
+ } else {
+ ++it;
+ }
+
+ if (updated && !removal_callback_.is_null())
+ removal_callback_.Run();
+ }
+ }
+
+ private:
+ std::list<CallbackType> callbacks_;
+ int active_iterator_count_;
+ Closure removal_callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(CallbackListBase);
+};
+
+} // namespace cef_internal
+
+template <typename Sig>
+class CallbackList;
+
+template <>
+class CallbackList<void(void)>
+ : public cef_internal::CallbackListBase<Callback<void(void)>> {
+ public:
+ typedef Callback<void(void)> CallbackType;
+
+ CallbackList() {}
+
+ void Notify() {
+ cef_internal::CallbackListBase<CallbackType>::Iterator it =
+ this->GetIterator();
+ CallbackType* cb;
+ while ((cb = it.GetNext()) != NULL) {
+ cb->Run();
+ }
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
+};
+
+template <typename A1>
+class CallbackList<void(A1)>
+ : public cef_internal::CallbackListBase<Callback<void(A1)>> {
+ public:
+ typedef Callback<void(A1)> CallbackType;
+
+ CallbackList() {}
+
+ void Notify(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1) {
+ typename cef_internal::CallbackListBase<CallbackType>::Iterator it =
+ this->GetIterator();
+ CallbackType* cb;
+ while ((cb = it.GetNext()) != NULL) {
+ cb->Run(a1);
+ }
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
+};
+
+template <typename A1, typename A2>
+class CallbackList<void(A1, A2)>
+ : public cef_internal::CallbackListBase<Callback<void(A1, A2)>> {
+ public:
+ typedef Callback<void(A1, A2)> CallbackType;
+
+ CallbackList() {}
+
+ void Notify(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
+ typename cef_internal::CallbackParamTraits<A2>::ForwardType a2) {
+ typename cef_internal::CallbackListBase<CallbackType>::Iterator it =
+ this->GetIterator();
+ CallbackType* cb;
+ while ((cb = it.GetNext()) != NULL) {
+ cb->Run(a1, a2);
+ }
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
+};
+
+template <typename A1, typename A2, typename A3>
+class CallbackList<void(A1, A2, A3)>
+ : public cef_internal::CallbackListBase<Callback<void(A1, A2, A3)>> {
+ public:
+ typedef Callback<void(A1, A2, A3)> CallbackType;
+
+ CallbackList() {}
+
+ void Notify(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
+ typename cef_internal::CallbackParamTraits<A2>::ForwardType a2,
+ typename cef_internal::CallbackParamTraits<A3>::ForwardType a3) {
+ typename cef_internal::CallbackListBase<CallbackType>::Iterator it =
+ this->GetIterator();
+ CallbackType* cb;
+ while ((cb = it.GetNext()) != NULL) {
+ cb->Run(a1, a2, a3);
+ }
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
+};
+
+template <typename A1, typename A2, typename A3, typename A4>
+class CallbackList<void(A1, A2, A3, A4)>
+ : public cef_internal::CallbackListBase<Callback<void(A1, A2, A3, A4)>> {
+ public:
+ typedef Callback<void(A1, A2, A3, A4)> CallbackType;
+
+ CallbackList() {}
+
+ void Notify(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
+ typename cef_internal::CallbackParamTraits<A2>::ForwardType a2,
+ typename cef_internal::CallbackParamTraits<A3>::ForwardType a3,
+ typename cef_internal::CallbackParamTraits<A4>::ForwardType a4) {
+ typename cef_internal::CallbackListBase<CallbackType>::Iterator it =
+ this->GetIterator();
+ CallbackType* cb;
+ while ((cb = it.GetNext()) != NULL) {
+ cb->Run(a1, a2, a3, a4);
+ }
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
+};
+
+template <typename A1, typename A2, typename A3, typename A4, typename A5>
+class CallbackList<void(A1, A2, A3, A4, A5)>
+ : public cef_internal::CallbackListBase<
+ Callback<void(A1, A2, A3, A4, A5)>> {
+ public:
+ typedef Callback<void(A1, A2, A3, A4, A5)> CallbackType;
+
+ CallbackList() {}
+
+ void Notify(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
+ typename cef_internal::CallbackParamTraits<A2>::ForwardType a2,
+ typename cef_internal::CallbackParamTraits<A3>::ForwardType a3,
+ typename cef_internal::CallbackParamTraits<A4>::ForwardType a4,
+ typename cef_internal::CallbackParamTraits<A5>::ForwardType a5) {
+ typename cef_internal::CallbackListBase<CallbackType>::Iterator it =
+ this->GetIterator();
+ CallbackType* cb;
+ while ((cb = it.GetNext()) != NULL) {
+ cb->Run(a1, a2, a3, a4, a5);
+ }
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
+};
+
+template <typename A1,
+ typename A2,
+ typename A3,
+ typename A4,
+ typename A5,
+ typename A6>
+class CallbackList<void(A1, A2, A3, A4, A5, A6)>
+ : public cef_internal::CallbackListBase<
+ Callback<void(A1, A2, A3, A4, A5, A6)>> {
+ public:
+ typedef Callback<void(A1, A2, A3, A4, A5, A6)> CallbackType;
+
+ CallbackList() {}
+
+ void Notify(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
+ typename cef_internal::CallbackParamTraits<A2>::ForwardType a2,
+ typename cef_internal::CallbackParamTraits<A3>::ForwardType a3,
+ typename cef_internal::CallbackParamTraits<A4>::ForwardType a4,
+ typename cef_internal::CallbackParamTraits<A5>::ForwardType a5,
+ typename cef_internal::CallbackParamTraits<A6>::ForwardType a6) {
+ typename cef_internal::CallbackListBase<CallbackType>::Iterator it =
+ this->GetIterator();
+ CallbackType* cb;
+ while ((cb = it.GetNext()) != NULL) {
+ cb->Run(a1, a2, a3, a4, a5, a6);
+ }
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
+};
+
+template <typename A1,
+ typename A2,
+ typename A3,
+ typename A4,
+ typename A5,
+ typename A6,
+ typename A7>
+class CallbackList<void(A1, A2, A3, A4, A5, A6, A7)>
+ : public cef_internal::CallbackListBase<
+ Callback<void(A1, A2, A3, A4, A5, A6, A7)>> {
+ public:
+ typedef Callback<void(A1, A2, A3, A4, A5, A6, A7)> CallbackType;
+
+ CallbackList() {}
+
+ void Notify(typename cef_internal::CallbackParamTraits<A1>::ForwardType a1,
+ typename cef_internal::CallbackParamTraits<A2>::ForwardType a2,
+ typename cef_internal::CallbackParamTraits<A3>::ForwardType a3,
+ typename cef_internal::CallbackParamTraits<A4>::ForwardType a4,
+ typename cef_internal::CallbackParamTraits<A5>::ForwardType a5,
+ typename cef_internal::CallbackParamTraits<A6>::ForwardType a6,
+ typename cef_internal::CallbackParamTraits<A7>::ForwardType a7) {
+ typename cef_internal::CallbackListBase<CallbackType>::Iterator it =
+ this->GetIterator();
+ CallbackType* cb;
+ while ((cb = it.GetNext()) != NULL) {
+ cb->Run(a1, a2, a3, a4, a5, a6, a7);
+ }
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
+};
+
+} // namespace base
+
+#endif // !USING_CHROMIUM_INCLUDES
+
+#endif // CEF_INCLUDE_BASE_CEF_CALLBACK_LIST_H_
diff --git a/src/include/base/cef_cancelable_callback.h b/src/include/base/cef_cancelable_callback.h
new file mode 100644
index 0000000..febce3a
--- /dev/null
+++ b/src/include/base/cef_cancelable_callback.h
@@ -0,0 +1,293 @@
+// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
+// Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// CancelableCallback is a wrapper around base::Callback that allows
+// cancellation of a callback. CancelableCallback takes a reference on the
+// wrapped callback until this object is destroyed or Reset()/Cancel() are
+// called.
+//
+// NOTE:
+//
+// Calling CancelableCallback::Cancel() brings the object back to its natural,
+// default-constructed state, i.e., CancelableCallback::callback() will return
+// a null callback.
+//
+// THREAD-SAFETY:
+//
+// CancelableCallback objects must be created on, posted to, cancelled on, and
+// destroyed on the same thread.
+//
+//
+// EXAMPLE USAGE:
+//
+// In the following example, the test is verifying that RunIntensiveTest()
+// Quit()s the message loop within 4 seconds. The cancelable callback is posted
+// to the message loop, the intensive test runs, the message loop is run,
+// then the callback is cancelled.
+//
+// void TimeoutCallback(const std::string& timeout_message) {
+// FAIL() << timeout_message;
+// MessageLoop::current()->QuitWhenIdle();
+// }
+//
+// CancelableClosure timeout(base::Bind(&TimeoutCallback, "Test timed out."));
+// MessageLoop::current()->PostDelayedTask(FROM_HERE, timeout.callback(),
+// 4000) // 4 seconds to run.
+// RunIntensiveTest();
+// MessageLoop::current()->Run();
+// timeout.Cancel(); // Hopefully this is hit before the timeout callback runs.
+//
+
+#ifndef CEF_INCLUDE_BASE_CEF_CANCELABLE_CALLBACK_H_
+#define CEF_INCLUDE_BASE_CEF_CANCELABLE_CALLBACK_H_
+#pragma once
+
+#if defined(BASE_CANCELABLE_CALLBACK_H_)
+// Do nothing if the Chromium header has already been included.
+// 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.
+#elif defined(USING_CHROMIUM_INCLUDES)
+// When building CEF include the Chromium header directly.
+#include "base/cancelable_callback.h"
+#else // !USING_CHROMIUM_INCLUDES
+// The following is substantially similar to the Chromium implementation.
+// If the Chromium implementation diverges the below implementation should be
+// updated to match.
+
+#include "include/base/cef_bind.h"
+#include "include/base/cef_build.h"
+#include "include/base/cef_callback.h"
+#include "include/base/cef_logging.h"
+#include "include/base/cef_macros.h"
+#include "include/base/cef_weak_ptr.h"
+#include "include/base/internal/cef_callback_internal.h"
+
+namespace base {
+
+template <typename Sig>
+class CancelableCallback;
+
+template <>
+class CancelableCallback<void(void)> {
+ public:
+ CancelableCallback() : weak_factory_(this) {}
+
+ // |callback| must not be null.
+ explicit CancelableCallback(const base::Callback<void(void)>& callback)
+ : weak_factory_(this), callback_(callback) {
+ DCHECK(!callback.is_null());
+ InitializeForwarder();
+ }
+
+ ~CancelableCallback() {}
+
+ // Cancels and drops the reference to the wrapped callback.
+ void Cancel() {
+ weak_factory_.InvalidateWeakPtrs();
+ forwarder_.Reset();
+ callback_.Reset();
+ }
+
+ // Returns true if the wrapped callback has been cancelled.
+ bool IsCancelled() const { return callback_.is_null(); }
+
+ // Sets |callback| as the closure that may be cancelled. |callback| may not
+ // be null. Outstanding and any previously wrapped callbacks are cancelled.
+ void Reset(const base::Callback<void(void)>& callback) {
+ DCHECK(!callback.is_null());
+
+ // Outstanding tasks (e.g., posted to a message loop) must not be called.
+ Cancel();
+
+ // |forwarder_| is no longer valid after Cancel(), so re-bind.
+ InitializeForwarder();
+
+ callback_ = callback;
+ }
+
+ // Returns a callback that can be disabled by calling Cancel().
+ const base::Callback<void(void)>& callback() const { return forwarder_; }
+
+ private:
+ void Forward() { callback_.Run(); }
+
+ // Helper method to bind |forwarder_| using a weak pointer from
+ // |weak_factory_|.
+ void InitializeForwarder() {
+ forwarder_ = base::Bind(&CancelableCallback<void(void)>::Forward,
+ weak_factory_.GetWeakPtr());
+ }
+
+ // Used to ensure Forward() is not run when this object is destroyed.
+ base::WeakPtrFactory<CancelableCallback<void(void)>> weak_factory_;
+
+ // The wrapper closure.
+ base::Callback<void(void)> forwarder_;
+
+ // The stored closure that may be cancelled.
+ base::Callback<void(void)> callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(CancelableCallback);
+};
+
+template <typename A1>
+class CancelableCallback<void(A1)> {
+ public:
+ CancelableCallback() : weak_factory_(this) {}
+
+ // |callback| must not be null.
+ explicit CancelableCallback(const base::Callback<void(A1)>& callback)
+ : weak_factory_(this), callback_(callback) {
+ DCHECK(!callback.is_null());
+ InitializeForwarder();
+ }
+
+ ~CancelableCallback() {}
+
+ // Cancels and drops the reference to the wrapped callback.
+ void Cancel() {
+ weak_factory_.InvalidateWeakPtrs();
+ forwarder_.Reset();
+ callback_.Reset();
+ }
+
+ // Returns true if the wrapped callback has been cancelled.
+ bool IsCancelled() const { return callback_.is_null(); }
+
+ // Sets |callback| as the closure that may be cancelled. |callback| may not
+ // be null. Outstanding and any previously wrapped callbacks are cancelled.
+ void Reset(const base::Callback<void(A1)>& callback) {
+ DCHECK(!callback.is_null());
+
+ // Outstanding tasks (e.g., posted to a message loop) must not be called.
+ Cancel();
+
+ // |forwarder_| is no longer valid after Cancel(), so re-bind.
+ InitializeForwarder();
+
+ callback_ = callback;
+ }
+
+ // Returns a callback that can be disabled by calling Cancel().
+ const base::Callback<void(A1)>& callback() const { return forwarder_; }
+
+ private:
+ void Forward(A1 a1) const { callback_.Run(a1); }
+
+ // Helper method to bind |forwarder_| using a weak pointer from
+ // |weak_factory_|.
+ void InitializeForwarder() {
+ forwarder_ = base::Bind(&CancelableCallback<void(A1)>::Forward,
+ weak_factory_.GetWeakPtr());
+ }
+
+ // Used to ensure Forward() is not run when this object is destroyed.
+ base::WeakPtrFactory<CancelableCallback<void(A1)>> weak_factory_;
+
+ // The wrapper closure.
+ base::Callback<void(A1)> forwarder_;
+
+ // The stored closure that may be cancelled.
+ base::Callback<void(A1)> callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(CancelableCallback);
+};
+
+template <typename A1, typename A2>
+class CancelableCallback<void(A1, A2)> {
+ public:
+ CancelableCallback() : weak_factory_(this) {}
+
+ // |callback| must not be null.
+ explicit CancelableCallback(const base::Callback<void(A1, A2)>& callback)
+ : weak_factory_(this), callback_(callback) {
+ DCHECK(!callback.is_null());
+ InitializeForwarder();
+ }
+
+ ~CancelableCallback() {}
+
+ // Cancels and drops the reference to the wrapped callback.
+ void Cancel() {
+ weak_factory_.InvalidateWeakPtrs();
+ forwarder_.Reset();
+ callback_.Reset();
+ }
+
+ // Returns true if the wrapped callback has been cancelled.
+ bool IsCancelled() const { return callback_.is_null(); }
+
+ // Sets |callback| as the closure that may be cancelled. |callback| may not
+ // be null. Outstanding and any previously wrapped callbacks are cancelled.
+ void Reset(const base::Callback<void(A1, A2)>& callback) {
+ DCHECK(!callback.is_null());
+
+ // Outstanding tasks (e.g., posted to a message loop) must not be called.
+ Cancel();
+
+ // |forwarder_| is no longer valid after Cancel(), so re-bind.
+ InitializeForwarder();
+
+ callback_ = callback;
+ }
+
+ // Returns a callback that can be disabled by calling Cancel().
+ const base::Callback<void(A1, A2)>& callback() const { return forwarder_; }
+
+ private:
+ void Forward(A1 a1, A2 a2) const { callback_.Run(a1, a2); }
+
+ // Helper method to bind |forwarder_| using a weak pointer from
+ // |weak_factory_|.
+ void InitializeForwarder() {
+ forwarder_ = base::Bind(&CancelableCallback<void(A1, A2)>::Forward,
+ weak_factory_.GetWeakPtr());
+ }
+
+ // Used to ensure Forward() is not run when this object is destroyed.
+ base::WeakPtrFactory<CancelableCallback<void(A1, A2)>> weak_factory_;
+
+ // The wrapper closure.
+ base::Callback<void(A1, A2)> forwarder_;
+
+ // The stored closure that may be cancelled.
+ base::Callback<void(A1, A2)> callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(CancelableCallback);
+};
+
+typedef CancelableCallback<void(void)> CancelableClosure;
+
+} // namespace base
+
+#endif // !USING_CHROMIUM_INCLUDES
+
+#endif // CEF_INCLUDE_BASE_CEF_CANCELABLE_CALLBACK_H_
diff --git a/src/include/base/cef_lock.h b/src/include/base/cef_lock.h
new file mode 100644
index 0000000..6909bd6
--- /dev/null
+++ b/src/include/base/cef_lock.h
@@ -0,0 +1,174 @@
+// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
+// Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef CEF_INCLUDE_BASE_CEF_LOCK_H_
+#define CEF_INCLUDE_BASE_CEF_LOCK_H_
+#pragma once
+
+#if defined(BASE_SYNCHRONIZATION_LOCK_H_)
+// Do nothing if the Chromium header has already been included.
+// 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.
+#elif defined(USING_CHROMIUM_INCLUDES)
+// When building CEF include the Chromium header directly.
+#include "base/synchronization/lock.h"
+#else // !USING_CHROMIUM_INCLUDES
+// The following is substantially similar to the Chromium implementation.
+// If the Chromium implementation diverges the below implementation should be
+// updated to match.
+
+#include "include/base/cef_logging.h"
+#include "include/base/cef_macros.h"
+#include "include/base/cef_platform_thread.h"
+#include "include/base/internal/cef_lock_impl.h"
+
+namespace base {
+namespace cef_internal {
+
+// A convenient wrapper for an OS specific critical section. The only real
+// intelligence in this class is in debug mode for the support for the
+// AssertAcquired() method.
+class Lock {
+ public:
+#if !DCHECK_IS_ON() // Optimized wrapper implementation
+ Lock() : lock_() {}
+ ~Lock() {}
+ void Acquire() { lock_.Lock(); }
+ void Release() { lock_.Unlock(); }
+
+ // If the lock is not held, take it and return true. If the lock is already
+ // held by another thread, immediately return false. This must not be called
+ // by a thread already holding the lock (what happens is undefined and an
+ // assertion may fail).
+ bool Try() { return lock_.Try(); }
+
+ // Null implementation if not debug.
+ void AssertAcquired() const {}
+#else
+ Lock();
+ ~Lock();
+
+ // NOTE: Although windows critical sections support recursive locks, we do not
+ // allow this, and we will commonly fire a DCHECK() if a thread attempts to
+ // acquire the lock a second time (while already holding it).
+ void Acquire() {
+ lock_.Lock();
+ CheckUnheldAndMark();
+ }
+ void Release() {
+ CheckHeldAndUnmark();
+ lock_.Unlock();
+ }
+
+ bool Try() {
+ bool rv = lock_.Try();
+ if (rv) {
+ CheckUnheldAndMark();
+ }
+ return rv;
+ }
+
+ void AssertAcquired() const;
+#endif // !DCHECK_IS_ON()
+
+ private:
+#if DCHECK_IS_ON()
+ // Members and routines taking care of locks assertions.
+ // Note that this checks for recursive locks and allows them
+ // if the variable is set. This is allowed by the underlying implementation
+ // on windows but not on Posix, so we're doing unneeded checks on Posix.
+ // It's worth it to share the code.
+ void CheckHeldAndUnmark();
+ void CheckUnheldAndMark();
+
+ // All private data is implicitly protected by lock_.
+ // Be VERY careful to only access members under that lock.
+ base::PlatformThreadRef owning_thread_ref_;
+#endif // DCHECK_IS_ON()
+
+ // Platform specific underlying lock implementation.
+ LockImpl lock_;
+
+ DISALLOW_COPY_AND_ASSIGN(Lock);
+};
+
+// A helper class that acquires the given Lock while the AutoLock is in scope.
+class AutoLock {
+ public:
+ struct AlreadyAcquired {};
+
+ explicit AutoLock(Lock& lock) : lock_(lock) { lock_.Acquire(); }
+
+ AutoLock(Lock& lock, const AlreadyAcquired&) : lock_(lock) {
+ lock_.AssertAcquired();
+ }
+
+ ~AutoLock() {
+ lock_.AssertAcquired();
+ lock_.Release();
+ }
+
+ private:
+ Lock& lock_;
+ DISALLOW_COPY_AND_ASSIGN(AutoLock);
+};
+
+// AutoUnlock is a helper that will Release() the |lock| argument in the
+// constructor, and re-Acquire() it in the destructor.
+class AutoUnlock {
+ public:
+ explicit AutoUnlock(Lock& lock) : lock_(lock) {
+ // We require our caller to have the lock.
+ lock_.AssertAcquired();
+ lock_.Release();
+ }
+
+ ~AutoUnlock() { lock_.Acquire(); }
+
+ private:
+ Lock& lock_;
+ DISALLOW_COPY_AND_ASSIGN(AutoUnlock);
+};
+
+} // namespace cef_internal
+
+// Implement classes in the cef_internal namespace and then expose them to the
+// base namespace. This avoids conflicts with the base.lib implementation when
+// linking sandbox support on Windows.
+using cef_internal::Lock;
+using cef_internal::AutoLock;
+using cef_internal::AutoUnlock;
+
+} // namespace base
+
+#endif // !USING_CHROMIUM_INCLUDES
+
+#endif // CEF_INCLUDE_BASE_CEF_LOCK_H_
diff --git a/src/include/base/cef_logging.h b/src/include/base/cef_logging.h
new file mode 100644
index 0000000..ba93097
--- /dev/null
+++ b/src/include/base/cef_logging.h
@@ -0,0 +1,760 @@
+// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012
+// Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// ---------------------------------------------------------------------------
+//
+// The contents of this file are only available to applications that link
+// against the libcef_dll_wrapper target.
+//
+// WARNING: Logging macros should not be used in the main/browser process before
+// calling CefInitialize or in sub-processes before calling CefExecuteProcess.
+//
+// Instructions
+// ------------
+//
+// Make a bunch of macros for logging. The way to log things is to stream
+// things to LOG(<a particular severity level>). E.g.,
+//
+// LOG(INFO) << "Found " << num_cookies << " cookies";
+//
+// You can also do conditional logging:
+//
+// LOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
+//
+// The CHECK(condition) macro is active in both debug and release builds and
+// effectively performs a LOG(FATAL) which terminates the process and
+// generates a crashdump unless a debugger is attached.
+//
+// There are also "debug mode" logging macros like the ones above:
+//
+// DLOG(INFO) << "Found cookies";
+//
+// DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
+//
+// All "debug mode" logging is compiled away to nothing for non-debug mode
+// compiles. LOG_IF and development flags also work well together
+// because the code can be compiled away sometimes.
+//
+// We also have
+//
+// LOG_ASSERT(assertion);
+// DLOG_ASSERT(assertion);
+//
+// which is syntactic sugar for {,D}LOG_IF(FATAL, assert fails) << assertion;
+//
+// There are "verbose level" logging macros. They look like
+//
+// VLOG(1) << "I'm printed when you run the program with --v=1 or more";
+// VLOG(2) << "I'm printed when you run the program with --v=2 or more";
+//
+// These always log at the INFO log level (when they log at all).
+// The verbose logging can also be turned on module-by-module. For instance,
+// --vmodule=profile=2,icon_loader=1,browser_*=3,*/chromeos/*=4 --v=0
+// will cause:
+// a. VLOG(2) and lower messages to be printed from profile.{h,cc}
+// b. VLOG(1) and lower messages to be printed from icon_loader.{h,cc}
+// c. VLOG(3) and lower messages to be printed from files prefixed with
+// "browser"
+// d. VLOG(4) and lower messages to be printed from files under a
+// "chromeos" directory.
+// e. VLOG(0) and lower messages to be printed from elsewhere
+//
+// The wildcarding functionality shown by (c) supports both '*' (match
+// 0 or more characters) and '?' (match any single character)
+// wildcards. Any pattern containing a forward or backward slash will
+// be tested against the whole pathname and not just the module.
+// E.g., "*/foo/bar/*=2" would change the logging level for all code
+// in source files under a "foo/bar" directory.
+//
+// There's also VLOG_IS_ON(n) "verbose level" condition macro. To be used as
+//
+// if (VLOG_IS_ON(2)) {
+// // do some logging preparation and logging
+// // that can't be accomplished with just VLOG(2) << ...;
+// }
+//
+// There is also a VLOG_IF "verbose level" condition macro for sample
+// cases, when some extra computation and preparation for logs is not
+// needed.
+//
+// VLOG_IF(1, (size > 1024))
+// << "I'm printed when size is more than 1024 and when you run the "
+// "program with --v=1 or more";
+//
+// We also override the standard 'assert' to use 'DLOG_ASSERT'.
+//
+// Lastly, there is:
+//
+// PLOG(ERROR) << "Couldn't do foo";
+// DPLOG(ERROR) << "Couldn't do foo";
+// PLOG_IF(ERROR, cond) << "Couldn't do foo";
+// DPLOG_IF(ERROR, cond) << "Couldn't do foo";
+// PCHECK(condition) << "Couldn't do foo";
+// DPCHECK(condition) << "Couldn't do foo";
+//
+// which append the last system error to the message in string form (taken from
+// GetLastError() on Windows and errno on POSIX).
+//
+// The supported severity levels for macros that allow you to specify one
+// are (in increasing order of severity) INFO, WARNING, ERROR, and FATAL.
+//
+// Very important: logging a message at the FATAL severity level causes
+// the program to terminate (after the message is logged).
+//
+// There is the special severity of DFATAL, which logs FATAL in debug mode,
+// ERROR in normal mode.
+//
+
+#ifndef CEF_INCLUDE_BASE_CEF_LOGGING_H_
+#define CEF_INCLUDE_BASE_CEF_LOGGING_H_
+#pragma once
+
+#if defined(DCHECK)
+// Do nothing if the macros provided by this header already exist.
+// 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() false
+#else
+#define DCHECK_IS_ON() true
+#endif
+
+#elif defined(USING_CHROMIUM_INCLUDES)
+// When building CEF include the Chromium header directly.
+#include "base/logging.h"
+#else // !USING_CHROMIUM_INCLUDES
+// The following is substantially similar to the Chromium implementation.
+// If the Chromium implementation diverges the below implementation should be
+// updated to match.
+
+#include <cassert>
+#include <cstring>
+#include <sstream>
+#include <string>
+
+#include "include/base/cef_build.h"
+#include "include/base/cef_macros.h"
+#include "include/internal/cef_logging_internal.h"
+
+namespace cef {
+namespace logging {
+
+// Gets the current log level.
+inline int GetMinLogLevel() {
+ return cef_get_min_log_level();
+}
+
+// Gets the current vlog level for the given file (usually taken from
+// __FILE__). Note that |N| is the size *with* the null terminator.
+template <size_t N>
+int GetVlogLevel(const char (&file)[N]) {
+ return cef_get_vlog_level(file, N);
+}
+
+typedef int LogSeverity;
+const LogSeverity LOG_VERBOSE = -1; // This is level 1 verbosity
+// Note: the log severities are used to index into the array of names,
+// see log_severity_names.
+const LogSeverity LOG_INFO = 0;
+const LogSeverity LOG_WARNING = 1;
+const LogSeverity LOG_ERROR = 2;
+const LogSeverity LOG_FATAL = 3;
+const LogSeverity LOG_NUM_SEVERITIES = 4;
+
+// LOG_DFATAL is LOG_FATAL in debug mode, ERROR in normal mode
+#ifdef NDEBUG
+const LogSeverity LOG_DFATAL = LOG_ERROR;
+#else
+const LogSeverity LOG_DFATAL = LOG_FATAL;
+#endif
+
+// A few definitions of macros that don't generate much code. These are used
+// by LOG() and LOG_IF, etc. Since these are used all over our code, it's
+// better to have compact code for these operations.
+#define COMPACT_GOOGLE_LOG_EX_INFO(ClassName, ...) \
+ cef::logging::ClassName(__FILE__, __LINE__, cef::logging::LOG_INFO, \
+ ##__VA_ARGS__)
+#define COMPACT_GOOGLE_LOG_EX_WARNING(ClassName, ...) \
+ cef::logging::ClassName(__FILE__, __LINE__, cef::logging::LOG_WARNING, \
+ ##__VA_ARGS__)
+#define COMPACT_GOOGLE_LOG_EX_ERROR(ClassName, ...) \
+ cef::logging::ClassName(__FILE__, __LINE__, cef::logging::LOG_ERROR, \
+ ##__VA_ARGS__)
+#define COMPACT_GOOGLE_LOG_EX_FATAL(ClassName, ...) \
+ cef::logging::ClassName(__FILE__, __LINE__, cef::logging::LOG_FATAL, \
+ ##__VA_ARGS__)
+#define COMPACT_GOOGLE_LOG_EX_DFATAL(ClassName, ...) \
+ cef::logging::ClassName(__FILE__, __LINE__, cef::logging::LOG_DFATAL, \
+ ##__VA_ARGS__)
+
+#define COMPACT_GOOGLE_LOG_INFO COMPACT_GOOGLE_LOG_EX_INFO(LogMessage)
+#define COMPACT_GOOGLE_LOG_WARNING COMPACT_GOOGLE_LOG_EX_WARNING(LogMessage)
+#define COMPACT_GOOGLE_LOG_ERROR COMPACT_GOOGLE_LOG_EX_ERROR(LogMessage)
+#define COMPACT_GOOGLE_LOG_FATAL COMPACT_GOOGLE_LOG_EX_FATAL(LogMessage)
+#define COMPACT_GOOGLE_LOG_DFATAL COMPACT_GOOGLE_LOG_EX_DFATAL(LogMessage)
+
+#if defined(OS_WIN)
+// wingdi.h defines ERROR to be 0. When we call LOG(ERROR), it gets
+// substituted with 0, and it expands to COMPACT_GOOGLE_LOG_0. To allow us
+// to keep using this syntax, we define this macro to do the same thing
+// as COMPACT_GOOGLE_LOG_ERROR, and also define ERROR the same way that
+// the Windows SDK does for consistency.
+#define ERROR 0
+#define COMPACT_GOOGLE_LOG_EX_0(ClassName, ...) \
+ COMPACT_GOOGLE_LOG_EX_ERROR(ClassName, ##__VA_ARGS__)
+#define COMPACT_GOOGLE_LOG_0 COMPACT_GOOGLE_LOG_ERROR
+// Needed for LOG_IS_ON(ERROR).
+const LogSeverity LOG_0 = LOG_ERROR;
+#endif
+
+// As special cases, we can assume that LOG_IS_ON(FATAL) always holds. Also,
+// LOG_IS_ON(DFATAL) always holds in debug mode. In particular, CHECK()s will
+// always fire if they fail.
+#define LOG_IS_ON(severity) \
+ ((::cef::logging::LOG_##severity) >= ::cef::logging::GetMinLogLevel())
+
+// We can't do any caching tricks with VLOG_IS_ON() like the
+// google-glog version since it requires GCC extensions. This means
+// that using the v-logging functions in conjunction with --vmodule
+// may be slow.
+#define VLOG_IS_ON(verboselevel) \
+ ((verboselevel) <= ::cef::logging::GetVlogLevel(__FILE__))
+
+// Helper macro which avoids evaluating the arguments to a stream if
+// the condition doesn't hold.
+#define LAZY_STREAM(stream, condition) \
+ !(condition) ? (void)0 : ::cef::logging::LogMessageVoidify() & (stream)
+
+// We use the preprocessor's merging operator, "##", so that, e.g.,
+// LOG(INFO) becomes the token COMPACT_GOOGLE_LOG_INFO. There's some funny
+// subtle difference between ostream member streaming functions (e.g.,
+// ostream::operator<<(int) and ostream non-member streaming functions
+// (e.g., ::operator<<(ostream&, string&): it turns out that it's
+// impossible to stream something like a string directly to an unnamed
+// ostream. We employ a neat hack by calling the stream() member
+// function of LogMessage which seems to avoid the problem.
+#define LOG_STREAM(severity) COMPACT_GOOGLE_LOG_##severity.stream()
+
+#define LOG(severity) LAZY_STREAM(LOG_STREAM(severity), LOG_IS_ON(severity))
+#define LOG_IF(severity, condition) \
+ LAZY_STREAM(LOG_STREAM(severity), LOG_IS_ON(severity) && (condition))
+
+#define SYSLOG(severity) LOG(severity)
+#define SYSLOG_IF(severity, condition) LOG_IF(severity, condition)
+
+// The VLOG macros log with negative verbosities.
+#define VLOG_STREAM(verbose_level) \
+ cef::logging::LogMessage(__FILE__, __LINE__, -verbose_level).stream()
+
+#define VLOG(verbose_level) \
+ LAZY_STREAM(VLOG_STREAM(verbose_level), VLOG_IS_ON(verbose_level))
+
+#define VLOG_IF(verbose_level, condition) \
+ LAZY_STREAM(VLOG_STREAM(verbose_level), \
+ VLOG_IS_ON(verbose_level) && (condition))
+
+#if defined(OS_WIN)
+#define VPLOG_STREAM(verbose_level) \
+ cef::logging::Win32ErrorLogMessage(__FILE__, __LINE__, -verbose_level, \
+ ::cef::logging::GetLastSystemErrorCode()) \
+ .stream()
+#elif defined(OS_POSIX)
+#define VPLOG_STREAM(verbose_level) \
+ cef::logging::ErrnoLogMessage(__FILE__, __LINE__, -verbose_level, \
+ ::cef::logging::GetLastSystemErrorCode()) \
+ .stream()
+#endif
+
+#define VPLOG(verbose_level) \
+ LAZY_STREAM(VPLOG_STREAM(verbose_level), VLOG_IS_ON(verbose_level))
+
+#define VPLOG_IF(verbose_level, condition) \
+ LAZY_STREAM(VPLOG_STREAM(verbose_level), \
+ VLOG_IS_ON(verbose_level) && (condition))
+
+// TODO(akalin): Add more VLOG variants, e.g. VPLOG.
+
+#define LOG_ASSERT(condition) \
+ LOG_IF(FATAL, !(condition)) << "Assert failed: " #condition ". "
+#define SYSLOG_ASSERT(condition) \
+ SYSLOG_IF(FATAL, !(condition)) << "Assert failed: " #condition ". "
+
+#if defined(OS_WIN)
+#define PLOG_STREAM(severity) \
+ COMPACT_GOOGLE_LOG_EX_##severity(Win32ErrorLogMessage, \
+ ::cef::logging::GetLastSystemErrorCode()) \
+ .stream()
+#elif defined(OS_POSIX)
+#define PLOG_STREAM(severity) \
+ COMPACT_GOOGLE_LOG_EX_##severity(ErrnoLogMessage, \
+ ::cef::logging::GetLastSystemErrorCode()) \
+ .stream()
+#endif
+
+#define PLOG(severity) LAZY_STREAM(PLOG_STREAM(severity), LOG_IS_ON(severity))
+
+#define PLOG_IF(severity, condition) \
+ LAZY_STREAM(PLOG_STREAM(severity), LOG_IS_ON(severity) && (condition))
+
+// The actual stream used isn't important.
+#define EAT_STREAM_PARAMETERS \
+ true ? (void)0 : ::cef::logging::LogMessageVoidify() & LOG_STREAM(FATAL)
+
+// CHECK dies with a fatal error if condition is not true. It is *not*
+// controlled by NDEBUG, so the check will be executed regardless of
+// compilation mode.
+//
+// We make sure CHECK et al. always evaluates their arguments, as
+// doing CHECK(FunctionWithSideEffect()) is a common idiom.
+
+#define CHECK(condition) \
+ LAZY_STREAM(LOG_STREAM(FATAL), !(condition)) \
+ << "Check failed: " #condition ". "
+
+#define PCHECK(condition) \
+ LAZY_STREAM(PLOG_STREAM(FATAL), !(condition)) \
+ << "Check failed: " #condition ". "
+
+// Helper macro for binary operators.
+// Don't use this macro directly in your code, use CHECK_EQ et al below.
+//
+// TODO(akalin): Rewrite this so that constructs like if (...)
+// CHECK_EQ(...) else { ... } work properly.
+#define CHECK_OP(name, op, val1, val2) \
+ if (std::string* _result = cef::logging::Check##name##Impl( \
+ (val1), (val2), #val1 " " #op " " #val2)) \
+ cef::logging::LogMessage(__FILE__, __LINE__, _result).stream()
+
+// Build the error message string. This is separate from the "Impl"
+// function template because it is not performance critical and so can
+// be out of line, while the "Impl" code should be inline. Caller
+// takes ownership of the returned string.
+template <class t1, class t2>
+std::string* MakeCheckOpString(const t1& v1, const t2& v2, const char* names) {
+ std::ostringstream ss;
+ ss << names << " (" << v1 << " vs. " << v2 << ")";
+ std::string* msg = new std::string(ss.str());
+ return msg;
+}
+
+// MSVC doesn't like complex extern templates and DLLs.
+#if !defined(COMPILER_MSVC)
+// Commonly used instantiations of MakeCheckOpString<>. Explicitly instantiated
+// in logging.cc.
+extern template std::string* MakeCheckOpString<int, int>(const int&,
+ const int&,
+ const char* names);
+extern template std::string* MakeCheckOpString<unsigned long, unsigned long>(
+ const unsigned long&,
+ const unsigned long&,
+ const char* names);
+extern template std::string* MakeCheckOpString<unsigned long, unsigned int>(
+ const unsigned long&,
+ const unsigned int&,
+ const char* names);
+extern template std::string* MakeCheckOpString<unsigned int, unsigned long>(
+ const unsigned int&,
+ const unsigned long&,
+ const char* names);
+extern template std::string* MakeCheckOpString<std::string, std::string>(
+ const std::string&,
+ const std::string&,
+ const char* name);
+#endif
+
+// Helper functions for CHECK_OP macro.
+// The (int, int) specialization works around the issue that the compiler
+// will not instantiate the template version of the function on values of
+// unnamed enum type - see comment below.
+#define DEFINE_CHECK_OP_IMPL(name, op) \
+ template <class t1, class t2> \
+ inline std::string* Check##name##Impl(const t1& v1, const t2& v2, \
+ const char* names) { \
+ if (v1 op v2) \
+ return NULL; \
+ else \
+ return MakeCheckOpString(v1, v2, names); \
+ } \
+ inline std::string* Check##name##Impl(int v1, int v2, const char* names) { \
+ if (v1 op v2) \
+ return NULL; \
+ else \
+ return MakeCheckOpString(v1, v2, names); \
+ }
+DEFINE_CHECK_OP_IMPL(EQ, ==)
+DEFINE_CHECK_OP_IMPL(NE, !=)
+DEFINE_CHECK_OP_IMPL(LE, <=)
+DEFINE_CHECK_OP_IMPL(LT, <)
+DEFINE_CHECK_OP_IMPL(GE, >=)
+DEFINE_CHECK_OP_IMPL(GT, >)
+#undef DEFINE_CHECK_OP_IMPL
+
+#define CHECK_EQ(val1, val2) CHECK_OP(EQ, ==, val1, val2)
+#define CHECK_NE(val1, val2) CHECK_OP(NE, !=, val1, val2)
+#define CHECK_LE(val1, val2) CHECK_OP(LE, <=, val1, val2)
+#define CHECK_LT(val1, val2) CHECK_OP(LT, <, val1, val2)
+#define CHECK_GE(val1, val2) CHECK_OP(GE, >=, val1, val2)
+#define CHECK_GT(val1, val2) CHECK_OP(GT, >, val1, val2)
+
+#if defined(NDEBUG)
+#define ENABLE_DLOG 0
+#else
+#define ENABLE_DLOG 1
+#endif
+
+#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
+#define DCHECK_IS_ON() 0
+#else
+#define DCHECK_IS_ON() 1
+#endif
+
+// Definitions for DLOG et al.
+
+#if ENABLE_DLOG
+
+#define DLOG_IS_ON(severity) LOG_IS_ON(severity)
+#define DLOG_IF(severity, condition) LOG_IF(severity, condition)
+#define DLOG_ASSERT(condition) LOG_ASSERT(condition)
+#define DPLOG_IF(severity, condition) PLOG_IF(severity, condition)
+#define DVLOG_IF(verboselevel, condition) VLOG_IF(verboselevel, condition)
+#define DVPLOG_IF(verboselevel, condition) VPLOG_IF(verboselevel, condition)
+
+#else // ENABLE_DLOG
+
+// If ENABLE_DLOG is off, we want to avoid emitting any references to
+// |condition| (which may reference a variable defined only if NDEBUG
+// is not defined). Contrast this with DCHECK et al., which has
+// different behavior.
+
+#define DLOG_IS_ON(severity) false
+#define DLOG_IF(severity, condition) EAT_STREAM_PARAMETERS
+#define DLOG_ASSERT(condition) EAT_STREAM_PARAMETERS
+#define DPLOG_IF(severity, condition) EAT_STREAM_PARAMETERS
+#define DVLOG_IF(verboselevel, condition) EAT_STREAM_PARAMETERS
+#define DVPLOG_IF(verboselevel, condition) EAT_STREAM_PARAMETERS
+
+#endif // ENABLE_DLOG
+
+// DEBUG_MODE is for uses like
+// if (DEBUG_MODE) foo.CheckThatFoo();
+// instead of
+// #ifndef NDEBUG
+// foo.CheckThatFoo();
+// #endif
+//
+// We tie its state to ENABLE_DLOG.
+enum { DEBUG_MODE = ENABLE_DLOG };
+
+#undef ENABLE_DLOG
+
+#define DLOG(severity) LAZY_STREAM(LOG_STREAM(severity), DLOG_IS_ON(severity))
+
+#define DPLOG(severity) LAZY_STREAM(PLOG_STREAM(severity), DLOG_IS_ON(severity))
+
+#define DVLOG(verboselevel) DVLOG_IF(verboselevel, VLOG_IS_ON(verboselevel))
+
+#define DVPLOG(verboselevel) DVPLOG_IF(verboselevel, VLOG_IS_ON(verboselevel))
+
+// Definitions for DCHECK et al.
+
+#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()
+
+// These are just dummy values.
+#define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \
+ COMPACT_GOOGLE_LOG_EX_INFO(ClassName, ##__VA_ARGS__)
+#define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_INFO
+const LogSeverity LOG_DCHECK = LOG_INFO;
+
+#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 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()
+
+// Equality/Inequality checks - compare two values, and log a
+// LOG_DCHECK message including the two values when the result is not
+// as expected. The values must have operator<<(ostream, ...)
+// defined.
+//
+// You may append to the error message like so:
+// DCHECK_NE(1, 2) << ": The world must be ending!";
+//
+// We are very careful to ensure that each argument is evaluated exactly
+// once, and that anything which is legal to pass as a function argument is
+// legal here. In particular, the arguments may be temporary expressions
+// which will end up being destroyed at the end of the apparent statement,
+// for example:
+// DCHECK_EQ(string("abc")[1], 'b');
+//
+// WARNING: These may not compile correctly if one of the arguments is a pointer
+// and the other is NULL. To work around this, simply static_cast NULL to the
+// type of the desired pointer.
+
+#define DCHECK_EQ(val1, val2) DCHECK_OP(EQ, ==, val1, val2)
+#define DCHECK_NE(val1, val2) DCHECK_OP(NE, !=, val1, val2)
+#define DCHECK_LE(val1, val2) DCHECK_OP(LE, <=, val1, val2)
+#define DCHECK_LT(val1, val2) DCHECK_OP(LT, <, val1, val2)
+#define DCHECK_GE(val1, val2) DCHECK_OP(GE, >=, val1, val2)
+#define DCHECK_GT(val1, val2) DCHECK_OP(GT, >, val1, val2)
+
+#if defined(NDEBUG) && defined(OS_CHROMEOS)
+#define NOTREACHED() \
+ LOG(ERROR) << "NOTREACHED() hit in " << __FUNCTION__ << ". "
+#else
+#define NOTREACHED() DCHECK(false)
+#endif
+
+// Redefine the standard assert to use our nice log files
+#undef assert
+#define assert(x) DLOG_ASSERT(x)
+
+// This class more or less represents a particular log message. You
+// create an instance of LogMessage and then stream stuff to it.
+// When you finish streaming to it, ~LogMessage is called and the
+// full message gets streamed to the appropriate destination.
+//
+// You shouldn't actually use LogMessage's constructor to log things,
+// though. You should use the LOG() macro (and variants thereof)
+// above.
+class LogMessage {
+ public:
+ // Used for LOG(severity).
+ LogMessage(const char* file, int line, LogSeverity severity);
+
+ // Used for CHECK_EQ(), etc. Takes ownership of the given string.
+ // Implied severity = LOG_FATAL.
+ LogMessage(const char* file, int line, std::string* result);
+
+ // Used for DCHECK_EQ(), etc. Takes ownership of the given string.
+ LogMessage(const char* file,
+ int line,
+ LogSeverity severity,
+ std::string* result);
+
+ ~LogMessage();
+
+ std::ostream& stream() { return stream_; }
+
+ private:
+ LogSeverity severity_;
+ std::ostringstream stream_;
+
+ // The file and line information passed in to the constructor.
+ const char* file_;
+ const int line_;
+
+#if defined(OS_WIN)
+ // Stores the current value of GetLastError in the constructor and restores
+ // it in the destructor by calling SetLastError.
+ // This is useful since the LogMessage class uses a lot of Win32 calls
+ // that will lose the value of GLE and the code that called the log function
+ // will have lost the thread error value when the log call returns.
+ class SaveLastError {
+ public:
+ SaveLastError();
+ ~SaveLastError();
+
+ unsigned long get_error() const { return last_error_; }
+
+ protected:
+ unsigned long last_error_;
+ };
+
+ SaveLastError last_error_;
+#endif
+
+ DISALLOW_COPY_AND_ASSIGN(LogMessage);
+};
+
+// A non-macro interface to the log facility; (useful
+// when the logging level is not a compile-time constant).
+inline void LogAtLevel(int const log_level, std::string const& msg) {
+ LogMessage(__FILE__, __LINE__, log_level).stream() << msg;
+}
+
+// This class is used to explicitly ignore values in the conditional
+// logging macros. This avoids compiler warnings like "value computed
+// is not used" and "statement has no effect".
+class LogMessageVoidify {
+ public:
+ LogMessageVoidify() {}
+ // This has to be an operator with a precedence lower than << but
+ // higher than ?:
+ void operator&(std::ostream&) {}
+};
+
+#if defined(OS_WIN)
+typedef unsigned long SystemErrorCode;
+#elif defined(OS_POSIX)
+typedef int SystemErrorCode;
+#endif
+
+// Alias for ::GetLastError() on Windows and errno on POSIX. Avoids having to
+// pull in windows.h just for GetLastError() and DWORD.
+SystemErrorCode GetLastSystemErrorCode();
+std::string SystemErrorCodeToString(SystemErrorCode error_code);
+
+#if defined(OS_WIN)
+// Appends a formatted system message of the GetLastError() type.
+class Win32ErrorLogMessage {
+ public:
+ Win32ErrorLogMessage(const char* file,
+ int line,
+ LogSeverity severity,
+ SystemErrorCode err);
+
+ // Appends the error message before destructing the encapsulated class.
+ ~Win32ErrorLogMessage();
+
+ std::ostream& stream() { return log_message_.stream(); }
+
+ private:
+ SystemErrorCode err_;
+ LogMessage log_message_;
+
+ DISALLOW_COPY_AND_ASSIGN(Win32ErrorLogMessage);
+};
+#elif defined(OS_POSIX)
+// Appends a formatted system message of the errno type
+class ErrnoLogMessage {
+ public:
+ ErrnoLogMessage(const char* file,
+ int line,
+ LogSeverity severity,
+ SystemErrorCode err);
+
+ // Appends the error message before destructing the encapsulated class.
+ ~ErrnoLogMessage();
+
+ std::ostream& stream() { return log_message_.stream(); }
+
+ private:
+ SystemErrorCode err_;
+ LogMessage log_message_;
+
+ DISALLOW_COPY_AND_ASSIGN(ErrnoLogMessage);
+};
+#endif // OS_WIN
+
+} // namespace logging
+} // namespace cef
+
+// These functions are provided as a convenience for logging, which is where we
+// use streams (it is against Google style to use streams in other places). It
+// is designed to allow you to emit non-ASCII Unicode strings to the log file,
+// which is normally ASCII. It is relatively slow, so try not to use it for
+// common cases. Non-ASCII characters will be converted to UTF-8 by these
+// operators.
+std::ostream& operator<<(std::ostream& out, const wchar_t* wstr);
+inline std::ostream& operator<<(std::ostream& out, const std::wstring& wstr) {
+ return out << wstr.c_str();
+}
+
+// The NOTIMPLEMENTED() macro annotates codepaths which have
+// not been implemented yet.
+//
+// The implementation of this macro is controlled by NOTIMPLEMENTED_POLICY:
+// 0 -- Do nothing (stripped by compiler)
+// 1 -- Warn at compile time
+// 2 -- Fail at compile time
+// 3 -- Fail at runtime (DCHECK)
+// 4 -- [default] LOG(ERROR) at runtime
+// 5 -- LOG(ERROR) at runtime, only once per call-site
+
+#ifndef NOTIMPLEMENTED_POLICY
+#if defined(OS_ANDROID) && defined(OFFICIAL_BUILD)
+#define NOTIMPLEMENTED_POLICY 0
+#else
+// Select default policy: LOG(ERROR)
+#define NOTIMPLEMENTED_POLICY 4
+#endif
+#endif
+
+#if defined(COMPILER_GCC)
+// On Linux, with GCC, we can use __PRETTY_FUNCTION__ to get the demangled name
+// of the current function in the NOTIMPLEMENTED message.
+#define NOTIMPLEMENTED_MSG "Not implemented reached in " << __PRETTY_FUNCTION__
+#else
+#define NOTIMPLEMENTED_MSG "NOT IMPLEMENTED"
+#endif
+
+#if NOTIMPLEMENTED_POLICY == 0
+#define NOTIMPLEMENTED() EAT_STREAM_PARAMETERS
+#elif NOTIMPLEMENTED_POLICY == 1
+// TODO, figure out how to generate a warning
+#define NOTIMPLEMENTED() COMPILE_ASSERT(false, NOT_IMPLEMENTED)
+#elif NOTIMPLEMENTED_POLICY == 2
+#define NOTIMPLEMENTED() COMPILE_ASSERT(false, NOT_IMPLEMENTED)
+#elif NOTIMPLEMENTED_POLICY == 3
+#define NOTIMPLEMENTED() NOTREACHED()
+#elif NOTIMPLEMENTED_POLICY == 4
+#define NOTIMPLEMENTED() LOG(ERROR) << NOTIMPLEMENTED_MSG
+#elif NOTIMPLEMENTED_POLICY == 5
+#define NOTIMPLEMENTED() \
+ do { \
+ static bool logged_once = false; \
+ LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG; \
+ logged_once = true; \
+ } while (0); \
+ EAT_STREAM_PARAMETERS
+#endif
+
+#endif // !USING_CHROMIUM_INCLUDES
+
+#endif // CEF_INCLUDE_BASE_CEF_LOGGING_H_
diff --git a/src/include/base/cef_macros.h b/src/include/base/cef_macros.h
new file mode 100644
index 0000000..e714529
--- /dev/null
+++ b/src/include/base/cef_macros.h
@@ -0,0 +1,220 @@
+// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012
+// Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef CEF_INCLUDE_BASE_CEF_MACROS_H_
+#define CEF_INCLUDE_BASE_CEF_MACROS_H_
+#pragma once
+
+#if defined(USING_CHROMIUM_INCLUDES)
+// When building CEF include the Chromium header directly.
+#include "base/macros.h"
+
+#else // !USING_CHROMIUM_INCLUDES
+// The following is substantially similar to the Chromium implementation.
+// If the Chromium implementation diverges the below implementation should be
+// updated to match.
+
+#include <stddef.h> // For size_t.
+#include "include/base/cef_build.h" // For COMPILER_MSVC
+
+#if !defined(arraysize)
+
+// The arraysize(arr) macro returns the # of elements in an array arr.
+// The expression is a compile-time constant, and therefore can be
+// used in defining new arrays, for example. If you use arraysize on
+// a pointer by mistake, you will get a compile-time error.
+//
+// One caveat is that arraysize() doesn't accept any array of an
+// anonymous type or a type defined inside a function. In these rare
+// cases, you have to use the unsafe ARRAYSIZE_UNSAFE() macro below. This is
+// due to a limitation in C++'s template system. The limitation might
+// eventually be removed, but it hasn't happened yet.
+
+// This template function declaration is used in defining arraysize.
+// Note that the function doesn't need an implementation, as we only
+// use its type.
+template <typename T, size_t N>
+char (&ArraySizeHelper(T (&array)[N]))[N];
+
+// That gcc wants both of these prototypes seems mysterious. VC, for
+// its part, can't decide which to use (another mystery). Matching of
+// template overloads: the final frontier.
+#ifndef _MSC_VER
+template <typename T, size_t N>
+char (&ArraySizeHelper(const T (&array)[N]))[N];
+#endif
+
+#define arraysize(array) (sizeof(ArraySizeHelper(array)))
+
+#endif // !arraysize
+
+#if !defined(DISALLOW_COPY_AND_ASSIGN)
+
+// A macro to disallow the copy constructor and operator= functions
+// This should be used in the private: declarations for a class
+#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
+ TypeName(const TypeName&); \
+ void operator=(const TypeName&)
+
+#endif // !DISALLOW_COPY_AND_ASSIGN
+
+#if !defined(DISALLOW_IMPLICIT_CONSTRUCTORS)
+
+// A macro to disallow all the implicit constructors, namely the
+// default constructor, copy constructor and operator= functions.
+//
+// This should be used in the private: declarations for a class
+// that wants to prevent anyone from instantiating it. This is
+// especially useful for classes containing only static methods.
+#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
+ TypeName(); \
+ DISALLOW_COPY_AND_ASSIGN(TypeName)
+
+#endif // !DISALLOW_IMPLICIT_CONSTRUCTORS
+
+#if !defined(COMPILE_ASSERT)
+
+// The COMPILE_ASSERT macro can be used to verify that a compile time
+// expression is true. For example, you could use it to verify the
+// size of a static array:
+//
+// COMPILE_ASSERT(ARRAYSIZE_UNSAFE(content_type_names) == CONTENT_NUM_TYPES,
+// content_type_names_incorrect_size);
+//
+// or to make sure a struct is smaller than a certain size:
+//
+// COMPILE_ASSERT(sizeof(foo) < 128, foo_too_large);
+//
+// The second argument to the macro is the name of the variable. If
+// the expression is false, most compilers will issue a warning/error
+// containing the name of the variable.
+
+#if __cplusplus >= 201103L
+
+// Under C++11, just use static_assert.
+#define COMPILE_ASSERT(expr, msg) static_assert(expr, #msg)
+
+#else
+
+namespace cef {
+
+template <bool>
+struct CompileAssert {};
+
+} // namespace cef
+
+#define COMPILE_ASSERT(expr, msg) \
+ typedef cef::CompileAssert<(bool(expr))> \
+ msg[bool(expr) ? 1 : -1] ALLOW_UNUSED_TYPE
+
+// Implementation details of COMPILE_ASSERT:
+//
+// - COMPILE_ASSERT works by defining an array type that has -1
+// elements (and thus is invalid) when the expression is false.
+//
+// - The simpler definition
+//
+// #define COMPILE_ASSERT(expr, msg) typedef char msg[(expr) ? 1 : -1]
+//
+// does not work, as gcc supports variable-length arrays whose sizes
+// are determined at run-time (this is gcc's extension and not part
+// of the C++ standard). As a result, gcc fails to reject the
+// following code with the simple definition:
+//
+// int foo;
+// COMPILE_ASSERT(foo, msg); // not supposed to compile as foo is
+// // not a compile-time constant.
+//
+// - By using the type CompileAssert<(bool(expr))>, we ensures that
+// expr is a compile-time constant. (Template arguments must be
+// determined at compile-time.)
+//
+// - The outer parentheses in CompileAssert<(bool(expr))> are necessary
+// to work around a bug in gcc 3.4.4 and 4.0.1. If we had written
+//
+// CompileAssert<bool(expr)>
+//
+// instead, these compilers will refuse to compile
+//
+// COMPILE_ASSERT(5 > 0, some_message);
+//
+// (They seem to think the ">" in "5 > 0" marks the end of the
+// template argument list.)
+//
+// - The array size is (bool(expr) ? 1 : -1), instead of simply
+//
+// ((expr) ? 1 : -1).
+//
+// This is to avoid running into a bug in MS VC 7.1, which
+// causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1.
+
+#endif // !(__cplusplus >= 201103L)
+
+#endif // !defined(COMPILE_ASSERT)
+
+#endif // !USING_CHROMIUM_INCLUDES
+
+#if !defined(MSVC_PUSH_DISABLE_WARNING) && defined(COMPILER_MSVC)
+
+// MSVC_PUSH_DISABLE_WARNING pushes |n| onto a stack of warnings to be disabled.
+// The warning remains disabled until popped by MSVC_POP_WARNING.
+#define MSVC_PUSH_DISABLE_WARNING(n) \
+ __pragma(warning(push)) __pragma(warning(disable : n))
+
+// MSVC_PUSH_WARNING_LEVEL pushes |n| as the global warning level. The level
+// remains in effect until popped by MSVC_POP_WARNING(). Use 0 to disable all
+// warnings.
+#define MSVC_PUSH_WARNING_LEVEL(n) __pragma(warning(push, n))
+
+// Pop effects of innermost MSVC_PUSH_* macro.
+#define MSVC_POP_WARNING() __pragma(warning(pop))
+
+#endif // !defined(MSVC_PUSH_DISABLE_WARNING) && defined(COMPILER_MSVC)
+
+#if !defined(ALLOW_THIS_IN_INITIALIZER_LIST)
+#if defined(COMPILER_MSVC)
+// Allows |this| to be passed as an argument in constructor initializer lists.
+// This uses push/pop instead of the seemingly simpler suppress feature to avoid
+// having the warning be disabled for more than just |code|.
+//
+// Example usage:
+// Foo::Foo() : x(NULL), ALLOW_THIS_IN_INITIALIZER_LIST(y(this)), z(3) {}
+//
+// Compiler warning C4355: 'this': used in base member initializer list:
+// http://msdn.microsoft.com/en-us/library/3c594ae3(VS.80).aspx
+#define ALLOW_THIS_IN_INITIALIZER_LIST(code) \
+ MSVC_PUSH_DISABLE_WARNING(4355) \
+ code MSVC_POP_WARNING()
+#else // !COMPILER_MSVC
+#define ALLOW_THIS_IN_INITIALIZER_LIST(code) code
+#endif // !COMPILER_MSVC
+#endif // !ALLOW_THIS_IN_INITIALIZER_LIST
+
+#endif // CEF_INCLUDE_BASE_CEF_MACROS_H_
diff --git a/src/include/base/cef_move.h b/src/include/base/cef_move.h
new file mode 100644
index 0000000..da47d2d
--- /dev/null
+++ b/src/include/base/cef_move.h
@@ -0,0 +1,261 @@
+// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012
+// Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef CEF_INCLUDE_BASE_CEF_MOVE_H_
+#define CEF_INCLUDE_BASE_CEF_MOVE_H_
+
+#if defined(MOVE_ONLY_TYPE_FOR_CPP_03)
+// Do nothing if the macro in this header has already been defined.
+// 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.
+#elif defined(USING_CHROMIUM_INCLUDES)
+// When building CEF include the Chromium header directly.
+#include "base/move.h"
+#else // !USING_CHROMIUM_INCLUDES
+// The following is substantially similar to the Chromium implementation.
+// If the Chromium implementation diverges the below implementation should be
+// updated to match.
+
+// Macro with the boilerplate that makes a type move-only in C++03.
+//
+// USAGE
+//
+// This macro should be used instead of DISALLOW_COPY_AND_ASSIGN to create
+// a "move-only" type. Unlike DISALLOW_COPY_AND_ASSIGN, this macro should be
+// the first line in a class declaration.
+//
+// A class using this macro must call .Pass() (or somehow be an r-value already)
+// before it can be:
+//
+// * Passed as a function argument
+// * Used as the right-hand side of an assignment
+// * Returned from a function
+//
+// Each class will still need to define their own "move constructor" and "move
+// operator=" to make this useful. Here's an example of the macro, the move
+// constructor, and the move operator= from the scoped_ptr class:
+//
+// template <typename T>
+// class scoped_ptr {
+// MOVE_ONLY_TYPE_FOR_CPP_03(scoped_ptr, RValue)
+// public:
+// scoped_ptr(RValue& other) : ptr_(other.release()) { }
+// scoped_ptr& operator=(RValue& other) {
+// swap(other);
+// return *this;
+// }
+// };
+//
+// Note that the constructor must NOT be marked explicit.
+//
+// For consistency, the second parameter to the macro should always be RValue
+// unless you have a strong reason to do otherwise. It is only exposed as a
+// macro parameter so that the move constructor and move operator= don't look
+// like they're using a phantom type.
+//
+//
+// HOW THIS WORKS
+//
+// For a thorough explanation of this technique, see:
+//
+// http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Move_Constructor
+//
+// The summary is that we take advantage of 2 properties:
+//
+// 1) non-const references will not bind to r-values.
+// 2) C++ can apply one user-defined conversion when initializing a
+// variable.
+//
+// The first lets us disable the copy constructor and assignment operator
+// by declaring private version of them with a non-const reference parameter.
+//
+// For l-values, direct initialization still fails like in
+// DISALLOW_COPY_AND_ASSIGN because the copy constructor and assignment
+// operators are private.
+//
+// For r-values, the situation is different. The copy constructor and
+// assignment operator are not viable due to (1), so we are trying to call
+// a non-existent constructor and non-existing operator= rather than a private
+// one. Since we have not committed an error quite yet, we can provide an
+// alternate conversion sequence and a constructor. We add
+//
+// * a private struct named "RValue"
+// * a user-defined conversion "operator RValue()"
+// * a "move constructor" and "move operator=" that take the RValue& as
+// their sole parameter.
+//
+// Only r-values will trigger this sequence and execute our "move constructor"
+// or "move operator=." L-values will match the private copy constructor and
+// operator= first giving a "private in this context" error. This combination
+// gives us a move-only type.
+//
+// For signaling a destructive transfer of data from an l-value, we provide a
+// method named Pass() which creates an r-value for the current instance
+// triggering the move constructor or move operator=.
+//
+// Other ways to get r-values is to use the result of an expression like a
+// function call.
+//
+// Here's an example with comments explaining what gets triggered where:
+//
+// class Foo {
+// MOVE_ONLY_TYPE_FOR_CPP_03(Foo, RValue);
+//
+// public:
+// ... API ...
+// Foo(RValue other); // Move constructor.
+// Foo& operator=(RValue rhs); // Move operator=
+// };
+//
+// Foo MakeFoo(); // Function that returns a Foo.
+//
+// Foo f;
+// Foo f_copy(f); // ERROR: Foo(Foo&) is private in this context.
+// Foo f_assign;
+// f_assign = f; // ERROR: operator=(Foo&) is private in this context.
+//
+//
+// Foo f(MakeFoo()); // R-value so alternate conversion executed.
+// Foo f_copy(f.Pass()); // R-value so alternate conversion executed.
+// f = f_copy.Pass(); // R-value so alternate conversion executed.
+//
+//
+// IMPLEMENTATION SUBTLETIES WITH RValue
+//
+// The RValue struct is just a container for a pointer back to the original
+// object. It should only ever be created as a temporary, and no external
+// class should ever declare it or use it in a parameter.
+//
+// It is tempting to want to use the RValue type in function parameters, but
+// excluding the limited usage here for the move constructor and move
+// operator=, doing so would mean that the function could take both r-values
+// and l-values equially which is unexpected. See COMPARED To Boost.Move for
+// more details.
+//
+// An alternate, and incorrect, implementation of the RValue class used by
+// Boost.Move makes RValue a fieldless child of the move-only type. RValue&
+// is then used in place of RValue in the various operators. The RValue& is
+// "created" by doing *reinterpret_cast<RValue*>(this). This has the appeal
+// of never creating a temporary RValue struct even with optimizations
+// disabled. Also, by virtue of inheritance you can treat the RValue
+// reference as if it were the move-only type itself. Unfortunately,
+// using the result of this reinterpret_cast<> is actually undefined behavior
+// due to C++98 5.2.10.7. In certain compilers (e.g., NaCl) the optimizer
+// will generate non-working code.
+//
+// In optimized builds, both implementations generate the same assembly so we
+// choose the one that adheres to the standard.
+//
+//
+// WHY HAVE typedef void MoveOnlyTypeForCPP03
+//
+// Callback<>/Bind() needs to understand movable-but-not-copyable semantics
+// to call .Pass() appropriately when it is expected to transfer the value.
+// The cryptic typedef MoveOnlyTypeForCPP03 is added to make this check
+// easy and automatic in helper templates for Callback<>/Bind().
+// See IsMoveOnlyType template and its usage in base/callback_internal.h
+// for more details.
+//
+//
+// COMPARED TO C++11
+//
+// In C++11, you would implement this functionality using an r-value reference
+// and our .Pass() method would be replaced with a call to std::move().
+//
+// This emulation also has a deficiency where it uses up the single
+// user-defined conversion allowed by C++ during initialization. This can
+// cause problems in some API edge cases. For instance, in scoped_ptr, it is
+// impossible to make a function "void Foo(scoped_ptr<Parent> p)" accept a
+// value of type scoped_ptr<Child> even if you add a constructor to
+// scoped_ptr<> that would make it look like it should work. C++11 does not
+// have this deficiency.
+//
+//
+// COMPARED TO Boost.Move
+//
+// Our implementation similar to Boost.Move, but we keep the RValue struct
+// private to the move-only type, and we don't use the reinterpret_cast<> hack.
+//
+// In Boost.Move, RValue is the boost::rv<> template. This type can be used
+// when writing APIs like:
+//
+// void MyFunc(boost::rv<Foo>& f)
+//
+// that can take advantage of rv<> to avoid extra copies of a type. However you
+// would still be able to call this version of MyFunc with an l-value:
+//
+// Foo f;
+// MyFunc(f); // Uh oh, we probably just destroyed |f| w/o calling Pass().
+//
+// unless someone is very careful to also declare a parallel override like:
+//
+// void MyFunc(const Foo& f)
+//
+// that would catch the l-values first. This was declared unsafe in C++11 and
+// a C++11 compiler will explicitly fail MyFunc(f). Unfortunately, we cannot
+// ensure this in C++03.
+//
+// Since we have no need for writing such APIs yet, our implementation keeps
+// RValue private and uses a .Pass() method to do the conversion instead of
+// trying to write a version of "std::move()." Writing an API like std::move()
+// would require the RValue struct to be public.
+//
+//
+// CAVEATS
+//
+// If you include a move-only type as a field inside a class that does not
+// explicitly declare a copy constructor, the containing class's implicit
+// copy constructor will change from Containing(const Containing&) to
+// Containing(Containing&). This can cause some unexpected errors.
+//
+// http://llvm.org/bugs/show_bug.cgi?id=11528
+//
+// The workaround is to explicitly declare your copy constructor.
+//
+#define MOVE_ONLY_TYPE_FOR_CPP_03(type, rvalue_type) \
+ private: \
+ struct rvalue_type { \
+ explicit rvalue_type(type* object) : object(object) {} \
+ type* object; \
+ }; \
+ type(type&); \
+ void operator=(type&); \
+ \
+ public: \
+ operator rvalue_type() { return rvalue_type(this); } \
+ type Pass() { return type(rvalue_type(this)); } \
+ typedef void MoveOnlyTypeForCPP03; \
+ \
+ private:
+
+#endif // !USING_CHROMIUM_INCLUDES
+
+#endif // CEF_INCLUDE_BASE_CEF_MOVE_H_
diff --git a/src/include/base/cef_platform_thread.h b/src/include/base/cef_platform_thread.h
new file mode 100644
index 0000000..d3fdd79
--- /dev/null
+++ b/src/include/base/cef_platform_thread.h
@@ -0,0 +1,106 @@
+// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
+// Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// WARNING: You should *NOT* be using this class directly. PlatformThread is
+// the low-level platform-specific abstraction to the OS's threading interface.
+// You should instead be using a message-loop driven Thread, see thread.h.
+
+#ifndef CEF_INCLUDE_BASE_PLATFORM_THREAD_H_
+#define CEF_INCLUDE_BASE_PLATFORM_THREAD_H_
+
+#if defined(BASE_THREADING_PLATFORM_THREAD_H_)
+// Do nothing if the Chromium header has already been included.
+// 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.
+#elif defined(USING_CHROMIUM_INCLUDES)
+// When building CEF include the Chromium header directly.
+#include "base/threading/platform_thread.h"
+#else // !USING_CHROMIUM_INCLUDES
+// The following is substantially similar to the Chromium implementation.
+// If the Chromium implementation diverges the below implementation should be
+// updated to match.
+
+#include "include/base/cef_basictypes.h"
+#include "include/base/cef_build.h"
+#include "include/internal/cef_thread_internal.h"
+
+namespace base {
+
+// Used for logging. Always an integer value.
+typedef cef_platform_thread_id_t PlatformThreadId;
+
+// Used for thread checking and debugging.
+// Meant to be as fast as possible.
+// These are produced by PlatformThread::CurrentRef(), and used to later
+// check if we are on the same thread or not by using ==. These are safe
+// to copy between threads, but can't be copied to another process as they
+// have no meaning there. Also, the internal identifier can be re-used
+// after a thread dies, so a PlatformThreadRef cannot be reliably used
+// to distinguish a new thread from an old, dead thread.
+class PlatformThreadRef {
+ public:
+ typedef cef_platform_thread_handle_t RefType;
+
+ PlatformThreadRef() : id_(0) {}
+
+ explicit PlatformThreadRef(RefType id) : id_(id) {}
+
+ bool operator==(PlatformThreadRef other) const { return id_ == other.id_; }
+
+ bool is_null() const { return id_ == 0; }
+
+ private:
+ RefType id_;
+};
+
+// A namespace for low-level thread functions.
+// Chromium uses a class with static methods but CEF uses an actual namespace
+// to avoid linker problems with the sandbox libaries on Windows.
+namespace PlatformThread {
+
+// Gets the current thread id, which may be useful for logging purposes.
+inline PlatformThreadId CurrentId() {
+ return cef_get_current_platform_thread_id();
+}
+
+// Gets the current thread reference, which can be used to check if
+// we're on the right thread quickly.
+inline PlatformThreadRef CurrentRef() {
+ return PlatformThreadRef(cef_get_current_platform_thread_handle());
+}
+
+} // namespace PlatformThread
+
+} // namespace base
+
+#endif // !USING_CHROMIUM_INCLUDES
+
+#endif // CEF_INCLUDE_BASE_PLATFORM_THREAD_H_
diff --git a/src/include/base/cef_ref_counted.h b/src/include/base/cef_ref_counted.h
new file mode 100644
index 0000000..7a68707
--- /dev/null
+++ b/src/include/base/cef_ref_counted.h
@@ -0,0 +1,370 @@
+// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012
+// Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+
+#ifndef CEF_INCLUDE_BASE_CEF_REF_COUNTED_H_
+#define CEF_INCLUDE_BASE_CEF_REF_COUNTED_H_
+#pragma once
+
+#if defined(BASE_MEMORY_REF_COUNTED_H_)
+// Do nothing if the Chromium header has already been included.
+// 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.
+#elif defined(USING_CHROMIUM_INCLUDES)
+// When building CEF include the Chromium header directly.
+#include "base/memory/ref_counted.h"
+#else // !USING_CHROMIUM_INCLUDES
+// The following is substantially similar to the Chromium implementation.
+// If the Chromium implementation diverges the below implementation should be
+// updated to match.
+
+#include <cassert>
+
+#include "include/base/cef_atomic_ref_count.h"
+#include "include/base/cef_build.h"
+#include "include/base/cef_logging.h"
+#include "include/base/cef_macros.h"
+
+namespace base {
+
+namespace cef_subtle {
+
+class RefCountedBase {
+ public:
+ bool HasOneRef() const { return ref_count_ == 1; }
+ bool HasAtLeastOneRef() const { return ref_count_ >= 1; }
+
+ protected:
+ RefCountedBase()
+ : ref_count_(0)
+#if DCHECK_IS_ON()
+ ,
+ in_dtor_(false)
+#endif
+ {
+ }
+
+ ~RefCountedBase() {
+#if DCHECK_IS_ON()
+ DCHECK(in_dtor_) << "RefCounted object deleted without calling Release()";
+#endif
+ }
+
+ void AddRef() const {
+#if DCHECK_IS_ON()
+ DCHECK(!in_dtor_);
+#endif
+ ++ref_count_;
+ }
+
+ // Returns true if the object should self-delete.
+ bool Release() const {
+#if DCHECK_IS_ON()
+ DCHECK(!in_dtor_);
+#endif
+ if (--ref_count_ == 0) {
+#if DCHECK_IS_ON()
+ in_dtor_ = true;
+#endif
+ return true;
+ }
+ return false;
+ }
+
+ private:
+ mutable int ref_count_;
+#if DCHECK_IS_ON()
+ mutable bool in_dtor_;
+#endif
+
+ DISALLOW_COPY_AND_ASSIGN(RefCountedBase);
+};
+
+class RefCountedThreadSafeBase {
+ public:
+ bool HasOneRef() const;
+ bool HasAtLeastOneRef() const;
+
+ protected:
+ RefCountedThreadSafeBase();
+ ~RefCountedThreadSafeBase();
+
+ void AddRef() const;
+
+ // Returns true if the object should self-delete.
+ bool Release() const;
+
+ private:
+ mutable AtomicRefCount ref_count_;
+#if DCHECK_IS_ON()
+ mutable bool in_dtor_;
+#endif
+
+ DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafeBase);
+};
+
+} // namespace cef_subtle
+
+//
+// A base class for reference counted classes. Otherwise, known as a cheap
+// knock-off of WebKit's RefCounted<T> class. To use this guy just extend your
+// class from it like so:
+//
+// class MyFoo : public base::RefCounted<MyFoo> {
+// ...
+// private:
+// friend class base::RefCounted<MyFoo>;
+// ~MyFoo();
+// };
+//
+// You should always make your destructor private, to avoid any code deleting
+// the object accidently while there are references to it.
+template <class T>
+class RefCounted : public cef_subtle::RefCountedBase {
+ public:
+ RefCounted() {}
+
+ void AddRef() const { cef_subtle::RefCountedBase::AddRef(); }
+
+ void Release() const {
+ if (cef_subtle::RefCountedBase::Release()) {
+ delete static_cast<const T*>(this);
+ }
+ }
+
+ protected:
+ ~RefCounted() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(RefCounted<T>);
+};
+
+// Forward declaration.
+template <class T, typename Traits>
+class RefCountedThreadSafe;
+
+// Default traits for RefCountedThreadSafe<T>. Deletes the object when its ref
+// count reaches 0. Overload to delete it on a different thread etc.
+template <typename T>
+struct DefaultRefCountedThreadSafeTraits {
+ static void Destruct(const T* x) {
+ // Delete through RefCountedThreadSafe to make child classes only need to be
+ // friend with RefCountedThreadSafe instead of this struct, which is an
+ // implementation detail.
+ RefCountedThreadSafe<T, DefaultRefCountedThreadSafeTraits>::DeleteInternal(
+ x);
+ }
+};
+
+//
+// A thread-safe variant of RefCounted<T>
+//
+// class MyFoo : public base::RefCountedThreadSafe<MyFoo> {
+// ...
+// };
+//
+// If you're using the default trait, then you should add compile time
+// asserts that no one else is deleting your object. i.e.
+// private:
+// friend class base::RefCountedThreadSafe<MyFoo>;
+// ~MyFoo();
+template <class T, typename Traits = DefaultRefCountedThreadSafeTraits<T>>
+class RefCountedThreadSafe : public cef_subtle::RefCountedThreadSafeBase {
+ public:
+ RefCountedThreadSafe() {}
+
+ void AddRef() const { cef_subtle::RefCountedThreadSafeBase::AddRef(); }
+
+ void Release() const {
+ if (cef_subtle::RefCountedThreadSafeBase::Release()) {
+ Traits::Destruct(static_cast<const T*>(this));
+ }
+ }
+
+ protected:
+ ~RefCountedThreadSafe() {}
+
+ private:
+ friend struct DefaultRefCountedThreadSafeTraits<T>;
+ static void DeleteInternal(const T* x) { delete x; }
+
+ DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafe);
+};
+
+//
+// A thread-safe wrapper for some piece of data so we can place other
+// things in scoped_refptrs<>.
+//
+template <typename T>
+class RefCountedData
+ : public base::RefCountedThreadSafe<base::RefCountedData<T>> {
+ public:
+ RefCountedData() : data() {}
+ RefCountedData(const T& in_value) : data(in_value) {}
+
+ T data;
+
+ private:
+ friend class base::RefCountedThreadSafe<base::RefCountedData<T>>;
+ ~RefCountedData() {}
+};
+
+} // namespace base
+
+//
+// A smart pointer class for reference counted objects. Use this class instead
+// of calling AddRef and Release manually on a reference counted object to
+// avoid common memory leaks caused by forgetting to Release an object
+// reference. Sample usage:
+//
+// class MyFoo : public RefCounted<MyFoo> {
+// ...
+// };
+//
+// void some_function() {
+// scoped_refptr<MyFoo> foo = new MyFoo();
+// foo->Method(param);
+// // |foo| is released when this function returns
+// }
+//
+// void some_other_function() {
+// scoped_refptr<MyFoo> foo = new MyFoo();
+// ...
+// foo = NULL; // explicitly releases |foo|
+// ...
+// if (foo)
+// foo->Method(param);
+// }
+//
+// The above examples show how scoped_refptr<T> acts like a pointer to T.
+// Given two scoped_refptr<T> classes, it is also possible to exchange
+// references between the two objects, like so:
+//
+// {
+// scoped_refptr<MyFoo> a = new MyFoo();
+// scoped_refptr<MyFoo> b;
+//
+// b.swap(a);
+// // now, |b| references the MyFoo object, and |a| references NULL.
+// }
+//
+// To make both |a| and |b| in the above example reference the same MyFoo
+// object, simply use the assignment operator:
+//
+// {
+// scoped_refptr<MyFoo> a = new MyFoo();
+// scoped_refptr<MyFoo> b;
+//
+// b = a;
+// // now, |a| and |b| each own a reference to the same MyFoo object.
+// }
+//
+template <class T>
+class scoped_refptr {
+ public:
+ typedef T element_type;
+
+ scoped_refptr() : ptr_(NULL) {}
+
+ scoped_refptr(T* p) : ptr_(p) {
+ if (ptr_)
+ ptr_->AddRef();
+ }
+
+ scoped_refptr(const scoped_refptr<T>& r) : ptr_(r.ptr_) {
+ if (ptr_)
+ ptr_->AddRef();
+ }
+
+ template <typename U>
+ scoped_refptr(const scoped_refptr<U>& r) : ptr_(r.get()) {
+ if (ptr_)
+ ptr_->AddRef();
+ }
+
+ ~scoped_refptr() {
+ if (ptr_)
+ ptr_->Release();
+ }
+
+ T* get() const { return ptr_; }
+
+ // Allow scoped_refptr<C> to be used in boolean expression
+ // and comparison operations.
+ operator T*() const { return ptr_; }
+
+ T* operator->() const {
+ assert(ptr_ != NULL);
+ return ptr_;
+ }
+
+ scoped_refptr<T>& operator=(T* p) {
+ // AddRef first so that self assignment should work
+ if (p)
+ p->AddRef();
+ T* old_ptr = ptr_;
+ ptr_ = p;
+ if (old_ptr)
+ old_ptr->Release();
+ return *this;
+ }
+
+ scoped_refptr<T>& operator=(const scoped_refptr<T>& r) {
+ return *this = r.ptr_;
+ }
+
+ template <typename U>
+ scoped_refptr<T>& operator=(const scoped_refptr<U>& r) {
+ return *this = r.get();
+ }
+
+ void swap(T** pp) {
+ T* p = ptr_;
+ ptr_ = *pp;
+ *pp = p;
+ }
+
+ void swap(scoped_refptr<T>& r) { swap(&r.ptr_); }
+
+ protected:
+ T* ptr_;
+};
+
+// Handy utility for creating a scoped_refptr<T> out of a T* explicitly without
+// having to retype all the template arguments
+template <typename T>
+scoped_refptr<T> make_scoped_refptr(T* t) {
+ return scoped_refptr<T>(t);
+}
+
+#endif // !USING_CHROMIUM_INCLUDES
+
+#endif // CEF_INCLUDE_BASE_CEF_REF_COUNTED_H_
diff --git a/src/include/base/cef_scoped_ptr.h b/src/include/base/cef_scoped_ptr.h
new file mode 100644
index 0000000..eb9e0e2
--- /dev/null
+++ b/src/include/base/cef_scoped_ptr.h
@@ -0,0 +1,625 @@
+// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012
+// Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Scopers help you manage ownership of a pointer, helping you easily manage a
+// pointer within a scope, and automatically destroying the pointer at the end
+// of a scope. There are two main classes you will use, which correspond to the
+// operators new/delete and new[]/delete[].
+//
+// Example usage (scoped_ptr<T>):
+// {
+// scoped_ptr<Foo> foo(new Foo("wee"));
+// } // foo goes out of scope, releasing the pointer with it.
+//
+// {
+// scoped_ptr<Foo> foo; // No pointer managed.
+// foo.reset(new Foo("wee")); // Now a pointer is managed.
+// foo.reset(new Foo("wee2")); // Foo("wee") was destroyed.
+// foo.reset(new Foo("wee3")); // Foo("wee2") was destroyed.
+// foo->Method(); // Foo::Method() called.
+// foo.get()->Method(); // Foo::Method() called.
+// SomeFunc(foo.release()); // SomeFunc takes ownership, foo no longer
+// // manages a pointer.
+// foo.reset(new Foo("wee4")); // foo manages a pointer again.
+// foo.reset(); // Foo("wee4") destroyed, foo no longer
+// // manages a pointer.
+// } // foo wasn't managing a pointer, so nothing was destroyed.
+//
+// Example usage (scoped_ptr<T[]>):
+// {
+// scoped_ptr<Foo[]> foo(new Foo[100]);
+// foo.get()->Method(); // Foo::Method on the 0th element.
+// foo[10].Method(); // Foo::Method on the 10th element.
+// }
+//
+// These scopers also implement part of the functionality of C++11 unique_ptr
+// in that they are "movable but not copyable." You can use the scopers in
+// the parameter and return types of functions to signify ownership transfer
+// in to and out of a function. When calling a function that has a scoper
+// as the argument type, it must be called with the result of an analogous
+// scoper's Pass() function or another function that generates a temporary;
+// passing by copy will NOT work. Here is an example using scoped_ptr:
+//
+// void TakesOwnership(scoped_ptr<Foo> arg) {
+// // Do something with arg
+// }
+// scoped_ptr<Foo> CreateFoo() {
+// // No need for calling Pass() because we are constructing a temporary
+// // for the return value.
+// return scoped_ptr<Foo>(new Foo("new"));
+// }
+// scoped_ptr<Foo> PassThru(scoped_ptr<Foo> arg) {
+// return arg.Pass();
+// }
+//
+// {
+// scoped_ptr<Foo> ptr(new Foo("yay")); // ptr manages Foo("yay").
+// TakesOwnership(ptr.Pass()); // ptr no longer owns Foo("yay").
+// scoped_ptr<Foo> ptr2 = CreateFoo(); // ptr2 owns the return Foo.
+// scoped_ptr<Foo> ptr3 = // ptr3 now owns what was in ptr2.
+// PassThru(ptr2.Pass()); // ptr2 is correspondingly NULL.
+// }
+//
+// Notice that if you do not call Pass() when returning from PassThru(), or
+// when invoking TakesOwnership(), the code will not compile because scopers
+// are not copyable; they only implement move semantics which require calling
+// the Pass() function to signify a destructive transfer of state. CreateFoo()
+// is different though because we are constructing a temporary on the return
+// line and thus can avoid needing to call Pass().
+//
+// Pass() properly handles upcast in initialization, i.e. you can use a
+// scoped_ptr<Child> to initialize a scoped_ptr<Parent>:
+//
+// scoped_ptr<Foo> foo(new Foo());
+// scoped_ptr<FooParent> parent(foo.Pass());
+//
+// PassAs<>() should be used to upcast return value in return statement:
+//
+// scoped_ptr<Foo> CreateFoo() {
+// scoped_ptr<FooChild> result(new FooChild());
+// return result.PassAs<Foo>();
+// }
+//
+// Note that PassAs<>() is implemented only for scoped_ptr<T>, but not for
+// scoped_ptr<T[]>. This is because casting array pointers may not be safe.
+
+#ifndef CEF_INCLUDE_BASE_CEF_MEMORY_SCOPED_PTR_H_
+#define CEF_INCLUDE_BASE_CEF_MEMORY_SCOPED_PTR_H_
+#pragma once
+
+#if defined(BASE_MEMORY_SCOPED_PTR_H_)
+// Do nothing if the Chromium header has already been included.
+// 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.
+#elif defined(USING_CHROMIUM_INCLUDES)
+// Do nothing when building CEF.
+#else // !USING_CHROMIUM_INCLUDES
+// The following is substantially similar to the Chromium implementation.
+// If the Chromium implementation diverges the below implementation should be
+// updated to match.
+
+// This is an implementation designed to match the anticipated future TR2
+// implementation of the scoped_ptr class.
+
+#include <assert.h>
+#include <stddef.h>
+#include <stdlib.h>
+
+#include <algorithm> // For std::swap().
+
+#include "include/base/cef_basictypes.h"
+#include "include/base/cef_build.h"
+#include "include/base/cef_macros.h"
+#include "include/base/cef_move.h"
+#include "include/base/cef_template_util.h"
+
+namespace base {
+
+namespace subtle {
+class RefCountedBase;
+class RefCountedThreadSafeBase;
+} // namespace subtle
+
+// Function object which deletes its parameter, which must be a pointer.
+// If C is an array type, invokes 'delete[]' on the parameter; otherwise,
+// invokes 'delete'. The default deleter for scoped_ptr<T>.
+template <class T>
+struct DefaultDeleter {
+ DefaultDeleter() {}
+ template <typename U>
+ DefaultDeleter(const DefaultDeleter<U>& other) {
+ // IMPLEMENTATION NOTE: C++11 20.7.1.1.2p2 only provides this constructor
+ // if U* is implicitly convertible to T* and U is not an array type.
+ //
+ // Correct implementation should use SFINAE to disable this
+ // constructor. However, since there are no other 1-argument constructors,
+ // using a COMPILE_ASSERT() based on is_convertible<> and requiring
+ // complete types is simpler and will cause compile failures for equivalent
+ // misuses.
+ //
+ // Note, the is_convertible<U*, T*> check also ensures that U is not an
+ // array. T is guaranteed to be a non-array, so any U* where U is an array
+ // cannot convert to T*.
+ enum { T_must_be_complete = sizeof(T) };
+ enum { U_must_be_complete = sizeof(U) };
+ COMPILE_ASSERT((base::is_convertible<U*, T*>::value),
+ U_ptr_must_implicitly_convert_to_T_ptr);
+ }
+ inline void operator()(T* ptr) const {
+ enum { type_must_be_complete = sizeof(T) };
+ delete ptr;
+ }
+};
+
+// Specialization of DefaultDeleter for array types.
+template <class T>
+struct DefaultDeleter<T[]> {
+ inline void operator()(T* ptr) const {
+ enum { type_must_be_complete = sizeof(T) };
+ delete[] ptr;
+ }
+
+ private:
+ // Disable this operator for any U != T because it is undefined to execute
+ // an array delete when the static type of the array mismatches the dynamic
+ // type.
+ //
+ // References:
+ // C++98 [expr.delete]p3
+ // http://cplusplus.github.com/LWG/lwg-defects.html#938
+ template <typename U>
+ void operator()(U* array) const;
+};
+
+template <class T, int n>
+struct DefaultDeleter<T[n]> {
+ // Never allow someone to declare something like scoped_ptr<int[10]>.
+ COMPILE_ASSERT(sizeof(T) == -1, do_not_use_array_with_size_as_type);
+};
+
+// Function object which invokes 'free' on its parameter, which must be
+// a pointer. Can be used to store malloc-allocated pointers in scoped_ptr:
+//
+// scoped_ptr<int, base::FreeDeleter> foo_ptr(
+// static_cast<int*>(malloc(sizeof(int))));
+struct FreeDeleter {
+ inline void operator()(void* ptr) const { free(ptr); }
+};
+
+namespace cef_internal {
+
+template <typename T>
+struct IsNotRefCounted {
+ enum {
+ value =
+ !base::is_convertible<T*, base::subtle::RefCountedBase*>::value &&
+ !base::is_convertible<T*,
+ base::subtle::RefCountedThreadSafeBase*>::value
+ };
+};
+
+// Minimal implementation of the core logic of scoped_ptr, suitable for
+// reuse in both scoped_ptr and its specializations.
+template <class T, class D>
+class scoped_ptr_impl {
+ public:
+ explicit scoped_ptr_impl(T* p) : data_(p) {}
+
+ // Initializer for deleters that have data parameters.
+ scoped_ptr_impl(T* p, const D& d) : data_(p, d) {}
+
+ // Templated constructor that destructively takes the value from another
+ // scoped_ptr_impl.
+ template <typename U, typename V>
+ scoped_ptr_impl(scoped_ptr_impl<U, V>* other)
+ : data_(other->release(), other->get_deleter()) {
+ // We do not support move-only deleters. We could modify our move
+ // emulation to have base::subtle::move() and base::subtle::forward()
+ // functions that are imperfect emulations of their C++11 equivalents,
+ // but until there's a requirement, just assume deleters are copyable.
+ }
+
+ template <typename U, typename V>
+ void TakeState(scoped_ptr_impl<U, V>* other) {
+ // See comment in templated constructor above regarding lack of support
+ // for move-only deleters.
+ reset(other->release());
+ get_deleter() = other->get_deleter();
+ }
+
+ ~scoped_ptr_impl() {
+ if (data_.ptr != NULL) {
+ // Not using get_deleter() saves one function call in non-optimized
+ // builds.
+ static_cast<D&>(data_)(data_.ptr);
+ }
+ }
+
+ void reset(T* p) {
+ // This is a self-reset, which is no longer allowed: http://crbug.com/162971
+ if (p != NULL && p == data_.ptr)
+ abort();
+
+ // Note that running data_.ptr = p can lead to undefined behavior if
+ // get_deleter()(get()) deletes this. In order to prevent this, reset()
+ // should update the stored pointer before deleting its old value.
+ //
+ // However, changing reset() to use that behavior may cause current code to
+ // break in unexpected ways. If the destruction of the owned object
+ // dereferences the scoped_ptr when it is destroyed by a call to reset(),
+ // then it will incorrectly dispatch calls to |p| rather than the original
+ // value of |data_.ptr|.
+ //
+ // During the transition period, set the stored pointer to NULL while
+ // deleting the object. Eventually, this safety check will be removed to
+ // prevent the scenario initially described from occuring and
+ // http://crbug.com/176091 can be closed.
+ T* old = data_.ptr;
+ data_.ptr = NULL;
+ if (old != NULL)
+ static_cast<D&>(data_)(old);
+ data_.ptr = p;
+ }
+
+ T* get() const { return data_.ptr; }
+
+ D& get_deleter() { return data_; }
+ const D& get_deleter() const { return data_; }
+
+ void swap(scoped_ptr_impl& p2) {
+ // Standard swap idiom: 'using std::swap' ensures that std::swap is
+ // present in the overload set, but we call swap unqualified so that
+ // any more-specific overloads can be used, if available.
+ using std::swap;
+ swap(static_cast<D&>(data_), static_cast<D&>(p2.data_));
+ swap(data_.ptr, p2.data_.ptr);
+ }
+
+ T* release() {
+ T* old_ptr = data_.ptr;
+ data_.ptr = NULL;
+ return old_ptr;
+ }
+
+ private:
+ // Needed to allow type-converting constructor.
+ template <typename U, typename V>
+ friend class scoped_ptr_impl;
+
+ // Use the empty base class optimization to allow us to have a D
+ // member, while avoiding any space overhead for it when D is an
+ // empty class. See e.g. http://www.cantrip.org/emptyopt.html for a good
+ // discussion of this technique.
+ struct Data : public D {
+ explicit Data(T* ptr_in) : ptr(ptr_in) {}
+ Data(T* ptr_in, const D& other) : D(other), ptr(ptr_in) {}
+ T* ptr;
+ };
+
+ Data data_;
+
+ DISALLOW_COPY_AND_ASSIGN(scoped_ptr_impl);
+};
+
+} // namespace cef_internal
+
+} // namespace base
+
+// A scoped_ptr<T> is like a T*, except that the destructor of scoped_ptr<T>
+// automatically deletes the pointer it holds (if any).
+// That is, scoped_ptr<T> owns the T object that it points to.
+// Like a T*, a scoped_ptr<T> may hold either NULL or a pointer to a T object.
+// Also like T*, scoped_ptr<T> is thread-compatible, and once you
+// dereference it, you get the thread safety guarantees of T.
+//
+// The size of scoped_ptr is small. On most compilers, when using the
+// DefaultDeleter, sizeof(scoped_ptr<T>) == sizeof(T*). Custom deleters will
+// increase the size proportional to whatever state they need to have. See
+// comments inside scoped_ptr_impl<> for details.
+//
+// Current implementation targets having a strict subset of C++11's
+// unique_ptr<> features. Known deficiencies include not supporting move-only
+// deleteres, function pointers as deleters, and deleters with reference
+// types.
+template <class T, class D = base::DefaultDeleter<T>>
+class scoped_ptr {
+ MOVE_ONLY_TYPE_FOR_CPP_03(scoped_ptr, RValue)
+
+ COMPILE_ASSERT(base::cef_internal::IsNotRefCounted<T>::value,
+ T_is_refcounted_type_and_needs_scoped_refptr);
+
+ public:
+ // The element and deleter types.
+ typedef T element_type;
+ typedef D deleter_type;
+
+ // Constructor. Defaults to initializing with NULL.
+ scoped_ptr() : impl_(NULL) {}
+
+ // Constructor. Takes ownership of p.
+ explicit scoped_ptr(element_type* p) : impl_(p) {}
+
+ // Constructor. Allows initialization of a stateful deleter.
+ scoped_ptr(element_type* p, const D& d) : impl_(p, d) {}
+
+ // Constructor. Allows construction from a scoped_ptr rvalue for a
+ // convertible type and deleter.
+ //
+ // IMPLEMENTATION NOTE: C++11 unique_ptr<> keeps this constructor distinct
+ // from the normal move constructor. By C++11 20.7.1.2.1.21, this constructor
+ // has different post-conditions if D is a reference type. Since this
+ // implementation does not support deleters with reference type,
+ // we do not need a separate move constructor allowing us to avoid one
+ // use of SFINAE. You only need to care about this if you modify the
+ // implementation of scoped_ptr.
+ template <typename U, typename V>
+ scoped_ptr(scoped_ptr<U, V> other) : impl_(&other.impl_) {
+ COMPILE_ASSERT(!base::is_array<U>::value, U_cannot_be_an_array);
+ }
+
+ // Constructor. Move constructor for C++03 move emulation of this type.
+ scoped_ptr(RValue rvalue) : impl_(&rvalue.object->impl_) {}
+
+ // operator=. Allows assignment from a scoped_ptr rvalue for a convertible
+ // type and deleter.
+ //
+ // IMPLEMENTATION NOTE: C++11 unique_ptr<> keeps this operator= distinct from
+ // the normal move assignment operator. By C++11 20.7.1.2.3.4, this templated
+ // form has different requirements on for move-only Deleters. Since this
+ // implementation does not support move-only Deleters, we do not need a
+ // separate move assignment operator allowing us to avoid one use of SFINAE.
+ // You only need to care about this if you modify the implementation of
+ // scoped_ptr.
+ template <typename U, typename V>
+ scoped_ptr& operator=(scoped_ptr<U, V> rhs) {
+ COMPILE_ASSERT(!base::is_array<U>::value, U_cannot_be_an_array);
+ impl_.TakeState(&rhs.impl_);
+ return *this;
+ }
+
+ // Reset. Deletes the currently owned object, if any.
+ // Then takes ownership of a new object, if given.
+ void reset(element_type* p = NULL) { impl_.reset(p); }
+
+ // Accessors to get the owned object.
+ // operator* and operator-> will assert() if there is no current object.
+ element_type& operator*() const {
+ assert(impl_.get() != NULL);
+ return *impl_.get();
+ }
+ element_type* operator->() const {
+ assert(impl_.get() != NULL);
+ return impl_.get();
+ }
+ element_type* get() const { return impl_.get(); }
+
+ // Access to the deleter.
+ deleter_type& get_deleter() { return impl_.get_deleter(); }
+ const deleter_type& get_deleter() const { return impl_.get_deleter(); }
+
+ // Allow scoped_ptr<element_type> to be used in boolean expressions, but not
+ // implicitly convertible to a real bool (which is dangerous).
+ //
+ // Note that this trick is only safe when the == and != operators
+ // are declared explicitly, as otherwise "scoped_ptr1 ==
+ // scoped_ptr2" will compile but do the wrong thing (i.e., convert
+ // to Testable and then do the comparison).
+ private:
+ typedef base::cef_internal::scoped_ptr_impl<element_type, deleter_type>
+ scoped_ptr::*Testable;
+
+ public:
+ operator Testable() const { return impl_.get() ? &scoped_ptr::impl_ : NULL; }
+
+ // Comparison operators.
+ // These return whether two scoped_ptr refer to the same object, not just to
+ // two different but equal objects.
+ bool operator==(const element_type* p) const { return impl_.get() == p; }
+ bool operator!=(const element_type* p) const { return impl_.get() != p; }
+
+ // Swap two scoped pointers.
+ void swap(scoped_ptr& p2) { impl_.swap(p2.impl_); }
+
+ // Release a pointer.
+ // The return value is the current pointer held by this object.
+ // If this object holds a NULL pointer, the return value is NULL.
+ // After this operation, this object will hold a NULL pointer,
+ // and will not own the object any more.
+ element_type* release() WARN_UNUSED_RESULT { return impl_.release(); }
+
+ // C++98 doesn't support functions templates with default parameters which
+ // makes it hard to write a PassAs() that understands converting the deleter
+ // while preserving simple calling semantics.
+ //
+ // Until there is a use case for PassAs() with custom deleters, just ignore
+ // the custom deleter.
+ template <typename PassAsType>
+ scoped_ptr<PassAsType> PassAs() {
+ return scoped_ptr<PassAsType>(Pass());
+ }
+
+ private:
+ // Needed to reach into |impl_| in the constructor.
+ template <typename U, typename V>
+ friend class scoped_ptr;
+ base::cef_internal::scoped_ptr_impl<element_type, deleter_type> impl_;
+
+ // Forbidden for API compatibility with std::unique_ptr.
+ explicit scoped_ptr(int disallow_construction_from_null);
+
+ // Forbid comparison of scoped_ptr types. If U != T, it totally
+ // doesn't make sense, and if U == T, it still doesn't make sense
+ // because you should never have the same object owned by two different
+ // scoped_ptrs.
+ template <class U>
+ bool operator==(scoped_ptr<U> const& p2) const;
+ template <class U>
+ bool operator!=(scoped_ptr<U> const& p2) const;
+};
+
+template <class T, class D>
+class scoped_ptr<T[], D> {
+ MOVE_ONLY_TYPE_FOR_CPP_03(scoped_ptr, RValue)
+
+ public:
+ // The element and deleter types.
+ typedef T element_type;
+ typedef D deleter_type;
+
+ // Constructor. Defaults to initializing with NULL.
+ scoped_ptr() : impl_(NULL) {}
+
+ // Constructor. Stores the given array. Note that the argument's type
+ // must exactly match T*. In particular:
+ // - it cannot be a pointer to a type derived from T, because it is
+ // inherently unsafe in the general case to access an array through a
+ // pointer whose dynamic type does not match its static type (eg., if
+ // T and the derived types had different sizes access would be
+ // incorrectly calculated). Deletion is also always undefined
+ // (C++98 [expr.delete]p3). If you're doing this, fix your code.
+ // - it cannot be NULL, because NULL is an integral expression, not a
+ // pointer to T. Use the no-argument version instead of explicitly
+ // passing NULL.
+ // - it cannot be const-qualified differently from T per unique_ptr spec
+ // (http://cplusplus.github.com/LWG/lwg-active.html#2118). Users wanting
+ // to work around this may use implicit_cast<const T*>().
+ // However, because of the first bullet in this comment, users MUST
+ // NOT use implicit_cast<Base*>() to upcast the static type of the array.
+ explicit scoped_ptr(element_type* array) : impl_(array) {}
+
+ // Constructor. Move constructor for C++03 move emulation of this type.
+ scoped_ptr(RValue rvalue) : impl_(&rvalue.object->impl_) {}
+
+ // operator=. Move operator= for C++03 move emulation of this type.
+ scoped_ptr& operator=(RValue rhs) {
+ impl_.TakeState(&rhs.object->impl_);
+ return *this;
+ }
+
+ // Reset. Deletes the currently owned array, if any.
+ // Then takes ownership of a new object, if given.
+ void reset(element_type* array = NULL) { impl_.reset(array); }
+
+ // Accessors to get the owned array.
+ element_type& operator[](size_t i) const {
+ assert(impl_.get() != NULL);
+ return impl_.get()[i];
+ }
+ element_type* get() const { return impl_.get(); }
+
+ // Access to the deleter.
+ deleter_type& get_deleter() { return impl_.get_deleter(); }
+ const deleter_type& get_deleter() const { return impl_.get_deleter(); }
+
+ // Allow scoped_ptr<element_type> to be used in boolean expressions, but not
+ // implicitly convertible to a real bool (which is dangerous).
+ private:
+ typedef base::cef_internal::scoped_ptr_impl<element_type, deleter_type>
+ scoped_ptr::*Testable;
+
+ public:
+ operator Testable() const { return impl_.get() ? &scoped_ptr::impl_ : NULL; }
+
+ // Comparison operators.
+ // These return whether two scoped_ptr refer to the same object, not just to
+ // two different but equal objects.
+ bool operator==(element_type* array) const { return impl_.get() == array; }
+ bool operator!=(element_type* array) const { return impl_.get() != array; }
+
+ // Swap two scoped pointers.
+ void swap(scoped_ptr& p2) { impl_.swap(p2.impl_); }
+
+ // Release a pointer.
+ // The return value is the current pointer held by this object.
+ // If this object holds a NULL pointer, the return value is NULL.
+ // After this operation, this object will hold a NULL pointer,
+ // and will not own the object any more.
+ element_type* release() WARN_UNUSED_RESULT { return impl_.release(); }
+
+ private:
+ // Force element_type to be a complete type.
+ enum { type_must_be_complete = sizeof(element_type) };
+
+ // Actually hold the data.
+ base::cef_internal::scoped_ptr_impl<element_type, deleter_type> impl_;
+
+ // Disable initialization from any type other than element_type*, by
+ // providing a constructor that matches such an initialization, but is
+ // private and has no definition. This is disabled because it is not safe to
+ // call delete[] on an array whose static type does not match its dynamic
+ // type.
+ template <typename U>
+ explicit scoped_ptr(U* array);
+ explicit scoped_ptr(int disallow_construction_from_null);
+
+ // Disable reset() from any type other than element_type*, for the same
+ // reasons as the constructor above.
+ template <typename U>
+ void reset(U* array);
+ void reset(int disallow_reset_from_null);
+
+ // Forbid comparison of scoped_ptr types. If U != T, it totally
+ // doesn't make sense, and if U == T, it still doesn't make sense
+ // because you should never have the same object owned by two different
+ // scoped_ptrs.
+ template <class U>
+ bool operator==(scoped_ptr<U> const& p2) const;
+ template <class U>
+ bool operator!=(scoped_ptr<U> const& p2) const;
+};
+
+// Free functions
+template <class T, class D>
+void swap(scoped_ptr<T, D>& p1, scoped_ptr<T, D>& p2) {
+ p1.swap(p2);
+}
+
+template <class T, class D>
+bool operator==(T* p1, const scoped_ptr<T, D>& p2) {
+ return p1 == p2.get();
+}
+
+template <class T, class D>
+bool operator!=(T* p1, const scoped_ptr<T, D>& p2) {
+ return p1 != p2.get();
+}
+
+// A function to convert T* into scoped_ptr<T>
+// Doing e.g. make_scoped_ptr(new FooBarBaz<type>(arg)) is a shorter notation
+// for scoped_ptr<FooBarBaz<type> >(new FooBarBaz<type>(arg))
+template <typename T>
+scoped_ptr<T> make_scoped_ptr(T* ptr) {
+ return scoped_ptr<T>(ptr);
+}
+
+#endif // !USING_CHROMIUM_INCLUDES
+
+#endif // CEF_INCLUDE_BASE_CEF_MEMORY_SCOPED_PTR_H_
diff --git a/src/include/base/cef_string16.h b/src/include/base/cef_string16.h
new file mode 100644
index 0000000..6afcb79
--- /dev/null
+++ b/src/include/base/cef_string16.h
@@ -0,0 +1,223 @@
+// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2013
+// Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef CEF_INCLUDE_BASE_CEF_STRING16_H_
+#define CEF_INCLUDE_BASE_CEF_STRING16_H_
+#pragma once
+
+#if defined(BASE_STRINGS_STRING16_H_)
+// Do nothing if the Chromium header has already been included.
+// 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.
+#elif defined(USING_CHROMIUM_INCLUDES)
+// When building CEF include the Chromium header directly.
+#include "base/strings/string16.h"
+#else // !USING_CHROMIUM_INCLUDES
+// The following is substantially similar to the Chromium implementation.
+// If the Chromium implementation diverges the below implementation should be
+// updated to match.
+// WHAT:
+// A version of std::basic_string that provides 2-byte characters even when
+// wchar_t is not implemented as a 2-byte type. You can access this class as
+// string16. We also define char16, which string16 is based upon.
+//
+// WHY:
+// On Windows, wchar_t is 2 bytes, and it can conveniently handle UTF-16/UCS-2
+// data. Plenty of existing code operates on strings encoded as UTF-16.
+//
+// On many other platforms, sizeof(wchar_t) is 4 bytes by default. We can make
+// it 2 bytes by using the GCC flag -fshort-wchar. But then std::wstring fails
+// at run time, because it calls some functions (like wcslen) that come from
+// the system's native C library -- which was built with a 4-byte wchar_t!
+// It's wasteful to use 4-byte wchar_t strings to carry UTF-16 data, and it's
+// entirely improper on those systems where the encoding of wchar_t is defined
+// as UTF-32.
+//
+// Here, we define string16, which is similar to std::wstring but replaces all
+// libc functions with custom, 2-byte-char compatible routines. It is capable
+// of carrying UTF-16-encoded data.
+
+#include <stdio.h>
+#include <string>
+
+#include "include/base/cef_basictypes.h"
+
+#if defined(WCHAR_T_IS_UTF16)
+
+namespace base {
+
+typedef wchar_t char16;
+typedef std::wstring string16;
+typedef std::char_traits<wchar_t> string16_char_traits;
+
+} // namespace base
+
+#elif defined(WCHAR_T_IS_UTF32)
+
+#include <stdint.h> // For uint16_t
+
+#include "include/base/cef_macros.h"
+
+namespace cef {
+namespace base {
+
+typedef uint16_t char16;
+
+// char16 versions of the functions required by string16_char_traits; these
+// are based on the wide character functions of similar names ("w" or "wcs"
+// instead of "c16").
+int c16memcmp(const char16* s1, const char16* s2, size_t n);
+size_t c16len(const char16* s);
+const char16* c16memchr(const char16* s, char16 c, size_t n);
+char16* c16memmove(char16* s1, const char16* s2, size_t n);
+char16* c16memcpy(char16* s1, const char16* s2, size_t n);
+char16* c16memset(char16* s, char16 c, size_t n);
+
+struct string16_char_traits {
+ typedef char16 char_type;
+ typedef int int_type;
+
+ // int_type needs to be able to hold each possible value of char_type, and in
+ // addition, the distinct value of eof().
+ COMPILE_ASSERT(sizeof(int_type) > sizeof(char_type), unexpected_type_width);
+
+ typedef std::streamoff off_type;
+ typedef mbstate_t state_type;
+ typedef std::fpos<state_type> pos_type;
+
+ static void assign(char_type& c1, const char_type& c2) { c1 = c2; }
+
+ static bool eq(const char_type& c1, const char_type& c2) { return c1 == c2; }
+ static bool lt(const char_type& c1, const char_type& c2) { return c1 < c2; }
+
+ static int compare(const char_type* s1, const char_type* s2, size_t n) {
+ return c16memcmp(s1, s2, n);
+ }
+
+ static size_t length(const char_type* s) { return c16len(s); }
+
+ static const char_type* find(const char_type* s,
+ size_t n,
+ const char_type& a) {
+ return c16memchr(s, a, n);
+ }
+
+ static char_type* move(char_type* s1, const char_type* s2, int_type n) {
+ return c16memmove(s1, s2, n);
+ }
+
+ static char_type* copy(char_type* s1, const char_type* s2, size_t n) {
+ return c16memcpy(s1, s2, n);
+ }
+
+ static char_type* assign(char_type* s, size_t n, char_type a) {
+ return c16memset(s, a, n);
+ }
+
+ static int_type not_eof(const int_type& c) {
+ return eq_int_type(c, eof()) ? 0 : c;
+ }
+
+ static char_type to_char_type(const int_type& c) { return char_type(c); }
+
+ static int_type to_int_type(const char_type& c) { return int_type(c); }
+
+ static bool eq_int_type(const int_type& c1, const int_type& c2) {
+ return c1 == c2;
+ }
+
+ static int_type eof() { return static_cast<int_type>(EOF); }
+};
+
+typedef std::basic_string<char16, string16_char_traits> string16;
+
+} // namespace base
+} // namespace cef
+
+namespace base {
+
+typedef cef::base::char16 char16;
+typedef cef::base::string16 string16;
+
+extern std::ostream& operator<<(std::ostream& out, const string16& str);
+
+// This is required by googletest to print a readable output on test failures.
+extern void PrintTo(const string16& str, std::ostream* out);
+
+} // namespace base
+
+// The string class will be explicitly instantiated only once, in string16.cc.
+//
+// std::basic_string<> in GNU libstdc++ contains a static data member,
+// _S_empty_rep_storage, to represent empty strings. When an operation such
+// as assignment or destruction is performed on a string, causing its existing
+// data member to be invalidated, it must not be freed if this static data
+// member is being used. Otherwise, it counts as an attempt to free static
+// (and not allocated) data, which is a memory error.
+//
+// Generally, due to C++ template magic, _S_empty_rep_storage will be marked
+// as a coalesced symbol, meaning that the linker will combine multiple
+// instances into a single one when generating output.
+//
+// If a string class is used by multiple shared libraries, a problem occurs.
+// Each library will get its own copy of _S_empty_rep_storage. When strings
+// are passed across a library boundary for alteration or destruction, memory
+// errors will result. GNU libstdc++ contains a configuration option,
+// --enable-fully-dynamic-string (_GLIBCXX_FULLY_DYNAMIC_STRING), which
+// disables the static data member optimization, but it's a good optimization
+// and non-STL code is generally at the mercy of the system's STL
+// configuration. Fully-dynamic strings are not the default for GNU libstdc++
+// libstdc++ itself or for the libstdc++ installations on the systems we care
+// about, such as Mac OS X and relevant flavors of Linux.
+//
+// See also http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24196 .
+//
+// To avoid problems, string classes need to be explicitly instantiated only
+// once, in exactly one library. All other string users see it via an "extern"
+// declaration. This is precisely how GNU libstdc++ handles
+// std::basic_string<char> (string) and std::basic_string<wchar_t> (wstring).
+//
+// This also works around a Mac OS X linker bug in ld64-85.2.1 (Xcode 3.1.2),
+// in which the linker does not fully coalesce symbols when dead code
+// stripping is enabled. This bug causes the memory errors described above
+// to occur even when a std::basic_string<> does not cross shared library
+// boundaries, such as in statically-linked executables.
+//
+// TODO(mark): File this bug with Apple and update this note with a bug number.
+
+extern template class std::basic_string<cef::base::char16,
+ cef::base::string16_char_traits>;
+
+#endif // WCHAR_T_IS_UTF32
+
+#endif // !USING_CHROMIUM_INCLUDES
+
+#endif // CEF_INCLUDE_BASE_CEF_STRING16_H_
diff --git a/src/include/base/cef_template_util.h b/src/include/base/cef_template_util.h
new file mode 100644
index 0000000..38fa583
--- /dev/null
+++ b/src/include/base/cef_template_util.h
@@ -0,0 +1,214 @@
+// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
+// Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef CEF_INCLUDE_BASE_CEF_TEMPLATE_UTIL_H_
+#define CEF_INCLUDE_BASE_CEF_TEMPLATE_UTIL_H_
+#pragma once
+
+#if defined(BASE_TEMPLATE_UTIL_H_)
+// Do nothing if the Chromium header has already been included.
+// 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.
+#elif defined(USING_CHROMIUM_INCLUDES)
+// When building CEF include the Chromium header directly.
+#include "base/template_util.h"
+#else // !USING_CHROMIUM_INCLUDES
+// The following is substantially similar to the Chromium implementation.
+// If the Chromium implementation diverges the below implementation should be
+// updated to match.
+
+#include <cstddef> // For size_t.
+
+#include "include/base/cef_build.h"
+
+namespace base {
+
+// template definitions from tr1
+
+template <class T, T v>
+struct integral_constant {
+ static const T value = v;
+ typedef T value_type;
+ typedef integral_constant<T, v> type;
+};
+
+template <class T, T v>
+const T integral_constant<T, v>::value;
+
+typedef integral_constant<bool, true> true_type;
+typedef integral_constant<bool, false> false_type;
+
+template <class T>
+struct is_pointer : false_type {};
+template <class T>
+struct is_pointer<T*> : true_type {};
+
+// Member function pointer detection up to four params. Add more as needed
+// below. This is built-in to C++ 11, and we can remove this when we switch.
+template <typename T>
+struct is_member_function_pointer : false_type {};
+
+template <typename R, typename Z>
+struct is_member_function_pointer<R (Z::*)()> : true_type {};
+template <typename R, typename Z>
+struct is_member_function_pointer<R (Z::*)() const> : true_type {};
+
+template <typename R, typename Z, typename A>
+struct is_member_function_pointer<R (Z::*)(A)> : true_type {};
+template <typename R, typename Z, typename A>
+struct is_member_function_pointer<R (Z::*)(A) const> : true_type {};
+
+template <typename R, typename Z, typename A, typename B>
+struct is_member_function_pointer<R (Z::*)(A, B)> : true_type {};
+template <typename R, typename Z, typename A, typename B>
+struct is_member_function_pointer<R (Z::*)(A, B) const> : true_type {};
+
+template <typename R, typename Z, typename A, typename B, typename C>
+struct is_member_function_pointer<R (Z::*)(A, B, C)> : true_type {};
+template <typename R, typename Z, typename A, typename B, typename C>
+struct is_member_function_pointer<R (Z::*)(A, B, C) const> : true_type {};
+
+template <typename R,
+ typename Z,
+ typename A,
+ typename B,
+ typename C,
+ typename D>
+struct is_member_function_pointer<R (Z::*)(A, B, C, D)> : true_type {};
+template <typename R,
+ typename Z,
+ typename A,
+ typename B,
+ typename C,
+ typename D>
+struct is_member_function_pointer<R (Z::*)(A, B, C, D) const> : true_type {};
+
+template <class T, class U>
+struct is_same : public false_type {};
+template <class T>
+struct is_same<T, T> : true_type {};
+
+template <class>
+struct is_array : public false_type {};
+template <class T, size_t n>
+struct is_array<T[n]> : public true_type {};
+template <class T>
+struct is_array<T[]> : public true_type {};
+
+template <class T>
+struct is_non_const_reference : false_type {};
+template <class T>
+struct is_non_const_reference<T&> : true_type {};
+template <class T>
+struct is_non_const_reference<const T&> : false_type {};
+
+template <class T>
+struct is_const : false_type {};
+template <class T>
+struct is_const<const T> : true_type {};
+
+template <class T>
+struct is_void : false_type {};
+template <>
+struct is_void<void> : true_type {};
+
+namespace cef_internal {
+
+// Types YesType and NoType are guaranteed such that sizeof(YesType) <
+// sizeof(NoType).
+typedef char YesType;
+
+struct NoType {
+ YesType dummy[2];
+};
+
+// This class is an implementation detail for is_convertible, and you
+// don't need to know how it works to use is_convertible. For those
+// who care: we declare two different functions, one whose argument is
+// of type To and one with a variadic argument list. We give them
+// return types of different size, so we can use sizeof to trick the
+// compiler into telling us which function it would have chosen if we
+// had called it with an argument of type From. See Alexandrescu's
+// _Modern C++ Design_ for more details on this sort of trick.
+
+struct ConvertHelper {
+ template <typename To>
+ static YesType Test(To);
+
+ template <typename To>
+ static NoType Test(...);
+
+ template <typename From>
+ static From& Create();
+};
+
+// Used to determine if a type is a struct/union/class. Inspired by Boost's
+// is_class type_trait implementation.
+struct IsClassHelper {
+ template <typename C>
+ static YesType Test(void (C::*)(void));
+
+ template <typename C>
+ static NoType Test(...);
+};
+
+} // namespace cef_internal
+
+// Inherits from true_type if From is convertible to To, false_type otherwise.
+//
+// Note that if the type is convertible, this will be a true_type REGARDLESS
+// of whether or not the conversion would emit a warning.
+template <typename From, typename To>
+struct is_convertible
+ : integral_constant<bool,
+ sizeof(cef_internal::ConvertHelper::Test<To>(
+ cef_internal::ConvertHelper::Create<From>())) ==
+ sizeof(cef_internal::YesType)> {};
+
+template <typename T>
+struct is_class
+ : integral_constant<bool,
+ sizeof(cef_internal::IsClassHelper::Test<T>(0)) ==
+ sizeof(cef_internal::YesType)> {};
+
+template <bool B, class T = void>
+struct enable_if {};
+
+template <class T>
+struct enable_if<true, T> {
+ typedef T type;
+};
+
+} // namespace base
+
+#endif // !USING_CHROMIUM_INCLUDES
+
+#endif // CEF_INCLUDE_BASE_CEF_TEMPLATE_UTIL_H_
diff --git a/src/include/base/cef_thread_checker.h b/src/include/base/cef_thread_checker.h
new file mode 100644
index 0000000..e48c8d0
--- /dev/null
+++ b/src/include/base/cef_thread_checker.h
@@ -0,0 +1,121 @@
+// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012
+// Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef CEF_INCLUDE_BASE_THREAD_CHECKER_H_
+#define CEF_INCLUDE_BASE_THREAD_CHECKER_H_
+#pragma once
+
+#if defined(BASE_THREADING_THREAD_CHECKER_H_)
+// Do nothing if the Chromium header has already been included.
+// 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.
+#elif defined(USING_CHROMIUM_INCLUDES)
+// When building CEF include the Chromium header directly.
+#include "base/threading/thread_checker.h"
+#else // !USING_CHROMIUM_INCLUDES
+// The following is substantially similar to the Chromium implementation.
+// 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.
+#if DCHECK_IS_ON()
+#define ENABLE_THREAD_CHECKER 1
+#else
+#define ENABLE_THREAD_CHECKER 0
+#endif
+
+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
+// right version for your build configuration.
+class ThreadCheckerDoNothing {
+ public:
+ bool CalledOnValidThread() const { return true; }
+
+ 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
+// than inherited from base::NonThreadSafe.
+//
+// While inheriting from base::NonThreadSafe may give a clear indication about
+// the thread-safety of a class, it may also lead to violations of the style
+// guide with regard to multiple inheritance. The choice between having a
+// ThreadChecker member and inheriting from base::NonThreadSafe should be based
+// on whether:
+// - Derived classes need to know the thread they belong to, as opposed to
+// having that functionality fully encapsulated in the base class.
+// - Derived classes should be able to reassign the base class to another
+// thread, via DetachFromThread.
+//
+// If neither of these are true, then having a ThreadChecker member and calling
+// CalledOnValidThread is the preferable solution.
+//
+// Example:
+// class MyClass {
+// public:
+// void Foo() {
+// DCHECK(thread_checker_.CalledOnValidThread());
+// ... (do stuff) ...
+// }
+//
+// private:
+// ThreadChecker thread_checker_;
+// }
+//
+// In Release mode, CalledOnValidThread will always return true.
+#if ENABLE_THREAD_CHECKER
+class ThreadChecker : public cef_internal::ThreadCheckerImpl {};
+#else
+class ThreadChecker : public cef_internal::ThreadCheckerDoNothing {};
+#endif // ENABLE_THREAD_CHECKER
+
+#undef ENABLE_THREAD_CHECKER
+
+} // namespace base
+
+#endif // !USING_CHROMIUM_INCLUDES
+
+#endif // CEF_INCLUDE_BASE_THREAD_CHECKER_H_
diff --git a/src/include/base/cef_trace_event.h b/src/include/base/cef_trace_event.h
new file mode 100644
index 0000000..1b2cad0
--- /dev/null
+++ b/src/include/base/cef_trace_event.h
@@ -0,0 +1,420 @@
+// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012
+// Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+///
+// Trace events are for tracking application performance and resource usage.
+// Macros are provided to track:
+// Begin and end of function calls
+// Counters
+//
+// Events are issued against categories. Whereas LOG's categories are statically
+// defined, TRACE categories are created implicitly with a string. For example:
+// TRACE_EVENT_INSTANT0("MY_SUBSYSTEM", "SomeImportantEvent")
+//
+// Events can be INSTANT, or can be pairs of BEGIN and END in the same scope:
+// TRACE_EVENT_BEGIN0("MY_SUBSYSTEM", "SomethingCostly")
+// doSomethingCostly()
+// TRACE_EVENT_END0("MY_SUBSYSTEM", "SomethingCostly")
+// Note: Our tools can't always determine the correct BEGIN/END pairs unless
+// these are used in the same scope. Use ASYNC_BEGIN/ASYNC_END macros if you
+// need them to be in separate scopes.
+//
+// A common use case is to trace entire function scopes. This issues a trace
+// BEGIN and END automatically:
+// void doSomethingCostly() {
+// TRACE_EVENT0("MY_SUBSYSTEM", "doSomethingCostly");
+// ...
+// }
+//
+// Additional parameters can be associated with an event:
+// void doSomethingCostly2(int howMuch) {
+// TRACE_EVENT1("MY_SUBSYSTEM", "doSomethingCostly",
+// "howMuch", howMuch);
+// ...
+// }
+//
+// The trace system will automatically add to this information the current
+// process id, thread id, and a timestamp in microseconds.
+//
+// To trace an asynchronous procedure such as an IPC send/receive, use
+// ASYNC_BEGIN and ASYNC_END:
+// [single threaded sender code]
+// static int send_count = 0;
+// ++send_count;
+// TRACE_EVENT_ASYNC_BEGIN0("ipc", "message", send_count);
+// Send(new MyMessage(send_count));
+// [receive code]
+// void OnMyMessage(send_count) {
+// TRACE_EVENT_ASYNC_END0("ipc", "message", send_count);
+// }
+// The third parameter is a unique ID to match ASYNC_BEGIN/ASYNC_END pairs.
+// ASYNC_BEGIN and ASYNC_END can occur on any thread of any traced process.
+// Pointers can be used for the ID parameter, and they will be mangled
+// internally so that the same pointer on two different processes will not
+// match. For example:
+// class MyTracedClass {
+// public:
+// MyTracedClass() {
+// TRACE_EVENT_ASYNC_BEGIN0("category", "MyTracedClass", this);
+// }
+// ~MyTracedClass() {
+// TRACE_EVENT_ASYNC_END0("category", "MyTracedClass", this);
+// }
+// }
+//
+// The trace event also supports counters, which is a way to track a quantity
+// as it varies over time. Counters are created with the following macro:
+// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter", g_myCounterValue);
+//
+// Counters are process-specific. The macro itself can be issued from any
+// thread, however.
+//
+// Sometimes, you want to track two counters at once. You can do this with two
+// counter macros:
+// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter0", g_myCounterValue[0]);
+// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter1", g_myCounterValue[1]);
+// Or you can do it with a combined macro:
+// TRACE_COUNTER2("MY_SUBSYSTEM", "myCounter",
+// "bytesPinned", g_myCounterValue[0],
+// "bytesAllocated", g_myCounterValue[1]);
+// This indicates to the tracing UI that these counters should be displayed
+// in a single graph, as a summed area chart.
+//
+// Since counters are in a global namespace, you may want to disembiguate with a
+// unique ID, by using the TRACE_COUNTER_ID* variations.
+//
+// By default, trace collection is compiled in, but turned off at runtime.
+// Collecting trace data is the responsibility of the embedding application. In
+// CEF's case, calling BeginTracing will turn on tracing on all active
+// processes.
+//
+//
+// Memory scoping note:
+// Tracing copies the pointers, not the string content, of the strings passed
+// in for category, name, and arg_names. Thus, the following code will cause
+// problems:
+// char* str = strdup("impprtantName");
+// TRACE_EVENT_INSTANT0("SUBSYSTEM", str); // BAD!
+// free(str); // Trace system now has dangling pointer
+//
+// To avoid this issue with the |name| and |arg_name| parameters, use the
+// TRACE_EVENT_COPY_XXX overloads of the macros at additional runtime
+// overhead.
+// Notes: The category must always be in a long-lived char* (i.e. static const).
+// The |arg_values|, when used, are always deep copied with the _COPY
+// macros.
+//
+//
+// Thread Safety:
+// All macros are thread safe and can be used from any process.
+///
+
+#ifndef CEF_INCLUDE_BASE_CEF_TRACE_EVENT_H_
+#define CEF_INCLUDE_BASE_CEF_TRACE_EVENT_H_
+#pragma once
+
+#if defined(TRACE_EVENT0)
+// Do nothing if the macros provided by this header already exist.
+// 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.
+#elif defined(USING_CHROMIUM_INCLUDES)
+// When building CEF include the Chromium header directly.
+#include "base/trace_event/trace_event.h"
+#else // !USING_CHROMIUM_INCLUDES
+// The following is substantially similar to the Chromium implementation.
+// If the Chromium implementation diverges the below implementation should be
+// updated to match.
+
+#include "include/internal/cef_trace_event_internal.h"
+
+// Records a pair of begin and end events called "name" for the current
+// scope, with 0, 1 or 2 associated arguments. If the category is not
+// enabled, then this does nothing.
+// - category and name strings must have application lifetime (statics or
+// literals). They may not include " chars.
+#define TRACE_EVENT0(category, name) \
+ cef_trace_event_begin(category, name, NULL, 0, NULL, 0, false); \
+ CEF_INTERNAL_TRACE_END_ON_SCOPE_CLOSE(category, name)
+#define TRACE_EVENT1(category, name, arg1_name, arg1_val) \
+ cef_trace_event_begin(category, name, arg1_name, arg1_val, NULL, 0, false); \
+ CEF_INTERNAL_TRACE_END_ON_SCOPE_CLOSE(category, name)
+#define TRACE_EVENT2(category, name, arg1_name, arg1_val, arg2_name, arg2_val) \
+ cef_trace_event_begin(category, name, arg1_name, arg1_val, arg2_name, \
+ arg2_val, false); \
+ CEF_INTERNAL_TRACE_END_ON_SCOPE_CLOSE(category, name)
+
+// Implementation detail: trace event macros create temporary variable names.
+// These macros give each temporary variable a unique name based on the line
+// number to prevent name collisions.
+#define CEF_INTERNAL_TRACE_EVENT_UID3(a, b) cef_trace_event_unique_##a##b
+#define CEF_INTERNAL_TRACE_EVENT_UID2(a, b) CEF_INTERNAL_TRACE_EVENT_UID3(a, b)
+#define CEF_INTERNAL_TRACE_EVENT_UID(name_prefix) \
+ CEF_INTERNAL_TRACE_EVENT_UID2(name_prefix, __LINE__)
+
+// Implementation detail: internal macro to end end event when the scope ends.
+#define CEF_INTERNAL_TRACE_END_ON_SCOPE_CLOSE(category, name) \
+ cef_trace_event::CefTraceEndOnScopeClose CEF_INTERNAL_TRACE_EVENT_UID( \
+ profileScope)(category, name)
+
+// Records a single event called "name" immediately, with 0, 1 or 2
+// associated arguments. If the category is not enabled, then this
+// does nothing.
+// - category and name strings must have application lifetime (statics or
+// literals). They may not include " chars.
+#define TRACE_EVENT_INSTANT0(category, name) \
+ cef_trace_event_instant(category, name, NULL, 0, NULL, 0, false)
+#define TRACE_EVENT_INSTANT1(category, name, arg1_name, arg1_val) \
+ cef_trace_event_instant(category, name, arg1_name, arg1_val, NULL, 0, false)
+#define TRACE_EVENT_INSTANT2(category, name, arg1_name, arg1_val, arg2_name, \
+ arg2_val) \
+ cef_trace_event_instant(category, name, arg1_name, arg1_val, arg2_name, \
+ arg2_val, false)
+#define TRACE_EVENT_COPY_INSTANT0(category, name) \
+ cef_trace_event_instant(category, name, NULL, 0, NULL, 0, true)
+#define TRACE_EVENT_COPY_INSTANT1(category, name, arg1_name, arg1_val) \
+ cef_trace_event_instant(category, name, arg1_name, arg1_val, NULL, 0, true)
+#define TRACE_EVENT_COPY_INSTANT2(category, name, arg1_name, arg1_val, \
+ arg2_name, arg2_val) \
+ cef_trace_event_instant(category, name, arg1_name, arg1_val, arg2_name, \
+ arg2_val, true)
+
+// Records a single BEGIN event called "name" immediately, with 0, 1 or 2
+// associated arguments. If the category is not enabled, then this
+// does nothing.
+// - category and name strings must have application lifetime (statics or
+// literals). They may not include " chars.
+#define TRACE_EVENT_BEGIN0(category, name) \
+ cef_trace_event_begin(category, name, NULL, 0, NULL, 0, false)
+#define TRACE_EVENT_BEGIN1(category, name, arg1_name, arg1_val) \
+ cef_trace_event_begin(category, name, arg1_name, arg1_val, NULL, 0, false)
+#define TRACE_EVENT_BEGIN2(category, name, arg1_name, arg1_val, arg2_name, \
+ arg2_val) \
+ cef_trace_event_begin(category, name, arg1_name, arg1_val, arg2_name, \
+ arg2_val, false)
+#define TRACE_EVENT_COPY_BEGIN0(category, name) \
+ cef_trace_event_begin(category, name, NULL, 0, NULL, 0, true)
+#define TRACE_EVENT_COPY_BEGIN1(category, name, arg1_name, arg1_val) \
+ cef_trace_event_begin(category, name, arg1_name, arg1_val, NULL, 0, true)
+#define TRACE_EVENT_COPY_BEGIN2(category, name, arg1_name, arg1_val, \
+ arg2_name, arg2_val) \
+ cef_trace_event_begin(category, name, arg1_name, arg1_val, arg2_name, \
+ arg2_val, true)
+
+// Records a single END event for "name" immediately. If the category
+// is not enabled, then this does nothing.
+// - category and name strings must have application lifetime (statics or
+// literals). They may not include " chars.
+#define TRACE_EVENT_END0(category, name) \
+ cef_trace_event_end(category, name, NULL, 0, NULL, 0, false)
+#define TRACE_EVENT_END1(category, name, arg1_name, arg1_val) \
+ cef_trace_event_end(category, name, arg1_name, arg1_val, NULL, 0, false)
+#define TRACE_EVENT_END2(category, name, arg1_name, arg1_val, arg2_name, \
+ arg2_val) \
+ cef_trace_event_end(category, name, arg1_name, arg1_val, arg2_name, \
+ arg2_val, false)
+#define TRACE_EVENT_COPY_END0(category, name) \
+ cef_trace_event_end(category, name, NULL, 0, NULL, 0, true)
+#define TRACE_EVENT_COPY_END1(category, name, arg1_name, arg1_val) \
+ cef_trace_event_end(category, name, arg1_name, arg1_val, NULL, 0, true)
+#define TRACE_EVENT_COPY_END2(category, name, arg1_name, arg1_val, arg2_name, \
+ arg2_val) \
+ cef_trace_event_end(category, name, arg1_name, arg1_val, arg2_name, \
+ arg2_val, true)
+
+// Records the value of a counter called "name" immediately. Value
+// must be representable as a 32 bit integer.
+// - category and name strings must have application lifetime (statics or
+// literals). They may not include " chars.
+#define TRACE_COUNTER1(category, name, value) \
+ cef_trace_counter(category, name, NULL, value, NULL, 0, false)
+#define TRACE_COPY_COUNTER1(category, name, value) \
+ cef_trace_counter(category, name, NULL, value, NULL, 0, true)
+
+// Records the values of a multi-parted counter called "name" immediately.
+// The UI will treat value1 and value2 as parts of a whole, displaying their
+// values as a stacked-bar chart.
+// - category and name strings must have application lifetime (statics or
+// literals). They may not include " chars.
+#define TRACE_COUNTER2(category, name, value1_name, value1_val, value2_name, \
+ value2_val) \
+ cef_trace_counter(category, name, value1_name, value1_val, value2_name, \
+ value2_val, false)
+#define TRACE_COPY_COUNTER2(category, name, value1_name, value1_val, \
+ value2_name, value2_val) \
+ cef_trace_counter(category, name, value1_name, value1_val, value2_name, \
+ value2_val, true)
+
+// Records the value of a counter called "name" immediately. Value
+// must be representable as a 32 bit integer.
+// - category and name strings must have application lifetime (statics or
+// literals). They may not include " chars.
+// - |id| is used to disambiguate counters with the same name. It must either
+// be a pointer or an integer value up to 64 bits. If it's a pointer, the
+// bits will be xored with a hash of the process ID so that the same pointer
+// on two different processes will not collide.
+#define TRACE_COUNTER_ID1(category, name, id, value) \
+ cef_trace_counter_id(category, name, id, NULL, value, NULL, 0, false)
+#define TRACE_COPY_COUNTER_ID1(category, name, id, value) \
+ cef_trace_counter_id(category, name, id, NULL, value, NULL, 0, true)
+
+// Records the values of a multi-parted counter called "name" immediately.
+// The UI will treat value1 and value2 as parts of a whole, displaying their
+// values as a stacked-bar chart.
+// - category and name strings must have application lifetime (statics or
+// literals). They may not include " chars.
+// - |id| is used to disambiguate counters with the same name. It must either
+// be a pointer or an integer value up to 64 bits. If it's a pointer, the
+// bits will be xored with a hash of the process ID so that the same pointer
+// on two different processes will not collide.
+#define TRACE_COUNTER_ID2(category, name, id, value1_name, value1_val, \
+ value2_name, value2_val) \
+ cef_trace_counter_id(category, name, id, value1_name, value1_val, \
+ value2_name, value2_val, false)
+#define TRACE_COPY_COUNTER_ID2(category, name, id, value1_name, value1_val, \
+ value2_name, value2_val) \
+ cef_trace_counter_id(category, name, id, value1_name, value1_val, \
+ value2_name, value2_val, true)
+
+// Records a single ASYNC_BEGIN event called "name" immediately, with 0, 1 or 2
+// associated arguments. If the category is not enabled, then this
+// does nothing.
+// - category and name strings must have application lifetime (statics or
+// literals). They may not include " chars.
+// - |id| is used to match the ASYNC_BEGIN event with the ASYNC_END event.
+// ASYNC events are considered to match if their category, name and id values
+// all match. |id| must either be a pointer or an integer value up to 64
+// bits. If it's a pointer, the bits will be xored with a hash of the process
+// ID sothat the same pointer on two different processes will not collide.
+// An asynchronous operation can consist of multiple phases. The first phase is
+// defined by the ASYNC_BEGIN calls. Additional phases can be defined using the
+// ASYNC_STEP_BEGIN macros. When the operation completes, call ASYNC_END.
+// An async operation can span threads and processes, but all events in that
+// operation must use the same |name| and |id|. Each event can have its own
+// args.
+#define TRACE_EVENT_ASYNC_BEGIN0(category, name, id) \
+ cef_trace_event_async_begin(category, name, id, NULL, 0, NULL, 0, false)
+#define TRACE_EVENT_ASYNC_BEGIN1(category, name, id, arg1_name, arg1_val) \
+ cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, NULL, \
+ 0, false)
+#define TRACE_EVENT_ASYNC_BEGIN2(category, name, id, arg1_name, arg1_val, \
+ arg2_name, arg2_val) \
+ cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, \
+ arg2_name, arg2_val, false)
+#define TRACE_EVENT_COPY_ASYNC_BEGIN0(category, name, id) \
+ cef_trace_event_async_begin(category, name, id, NULL, 0, NULL, 0, true)
+#define TRACE_EVENT_COPY_ASYNC_BEGIN1(category, name, id, arg1_name, arg1_val) \
+ cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, NULL, \
+ 0, true)
+#define TRACE_EVENT_COPY_ASYNC_BEGIN2(category, name, id, arg1_name, arg1_val, \
+ arg2_name, arg2_val) \
+ cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, \
+ arg2_name, arg2_val, true)
+
+// Records a single ASYNC_STEP_INTO event for |step| immediately. If the
+// category is not enabled, then this does nothing. The |name| and |id| must
+// match the ASYNC_BEGIN event above. The |step| param identifies this step
+// within the async event. This should be called at the beginning of the next
+// phase of an asynchronous operation. The ASYNC_BEGIN event must not have any
+// ASYNC_STEP_PAST events.
+#define TRACE_EVENT_ASYNC_STEP_INTO0(category, name, id, step) \
+ cef_trace_event_async_step_into(category, name, id, step, NULL, 0, false)
+#define TRACE_EVENT_ASYNC_STEP_INTO1(category, name, id, step, arg1_name, \
+ arg1_val) \
+ cef_trace_event_async_step_into(category, name, id, step, arg1_name, \
+ arg1_val, false)
+#define TRACE_EVENT_COPY_ASYNC_STEP_INTO0(category, name, id, step) \
+ cef_trace_event_async_step_into(category, name, id, step, NULL, 0, true)
+#define TRACE_EVENT_COPY_ASYNC_STEP_INTO1(category, name, id, step, arg1_name, \
+ arg1_val) \
+ cef_trace_event_async_step_into(category, name, id, step, arg1_name, \
+ arg1_val, true)
+
+// Records a single ASYNC_STEP_PAST event for |step| immediately. If the
+// category is not enabled, then this does nothing. The |name| and |id| must
+// match the ASYNC_BEGIN event above. The |step| param identifies this step
+// within the async event. This should be called at the beginning of the next
+// phase of an asynchronous operation. The ASYNC_BEGIN event must not have any
+// ASYNC_STEP_INTO events.
+#define TRACE_EVENT_ASYNC_STEP_PAST0(category, name, id, step) \
+ cef_trace_event_async_step_past(category, name, id, step, NULL, 0, false)
+#define TRACE_EVENT_ASYNC_STEP_PAST1(category, name, id, step, arg1_name, \
+ arg1_val) \
+ cef_trace_event_async_step_past(category, name, id, step, arg1_name, \
+ arg1_val, false)
+#define TRACE_EVENT_COPY_ASYNC_STEP_PAST0(category, name, id, step) \
+ cef_trace_event_async_step_past(category, name, id, step, NULL, 0, true)
+#define TRACE_EVENT_COPY_ASYNC_STEP_PAST1(category, name, id, step, arg1_name, \
+ arg1_val) \
+ cef_trace_event_async_step_past(category, name, id, step, arg1_name, \
+ arg1_val, true)
+
+// Records a single ASYNC_END event for "name" immediately. If the category
+// is not enabled, then this does nothing.
+#define TRACE_EVENT_ASYNC_END0(category, name, id) \
+ cef_trace_event_async_end(category, name, id, NULL, 0, NULL, 0, false)
+#define TRACE_EVENT_ASYNC_END1(category, name, id, arg1_name, arg1_val) \
+ cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, NULL, 0, \
+ false)
+#define TRACE_EVENT_ASYNC_END2(category, name, id, arg1_name, arg1_val, \
+ arg2_name, arg2_val) \
+ cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, \
+ arg2_name, arg2_val, false)
+#define TRACE_EVENT_COPY_ASYNC_END0(category, name, id) \
+ cef_trace_event_async_end(category, name, id, NULL, 0, NULL, 0, true)
+#define TRACE_EVENT_COPY_ASYNC_END1(category, name, id, arg1_name, arg1_val) \
+ cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, NULL, 0, \
+ true)
+#define TRACE_EVENT_COPY_ASYNC_END2(category, name, id, arg1_name, arg1_val, \
+ arg2_name, arg2_val) \
+ cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, \
+ arg2_name, arg2_val, true)
+
+namespace cef_trace_event {
+
+// Used by TRACE_EVENTx macro. Do not use directly.
+class CefTraceEndOnScopeClose {
+ public:
+ CefTraceEndOnScopeClose(const char* category, const char* name)
+ : category_(category), name_(name) {}
+ ~CefTraceEndOnScopeClose() {
+ cef_trace_event_end(category_, name_, NULL, 0, NULL, 0, false);
+ }
+
+ private:
+ const char* category_;
+ const char* name_;
+};
+
+} // cef_trace_event
+
+#endif // !USING_CHROMIUM_INCLUDES
+
+#endif // CEF_INCLUDE_BASE_CEF_TRACE_EVENT_H_
diff --git a/src/include/base/cef_tuple.h b/src/include/base/cef_tuple.h
new file mode 100644
index 0000000..aeb6e9c
--- /dev/null
+++ b/src/include/base/cef_tuple.h
@@ -0,0 +1,1610 @@
+// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
+// Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the name Chromium Embedded
+// Framework nor the names of its contributors may be used to endorse
+// or promote products derived from this software without specific prior
+// written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// A Tuple is a generic templatized container, similar in concept to std::pair.
+// There are classes Tuple0 to Tuple6, cooresponding to the number of elements
+// it contains. The convenient MakeTuple() function takes 0 to 6 arguments,
+// and will construct and return the appropriate Tuple object. The functions
+// DispatchToMethod and DispatchToFunction take a function pointer or instance
+// and method pointer, and unpack a tuple into arguments to the call.
+//
+// Tuple elements are copied by value, and stored in the tuple. See the unit
+// tests for more details of how/when the values are copied.
+//
+// Example usage:
+// // These two methods of creating a Tuple are identical.
+// Tuple2<int, const char*> tuple_a(1, "wee");
+// Tuple2<int, const char*> tuple_b = MakeTuple(1, "wee");
+//
+// void SomeFunc(int a, const char* b) { }
+// DispatchToFunction(&SomeFunc, tuple_a); // SomeFunc(1, "wee")
+// DispatchToFunction(
+// &SomeFunc, MakeTuple(10, "foo")); // SomeFunc(10, "foo")
+//
+// struct { void SomeMeth(int a, int b, int c) { } } foo;
+// DispatchToMethod(&foo, &Foo::SomeMeth, MakeTuple(1, 2, 3));
+// // foo->SomeMeth(1, 2, 3);
+
+#ifndef CEF_INCLUDE_BASE_CEF_TUPLE_H_
+#define CEF_INCLUDE_BASE_CEF_TUPLE_H_
+#pragma once
+
+#if defined(BASE_TUPLE_H_)
+// Do nothing if the Chromium header has already been included.
+// 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.
+#elif defined(USING_CHROMIUM_INCLUDES)
+// When building CEF include the Chromium header directly.
+#include "base/tuple.h"
+#else // !USING_CHROMIUM_INCLUDES
+// The following is substantially similar to the Chromium implementation.
+// If the Chromium implementation diverges the below implementation should be
+// updated to match.
+
+#include "include/base/cef_bind_helpers.h"
+
+namespace base {
+
+// Traits ----------------------------------------------------------------------
+//
+// A simple traits class for tuple arguments.
+//
+// ValueType: the bare, nonref version of a type (same as the type for nonrefs).
+// RefType: the ref version of a type (same as the type for refs).
+// ParamType: what type to pass to functions (refs should not be constified).
+
+template <class P>
+struct TupleTraits {
+ typedef P ValueType;
+ typedef P& RefType;
+ typedef const P& ParamType;
+};
+
+template <class P>
+struct TupleTraits<P&> {
+ typedef P ValueType;
+ typedef P& RefType;
+ typedef P& ParamType;
+};
+
+template <class P>
+struct TupleTypes {};
+
+// Tuple -----------------------------------------------------------------------
+//
+// This set of classes is useful for bundling 0 or more heterogeneous data types
+// into a single variable. The advantage of this is that it greatly simplifies
+// function objects that need to take an arbitrary number of parameters; see
+// RunnableMethod and IPC::MessageWithTuple.
+//
+// Tuple0 is supplied to act as a 'void' type. It can be used, for example,
+// when dispatching to a function that accepts no arguments (see the
+// Dispatchers below).
+// Tuple1<A> is rarely useful. One such use is when A is non-const ref that you
+// want filled by the dispatchee, and the tuple is merely a container for that
+// output (a "tier"). See MakeRefTuple and its usages.
+
+struct Tuple0 {
+ typedef Tuple0 ValueTuple;
+ typedef Tuple0 RefTuple;
+ typedef Tuple0 ParamTuple;
+};
+
+template <class A>
+struct Tuple1 {
+ public:
+ typedef A TypeA;
+
+ Tuple1() {}
+ explicit Tuple1(typename TupleTraits<A>::ParamType a) : a(a) {}
+
+ A a;
+};
+
+template <class A, class B>
+struct Tuple2 {
+ public:
+ typedef A TypeA;
+ typedef B TypeB;
+
+ Tuple2() {}
+ Tuple2(typename TupleTraits<A>::ParamType a,
+ typename TupleTraits<B>::ParamType b)
+ : a(a), b(b) {}
+
+ A a;
+ B b;
+};
+
+template <class A, class B, class C>
+struct Tuple3 {
+ public:
+ typedef A TypeA;
+ typedef B TypeB;
+ typedef C TypeC;
+
+ Tuple3() {}
+ Tuple3(typename TupleTraits<A>::ParamType a,
+ typename TupleTraits<B>::ParamType b,
+ typename TupleTraits<C>::ParamType c)
+ : a(a), b(b), c(c) {}
+
+ A a;
+ B b;
+ C c;
+};
+
+template <class A, class B, class C, class D>
+struct Tuple4 {
+ public:
+ typedef A TypeA;
+ typedef B TypeB;
+ typedef C TypeC;
+ typedef D TypeD;
+
+ Tuple4() {}
+ Tuple4(typename TupleTraits<A>::ParamType a,
+ typename TupleTraits<B>::ParamType b,
+ typename TupleTraits<C>::ParamType c,
+ typename TupleTraits<D>::ParamType d)
+ : a(a), b(b), c(c), d(d) {}
+
+ A a;
+ B b;
+ C c;
+ D d;
+};
+
+template <class A, class B, class C, class D, class E>
+struct Tuple5 {
+ public:
+ typedef A TypeA;
+ typedef B TypeB;
+ typedef C TypeC;
+ typedef D TypeD;
+ typedef E TypeE;
+
+ Tuple5() {}
+ Tuple5(typename TupleTraits<A>::ParamType a,
+ typename TupleTraits<B>::ParamType b,
+ typename TupleTraits<C>::ParamType c,
+ typename TupleTraits<D>::ParamType d,
+ typename TupleTraits<E>::ParamType e)
+ : a(a), b(b), c(c), d(d), e(e) {}
+
+ A a;
+ B b;
+ C c;
+ D d;
+ E e;
+};
+
+template <class A, class B, class C, class D, class E, class F>
+struct Tuple6 {
+ public:
+ typedef A TypeA;
+ typedef B TypeB;
+ typedef C TypeC;
+ typedef D TypeD;
+ typedef E TypeE;
+ typedef F TypeF;
+
+ Tuple6() {}
+ Tuple6(typename TupleTraits<A>::ParamType a,
+ typename TupleTraits<B>::ParamType b,
+ typename TupleTraits<C>::ParamType c,
+ typename TupleTraits<D>::ParamType d,
+ typename TupleTraits<E>::ParamType e,
+ typename TupleTraits<F>::ParamType f)
+ : a(a), b(b), c(c), d(d), e(e), f(f) {}
+
+ A a;
+ B b;
+ C c;
+ D d;
+ E e;
+ F f;
+};
+
+template <class A, class B, class C, class D, class E, class F, class G>
+struct Tuple7 {
+ public:
+ typedef A TypeA;
+ typedef B TypeB;
+ typedef C TypeC;
+ typedef D TypeD;
+ typedef E TypeE;
+ typedef F TypeF;
+ typedef G TypeG;
+
+ Tuple7() {}
+ Tuple7(typename TupleTraits<A>::ParamType a,
+ typename TupleTraits<B>::ParamType b,
+ typename TupleTraits<C>::ParamType c,
+ typename TupleTraits<D>::ParamType d,
+ typename TupleTraits<E>::ParamType e,
+ typename TupleTraits<F>::ParamType f,
+ typename TupleTraits<G>::ParamType g)
+ : a(a), b(b), c(c), d(d), e(e), f(f), g(g) {}
+
+ A a;
+ B b;
+ C c;
+ D d;
+ E e;
+ F f;
+ G g;
+};
+
+template <class A,
+ class B,
+ class C,
+ class D,
+ class E,
+ class F,
+ class G,
+ class H>
+struct Tuple8 {
+ public:
+ typedef A TypeA;<