diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..f76789dfd --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +* text eol=lf +*.jpg -text +*.png -text +*.ico -text diff --git a/README.md b/README.md index 3003b368e..8043036b0 100644 --- a/README.md +++ b/README.md @@ -239,9 +239,9 @@ support old operating systems then choose the v31 release. OS | Py2 | Py3 | 32bit | 64bit | Requirements --- | --- | --- | --- | --- | --- -Windows | 2.7 | 3.4 / 3.5 / 3.6 / 3.7 | Yes | Yes | Windows 7+ -Linux | 2.7 | 3.4 / 3.5 / 3.6 / 3.7 | Yes | Yes | Debian 8+, Ubuntu 14.04+, Fedora 24+, openSUSE 13.3+ -Mac | 2.7 | 3.4 / 3.5 / 3.6 / 3.7 | No | Yes | MacOS 10.9+ +Windows | 2.7 | 3.4 / 3.5 / 3.6 / 3.7 / 3.8 | Yes | Yes | Windows 7+ +Linux | 2.7 | 3.4 / 3.5 / 3.6 / 3.7 / 3.8 | Yes | Yes | Debian 8+, Ubuntu 14.04+, Fedora 24+, openSUSE 13.3+ +Mac | 2.7 | 3.4 / 3.5 / 3.6 / 3.7 / 3.8 | No | Yes | MacOS 10.9+ These platforms are not supported yet: - ARM - see [Issue #267](../../issues/267) diff --git a/patches/prebuilt_74.1.19.patch b/patches/prebuilt_74.1.19.patch new file mode 100644 index 000000000..9a285759b --- /dev/null +++ b/patches/prebuilt_74.1.19.patch @@ -0,0 +1,13 @@ +diff --git a/tests/cefclient/browser/browser_window_std_win.cc b/tests/cefclient/browser/browser_window_std_win.cc +index fa7ee02..90f17aa 100644 +--- a/tests/cefclient/browser/browser_window_std_win.cc ++++ b/tests/cefclient/browser/browser_window_std_win.cc +@@ -65,7 +65,7 @@ void BrowserWindowStdWin::ShowPopup(ClientWindowHandle parent_handle, + static_cast(height), SWP_NOZORDER | SWP_NOACTIVATE); + + const bool no_activate = +- GetWindowLongPtr(parent_handle, GWL_EXSTYLE) & WS_EX_NOACTIVATE; ++ (GetWindowLongPtr(parent_handle, GWL_EXSTYLE) & WS_EX_NOACTIVATE) != 0; + ShowWindow(hwnd, no_activate ? SW_SHOWNOACTIVATE : SW_SHOW); + } + } diff --git a/src/cefpython.pyx b/src/cefpython.pyx index 1631636fb..b51b42cbe 100644 --- a/src/cefpython.pyx +++ b/src/cefpython.pyx @@ -583,8 +583,11 @@ def Initialize(applicationSettings=None, commandLineSwitches=None, **kwargs): # ------------------------------------------------------------------------ if not "multi_threaded_message_loop" in application_settings: application_settings["multi_threaded_message_loop"] = False - if not "single_process" in application_settings: - application_settings["single_process"] = False + if not "multi_threaded_message_loop_windows" in application_settings: + application_settings["multi_threaded_message_loop_windows"] = False + else: + # multi_threaded_message_loop_windows overrides multi_threaded_message_loop + application_settings["multi_threaded_message_loop"] = application_settings["multi_threaded_message_loop_windows"] # ------------------------------------------------------------------------ # ------------------------------------------------------------------------ @@ -897,11 +900,12 @@ def Shutdown(): # and closes browser automatically if you give it some time. # If the time was not enough, then there is an emergency plan, # the code block further down that checks len(g_pyBrowsers). - for _ in range(20): - for __ in range(10): - with nogil: - CefDoMessageLoopWork() - time.sleep(0.01) + if not GetAppSetting("multi_threaded_message_loop_windows"): + for _ in range(20): + for __ in range(10): + with nogil: + CefDoMessageLoopWork() + time.sleep(0.01) # Emergency plan in case the code above didn't close browsers, # and neither browsers were closed in client app. This code @@ -925,7 +929,7 @@ def Shutdown(): browser_close_forced = True browser = None # free reference RemovePyBrowser(browserId) - if browser_close_forced: + if browser_close_forced and not GetAppSetting("multi_threaded_message_loop_windows"): for _ in range(20): for __ in range(10): with nogil: diff --git a/src/client_handler/render_handler.cpp b/src/client_handler/render_handler.cpp index cf45d15ee..dd7b900a0 100644 --- a/src/client_handler/render_handler.cpp +++ b/src/client_handler/render_handler.cpp @@ -13,11 +13,11 @@ bool RenderHandler::GetRootScreenRect(CefRefPtr browser, } -bool RenderHandler::GetViewRect(CefRefPtr browser, +void RenderHandler::GetViewRect(CefRefPtr browser, CefRect& rect) { REQUIRE_UI_THREAD(); - return RenderHandler_GetViewRect(browser, rect); + RenderHandler_GetViewRect(browser, rect); } diff --git a/src/client_handler/render_handler.h b/src/client_handler/render_handler.h index 75eee86c5..ab89f4ba1 100644 --- a/src/client_handler/render_handler.h +++ b/src/client_handler/render_handler.h @@ -22,7 +22,7 @@ class RenderHandler : public CefRenderHandler, bool GetRootScreenRect(CefRefPtr browser, CefRect& rect) override; - bool GetViewRect(CefRefPtr browser, + void GetViewRect(CefRefPtr browser, CefRect& rect) override; bool GetScreenPoint(CefRefPtr browser, diff --git a/src/common/cefpython_public_api.h b/src/common/cefpython_public_api.h index 53ad62c63..8e4ff60b6 100644 --- a/src/common/cefpython_public_api.h +++ b/src/common/cefpython_public_api.h @@ -46,6 +46,8 @@ #include "../../build/build_cefpython/cefpython_py36_fixed.h" #elif PY_MINOR_VERSION == 7 #include "../../build/build_cefpython/cefpython_py37_fixed.h" +#elif PY_MINOR_VERSION == 8 +#include "../../build/build_cefpython/cefpython_py38_fixed.h" #endif // PY_MINOR_VERSION #endif // PY_MAJOR_VERSION diff --git a/src/extern/cef/cef_types.pxd b/src/extern/cef/cef_types.pxd index 6bd21ba46..afb4bf0ef 100644 --- a/src/extern/cef/cef_types.pxd +++ b/src/extern/cef/cef_types.pxd @@ -34,7 +34,6 @@ cdef extern from "include/internal/cef_types.h": ctypedef struct CefSettings: cef_string_t accept_language_list - int single_process cef_string_t browser_subprocess_path int command_line_args_disabled cef_string_t cache_path diff --git a/src/handlers/render_handler.pyx b/src/handlers/render_handler.pyx index a8ad49124..9aab56c1b 100644 --- a/src/handlers/render_handler.pyx +++ b/src/handlers/render_handler.pyx @@ -51,7 +51,7 @@ cdef public cpp_bool RenderHandler_GetRootScreenRect( (exc_type, exc_value, exc_trace) = sys.exc_info() sys.excepthook(exc_type, exc_value, exc_trace) -cdef public cpp_bool RenderHandler_GetViewRect( +cdef public void RenderHandler_GetViewRect( CefRefPtr[CefBrowser] cefBrowser, CefRect& cefRect ) except * with gil: @@ -69,11 +69,6 @@ cdef public cpp_bool RenderHandler_GetViewRect( cefRect.y = pyRect[1] cefRect.width = pyRect[2] cefRect.height = pyRect[3] - return True - else: - return False - else: - return False except: (exc_type, exc_value, exc_trace) = sys.exc_info() sys.excepthook(exc_type, exc_value, exc_trace) diff --git a/src/include/base/cef_build.h b/src/include/base/cef_build.h index 1e2065ce3..5f3a8639c 100644 --- a/src/include/base/cef_build.h +++ b/src/include/base/cef_build.h @@ -162,6 +162,16 @@ #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 diff --git a/src/include/base/cef_ref_counted.h b/src/include/base/cef_ref_counted.h index 480b1ce9d..7a687070c 100644 --- a/src/include/base/cef_ref_counted.h +++ b/src/include/base/cef_ref_counted.h @@ -51,7 +51,7 @@ #include "include/base/cef_atomic_ref_count.h" #include "include/base/cef_build.h" #include "include/base/cef_logging.h" -#include "include/base/cef_thread_collision_warner.h" +#include "include/base/cef_macros.h" namespace base { @@ -60,6 +60,7 @@ namespace cef_subtle { class RefCountedBase { public: bool HasOneRef() const { return ref_count_ == 1; } + bool HasAtLeastOneRef() const { return ref_count_ >= 1; } protected: RefCountedBase() @@ -78,10 +79,6 @@ class RefCountedBase { } void AddRef() const { -// TODO(maruel): Add back once it doesn't assert 500 times/sec. -// Current thread books the critical section "AddRelease" -// without release it. -// DFAKE_SCOPED_LOCK_THREAD_LOCKED(add_release_); #if DCHECK_IS_ON() DCHECK(!in_dtor_); #endif @@ -90,10 +87,6 @@ class RefCountedBase { // Returns true if the object should self-delete. bool Release() const { -// TODO(maruel): Add back once it doesn't assert 500 times/sec. -// Current thread books the critical section "AddRelease" -// without release it. -// DFAKE_SCOPED_LOCK_THREAD_LOCKED(add_release_); #if DCHECK_IS_ON() DCHECK(!in_dtor_); #endif @@ -112,14 +105,13 @@ class RefCountedBase { mutable bool in_dtor_; #endif - DFAKE_MUTEX(add_release_); - DISALLOW_COPY_AND_ASSIGN(RefCountedBase); }; class RefCountedThreadSafeBase { public: bool HasOneRef() const; + bool HasAtLeastOneRef() const; protected: RefCountedThreadSafeBase(); diff --git a/src/include/base/cef_string16.h b/src/include/base/cef_string16.h index 427564073..6afcb79bd 100644 --- a/src/include/base/cef_string16.h +++ b/src/include/base/cef_string16.h @@ -86,6 +86,7 @@ typedef std::char_traits string16_char_traits; #include "include/base/cef_macros.h" +namespace cef { namespace base { typedef uint16_t char16; @@ -156,7 +157,15 @@ struct string16_char_traits { static int_type eof() { return static_cast(EOF); } }; -typedef std::basic_string string16; +typedef std::basic_string 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); @@ -204,8 +213,8 @@ extern void PrintTo(const string16& str, std::ostream* out); // // TODO(mark): File this bug with Apple and update this note with a bug number. -extern template class std::basic_string; +extern template class std::basic_string; #endif // WCHAR_T_IS_UTF32 diff --git a/src/include/base/cef_thread_collision_warner.h b/src/include/base/cef_thread_collision_warner.h deleted file mode 100644 index 53f6ef6d5..000000000 --- a/src/include/base/cef_thread_collision_warner.h +++ /dev/null @@ -1,276 +0,0 @@ -// 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_THREAD_COLLISION_WARNER_H_ -#define CEF_INCLUDE_BASE_CEF_THREAD_COLLISION_WARNER_H_ -#pragma once - -#if defined(BASE_THREADING_THREAD_COLLISION_WARNER_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_collision_warner.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 "include/base/cef_atomicops.h" -#include "include/base/cef_basictypes.h" -#include "include/base/cef_build.h" -#include "include/base/cef_logging.h" -#include "include/base/cef_macros.h" - -// A helper class alongside macros to be used to verify assumptions about thread -// safety of a class. -// -// Example: Queue implementation non thread-safe but still usable if clients -// are synchronized somehow. -// -// In this case the macro DFAKE_SCOPED_LOCK has to be -// used, it checks that if a thread is inside the push/pop then -// noone else is still inside the pop/push -// -// class NonThreadSafeQueue { -// public: -// ... -// void push(int) { DFAKE_SCOPED_LOCK(push_pop_); ... } -// int pop() { DFAKE_SCOPED_LOCK(push_pop_); ... } -// ... -// private: -// DFAKE_MUTEX(push_pop_); -// }; -// -// -// Example: Queue implementation non thread-safe but still usable if clients -// are synchronized somehow, it calls a method to "protect" from -// a "protected" method -// -// In this case the macro DFAKE_SCOPED_RECURSIVE_LOCK -// has to be used, it checks that if a thread is inside the push/pop -// then noone else is still inside the pop/push -// -// class NonThreadSafeQueue { -// public: -// void push(int) { -// DFAKE_SCOPED_LOCK(push_pop_); -// ... -// } -// int pop() { -// DFAKE_SCOPED_RECURSIVE_LOCK(push_pop_); -// bar(); -// ... -// } -// void bar() { DFAKE_SCOPED_RECURSIVE_LOCK(push_pop_); ... } -// ... -// private: -// DFAKE_MUTEX(push_pop_); -// }; -// -// -// Example: Queue implementation not usable even if clients are synchronized, -// so only one thread in the class life cycle can use the two members -// push/pop. -// -// In this case the macro DFAKE_SCOPED_LOCK_THREAD_LOCKED pins the -// specified -// critical section the first time a thread enters push or pop, from -// that time on only that thread is allowed to execute push or pop. -// -// class NonThreadSafeQueue { -// public: -// ... -// void push(int) { DFAKE_SCOPED_LOCK_THREAD_LOCKED(push_pop_); ... } -// int pop() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(push_pop_); ... } -// ... -// private: -// DFAKE_MUTEX(push_pop_); -// }; -// -// -// Example: Class that has to be contructed/destroyed on same thread, it has -// a "shareable" method (with external synchronization) and a not -// shareable method (even with external synchronization). -// -// In this case 3 Critical sections have to be defined -// -// class ExoticClass { -// public: -// ExoticClass() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(ctor_dtor_); ... } -// ~ExoticClass() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(ctor_dtor_); ... } -// -// void Shareable() { DFAKE_SCOPED_LOCK(shareable_section_); ... } -// void NotShareable() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(ctor_dtor_); ... } -// ... -// private: -// DFAKE_MUTEX(ctor_dtor_); -// DFAKE_MUTEX(shareable_section_); -// }; - -#if DCHECK_IS_ON() - -// Defines a class member that acts like a mutex. It is used only as a -// verification tool. -#define DFAKE_MUTEX(obj) mutable base::ThreadCollisionWarner obj -// Asserts the call is never called simultaneously in two threads. Used at -// member function scope. -#define DFAKE_SCOPED_LOCK(obj) \ - base::ThreadCollisionWarner::ScopedCheck s_check_##obj(&obj) -// Asserts the call is never called simultaneously in two threads. Used at -// member function scope. Same as DFAKE_SCOPED_LOCK but allows recursive locks. -#define DFAKE_SCOPED_RECURSIVE_LOCK(obj) \ - base::ThreadCollisionWarner::ScopedRecursiveCheck sr_check_##obj(&obj) -// Asserts the code is always executed in the same thread. -#define DFAKE_SCOPED_LOCK_THREAD_LOCKED(obj) \ - base::ThreadCollisionWarner::Check check_##obj(&obj) - -#else - -#define DFAKE_MUTEX(obj) typedef void InternalFakeMutexType##obj -#define DFAKE_SCOPED_LOCK(obj) ((void)0) -#define DFAKE_SCOPED_RECURSIVE_LOCK(obj) ((void)0) -#define DFAKE_SCOPED_LOCK_THREAD_LOCKED(obj) ((void)0) - -#endif - -namespace base { - -// The class ThreadCollisionWarner uses an Asserter to notify the collision -// AsserterBase is the interfaces and DCheckAsserter is the default asserter -// used. During the unit tests is used another class that doesn't "DCHECK" -// in case of collision (check thread_collision_warner_unittests.cc) -struct AsserterBase { - virtual ~AsserterBase() {} - virtual void warn() = 0; -}; - -struct DCheckAsserter : public AsserterBase { - virtual ~DCheckAsserter() {} - virtual void warn() OVERRIDE; -}; - -class ThreadCollisionWarner { - public: - // The parameter asserter is there only for test purpose - explicit ThreadCollisionWarner(AsserterBase* asserter = new DCheckAsserter()) - : valid_thread_id_(0), counter_(0), asserter_(asserter) {} - - ~ThreadCollisionWarner() { delete asserter_; } - - // This class is meant to be used through the macro - // DFAKE_SCOPED_LOCK_THREAD_LOCKED - // it doesn't leave the critical section, as opposed to ScopedCheck, - // because the critical section being pinned is allowed to be used only - // from one thread - class Check { - public: - explicit Check(ThreadCollisionWarner* warner) : warner_(warner) { - warner_->EnterSelf(); - } - - ~Check() {} - - private: - ThreadCollisionWarner* warner_; - - DISALLOW_COPY_AND_ASSIGN(Check); - }; - - // This class is meant to be used through the macro - // DFAKE_SCOPED_LOCK - class ScopedCheck { - public: - explicit ScopedCheck(ThreadCollisionWarner* warner) : warner_(warner) { - warner_->Enter(); - } - - ~ScopedCheck() { warner_->Leave(); } - - private: - ThreadCollisionWarner* warner_; - - DISALLOW_COPY_AND_ASSIGN(ScopedCheck); - }; - - // This class is meant to be used through the macro - // DFAKE_SCOPED_RECURSIVE_LOCK - class ScopedRecursiveCheck { - public: - explicit ScopedRecursiveCheck(ThreadCollisionWarner* warner) - : warner_(warner) { - warner_->EnterSelf(); - } - - ~ScopedRecursiveCheck() { warner_->Leave(); } - - private: - ThreadCollisionWarner* warner_; - - DISALLOW_COPY_AND_ASSIGN(ScopedRecursiveCheck); - }; - - private: - // This method stores the current thread identifier and does a DCHECK - // if a another thread has already done it, it is safe if same thread - // calls this multiple time (recursion allowed). - void EnterSelf(); - - // Same as EnterSelf but recursion is not allowed. - void Enter(); - - // Removes the thread_id stored in order to allow other threads to - // call EnterSelf or Enter. - void Leave(); - - // This stores the thread id that is inside the critical section, if the - // value is 0 then no thread is inside. - volatile subtle::Atomic32 valid_thread_id_; - - // Counter to trace how many time a critical section was "pinned" - // (when allowed) in order to unpin it when counter_ reaches 0. - volatile subtle::Atomic32 counter_; - - // Here only for class unit tests purpose, during the test I need to not - // DCHECK but notify the collision with something else. - AsserterBase* asserter_; - - DISALLOW_COPY_AND_ASSIGN(ThreadCollisionWarner); -}; - -} // namespace base - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_THREAD_COLLISION_WARNER_H_ diff --git a/src/include/base/internal/cef_atomicops_arm_gcc.h b/src/include/base/internal/cef_atomicops_arm_gcc.h deleted file mode 100644 index 2e39ce3c2..000000000 --- a/src/include/base/internal/cef_atomicops_arm_gcc.h +++ /dev/null @@ -1,325 +0,0 @@ -// Copyright (c) 2013 Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Do not include this header file directly. Use base/cef_atomicops.h -// instead. -// -// LinuxKernelCmpxchg and Barrier_AtomicIncrement are from Google Gears. - -#ifndef CEF_INCLUDE_BASE_INTERNAL_CEF_ATOMICOPS_ARM_GCC_H_ -#define CEF_INCLUDE_BASE_INTERNAL_CEF_ATOMICOPS_ARM_GCC_H_ - -#if defined(OS_QNX) -#include -#endif - -namespace base { -namespace subtle { - -// Memory barriers on ARM are funky, but the kernel is here to help: -// -// * ARMv5 didn't support SMP, there is no memory barrier instruction at -// all on this architecture, or when targeting its machine code. -// -// * Some ARMv6 CPUs support SMP. A full memory barrier can be produced by -// writing a random value to a very specific coprocessor register. -// -// * On ARMv7, the "dmb" instruction is used to perform a full memory -// barrier (though writing to the co-processor will still work). -// However, on single core devices (e.g. Nexus One, or Nexus S), -// this instruction will take up to 200 ns, which is huge, even though -// it's completely un-needed on these devices. -// -// * There is no easy way to determine at runtime if the device is -// single or multi-core. However, the kernel provides a useful helper -// function at a fixed memory address (0xffff0fa0), which will always -// perform a memory barrier in the most efficient way. I.e. on single -// core devices, this is an empty function that exits immediately. -// On multi-core devices, it implements a full memory barrier. -// -// * This source could be compiled to ARMv5 machine code that runs on a -// multi-core ARMv6 or ARMv7 device. In this case, memory barriers -// are needed for correct execution. Always call the kernel helper, even -// when targeting ARMv5TE. -// - -inline void MemoryBarrier() { -#if defined(OS_LINUX) || defined(OS_ANDROID) - // Note: This is a function call, which is also an implicit compiler barrier. - typedef void (*KernelMemoryBarrierFunc)(); - ((KernelMemoryBarrierFunc)0xffff0fa0)(); -#elif defined(OS_QNX) - __cpu_membarrier(); -#else -#error MemoryBarrier() is not implemented on this platform. -#endif -} - -// An ARM toolchain would only define one of these depending on which -// variant of the target architecture is being used. This tests against -// any known ARMv6 or ARMv7 variant, where it is possible to directly -// use ldrex/strex instructions to implement fast atomic operations. -#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || \ - defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || \ - defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || \ - defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || \ - defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) - -inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value) { - Atomic32 prev_value; - int reloop; - do { - // The following is equivalent to: - // - // prev_value = LDREX(ptr) - // reloop = 0 - // if (prev_value != old_value) - // reloop = STREX(ptr, new_value) - __asm__ __volatile__( - " ldrex %0, [%3]\n" - " mov %1, #0\n" - " cmp %0, %4\n" -#ifdef __thumb2__ - " it eq\n" -#endif - " strexeq %1, %5, [%3]\n" - : "=&r"(prev_value), "=&r"(reloop), "+m"(*ptr) - : "r"(ptr), "r"(old_value), "r"(new_value) - : "cc", "memory"); - } while (reloop != 0); - return prev_value; -} - -inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value) { - Atomic32 result = NoBarrier_CompareAndSwap(ptr, old_value, new_value); - MemoryBarrier(); - return result; -} - -inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value) { - MemoryBarrier(); - return NoBarrier_CompareAndSwap(ptr, old_value, new_value); -} - -inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, - Atomic32 increment) { - Atomic32 value; - int reloop; - do { - // Equivalent to: - // - // value = LDREX(ptr) - // value += increment - // reloop = STREX(ptr, value) - // - __asm__ __volatile__( - " ldrex %0, [%3]\n" - " add %0, %0, %4\n" - " strex %1, %0, [%3]\n" - : "=&r"(value), "=&r"(reloop), "+m"(*ptr) - : "r"(ptr), "r"(increment) - : "cc", "memory"); - } while (reloop); - return value; -} - -inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, - Atomic32 increment) { - // TODO(digit): Investigate if it's possible to implement this with - // a single MemoryBarrier() operation between the LDREX and STREX. - // See http://crbug.com/246514 - MemoryBarrier(); - Atomic32 result = NoBarrier_AtomicIncrement(ptr, increment); - MemoryBarrier(); - return result; -} - -inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, - Atomic32 new_value) { - Atomic32 old_value; - int reloop; - do { - // old_value = LDREX(ptr) - // reloop = STREX(ptr, new_value) - __asm__ __volatile__( - " ldrex %0, [%3]\n" - " strex %1, %4, [%3]\n" - : "=&r"(old_value), "=&r"(reloop), "+m"(*ptr) - : "r"(ptr), "r"(new_value) - : "cc", "memory"); - } while (reloop != 0); - return old_value; -} - -// This tests against any known ARMv5 variant. -#elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) || \ - defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_5TEJ__) - -// The kernel also provides a helper function to perform an atomic -// compare-and-swap operation at the hard-wired address 0xffff0fc0. -// On ARMv5, this is implemented by a special code path that the kernel -// detects and treats specially when thread pre-emption happens. -// On ARMv6 and higher, it uses LDREX/STREX instructions instead. -// -// Note that this always perform a full memory barrier, there is no -// need to add calls MemoryBarrier() before or after it. It also -// returns 0 on success, and 1 on exit. -// -// Available and reliable since Linux 2.6.24. Both Android and ChromeOS -// use newer kernel revisions, so this should not be a concern. -namespace { - -inline int LinuxKernelCmpxchg(Atomic32 old_value, - Atomic32 new_value, - volatile Atomic32* ptr) { - typedef int (*KernelCmpxchgFunc)(Atomic32, Atomic32, volatile Atomic32*); - return ((KernelCmpxchgFunc)0xffff0fc0)(old_value, new_value, ptr); -} - -} // namespace - -inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value) { - Atomic32 prev_value; - for (;;) { - prev_value = *ptr; - if (prev_value != old_value) - return prev_value; - if (!LinuxKernelCmpxchg(old_value, new_value, ptr)) - return old_value; - } -} - -inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, - Atomic32 new_value) { - Atomic32 old_value; - do { - old_value = *ptr; - } while (LinuxKernelCmpxchg(old_value, new_value, ptr)); - return old_value; -} - -inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, - Atomic32 increment) { - return Barrier_AtomicIncrement(ptr, increment); -} - -inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, - Atomic32 increment) { - for (;;) { - // Atomic exchange the old value with an incremented one. - Atomic32 old_value = *ptr; - Atomic32 new_value = old_value + increment; - if (!LinuxKernelCmpxchg(old_value, new_value, ptr)) { - // The exchange took place as expected. - return new_value; - } - // Otherwise, *ptr changed mid-loop and we need to retry. - } -} - -inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value) { - Atomic32 prev_value; - for (;;) { - prev_value = *ptr; - if (prev_value != old_value) { - // Always ensure acquire semantics. - MemoryBarrier(); - return prev_value; - } - if (!LinuxKernelCmpxchg(old_value, new_value, ptr)) - return old_value; - } -} - -inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value) { - // This could be implemented as: - // MemoryBarrier(); - // return NoBarrier_CompareAndSwap(); - // - // But would use 3 barriers per succesful CAS. To save performance, - // use Acquire_CompareAndSwap(). Its implementation guarantees that: - // - A succesful swap uses only 2 barriers (in the kernel helper). - // - An early return due to (prev_value != old_value) performs - // a memory barrier with no store, which is equivalent to the - // generic implementation above. - return Acquire_CompareAndSwap(ptr, old_value, new_value); -} - -#else -#error "Your CPU's ARM architecture is not supported yet" -#endif - -// NOTE: Atomicity of the following load and store operations is only -// guaranteed in case of 32-bit alignement of |ptr| values. - -inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) { - *ptr = value; -} - -inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) { - *ptr = value; - MemoryBarrier(); -} - -inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) { - MemoryBarrier(); - *ptr = value; -} - -inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) { - return *ptr; -} - -inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) { - Atomic32 value = *ptr; - MemoryBarrier(); - return value; -} - -inline Atomic32 Release_Load(volatile const Atomic32* ptr) { - MemoryBarrier(); - return *ptr; -} - -} // namespace base::subtle -} // namespace base - -#endif // CEF_INCLUDE_BASE_INTERNAL_CEF_ATOMICOPS_ARM_GCC_H_ diff --git a/src/include/base/internal/cef_atomicops_atomicword_compat.h b/src/include/base/internal/cef_atomicops_atomicword_compat.h deleted file mode 100644 index f905de85f..000000000 --- a/src/include/base/internal/cef_atomicops_atomicword_compat.h +++ /dev/null @@ -1,124 +0,0 @@ -// 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. - -// Do not include this header file directly. Use base/cef_atomicops.h -// instead. - -#ifndef CEF_INCLUDE_BASE_INTERNAL_CEF_ATOMICOPS_ATOMICWORD_COMPAT_H_ -#define CEF_INCLUDE_BASE_INTERNAL_CEF_ATOMICOPS_ATOMICWORD_COMPAT_H_ - -// AtomicWord is a synonym for intptr_t, and Atomic32 is a synonym for int32, -// which in turn means int. On some LP32 platforms, intptr_t is an int, but -// on others, it's a long. When AtomicWord and Atomic32 are based on different -// fundamental types, their pointers are incompatible. -// -// This file defines function overloads to allow both AtomicWord and Atomic32 -// data to be used with this interface. -// -// On LP64 platforms, AtomicWord and Atomic64 are both always long, -// so this problem doesn't occur. - -#if !defined(ARCH_CPU_64_BITS) - -namespace base { -namespace subtle { - -inline AtomicWord NoBarrier_CompareAndSwap(volatile AtomicWord* ptr, - AtomicWord old_value, - AtomicWord new_value) { - return NoBarrier_CompareAndSwap(reinterpret_cast(ptr), - old_value, new_value); -} - -inline AtomicWord NoBarrier_AtomicExchange(volatile AtomicWord* ptr, - AtomicWord new_value) { - return NoBarrier_AtomicExchange(reinterpret_cast(ptr), - new_value); -} - -inline AtomicWord NoBarrier_AtomicIncrement(volatile AtomicWord* ptr, - AtomicWord increment) { - return NoBarrier_AtomicIncrement(reinterpret_cast(ptr), - increment); -} - -inline AtomicWord Barrier_AtomicIncrement(volatile AtomicWord* ptr, - AtomicWord increment) { - return Barrier_AtomicIncrement(reinterpret_cast(ptr), - increment); -} - -inline AtomicWord Acquire_CompareAndSwap(volatile AtomicWord* ptr, - AtomicWord old_value, - AtomicWord new_value) { - return base::subtle::Acquire_CompareAndSwap( - reinterpret_cast(ptr), old_value, new_value); -} - -inline AtomicWord Release_CompareAndSwap(volatile AtomicWord* ptr, - AtomicWord old_value, - AtomicWord new_value) { - return base::subtle::Release_CompareAndSwap( - reinterpret_cast(ptr), old_value, new_value); -} - -inline void NoBarrier_Store(volatile AtomicWord* ptr, AtomicWord value) { - NoBarrier_Store(reinterpret_cast(ptr), value); -} - -inline void Acquire_Store(volatile AtomicWord* ptr, AtomicWord value) { - return base::subtle::Acquire_Store(reinterpret_cast(ptr), - value); -} - -inline void Release_Store(volatile AtomicWord* ptr, AtomicWord value) { - return base::subtle::Release_Store(reinterpret_cast(ptr), - value); -} - -inline AtomicWord NoBarrier_Load(volatile const AtomicWord* ptr) { - return NoBarrier_Load(reinterpret_cast(ptr)); -} - -inline AtomicWord Acquire_Load(volatile const AtomicWord* ptr) { - return base::subtle::Acquire_Load( - reinterpret_cast(ptr)); -} - -inline AtomicWord Release_Load(volatile const AtomicWord* ptr) { - return base::subtle::Release_Load( - reinterpret_cast(ptr)); -} - -} // namespace base::subtle -} // namespace base - -#endif // !defined(ARCH_CPU_64_BITS) - -#endif // CEF_INCLUDE_BASE_INTERNAL_CEF_ATOMICOPS_ATOMICWORD_COMPAT_H_ diff --git a/src/include/base/internal/cef_atomicops_mac.h b/src/include/base/internal/cef_atomicops_mac.h deleted file mode 100644 index 374ae35d6..000000000 --- a/src/include/base/internal/cef_atomicops_mac.h +++ /dev/null @@ -1,223 +0,0 @@ -// 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. - -// Do not include this header file directly. Use base/cef_atomicops.h -// instead. - -#ifndef CEF_INCLUDE_BASE_INTERNAL_CEF_ATOMICOPS_MAC_H_ -#define CEF_INCLUDE_BASE_INTERNAL_CEF_ATOMICOPS_MAC_H_ - -#include - -namespace base { -namespace subtle { - -inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value) { - Atomic32 prev_value; - do { - if (OSAtomicCompareAndSwap32(old_value, new_value, - const_cast(ptr))) { - return old_value; - } - prev_value = *ptr; - } while (prev_value == old_value); - return prev_value; -} - -inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, - Atomic32 new_value) { - Atomic32 old_value; - do { - old_value = *ptr; - } while (!OSAtomicCompareAndSwap32(old_value, new_value, - const_cast(ptr))); - return old_value; -} - -inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, - Atomic32 increment) { - return OSAtomicAdd32(increment, const_cast(ptr)); -} - -inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, - Atomic32 increment) { - return OSAtomicAdd32Barrier(increment, const_cast(ptr)); -} - -inline void MemoryBarrier() { - OSMemoryBarrier(); -} - -inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value) { - Atomic32 prev_value; - do { - if (OSAtomicCompareAndSwap32Barrier(old_value, new_value, - const_cast(ptr))) { - return old_value; - } - prev_value = *ptr; - } while (prev_value == old_value); - return prev_value; -} - -inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value) { - return Acquire_CompareAndSwap(ptr, old_value, new_value); -} - -inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) { - *ptr = value; -} - -inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) { - *ptr = value; - MemoryBarrier(); -} - -inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) { - MemoryBarrier(); - *ptr = value; -} - -inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) { - return *ptr; -} - -inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) { - Atomic32 value = *ptr; - MemoryBarrier(); - return value; -} - -inline Atomic32 Release_Load(volatile const Atomic32* ptr) { - MemoryBarrier(); - return *ptr; -} - -#ifdef __LP64__ - -// 64-bit implementation on 64-bit platform - -inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, - Atomic64 old_value, - Atomic64 new_value) { - Atomic64 prev_value; - do { - if (OSAtomicCompareAndSwap64(old_value, new_value, - reinterpret_cast(ptr))) { - return old_value; - } - prev_value = *ptr; - } while (prev_value == old_value); - return prev_value; -} - -inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, - Atomic64 new_value) { - Atomic64 old_value; - do { - old_value = *ptr; - } while (!OSAtomicCompareAndSwap64(old_value, new_value, - reinterpret_cast(ptr))); - return old_value; -} - -inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, - Atomic64 increment) { - return OSAtomicAdd64(increment, reinterpret_cast(ptr)); -} - -inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, - Atomic64 increment) { - return OSAtomicAdd64Barrier(increment, - reinterpret_cast(ptr)); -} - -inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, - Atomic64 old_value, - Atomic64 new_value) { - Atomic64 prev_value; - do { - if (OSAtomicCompareAndSwap64Barrier( - old_value, new_value, reinterpret_cast(ptr))) { - return old_value; - } - prev_value = *ptr; - } while (prev_value == old_value); - return prev_value; -} - -inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr, - Atomic64 old_value, - Atomic64 new_value) { - // The lib kern interface does not distinguish between - // Acquire and Release memory barriers; they are equivalent. - return Acquire_CompareAndSwap(ptr, old_value, new_value); -} - -inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) { - *ptr = value; -} - -inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) { - *ptr = value; - MemoryBarrier(); -} - -inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) { - MemoryBarrier(); - *ptr = value; -} - -inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) { - return *ptr; -} - -inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) { - Atomic64 value = *ptr; - MemoryBarrier(); - return value; -} - -inline Atomic64 Release_Load(volatile const Atomic64* ptr) { - MemoryBarrier(); - return *ptr; -} - -#endif // defined(__LP64__) - -} // namespace base::subtle -} // namespace base - -#endif // CEF_INCLUDE_BASE_INTERNAL_CEF_ATOMICOPS_MAC_H_ diff --git a/src/include/base/internal/cef_atomicops_x86_gcc.h b/src/include/base/internal/cef_atomicops_x86_gcc.h deleted file mode 100644 index b93df21b0..000000000 --- a/src/include/base/internal/cef_atomicops_x86_gcc.h +++ /dev/null @@ -1,268 +0,0 @@ -// 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. - -// Do not include this header file directly. Use base/cef_atomicops.h -// instead. - -#ifndef CEF_INCLUDE_BASE_INTERNAL_CEF_ATOMICOPS_X86_GCC_H_ -#define CEF_INCLUDE_BASE_INTERNAL_CEF_ATOMICOPS_X86_GCC_H_ - -// This struct is not part of the public API of this module; clients may not -// use it. -// Features of this x86. Values may not be correct before main() is run, -// but are set conservatively. -struct AtomicOps_x86CPUFeatureStruct { - bool has_amd_lock_mb_bug; // Processor has AMD memory-barrier bug; do lfence - // after acquire compare-and-swap. -}; -extern struct AtomicOps_x86CPUFeatureStruct AtomicOps_Internalx86CPUFeatures; - -#define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory") - -namespace base { -namespace subtle { - -// 32-bit low-level operations on any platform. - -inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value) { - Atomic32 prev; - __asm__ __volatile__("lock; cmpxchgl %1,%2" - : "=a"(prev) - : "q"(new_value), "m"(*ptr), "0"(old_value) - : "memory"); - return prev; -} - -inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, - Atomic32 new_value) { - __asm__ __volatile__("xchgl %1,%0" // The lock prefix is implicit for xchg. - : "=r"(new_value) - : "m"(*ptr), "0"(new_value) - : "memory"); - return new_value; // Now it's the previous value. -} - -inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, - Atomic32 increment) { - Atomic32 temp = increment; - __asm__ __volatile__("lock; xaddl %0,%1" - : "+r"(temp), "+m"(*ptr) - : - : "memory"); - // temp now holds the old value of *ptr - return temp + increment; -} - -inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, - Atomic32 increment) { - Atomic32 temp = increment; - __asm__ __volatile__("lock; xaddl %0,%1" - : "+r"(temp), "+m"(*ptr) - : - : "memory"); - // temp now holds the old value of *ptr - if (AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug) { - __asm__ __volatile__("lfence" : : : "memory"); - } - return temp + increment; -} - -inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value) { - Atomic32 x = NoBarrier_CompareAndSwap(ptr, old_value, new_value); - if (AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug) { - __asm__ __volatile__("lfence" : : : "memory"); - } - return x; -} - -inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value) { - return NoBarrier_CompareAndSwap(ptr, old_value, new_value); -} - -inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) { - *ptr = value; -} - -inline void MemoryBarrier() { - __asm__ __volatile__("mfence" : : : "memory"); -} - -inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) { - *ptr = value; - MemoryBarrier(); -} - -inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) { - ATOMICOPS_COMPILER_BARRIER(); - *ptr = value; // An x86 store acts as a release barrier. - // See comments in Atomic64 version of Release_Store(), below. -} - -inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) { - return *ptr; -} - -inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) { - Atomic32 value = *ptr; // An x86 load acts as a acquire barrier. - // See comments in Atomic64 version of Release_Store(), below. - ATOMICOPS_COMPILER_BARRIER(); - return value; -} - -inline Atomic32 Release_Load(volatile const Atomic32* ptr) { - MemoryBarrier(); - return *ptr; -} - -#if defined(__x86_64__) - -// 64-bit low-level operations on 64-bit platform. - -inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, - Atomic64 old_value, - Atomic64 new_value) { - Atomic64 prev; - __asm__ __volatile__("lock; cmpxchgq %1,%2" - : "=a"(prev) - : "q"(new_value), "m"(*ptr), "0"(old_value) - : "memory"); - return prev; -} - -inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, - Atomic64 new_value) { - __asm__ __volatile__("xchgq %1,%0" // The lock prefix is implicit for xchg. - : "=r"(new_value) - : "m"(*ptr), "0"(new_value) - : "memory"); - return new_value; // Now it's the previous value. -} - -inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, - Atomic64 increment) { - Atomic64 temp = increment; - __asm__ __volatile__("lock; xaddq %0,%1" - : "+r"(temp), "+m"(*ptr) - : - : "memory"); - // temp now contains the previous value of *ptr - return temp + increment; -} - -inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, - Atomic64 increment) { - Atomic64 temp = increment; - __asm__ __volatile__("lock; xaddq %0,%1" - : "+r"(temp), "+m"(*ptr) - : - : "memory"); - // temp now contains the previous value of *ptr - if (AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug) { - __asm__ __volatile__("lfence" : : : "memory"); - } - return temp + increment; -} - -inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) { - *ptr = value; -} - -inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) { - *ptr = value; - MemoryBarrier(); -} - -inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) { - ATOMICOPS_COMPILER_BARRIER(); - - *ptr = value; // An x86 store acts as a release barrier - // for current AMD/Intel chips as of Jan 2008. - // See also Acquire_Load(), below. - - // When new chips come out, check: - // IA-32 Intel Architecture Software Developer's Manual, Volume 3: - // System Programming Guide, Chatper 7: Multiple-processor management, - // Section 7.2, Memory Ordering. - // Last seen at: - // http://developer.intel.com/design/pentium4/manuals/index_new.htm - // - // x86 stores/loads fail to act as barriers for a few instructions (clflush - // maskmovdqu maskmovq movntdq movnti movntpd movntps movntq) but these are - // not generated by the compiler, and are rare. Users of these instructions - // need to know about cache behaviour in any case since all of these involve - // either flushing cache lines or non-temporal cache hints. -} - -inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) { - return *ptr; -} - -inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) { - Atomic64 value = *ptr; // An x86 load acts as a acquire barrier, - // for current AMD/Intel chips as of Jan 2008. - // See also Release_Store(), above. - ATOMICOPS_COMPILER_BARRIER(); - return value; -} - -inline Atomic64 Release_Load(volatile const Atomic64* ptr) { - MemoryBarrier(); - return *ptr; -} - -inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, - Atomic64 old_value, - Atomic64 new_value) { - Atomic64 x = NoBarrier_CompareAndSwap(ptr, old_value, new_value); - if (AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug) { - __asm__ __volatile__("lfence" : : : "memory"); - } - return x; -} - -inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr, - Atomic64 old_value, - Atomic64 new_value) { - return NoBarrier_CompareAndSwap(ptr, old_value, new_value); -} - -#endif // defined(__x86_64__) - -} // namespace base::subtle -} // namespace base - -#undef ATOMICOPS_COMPILER_BARRIER - -#endif // CEF_INCLUDE_BASE_INTERNAL_CEF_ATOMICOPS_X86_GCC_H_ diff --git a/src/include/capi/cef_accessibility_handler_capi.h b/src/include/capi/cef_accessibility_handler_capi.h new file mode 100644 index 000000000..36f5d1385 --- /dev/null +++ b/src/include/capi/cef_accessibility_handler_capi.h @@ -0,0 +1,81 @@ +// Copyright (c) 2019 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=05029efef860f52da671d55b0afa3df43e016045$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_ACCESSIBILITY_HANDLER_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_ACCESSIBILITY_HANDLER_CAPI_H_ +#pragma once + +#include "include/capi/cef_values_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/// +// Implement this structure to receive accessibility notification when +// accessibility events have been registered. The functions of this structure +// will be called on the UI thread. +/// +typedef struct _cef_accessibility_handler_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Called after renderer process sends accessibility tree changes to the + // browser process. + /// + void(CEF_CALLBACK* on_accessibility_tree_change)( + struct _cef_accessibility_handler_t* self, + struct _cef_value_t* value); + + /// + // Called after renderer process sends accessibility location changes to the + // browser process. + /// + void(CEF_CALLBACK* on_accessibility_location_change)( + struct _cef_accessibility_handler_t* self, + struct _cef_value_t* value); +} cef_accessibility_handler_t; + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_ACCESSIBILITY_HANDLER_CAPI_H_ diff --git a/src/include/capi/cef_app_capi.h b/src/include/capi/cef_app_capi.h new file mode 100644 index 000000000..efb8f5966 --- /dev/null +++ b/src/include/capi/cef_app_capi.h @@ -0,0 +1,201 @@ +// Copyright (c) 2019 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=a386eaf81574ae85a4f522afd4287742f778e78d$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_ +#pragma once + +#include "include/capi/cef_base_capi.h" +#include "include/capi/cef_browser_process_handler_capi.h" +#include "include/capi/cef_command_line_capi.h" +#include "include/capi/cef_render_process_handler_capi.h" +#include "include/capi/cef_resource_bundle_handler_capi.h" +#include "include/capi/cef_scheme_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct _cef_app_t; + +/// +// Implement this structure to provide handler implementations. Methods will be +// called by the process and/or thread indicated. +/// +typedef struct _cef_app_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Provides an opportunity to view and/or modify command-line arguments before + // processing by CEF and Chromium. The |process_type| value will be NULL for + // the browser process. Do not keep a reference to the cef_command_line_t + // object passed to this function. The CefSettings.command_line_args_disabled + // value can be used to start with an NULL command-line object. Any values + // specified in CefSettings that equate to command-line arguments will be set + // before this function is called. Be cautious when using this function to + // modify command-line arguments for non-browser processes as this may result + // in undefined behavior including crashes. + /// + void(CEF_CALLBACK* on_before_command_line_processing)( + struct _cef_app_t* self, + const cef_string_t* process_type, + struct _cef_command_line_t* command_line); + + /// + // Provides an opportunity to register custom schemes. Do not keep a reference + // to the |registrar| object. This function is called on the main thread for + // each process and the registered schemes should be the same across all + // processes. + /// + void(CEF_CALLBACK* on_register_custom_schemes)( + struct _cef_app_t* self, + struct _cef_scheme_registrar_t* registrar); + + /// + // Return the handler for resource bundle events. If + // CefSettings.pack_loading_disabled is true (1) a handler must be returned. + // If no handler is returned resources will be loaded from pack files. This + // function is called by the browser and render processes on multiple threads. + /// + struct _cef_resource_bundle_handler_t*( + CEF_CALLBACK* get_resource_bundle_handler)(struct _cef_app_t* self); + + /// + // Return the handler for functionality specific to the browser process. This + // function is called on multiple threads in the browser process. + /// + struct _cef_browser_process_handler_t*( + CEF_CALLBACK* get_browser_process_handler)(struct _cef_app_t* self); + + /// + // Return the handler for functionality specific to the render process. This + // function is called on the render process main thread. + /// + struct _cef_render_process_handler_t*( + CEF_CALLBACK* get_render_process_handler)(struct _cef_app_t* self); +} cef_app_t; + +/// +// This function should be called from the application entry point function to +// execute a secondary process. It can be used to run secondary processes from +// the browser client executable (default behavior) or from a separate +// executable specified by the CefSettings.browser_subprocess_path value. If +// called for the browser process (identified by no "type" command-line value) +// it will return immediately with a value of -1. If called for a recognized +// secondary process it will block until the process should exit and then return +// the process exit code. The |application| parameter may be NULL. The +// |windows_sandbox_info| parameter is only used on Windows and may be NULL (see +// cef_sandbox_win.h for details). +/// +CEF_EXPORT int cef_execute_process(const struct _cef_main_args_t* args, + cef_app_t* application, + void* windows_sandbox_info); + +/// +// This function should be called on the main application thread to initialize +// the CEF browser process. The |application| parameter may be NULL. A return +// value of true (1) indicates that it succeeded and false (0) indicates that it +// failed. The |windows_sandbox_info| parameter is only used on Windows and may +// be NULL (see cef_sandbox_win.h for details). +/// +CEF_EXPORT int cef_initialize(const struct _cef_main_args_t* args, + const struct _cef_settings_t* settings, + cef_app_t* application, + void* windows_sandbox_info); + +/// +// This function should be called on the main application thread to shut down +// the CEF browser process before the application exits. +/// +CEF_EXPORT void cef_shutdown(); + +/// +// Perform a single iteration of CEF message loop processing. This function is +// provided for cases where the CEF message loop must be integrated into an +// existing application message loop. Use of this function is not recommended +// for most users; use either the cef_run_message_loop() function or +// CefSettings.multi_threaded_message_loop if possible. When using this function +// care must be taken to balance performance against excessive CPU usage. It is +// recommended to enable the CefSettings.external_message_pump option when using +// this function so that +// cef_browser_process_handler_t::on_schedule_message_pump_work() callbacks can +// facilitate the scheduling process. This function should only be called on the +// main application thread and only if cef_initialize() is called with a +// CefSettings.multi_threaded_message_loop value of false (0). This function +// will not block. +/// +CEF_EXPORT void cef_do_message_loop_work(); + +/// +// Run the CEF message loop. Use this function instead of an application- +// provided message loop to get the best balance between performance and CPU +// usage. This function should only be called on the main application thread and +// only if cef_initialize() is called with a +// CefSettings.multi_threaded_message_loop value of false (0). This function +// will block until a quit message is received by the system. +/// +CEF_EXPORT void cef_run_message_loop(); + +/// +// Quit the CEF message loop that was started by calling cef_run_message_loop(). +// This function should only be called on the main application thread and only +// if cef_run_message_loop() was used. +/// +CEF_EXPORT void cef_quit_message_loop(); + +/// +// Set to true (1) before calling Windows APIs like TrackPopupMenu that enter a +// modal message loop. Set to false (0) after exiting the modal message loop. +/// +CEF_EXPORT void cef_set_osmodal_loop(int osModalLoop); + +/// +// Call during process startup to enable High-DPI support on Windows 7 or newer. +// Older versions of Windows should be left DPI-unaware because they do not +// support DirectWrite and GDI fonts are kerned very badly. +/// +CEF_EXPORT void cef_enable_highdpi_support(); + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_ diff --git a/src/include/capi/cef_audio_handler_capi.h b/src/include/capi/cef_audio_handler_capi.h new file mode 100644 index 000000000..920b7e1e3 --- /dev/null +++ b/src/include/capi/cef_audio_handler_capi.h @@ -0,0 +1,110 @@ +// Copyright (c) 2019 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=0385a38b6761c5dec07bb89a95a007ad3c11bea6$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_AUDIO_HANDLER_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_AUDIO_HANDLER_CAPI_H_ +#pragma once + +#include "include/capi/cef_base_capi.h" +#include "include/capi/cef_browser_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/// +// Implement this structure to handle audio events All functions will be called +// on the UI thread +/// +typedef struct _cef_audio_handler_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Called when the stream identified by |audio_stream_id| has started. + // |audio_stream_id| will uniquely identify the stream across all future + // cef_audio_handler_t callbacks. OnAudioSteamStopped will always be called + // after OnAudioStreamStarted; both functions may be called multiple times for + // the same stream. |channels| is the number of channels, |channel_layout| is + // the layout of the channels and |sample_rate| is the stream sample rate. + // |frames_per_buffer| is the maximum number of frames that will occur in the + // PCM packet passed to OnAudioStreamPacket. + /// + void(CEF_CALLBACK* on_audio_stream_started)( + struct _cef_audio_handler_t* self, + struct _cef_browser_t* browser, + int audio_stream_id, + int channels, + cef_channel_layout_t channel_layout, + int sample_rate, + int frames_per_buffer); + + /// + // Called when a PCM packet is received for the stream identified by + // |audio_stream_id|. |data| is an array representing the raw PCM data as a + // floating point type, i.e. 4-byte value(s). |frames| is the number of frames + // in the PCM packet. |pts| is the presentation timestamp (in milliseconds + // since the Unix Epoch) and represents the time at which the decompressed + // packet should be presented to the user. Based on |frames| and the + // |channel_layout| value passed to OnAudioStreamStarted you can calculate the + // size of the |data| array in bytes. + /// + void(CEF_CALLBACK* on_audio_stream_packet)(struct _cef_audio_handler_t* self, + struct _cef_browser_t* browser, + int audio_stream_id, + const float** data, + int frames, + int64 pts); + + /// + // Called when the stream identified by |audio_stream_id| has stopped. + // OnAudioSteamStopped will always be called after OnAudioStreamStarted; both + // functions may be called multiple times for the same stream. + /// + void(CEF_CALLBACK* on_audio_stream_stopped)(struct _cef_audio_handler_t* self, + struct _cef_browser_t* browser, + int audio_stream_id); +} cef_audio_handler_t; + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_AUDIO_HANDLER_CAPI_H_ diff --git a/src/include/capi/cef_auth_callback_capi.h b/src/include/capi/cef_auth_callback_capi.h new file mode 100644 index 000000000..e7d65bb40 --- /dev/null +++ b/src/include/capi/cef_auth_callback_capi.h @@ -0,0 +1,76 @@ +// Copyright (c) 2019 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=9f05ee0596b82355ba8c07dcd8244a761b95df58$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_AUTH_CALLBACK_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_AUTH_CALLBACK_CAPI_H_ +#pragma once + +#include "include/capi/cef_base_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/// +// Callback structure used for asynchronous continuation of authentication +// requests. +/// +typedef struct _cef_auth_callback_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Continue the authentication request. + /// + void(CEF_CALLBACK* cont)(struct _cef_auth_callback_t* self, + const cef_string_t* username, + const cef_string_t* password); + + /// + // Cancel the authentication request. + /// + void(CEF_CALLBACK* cancel)(struct _cef_auth_callback_t* self); +} cef_auth_callback_t; + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_AUTH_CALLBACK_CAPI_H_ diff --git a/src/include/capi/cef_base_capi.h b/src/include/capi/cef_base_capi.h new file mode 100644 index 000000000..dbd0b9f33 --- /dev/null +++ b/src/include/capi/cef_base_capi.h @@ -0,0 +1,107 @@ +// Copyright (c) 2014 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_CAPI_CEF_BASE_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_BASE_CAPI_H_ + +#include + +#include "include/internal/cef_export.h" +#include "include/internal/cef_string.h" +#include "include/internal/cef_string_list.h" +#include "include/internal/cef_string_map.h" +#include "include/internal/cef_string_multimap.h" +#include "include/internal/cef_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/// +// All ref-counted framework structures must include this structure first. +/// +typedef struct _cef_base_ref_counted_t { + /// + // Size of the data structure. + /// + size_t size; + + /// + // Called to increment the reference count for the object. Should be called + // for every new copy of a pointer to a given object. + /// + void(CEF_CALLBACK* add_ref)(struct _cef_base_ref_counted_t* self); + + /// + // Called to decrement the reference count for the object. If the reference + // count falls to 0 the object should self-delete. Returns true (1) if the + // resulting reference count is 0. + /// + int(CEF_CALLBACK* release)(struct _cef_base_ref_counted_t* self); + + /// + // Returns true (1) if the current reference count is 1. + /// + int(CEF_CALLBACK* has_one_ref)(struct _cef_base_ref_counted_t* self); + + /// + // Returns true (1) if the current reference count is at least 1. + /// + int(CEF_CALLBACK* has_at_least_one_ref)(struct _cef_base_ref_counted_t* self); +} cef_base_ref_counted_t; + +/// +// All scoped framework structures must include this structure first. +/// +typedef struct _cef_base_scoped_t { + /// + // Size of the data structure. + /// + size_t size; + + /// + // Called to delete this object. May be NULL if the object is not owned. + /// + void(CEF_CALLBACK* del)(struct _cef_base_scoped_t* self); + +} cef_base_scoped_t; + +// Check that the structure |s|, which is defined with a size_t member at the +// top, is large enough to contain the specified member |f|. +#define CEF_MEMBER_EXISTS(s, f) \ + ((intptr_t) & \ + ((s)->f) - (intptr_t)(s) + sizeof((s)->f) <= *reinterpret_cast(s)) + +#define CEF_MEMBER_MISSING(s, f) (!CEF_MEMBER_EXISTS(s, f) || !((s)->f)) + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_BASE_CAPI_H_ diff --git a/src/include/capi/cef_browser_capi.h b/src/include/capi/cef_browser_capi.h new file mode 100644 index 000000000..a9b1f142b --- /dev/null +++ b/src/include/capi/cef_browser_capi.h @@ -0,0 +1,897 @@ +// Copyright (c) 2019 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=15f23de47af54fa690b6c5810e3049f97ae2aabd$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ +#pragma once + +#include "include/capi/cef_base_capi.h" +#include "include/capi/cef_drag_data_capi.h" +#include "include/capi/cef_frame_capi.h" +#include "include/capi/cef_image_capi.h" +#include "include/capi/cef_navigation_entry_capi.h" +#include "include/capi/cef_process_message_capi.h" +#include "include/capi/cef_request_context_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct _cef_browser_host_t; +struct _cef_client_t; + +/// +// Structure used to represent a browser window. When used in the browser +// process the functions of this structure may be called on any thread unless +// otherwise indicated in the comments. When used in the render process the +// functions of this structure may only be called on the main thread. +/// +typedef struct _cef_browser_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Returns the browser host object. This function can only be called in the + // browser process. + /// + struct _cef_browser_host_t*(CEF_CALLBACK* get_host)( + struct _cef_browser_t* self); + + /// + // Returns true (1) if the browser can navigate backwards. + /// + int(CEF_CALLBACK* can_go_back)(struct _cef_browser_t* self); + + /// + // Navigate backwards. + /// + void(CEF_CALLBACK* go_back)(struct _cef_browser_t* self); + + /// + // Returns true (1) if the browser can navigate forwards. + /// + int(CEF_CALLBACK* can_go_forward)(struct _cef_browser_t* self); + + /// + // Navigate forwards. + /// + void(CEF_CALLBACK* go_forward)(struct _cef_browser_t* self); + + /// + // Returns true (1) if the browser is currently loading. + /// + int(CEF_CALLBACK* is_loading)(struct _cef_browser_t* self); + + /// + // Reload the current page. + /// + void(CEF_CALLBACK* reload)(struct _cef_browser_t* self); + + /// + // Reload the current page ignoring any cached data. + /// + void(CEF_CALLBACK* reload_ignore_cache)(struct _cef_browser_t* self); + + /// + // Stop loading the page. + /// + void(CEF_CALLBACK* stop_load)(struct _cef_browser_t* self); + + /// + // Returns the globally unique identifier for this browser. This value is also + // used as the tabId for extension APIs. + /// + int(CEF_CALLBACK* get_identifier)(struct _cef_browser_t* self); + + /// + // Returns true (1) if this object is pointing to the same handle as |that| + // object. + /// + int(CEF_CALLBACK* is_same)(struct _cef_browser_t* self, + struct _cef_browser_t* that); + + /// + // Returns true (1) if the window is a popup window. + /// + int(CEF_CALLBACK* is_popup)(struct _cef_browser_t* self); + + /// + // Returns true (1) if a document has been loaded in the browser. + /// + int(CEF_CALLBACK* has_document)(struct _cef_browser_t* self); + + /// + // Returns the main (top-level) frame for the browser window. + /// + struct _cef_frame_t*(CEF_CALLBACK* get_main_frame)( + struct _cef_browser_t* self); + + /// + // Returns the focused frame for the browser window. + /// + struct _cef_frame_t*(CEF_CALLBACK* get_focused_frame)( + struct _cef_browser_t* self); + + /// + // Returns the frame with the specified identifier, or NULL if not found. + /// + struct _cef_frame_t*(CEF_CALLBACK* get_frame_byident)( + struct _cef_browser_t* self, + int64 identifier); + + /// + // Returns the frame with the specified name, or NULL if not found. + /// + struct _cef_frame_t*(CEF_CALLBACK* get_frame)(struct _cef_browser_t* self, + const cef_string_t* name); + + /// + // Returns the number of frames that currently exist. + /// + size_t(CEF_CALLBACK* get_frame_count)(struct _cef_browser_t* self); + + /// + // Returns the identifiers of all existing frames. + /// + void(CEF_CALLBACK* get_frame_identifiers)(struct _cef_browser_t* self, + size_t* identifiersCount, + int64* identifiers); + + /// + // Returns the names of all existing frames. + /// + void(CEF_CALLBACK* get_frame_names)(struct _cef_browser_t* self, + cef_string_list_t names); + + /// + // Send a message to the specified |target_process|. Returns true (1) if the + // message was sent successfully. + /// + int(CEF_CALLBACK* send_process_message)( + struct _cef_browser_t* self, + cef_process_id_t target_process, + struct _cef_process_message_t* message); +} cef_browser_t; + +/// +// Callback structure for cef_browser_host_t::RunFileDialog. The functions of +// this structure will be called on the browser process UI thread. +/// +typedef struct _cef_run_file_dialog_callback_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Called asynchronously after the file dialog is dismissed. + // |selected_accept_filter| is the 0-based index of the value selected from + // the accept filters array passed to cef_browser_host_t::RunFileDialog. + // |file_paths| will be a single value or a list of values depending on the + // dialog mode. If the selection was cancelled |file_paths| will be NULL. + /// + void(CEF_CALLBACK* on_file_dialog_dismissed)( + struct _cef_run_file_dialog_callback_t* self, + int selected_accept_filter, + cef_string_list_t file_paths); +} cef_run_file_dialog_callback_t; + +/// +// Callback structure for cef_browser_host_t::GetNavigationEntries. The +// functions of this structure will be called on the browser process UI thread. +/// +typedef struct _cef_navigation_entry_visitor_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Method that will be executed. Do not keep a reference to |entry| outside of + // this callback. Return true (1) to continue visiting entries or false (0) to + // stop. |current| is true (1) if this entry is the currently loaded + // navigation entry. |index| is the 0-based index of this entry and |total| is + // the total number of entries. + /// + int(CEF_CALLBACK* visit)(struct _cef_navigation_entry_visitor_t* self, + struct _cef_navigation_entry_t* entry, + int current, + int index, + int total); +} cef_navigation_entry_visitor_t; + +/// +// Callback structure for cef_browser_host_t::PrintToPDF. The functions of this +// structure will be called on the browser process UI thread. +/// +typedef struct _cef_pdf_print_callback_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Method that will be executed when the PDF printing has completed. |path| is + // the output path. |ok| will be true (1) if the printing completed + // successfully or false (0) otherwise. + /// + void(CEF_CALLBACK* on_pdf_print_finished)( + struct _cef_pdf_print_callback_t* self, + const cef_string_t* path, + int ok); +} cef_pdf_print_callback_t; + +/// +// Callback structure for cef_browser_host_t::DownloadImage. The functions of +// this structure will be called on the browser process UI thread. +/// +typedef struct _cef_download_image_callback_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Method that will be executed when the image download has completed. + // |image_url| is the URL that was downloaded and |http_status_code| is the + // resulting HTTP status code. |image| is the resulting image, possibly at + // multiple scale factors, or NULL if the download failed. + /// + void(CEF_CALLBACK* on_download_image_finished)( + struct _cef_download_image_callback_t* self, + const cef_string_t* image_url, + int http_status_code, + struct _cef_image_t* image); +} cef_download_image_callback_t; + +/// +// Structure used to represent the browser process aspects of a browser window. +// The functions of this structure can only be called in the browser process. +// They may be called on any thread in that process unless otherwise indicated +// in the comments. +/// +typedef struct _cef_browser_host_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Returns the hosted browser object. + /// + struct _cef_browser_t*(CEF_CALLBACK* get_browser)( + struct _cef_browser_host_t* self); + + /// + // Request that the browser close. The JavaScript 'onbeforeunload' event will + // be fired. If |force_close| is false (0) the event handler, if any, will be + // allowed to prompt the user and the user can optionally cancel the close. If + // |force_close| is true (1) the prompt will not be displayed and the close + // will proceed. Results in a call to cef_life_span_handler_t::do_close() if + // the event handler allows the close or if |force_close| is true (1). See + // cef_life_span_handler_t::do_close() documentation for additional usage + // information. + /// + void(CEF_CALLBACK* close_browser)(struct _cef_browser_host_t* self, + int force_close); + + /// + // Helper for closing a browser. Call this function from the top-level window + // close handler. Internally this calls CloseBrowser(false (0)) if the close + // has not yet been initiated. This function returns false (0) while the close + // is pending and true (1) after the close has completed. See close_browser() + // and cef_life_span_handler_t::do_close() documentation for additional usage + // information. This function must be called on the browser process UI thread. + /// + int(CEF_CALLBACK* try_close_browser)(struct _cef_browser_host_t* self); + + /// + // Set whether the browser is focused. + /// + void(CEF_CALLBACK* set_focus)(struct _cef_browser_host_t* self, int focus); + + /// + // Retrieve the window handle for this browser. If this browser is wrapped in + // a cef_browser_view_t this function should be called on the browser process + // UI thread and it will return the handle for the top-level native window. + /// + cef_window_handle_t(CEF_CALLBACK* get_window_handle)( + struct _cef_browser_host_t* self); + + /// + // Retrieve the window handle of the browser that opened this browser. Will + // return NULL for non-popup windows or if this browser is wrapped in a + // cef_browser_view_t. This function can be used in combination with custom + // handling of modal windows. + /// + cef_window_handle_t(CEF_CALLBACK* get_opener_window_handle)( + struct _cef_browser_host_t* self); + + /// + // Returns true (1) if this browser is wrapped in a cef_browser_view_t. + /// + int(CEF_CALLBACK* has_view)(struct _cef_browser_host_t* self); + + /// + // Returns the client for this browser. + /// + struct _cef_client_t*(CEF_CALLBACK* get_client)( + struct _cef_browser_host_t* self); + + /// + // Returns the request context for this browser. + /// + struct _cef_request_context_t*(CEF_CALLBACK* get_request_context)( + struct _cef_browser_host_t* self); + + /// + // Get the current zoom level. The default zoom level is 0.0. This function + // can only be called on the UI thread. + /// + double(CEF_CALLBACK* get_zoom_level)(struct _cef_browser_host_t* self); + + /// + // Change the zoom level to the specified value. Specify 0.0 to reset the zoom + // level. If called on the UI thread the change will be applied immediately. + // Otherwise, the change will be applied asynchronously on the UI thread. + /// + void(CEF_CALLBACK* set_zoom_level)(struct _cef_browser_host_t* self, + double zoomLevel); + + /// + // Call to run a file chooser dialog. Only a single file chooser dialog may be + // pending at any given time. |mode| represents the type of dialog to display. + // |title| to the title to be used for the dialog and may be NULL to show the + // default title ("Open" or "Save" depending on the mode). |default_file_path| + // is the path with optional directory and/or file name component that will be + // initially selected in the dialog. |accept_filters| are used to restrict the + // selectable file types and may any combination of (a) valid lower-cased MIME + // types (e.g. "text/*" or "image/*"), (b) individual file extensions (e.g. + // ".txt" or ".png"), or (c) combined description and file extension delimited + // using "|" and ";" (e.g. "Image Types|.png;.gif;.jpg"). + // |selected_accept_filter| is the 0-based index of the filter that will be + // selected by default. |callback| will be executed after the dialog is + // dismissed or immediately if another dialog is already pending. The dialog + // will be initiated asynchronously on the UI thread. + /// + void(CEF_CALLBACK* run_file_dialog)( + struct _cef_browser_host_t* self, + cef_file_dialog_mode_t mode, + const cef_string_t* title, + const cef_string_t* default_file_path, + cef_string_list_t accept_filters, + int selected_accept_filter, + struct _cef_run_file_dialog_callback_t* callback); + + /// + // Download the file at |url| using cef_download_handler_t. + /// + void(CEF_CALLBACK* start_download)(struct _cef_browser_host_t* self, + const cef_string_t* url); + + /// + // Download |image_url| and execute |callback| on completion with the images + // received from the renderer. If |is_favicon| is true (1) then cookies are + // not sent and not accepted during download. Images with density independent + // pixel (DIP) sizes larger than |max_image_size| are filtered out from the + // image results. Versions of the image at different scale factors may be + // downloaded up to the maximum scale factor supported by the system. If there + // are no image results <= |max_image_size| then the smallest image is resized + // to |max_image_size| and is the only result. A |max_image_size| of 0 means + // unlimited. If |bypass_cache| is true (1) then |image_url| is requested from + // the server even if it is present in the browser cache. + /// + void(CEF_CALLBACK* download_image)( + struct _cef_browser_host_t* self, + const cef_string_t* image_url, + int is_favicon, + uint32 max_image_size, + int bypass_cache, + struct _cef_download_image_callback_t* callback); + + /// + // Print the current browser contents. + /// + void(CEF_CALLBACK* print)(struct _cef_browser_host_t* self); + + /// + // Print the current browser contents to the PDF file specified by |path| and + // execute |callback| on completion. The caller is responsible for deleting + // |path| when done. For PDF printing to work on Linux you must implement the + // cef_print_handler_t::GetPdfPaperSize function. + /// + void(CEF_CALLBACK* print_to_pdf)( + struct _cef_browser_host_t* self, + const cef_string_t* path, + const struct _cef_pdf_print_settings_t* settings, + struct _cef_pdf_print_callback_t* callback); + + /// + // Search for |searchText|. |identifier| must be a unique ID and these IDs + // must strictly increase so that newer requests always have greater IDs than + // older requests. If |identifier| is zero or less than the previous ID value + // then it will be automatically assigned a new valid ID. |forward| indicates + // whether to search forward or backward within the page. |matchCase| + // indicates whether the search should be case-sensitive. |findNext| indicates + // whether this is the first request or a follow-up. The cef_find_handler_t + // instance, if any, returned via cef_client_t::GetFindHandler will be called + // to report find results. + /// + void(CEF_CALLBACK* find)(struct _cef_browser_host_t* self, + int identifier, + const cef_string_t* searchText, + int forward, + int matchCase, + int findNext); + + /// + // Cancel all searches that are currently going on. + /// + void(CEF_CALLBACK* stop_finding)(struct _cef_browser_host_t* self, + int clearSelection); + + /// + // Open developer tools (DevTools) in its own browser. The DevTools browser + // will remain associated with this browser. If the DevTools browser is + // already open then it will be focused, in which case the |windowInfo|, + // |client| and |settings| parameters will be ignored. If |inspect_element_at| + // is non-NULL then the element at the specified (x,y) location will be + // inspected. The |windowInfo| parameter will be ignored if this browser is + // wrapped in a cef_browser_view_t. + /// + void(CEF_CALLBACK* show_dev_tools)( + struct _cef_browser_host_t* self, + const struct _cef_window_info_t* windowInfo, + struct _cef_client_t* client, + const struct _cef_browser_settings_t* settings, + const cef_point_t* inspect_element_at); + + /// + // Explicitly close the associated DevTools browser, if any. + /// + void(CEF_CALLBACK* close_dev_tools)(struct _cef_browser_host_t* self); + + /// + // Returns true (1) if this browser currently has an associated DevTools + // browser. Must be called on the browser process UI thread. + /// + int(CEF_CALLBACK* has_dev_tools)(struct _cef_browser_host_t* self); + + /// + // Retrieve a snapshot of current navigation entries as values sent to the + // specified visitor. If |current_only| is true (1) only the current + // navigation entry will be sent, otherwise all navigation entries will be + // sent. + /// + void(CEF_CALLBACK* get_navigation_entries)( + struct _cef_browser_host_t* self, + struct _cef_navigation_entry_visitor_t* visitor, + int current_only); + + /// + // Set whether mouse cursor change is disabled. + /// + void(CEF_CALLBACK* set_mouse_cursor_change_disabled)( + struct _cef_browser_host_t* self, + int disabled); + + /// + // Returns true (1) if mouse cursor change is disabled. + /// + int(CEF_CALLBACK* is_mouse_cursor_change_disabled)( + struct _cef_browser_host_t* self); + + /// + // If a misspelled word is currently selected in an editable node calling this + // function will replace it with the specified |word|. + /// + void(CEF_CALLBACK* replace_misspelling)(struct _cef_browser_host_t* self, + const cef_string_t* word); + + /// + // Add the specified |word| to the spelling dictionary. + /// + void(CEF_CALLBACK* add_word_to_dictionary)(struct _cef_browser_host_t* self, + const cef_string_t* word); + + /// + // Returns true (1) if window rendering is disabled. + /// + int(CEF_CALLBACK* is_window_rendering_disabled)( + struct _cef_browser_host_t* self); + + /// + // Notify the browser that the widget has been resized. The browser will first + // call cef_render_handler_t::GetViewRect to get the new size and then call + // cef_render_handler_t::OnPaint asynchronously with the updated regions. This + // function is only used when window rendering is disabled. + /// + void(CEF_CALLBACK* was_resized)(struct _cef_browser_host_t* self); + + /// + // Notify the browser that it has been hidden or shown. Layouting and + // cef_render_handler_t::OnPaint notification will stop when the browser is + // hidden. This function is only used when window rendering is disabled. + /// + void(CEF_CALLBACK* was_hidden)(struct _cef_browser_host_t* self, int hidden); + + /// + // Send a notification to the browser that the screen info has changed. The + // browser will then call cef_render_handler_t::GetScreenInfo to update the + // screen information with the new values. This simulates moving the webview + // window from one display to another, or changing the properties of the + // current display. This function is only used when window rendering is + // disabled. + /// + void(CEF_CALLBACK* notify_screen_info_changed)( + struct _cef_browser_host_t* self); + + /// + // Invalidate the view. The browser will call cef_render_handler_t::OnPaint + // asynchronously. This function is only used when window rendering is + // disabled. + /// + void(CEF_CALLBACK* invalidate)(struct _cef_browser_host_t* self, + cef_paint_element_type_t type); + + /// + // Issue a BeginFrame request to Chromium. Only valid when + // cef_window_tInfo::external_begin_frame_enabled is set to true (1). + /// + void(CEF_CALLBACK* send_external_begin_frame)( + struct _cef_browser_host_t* self); + + /// + // Send a key event to the browser. + /// + void(CEF_CALLBACK* send_key_event)(struct _cef_browser_host_t* self, + const struct _cef_key_event_t* event); + + /// + // Send a mouse click event to the browser. The |x| and |y| coordinates are + // relative to the upper-left corner of the view. + /// + void(CEF_CALLBACK* send_mouse_click_event)( + struct _cef_browser_host_t* self, + const struct _cef_mouse_event_t* event, + cef_mouse_button_type_t type, + int mouseUp, + int clickCount); + + /// + // Send a mouse move event to the browser. The |x| and |y| coordinates are + // relative to the upper-left corner of the view. + /// + void(CEF_CALLBACK* send_mouse_move_event)( + struct _cef_browser_host_t* self, + const struct _cef_mouse_event_t* event, + int mouseLeave); + + /// + // Send a mouse wheel event to the browser. The |x| and |y| coordinates are + // relative to the upper-left corner of the view. The |deltaX| and |deltaY| + // values represent the movement delta in the X and Y directions respectively. + // In order to scroll inside select popups with window rendering disabled + // cef_render_handler_t::GetScreenPoint should be implemented properly. + /// + void(CEF_CALLBACK* send_mouse_wheel_event)( + struct _cef_browser_host_t* self, + const struct _cef_mouse_event_t* event, + int deltaX, + int deltaY); + + /// + // Send a touch event to the browser for a windowless browser. + /// + void(CEF_CALLBACK* send_touch_event)(struct _cef_browser_host_t* self, + const struct _cef_touch_event_t* event); + + /// + // Send a focus event to the browser. + /// + void(CEF_CALLBACK* send_focus_event)(struct _cef_browser_host_t* self, + int setFocus); + + /// + // Send a capture lost event to the browser. + /// + void(CEF_CALLBACK* send_capture_lost_event)(struct _cef_browser_host_t* self); + + /// + // Notify the browser that the window hosting it is about to be moved or + // resized. This function is only used on Windows and Linux. + /// + void(CEF_CALLBACK* notify_move_or_resize_started)( + struct _cef_browser_host_t* self); + + /// + // Returns the maximum rate in frames per second (fps) that + // cef_render_handler_t:: OnPaint will be called for a windowless browser. The + // actual fps may be lower if the browser cannot generate frames at the + // requested rate. The minimum value is 1 and the maximum value is 60 (default + // 30). This function can only be called on the UI thread. + /// + int(CEF_CALLBACK* get_windowless_frame_rate)( + struct _cef_browser_host_t* self); + + /// + // Set the maximum rate in frames per second (fps) that cef_render_handler_t:: + // OnPaint will be called for a windowless browser. The actual fps may be + // lower if the browser cannot generate frames at the requested rate. The + // minimum value is 1 and the maximum value is 60 (default 30). Can also be + // set at browser creation via cef_browser_tSettings.windowless_frame_rate. + /// + void(CEF_CALLBACK* set_windowless_frame_rate)( + struct _cef_browser_host_t* self, + int frame_rate); + + /// + // Begins a new composition or updates the existing composition. Blink has a + // special node (a composition node) that allows the input function to change + // text without affecting other DOM nodes. |text| is the optional text that + // will be inserted into the composition node. |underlines| is an optional set + // of ranges that will be underlined in the resulting text. + // |replacement_range| is an optional range of the existing text that will be + // replaced. |selection_range| is an optional range of the resulting text that + // will be selected after insertion or replacement. The |replacement_range| + // value is only used on OS X. + // + // This function may be called multiple times as the composition changes. When + // the client is done making changes the composition should either be canceled + // or completed. To cancel the composition call ImeCancelComposition. To + // complete the composition call either ImeCommitText or + // ImeFinishComposingText. Completion is usually signaled when: + // A. The client receives a WM_IME_COMPOSITION message with a GCS_RESULTSTR + // flag (on Windows), or; + // B. The client receives a "commit" signal of GtkIMContext (on Linux), or; + // C. insertText of NSTextInput is called (on Mac). + // + // This function is only used when window rendering is disabled. + /// + void(CEF_CALLBACK* ime_set_composition)( + struct _cef_browser_host_t* self, + const cef_string_t* text, + size_t underlinesCount, + cef_composition_underline_t const* underlines, + const cef_range_t* replacement_range, + const cef_range_t* selection_range); + + /// + // Completes the existing composition by optionally inserting the specified + // |text| into the composition node. |replacement_range| is an optional range + // of the existing text that will be replaced. |relative_cursor_pos| is where + // the cursor will be positioned relative to the current cursor position. See + // comments on ImeSetComposition for usage. The |replacement_range| and + // |relative_cursor_pos| values are only used on OS X. This function is only + // used when window rendering is disabled. + /// + void(CEF_CALLBACK* ime_commit_text)(struct _cef_browser_host_t* self, + const cef_string_t* text, + const cef_range_t* replacement_range, + int relative_cursor_pos); + + /// + // Completes the existing composition by applying the current composition node + // contents. If |keep_selection| is false (0) the current selection, if any, + // will be discarded. See comments on ImeSetComposition for usage. This + // function is only used when window rendering is disabled. + /// + void(CEF_CALLBACK* ime_finish_composing_text)( + struct _cef_browser_host_t* self, + int keep_selection); + + /// + // Cancels the existing composition and discards the composition node contents + // without applying them. See comments on ImeSetComposition for usage. This + // function is only used when window rendering is disabled. + /// + void(CEF_CALLBACK* ime_cancel_composition)(struct _cef_browser_host_t* self); + + /// + // Call this function when the user drags the mouse into the web view (before + // calling DragTargetDragOver/DragTargetLeave/DragTargetDrop). |drag_data| + // should not contain file contents as this type of data is not allowed to be + // dragged into the web view. File contents can be removed using + // cef_drag_data_t::ResetFileContents (for example, if |drag_data| comes from + // cef_render_handler_t::StartDragging). This function is only used when + // window rendering is disabled. + /// + void(CEF_CALLBACK* drag_target_drag_enter)( + struct _cef_browser_host_t* self, + struct _cef_drag_data_t* drag_data, + const struct _cef_mouse_event_t* event, + cef_drag_operations_mask_t allowed_ops); + + /// + // Call this function each time the mouse is moved across the web view during + // a drag operation (after calling DragTargetDragEnter and before calling + // DragTargetDragLeave/DragTargetDrop). This function is only used when window + // rendering is disabled. + /// + void(CEF_CALLBACK* drag_target_drag_over)( + struct _cef_browser_host_t* self, + const struct _cef_mouse_event_t* event, + cef_drag_operations_mask_t allowed_ops); + + /// + // Call this function when the user drags the mouse out of the web view (after + // calling DragTargetDragEnter). This function is only used when window + // rendering is disabled. + /// + void(CEF_CALLBACK* drag_target_drag_leave)(struct _cef_browser_host_t* self); + + /// + // Call this function when the user completes the drag operation by dropping + // the object onto the web view (after calling DragTargetDragEnter). The + // object being dropped is |drag_data|, given as an argument to the previous + // DragTargetDragEnter call. This function is only used when window rendering + // is disabled. + /// + void(CEF_CALLBACK* drag_target_drop)(struct _cef_browser_host_t* self, + const struct _cef_mouse_event_t* event); + + /// + // Call this function when the drag operation started by a + // cef_render_handler_t::StartDragging call has ended either in a drop or by + // being cancelled. |x| and |y| are mouse coordinates relative to the upper- + // left corner of the view. If the web view is both the drag source and the + // drag target then all DragTarget* functions should be called before + // DragSource* mthods. This function is only used when window rendering is + // disabled. + /// + void(CEF_CALLBACK* drag_source_ended_at)(struct _cef_browser_host_t* self, + int x, + int y, + cef_drag_operations_mask_t op); + + /// + // Call this function when the drag operation started by a + // cef_render_handler_t::StartDragging call has completed. This function may + // be called immediately without first calling DragSourceEndedAt to cancel a + // drag operation. If the web view is both the drag source and the drag target + // then all DragTarget* functions should be called before DragSource* mthods. + // This function is only used when window rendering is disabled. + /// + void(CEF_CALLBACK* drag_source_system_drag_ended)( + struct _cef_browser_host_t* self); + + /// + // Returns the current visible navigation entry for this browser. This + // function can only be called on the UI thread. + /// + struct _cef_navigation_entry_t*(CEF_CALLBACK* get_visible_navigation_entry)( + struct _cef_browser_host_t* self); + + /// + // Set accessibility state for all frames. |accessibility_state| may be + // default, enabled or disabled. If |accessibility_state| is STATE_DEFAULT + // then accessibility will be disabled by default and the state may be further + // controlled with the "force-renderer-accessibility" and "disable-renderer- + // accessibility" command-line switches. If |accessibility_state| is + // STATE_ENABLED then accessibility will be enabled. If |accessibility_state| + // is STATE_DISABLED then accessibility will be completely disabled. + // + // For windowed browsers accessibility will be enabled in Complete mode (which + // corresponds to kAccessibilityModeComplete in Chromium). In this mode all + // platform accessibility objects will be created and managed by Chromium's + // internal implementation. The client needs only to detect the screen reader + // and call this function appropriately. For example, on macOS the client can + // handle the @"AXEnhancedUserStructure" accessibility attribute to detect + // VoiceOver state changes and on Windows the client can handle WM_GETOBJECT + // with OBJID_CLIENT to detect accessibility readers. + // + // For windowless browsers accessibility will be enabled in TreeOnly mode + // (which corresponds to kAccessibilityModeWebContentsOnly in Chromium). In + // this mode renderer accessibility is enabled, the full tree is computed, and + // events are passed to CefAccessibiltyHandler, but platform accessibility + // objects are not created. The client may implement platform accessibility + // objects using CefAccessibiltyHandler callbacks if desired. + /// + void(CEF_CALLBACK* set_accessibility_state)(struct _cef_browser_host_t* self, + cef_state_t accessibility_state); + + /// + // Enable notifications of auto resize via + // cef_display_handler_t::OnAutoResize. Notifications are disabled by default. + // |min_size| and |max_size| define the range of allowed sizes. + /// + void(CEF_CALLBACK* set_auto_resize_enabled)(struct _cef_browser_host_t* self, + int enabled, + const cef_size_t* min_size, + const cef_size_t* max_size); + + /// + // Returns the extension hosted in this browser or NULL if no extension is + // hosted. See cef_request_tContext::LoadExtension for details. + /// + struct _cef_extension_t*(CEF_CALLBACK* get_extension)( + struct _cef_browser_host_t* self); + + /// + // Returns true (1) if this browser is hosting an extension background script. + // Background hosts do not have a window and are not displayable. See + // cef_request_tContext::LoadExtension for details. + /// + int(CEF_CALLBACK* is_background_host)(struct _cef_browser_host_t* self); + + /// + // Set whether the browser's audio is muted. + /// + void(CEF_CALLBACK* set_audio_muted)(struct _cef_browser_host_t* self, + int mute); + + /// + // Returns true (1) if the browser's audio is muted. This function can only + // be called on the UI thread. + /// + int(CEF_CALLBACK* is_audio_muted)(struct _cef_browser_host_t* self); +} cef_browser_host_t; + +/// +// Create a new browser window using the window parameters specified by +// |windowInfo|. All values will be copied internally and the actual window will +// be created on the UI thread. If |request_context| is NULL the global request +// context will be used. This function can be called on any browser process +// thread and will not block. +/// +CEF_EXPORT int cef_browser_host_create_browser( + const cef_window_info_t* windowInfo, + struct _cef_client_t* client, + const cef_string_t* url, + const struct _cef_browser_settings_t* settings, + struct _cef_request_context_t* request_context); + +/// +// Create a new browser window using the window parameters specified by +// |windowInfo|. If |request_context| is NULL the global request context will be +// used. This function can only be called on the browser process UI thread. +/// +CEF_EXPORT cef_browser_t* cef_browser_host_create_browser_sync( + const cef_window_info_t* windowInfo, + struct _cef_client_t* client, + const cef_string_t* url, + const struct _cef_browser_settings_t* settings, + struct _cef_request_context_t* request_context); + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ diff --git a/src/include/capi/cef_browser_process_handler_capi.h b/src/include/capi/cef_browser_process_handler_capi.h new file mode 100644 index 000000000..6894d3813 --- /dev/null +++ b/src/include/capi/cef_browser_process_handler_capi.h @@ -0,0 +1,121 @@ +// Copyright (c) 2019 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=372bc8b015110d2849eb1d8c16b616871e2d9320$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_PROCESS_HANDLER_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_BROWSER_PROCESS_HANDLER_CAPI_H_ +#pragma once + +#include "include/capi/cef_base_capi.h" +#include "include/capi/cef_command_line_capi.h" +#include "include/capi/cef_print_handler_capi.h" +#include "include/capi/cef_values_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/// +// Structure used to implement browser process callbacks. The functions of this +// structure will be called on the browser process main thread unless otherwise +// indicated. +/// +typedef struct _cef_browser_process_handler_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Called on the browser process UI thread immediately after the CEF context + // has been initialized. + /// + void(CEF_CALLBACK* on_context_initialized)( + struct _cef_browser_process_handler_t* self); + + /// + // Called before a child process is launched. Will be called on the browser + // process UI thread when launching a render process and on the browser + // process IO thread when launching a GPU or plugin process. Provides an + // opportunity to modify the child process command line. Do not keep a + // reference to |command_line| outside of this function. + /// + void(CEF_CALLBACK* on_before_child_process_launch)( + struct _cef_browser_process_handler_t* self, + struct _cef_command_line_t* command_line); + + /// + // Called on the browser process IO thread after the main thread has been + // created for a new render process. Provides an opportunity to specify extra + // information that will be passed to + // cef_render_process_handler_t::on_render_thread_created() in the render + // process. Do not keep a reference to |extra_info| outside of this function. + /// + void(CEF_CALLBACK* on_render_process_thread_created)( + struct _cef_browser_process_handler_t* self, + struct _cef_list_value_t* extra_info); + + /// + // Return the handler for printing on Linux. If a print handler is not + // provided then printing will not be supported on the Linux platform. + /// + struct _cef_print_handler_t*(CEF_CALLBACK* get_print_handler)( + struct _cef_browser_process_handler_t* self); + + /// + // Called from any thread when work has been scheduled for the browser process + // main (UI) thread. This callback is used in combination with CefSettings. + // external_message_pump and cef_do_message_loop_work() in cases where the CEF + // message loop must be integrated into an existing application message loop + // (see additional comments and warnings on CefDoMessageLoopWork). This + // callback should schedule a cef_do_message_loop_work() call to happen on the + // main (UI) thread. |delay_ms| is the requested delay in milliseconds. If + // |delay_ms| is <= 0 then the call should happen reasonably soon. If + // |delay_ms| is > 0 then the call should be scheduled to happen after the + // specified delay and any currently pending scheduled call should be + // cancelled. + /// + void(CEF_CALLBACK* on_schedule_message_pump_work)( + struct _cef_browser_process_handler_t* self, + int64 delay_ms); +} cef_browser_process_handler_t; + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_BROWSER_PROCESS_HANDLER_CAPI_H_ diff --git a/src/include/capi/cef_callback_capi.h b/src/include/capi/cef_callback_capi.h new file mode 100644 index 000000000..49421850a --- /dev/null +++ b/src/include/capi/cef_callback_capi.h @@ -0,0 +1,88 @@ +// Copyright (c) 2019 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=7419140aa82db2a86a5eca062193ac8bde9f5d40$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_CALLBACK_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_CALLBACK_CAPI_H_ +#pragma once + +#include "include/capi/cef_base_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/// +// Generic callback structure used for asynchronous continuation. +/// +typedef struct _cef_callback_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Continue processing. + /// + void(CEF_CALLBACK* cont)(struct _cef_callback_t* self); + + /// + // Cancel processing. + /// + void(CEF_CALLBACK* cancel)(struct _cef_callback_t* self); +} cef_callback_t; + +/// +// Generic callback structure used for asynchronous completion. +/// +typedef struct _cef_completion_callback_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Method that will be called once the task is complete. + /// + void(CEF_CALLBACK* on_complete)(struct _cef_completion_callback_t* self); +} cef_completion_callback_t; + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_CALLBACK_CAPI_H_ diff --git a/src/include/capi/cef_client_capi.h b/src/include/capi/cef_client_capi.h new file mode 100644 index 000000000..802ed79d4 --- /dev/null +++ b/src/include/capi/cef_client_capi.h @@ -0,0 +1,177 @@ +// Copyright (c) 2019 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=485de431252b72e5516f3f7f16a8d6f416801dfd$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_ +#pragma once + +#include "include/capi/cef_audio_handler_capi.h" +#include "include/capi/cef_base_capi.h" +#include "include/capi/cef_context_menu_handler_capi.h" +#include "include/capi/cef_dialog_handler_capi.h" +#include "include/capi/cef_display_handler_capi.h" +#include "include/capi/cef_download_handler_capi.h" +#include "include/capi/cef_drag_handler_capi.h" +#include "include/capi/cef_find_handler_capi.h" +#include "include/capi/cef_focus_handler_capi.h" +#include "include/capi/cef_jsdialog_handler_capi.h" +#include "include/capi/cef_keyboard_handler_capi.h" +#include "include/capi/cef_life_span_handler_capi.h" +#include "include/capi/cef_load_handler_capi.h" +#include "include/capi/cef_process_message_capi.h" +#include "include/capi/cef_render_handler_capi.h" +#include "include/capi/cef_request_handler_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/// +// Implement this structure to provide handler implementations. +/// +typedef struct _cef_client_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Return the handler for audio rendering events. + /// + struct _cef_audio_handler_t*(CEF_CALLBACK* get_audio_handler)( + struct _cef_client_t* self); + + /// + // Return the handler for context menus. If no handler is provided the default + // implementation will be used. + /// + struct _cef_context_menu_handler_t*(CEF_CALLBACK* get_context_menu_handler)( + struct _cef_client_t* self); + + /// + // Return the handler for dialogs. If no handler is provided the default + // implementation will be used. + /// + struct _cef_dialog_handler_t*(CEF_CALLBACK* get_dialog_handler)( + struct _cef_client_t* self); + + /// + // Return the handler for browser display state events. + /// + struct _cef_display_handler_t*(CEF_CALLBACK* get_display_handler)( + struct _cef_client_t* self); + + /// + // Return the handler for download events. If no handler is returned downloads + // will not be allowed. + /// + struct _cef_download_handler_t*(CEF_CALLBACK* get_download_handler)( + struct _cef_client_t* self); + + /// + // Return the handler for drag events. + /// + struct _cef_drag_handler_t*(CEF_CALLBACK* get_drag_handler)( + struct _cef_client_t* self); + + /// + // Return the handler for find result events. + /// + struct _cef_find_handler_t*(CEF_CALLBACK* get_find_handler)( + struct _cef_client_t* self); + + /// + // Return the handler for focus events. + /// + struct _cef_focus_handler_t*(CEF_CALLBACK* get_focus_handler)( + struct _cef_client_t* self); + + /// + // Return the handler for JavaScript dialogs. If no handler is provided the + // default implementation will be used. + /// + struct _cef_jsdialog_handler_t*(CEF_CALLBACK* get_jsdialog_handler)( + struct _cef_client_t* self); + + /// + // Return the handler for keyboard events. + /// + struct _cef_keyboard_handler_t*(CEF_CALLBACK* get_keyboard_handler)( + struct _cef_client_t* self); + + /// + // Return the handler for browser life span events. + /// + struct _cef_life_span_handler_t*(CEF_CALLBACK* get_life_span_handler)( + struct _cef_client_t* self); + + /// + // Return the handler for browser load status events. + /// + struct _cef_load_handler_t*(CEF_CALLBACK* get_load_handler)( + struct _cef_client_t* self); + + /// + // Return the handler for off-screen rendering events. + /// + struct _cef_render_handler_t*(CEF_CALLBACK* get_render_handler)( + struct _cef_client_t* self); + + /// + // Return the handler for browser request events. + /// + struct _cef_request_handler_t*(CEF_CALLBACK* get_request_handler)( + struct _cef_client_t* self); + + /// + // Called when a new message is received from a different process. Return true + // (1) if the message was handled or false (0) otherwise. Do not keep a + // reference to or attempt to access the message outside of this callback. + /// + int(CEF_CALLBACK* on_process_message_received)( + struct _cef_client_t* self, + struct _cef_browser_t* browser, + cef_process_id_t source_process, + struct _cef_process_message_t* message); +} cef_client_t; + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_ diff --git a/src/include/capi/cef_command_line_capi.h b/src/include/capi/cef_command_line_capi.h new file mode 100644 index 000000000..25a261b73 --- /dev/null +++ b/src/include/capi/cef_command_line_capi.h @@ -0,0 +1,214 @@ +// Copyright (c) 2019 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=540c73b297f3b0843058881c5a9a7433dc346fd2$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_COMMAND_LINE_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_COMMAND_LINE_CAPI_H_ +#pragma once + +#include "include/capi/cef_base_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/// +// Structure used to create and/or parse command line arguments. Arguments with +// '--', '-' and, on Windows, '/' prefixes are considered switches. Switches +// will always precede any arguments without switch prefixes. Switches can +// optionally have a value specified using the '=' delimiter (e.g. +// "-switch=value"). An argument of "--" will terminate switch parsing with all +// subsequent tokens, regardless of prefix, being interpreted as non-switch +// arguments. Switch names are considered case-insensitive. This structure can +// be used before cef_initialize() is called. +/// +typedef struct _cef_command_line_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Returns true (1) if this object is valid. Do not call any other functions + // if this function returns false (0). + /// + int(CEF_CALLBACK* is_valid)(struct _cef_command_line_t* self); + + /// + // Returns true (1) if the values of this object are read-only. Some APIs may + // expose read-only objects. + /// + int(CEF_CALLBACK* is_read_only)(struct _cef_command_line_t* self); + + /// + // Returns a writable copy of this object. + /// + struct _cef_command_line_t*(CEF_CALLBACK* copy)( + struct _cef_command_line_t* self); + + /// + // Initialize the command line with the specified |argc| and |argv| values. + // The first argument must be the name of the program. This function is only + // supported on non-Windows platforms. + /// + void(CEF_CALLBACK* init_from_argv)(struct _cef_command_line_t* self, + int argc, + const char* const* argv); + + /// + // Initialize the command line with the string returned by calling + // GetCommandLineW(). This function is only supported on Windows. + /// + void(CEF_CALLBACK* init_from_string)(struct _cef_command_line_t* self, + const cef_string_t* command_line); + + /// + // Reset the command-line switches and arguments but leave the program + // component unchanged. + /// + void(CEF_CALLBACK* reset)(struct _cef_command_line_t* self); + + /// + // Retrieve the original command line string as a vector of strings. The argv + // array: { program, [(--|-|/)switch[=value]]*, [--], [argument]* } + /// + void(CEF_CALLBACK* get_argv)(struct _cef_command_line_t* self, + cef_string_list_t argv); + + /// + // Constructs and returns the represented command line string. Use this + // function cautiously because quoting behavior is unclear. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_command_line_string)( + struct _cef_command_line_t* self); + + /// + // Get the program part of the command line string (the first item). + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_program)( + struct _cef_command_line_t* self); + + /// + // Set the program part of the command line string (the first item). + /// + void(CEF_CALLBACK* set_program)(struct _cef_command_line_t* self, + const cef_string_t* program); + + /// + // Returns true (1) if the command line has switches. + /// + int(CEF_CALLBACK* has_switches)(struct _cef_command_line_t* self); + + /// + // Returns true (1) if the command line contains the given switch. + /// + int(CEF_CALLBACK* has_switch)(struct _cef_command_line_t* self, + const cef_string_t* name); + + /// + // Returns the value associated with the given switch. If the switch has no + // value or isn't present this function returns the NULL string. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_switch_value)( + struct _cef_command_line_t* self, + const cef_string_t* name); + + /// + // Returns the map of switch names and values. If a switch has no value an + // NULL string is returned. + /// + void(CEF_CALLBACK* get_switches)(struct _cef_command_line_t* self, + cef_string_map_t switches); + + /// + // Add a switch to the end of the command line. If the switch has no value + // pass an NULL value string. + /// + void(CEF_CALLBACK* append_switch)(struct _cef_command_line_t* self, + const cef_string_t* name); + + /// + // Add a switch with the specified value to the end of the command line. + /// + void(CEF_CALLBACK* append_switch_with_value)(struct _cef_command_line_t* self, + const cef_string_t* name, + const cef_string_t* value); + + /// + // True if there are remaining command line arguments. + /// + int(CEF_CALLBACK* has_arguments)(struct _cef_command_line_t* self); + + /// + // Get the remaining command line arguments. + /// + void(CEF_CALLBACK* get_arguments)(struct _cef_command_line_t* self, + cef_string_list_t arguments); + + /// + // Add an argument to the end of the command line. + /// + void(CEF_CALLBACK* append_argument)(struct _cef_command_line_t* self, + const cef_string_t* argument); + + /// + // Insert a command before the current command. Common for debuggers, like + // "valgrind" or "gdb --args". + /// + void(CEF_CALLBACK* prepend_wrapper)(struct _cef_command_line_t* self, + const cef_string_t* wrapper); +} cef_command_line_t; + +/// +// Create a new cef_command_line_t instance. +/// +CEF_EXPORT cef_command_line_t* cef_command_line_create(); + +/// +// Returns the singleton global cef_command_line_t object. The returned object +// will be read-only. +/// +CEF_EXPORT cef_command_line_t* cef_command_line_get_global(); + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_COMMAND_LINE_CAPI_H_ diff --git a/src/include/capi/cef_context_menu_handler_capi.h b/src/include/capi/cef_context_menu_handler_capi.h new file mode 100644 index 000000000..e810dea35 --- /dev/null +++ b/src/include/capi/cef_context_menu_handler_capi.h @@ -0,0 +1,308 @@ +// Copyright (c) 2019 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=75b5bd826645fabb12c16c938b2fc30ec1642b1c$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_CONTEXT_MENU_HANDLER_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_CONTEXT_MENU_HANDLER_CAPI_H_ +#pragma once + +#include "include/capi/cef_base_capi.h" +#include "include/capi/cef_browser_capi.h" +#include "include/capi/cef_frame_capi.h" +#include "include/capi/cef_menu_model_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct _cef_context_menu_params_t; + +/// +// Callback structure used for continuation of custom context menu display. +/// +typedef struct _cef_run_context_menu_callback_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Complete context menu display by selecting the specified |command_id| and + // |event_flags|. + /// + void(CEF_CALLBACK* cont)(struct _cef_run_context_menu_callback_t* self, + int command_id, + cef_event_flags_t event_flags); + + /// + // Cancel context menu display. + /// + void(CEF_CALLBACK* cancel)(struct _cef_run_context_menu_callback_t* self); +} cef_run_context_menu_callback_t; + +/// +// Implement this structure to handle context menu events. The functions of this +// structure will be called on the UI thread. +/// +typedef struct _cef_context_menu_handler_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Called before a context menu is displayed. |params| provides information + // about the context menu state. |model| initially contains the default + // context menu. The |model| can be cleared to show no context menu or + // modified to show a custom menu. Do not keep references to |params| or + // |model| outside of this callback. + /// + void(CEF_CALLBACK* on_before_context_menu)( + struct _cef_context_menu_handler_t* self, + struct _cef_browser_t* browser, + struct _cef_frame_t* frame, + struct _cef_context_menu_params_t* params, + struct _cef_menu_model_t* model); + + /// + // Called to allow custom display of the context menu. |params| provides + // information about the context menu state. |model| contains the context menu + // model resulting from OnBeforeContextMenu. For custom display return true + // (1) and execute |callback| either synchronously or asynchronously with the + // selected command ID. For default display return false (0). Do not keep + // references to |params| or |model| outside of this callback. + /// + int(CEF_CALLBACK* run_context_menu)( + struct _cef_context_menu_handler_t* self, + struct _cef_browser_t* browser, + struct _cef_frame_t* frame, + struct _cef_context_menu_params_t* params, + struct _cef_menu_model_t* model, + struct _cef_run_context_menu_callback_t* callback); + + /// + // Called to execute a command selected from the context menu. Return true (1) + // if the command was handled or false (0) for the default implementation. See + // cef_menu_id_t for the command ids that have default implementations. All + // user-defined command ids should be between MENU_ID_USER_FIRST and + // MENU_ID_USER_LAST. |params| will have the same values as what was passed to + // on_before_context_menu(). Do not keep a reference to |params| outside of + // this callback. + /// + int(CEF_CALLBACK* on_context_menu_command)( + struct _cef_context_menu_handler_t* self, + struct _cef_browser_t* browser, + struct _cef_frame_t* frame, + struct _cef_context_menu_params_t* params, + int command_id, + cef_event_flags_t event_flags); + + /// + // Called when the context menu is dismissed irregardless of whether the menu + // was NULL or a command was selected. + /// + void(CEF_CALLBACK* on_context_menu_dismissed)( + struct _cef_context_menu_handler_t* self, + struct _cef_browser_t* browser, + struct _cef_frame_t* frame); +} cef_context_menu_handler_t; + +/// +// Provides information about the context menu state. The ethods of this +// structure can only be accessed on browser process the UI thread. +/// +typedef struct _cef_context_menu_params_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Returns the X coordinate of the mouse where the context menu was invoked. + // Coords are relative to the associated RenderView's origin. + /// + int(CEF_CALLBACK* get_xcoord)(struct _cef_context_menu_params_t* self); + + /// + // Returns the Y coordinate of the mouse where the context menu was invoked. + // Coords are relative to the associated RenderView's origin. + /// + int(CEF_CALLBACK* get_ycoord)(struct _cef_context_menu_params_t* self); + + /// + // Returns flags representing the type of node that the context menu was + // invoked on. + /// + cef_context_menu_type_flags_t(CEF_CALLBACK* get_type_flags)( + struct _cef_context_menu_params_t* self); + + /// + // Returns the URL of the link, if any, that encloses the node that the + // context menu was invoked on. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_link_url)( + struct _cef_context_menu_params_t* self); + + /// + // Returns the link URL, if any, to be used ONLY for "copy link address". We + // don't validate this field in the frontend process. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_unfiltered_link_url)( + struct _cef_context_menu_params_t* self); + + /// + // Returns the source URL, if any, for the element that the context menu was + // invoked on. Example of elements with source URLs are img, audio, and video. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_source_url)( + struct _cef_context_menu_params_t* self); + + /// + // Returns true (1) if the context menu was invoked on an image which has non- + // NULL contents. + /// + int(CEF_CALLBACK* has_image_contents)( + struct _cef_context_menu_params_t* self); + + /// + // Returns the title text or the alt text if the context menu was invoked on + // an image. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_title_text)( + struct _cef_context_menu_params_t* self); + + /// + // Returns the URL of the top level page that the context menu was invoked on. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_page_url)( + struct _cef_context_menu_params_t* self); + + /// + // Returns the URL of the subframe that the context menu was invoked on. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_frame_url)( + struct _cef_context_menu_params_t* self); + + /// + // Returns the character encoding of the subframe that the context menu was + // invoked on. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_frame_charset)( + struct _cef_context_menu_params_t* self); + + /// + // Returns the type of context node that the context menu was invoked on. + /// + cef_context_menu_media_type_t(CEF_CALLBACK* get_media_type)( + struct _cef_context_menu_params_t* self); + + /// + // Returns flags representing the actions supported by the media element, if + // any, that the context menu was invoked on. + /// + cef_context_menu_media_state_flags_t(CEF_CALLBACK* get_media_state_flags)( + struct _cef_context_menu_params_t* self); + + /// + // Returns the text of the selection, if any, that the context menu was + // invoked on. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_selection_text)( + struct _cef_context_menu_params_t* self); + + /// + // Returns the text of the misspelled word, if any, that the context menu was + // invoked on. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_misspelled_word)( + struct _cef_context_menu_params_t* self); + + /// + // Returns true (1) if suggestions exist, false (0) otherwise. Fills in + // |suggestions| from the spell check service for the misspelled word if there + // is one. + /// + int(CEF_CALLBACK* get_dictionary_suggestions)( + struct _cef_context_menu_params_t* self, + cef_string_list_t suggestions); + + /// + // Returns true (1) if the context menu was invoked on an editable node. + /// + int(CEF_CALLBACK* is_editable)(struct _cef_context_menu_params_t* self); + + /// + // Returns true (1) if the context menu was invoked on an editable node where + // spell-check is enabled. + /// + int(CEF_CALLBACK* is_spell_check_enabled)( + struct _cef_context_menu_params_t* self); + + /// + // Returns flags representing the actions supported by the editable node, if + // any, that the context menu was invoked on. + /// + cef_context_menu_edit_state_flags_t(CEF_CALLBACK* get_edit_state_flags)( + struct _cef_context_menu_params_t* self); + + /// + // Returns true (1) if the context menu contains items specified by the + // renderer process (for example, plugin placeholder or pepper plugin menu + // items). + /// + int(CEF_CALLBACK* is_custom_menu)(struct _cef_context_menu_params_t* self); + + /// + // Returns true (1) if the context menu was invoked from a pepper plugin. + /// + int(CEF_CALLBACK* is_pepper_menu)(struct _cef_context_menu_params_t* self); +} cef_context_menu_params_t; + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_CONTEXT_MENU_HANDLER_CAPI_H_ diff --git a/src/include/capi/cef_cookie_capi.h b/src/include/capi/cef_cookie_capi.h new file mode 100644 index 000000000..802dba051 --- /dev/null +++ b/src/include/capi/cef_cookie_capi.h @@ -0,0 +1,250 @@ +// Copyright (c) 2019 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=48b5fa68109eed1ea30fa0c805218ebd258c0573$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_ +#pragma once + +#include "include/capi/cef_base_capi.h" +#include "include/capi/cef_callback_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct _cef_cookie_visitor_t; +struct _cef_delete_cookies_callback_t; +struct _cef_set_cookie_callback_t; + +/// +// Structure used for managing cookies. The functions of this structure may be +// called on any thread unless otherwise indicated. +/// +typedef struct _cef_cookie_manager_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Set the schemes supported by this manager. The default schemes ("http", + // "https", "ws" and "wss") will always be supported. If |callback| is non- + // NULL it will be executed asnychronously on the IO thread after the change + // has been applied. Must be called before any cookies are accessed. + /// + void(CEF_CALLBACK* set_supported_schemes)( + struct _cef_cookie_manager_t* self, + cef_string_list_t schemes, + struct _cef_completion_callback_t* callback); + + /// + // Visit all cookies on the IO thread. The returned cookies are ordered by + // longest path, then by earliest creation date. Returns false (0) if cookies + // cannot be accessed. + /// + int(CEF_CALLBACK* visit_all_cookies)(struct _cef_cookie_manager_t* self, + struct _cef_cookie_visitor_t* visitor); + + /// + // Visit a subset of cookies on the IO thread. The results are filtered by the + // given url scheme, host, domain and path. If |includeHttpOnly| is true (1) + // HTTP-only cookies will also be included in the results. The returned + // cookies are ordered by longest path, then by earliest creation date. + // Returns false (0) if cookies cannot be accessed. + /// + int(CEF_CALLBACK* visit_url_cookies)(struct _cef_cookie_manager_t* self, + const cef_string_t* url, + int includeHttpOnly, + struct _cef_cookie_visitor_t* visitor); + + /// + // Sets a cookie given a valid URL and explicit user-provided cookie + // attributes. This function expects each attribute to be well-formed. It will + // check for disallowed characters (e.g. the ';' character is disallowed + // within the cookie value attribute) and fail without setting the cookie if + // such characters are found. If |callback| is non-NULL it will be executed + // asnychronously on the IO thread after the cookie has been set. Returns + // false (0) if an invalid URL is specified or if cookies cannot be accessed. + /// + int(CEF_CALLBACK* set_cookie)(struct _cef_cookie_manager_t* self, + const cef_string_t* url, + const struct _cef_cookie_t* cookie, + struct _cef_set_cookie_callback_t* callback); + + /// + // Delete all cookies that match the specified parameters. If both |url| and + // |cookie_name| values are specified all host and domain cookies matching + // both will be deleted. If only |url| is specified all host cookies (but not + // domain cookies) irrespective of path will be deleted. If |url| is NULL all + // cookies for all hosts and domains will be deleted. If |callback| is non- + // NULL it will be executed asnychronously on the IO thread after the cookies + // have been deleted. Returns false (0) if a non-NULL invalid URL is specified + // or if cookies cannot be accessed. Cookies can alternately be deleted using + // the Visit*Cookies() functions. + /// + int(CEF_CALLBACK* delete_cookies)( + struct _cef_cookie_manager_t* self, + const cef_string_t* url, + const cef_string_t* cookie_name, + struct _cef_delete_cookies_callback_t* callback); + + /// + // Sets the directory path that will be used for storing cookie data. If + // |path| is NULL data will be stored in memory only. Otherwise, data will be + // stored at the specified |path|. To persist session cookies (cookies without + // an expiry date or validity interval) set |persist_session_cookies| to true + // (1). Session cookies are generally intended to be transient and most Web + // browsers do not persist them. If |callback| is non-NULL it will be executed + // asnychronously on the IO thread after the manager's storage has been + // initialized. Returns false (0) if cookies cannot be accessed. + /// + int(CEF_CALLBACK* set_storage_path)( + struct _cef_cookie_manager_t* self, + const cef_string_t* path, + int persist_session_cookies, + struct _cef_completion_callback_t* callback); + + /// + // Flush the backing store (if any) to disk. If |callback| is non-NULL it will + // be executed asnychronously on the IO thread after the flush is complete. + // Returns false (0) if cookies cannot be accessed. + /// + int(CEF_CALLBACK* flush_store)(struct _cef_cookie_manager_t* self, + struct _cef_completion_callback_t* callback); +} cef_cookie_manager_t; + +/// +// Returns the global cookie manager. By default data will be stored at +// CefSettings.cache_path if specified or in memory otherwise. If |callback| is +// non-NULL it will be executed asnychronously on the IO thread after the +// manager's storage has been initialized. Using this function is equivalent to +// calling cef_request_tContext::cef_request_context_get_global_context()->get_d +// efault_cookie_manager(). +/// +CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_global_manager( + struct _cef_completion_callback_t* callback); + +/// +// Returns a cookie manager that neither stores nor retrieves cookies. All usage +// of cookies will be blocked including cookies accessed via the network +// (request/response headers), via JavaScript (document.cookie), and via +// cef_cookie_manager_t functions. No cookies will be displayed in DevTools. If +// you wish to only block cookies sent via the network use the +// cef_request_tHandler CanGetCookies and CanSetCookie functions instead. +/// +CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_blocking_manager(); + +/// +// Creates a new cookie manager. If |path| is NULL data will be stored in memory +// only. Otherwise, data will be stored at the specified |path|. To persist +// session cookies (cookies without an expiry date or validity interval) set +// |persist_session_cookies| to true (1). Session cookies are generally intended +// to be transient and most Web browsers do not persist them. If |callback| is +// non-NULL it will be executed asnychronously on the IO thread after the +// manager's storage has been initialized. +/// +CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_create_manager( + const cef_string_t* path, + int persist_session_cookies, + struct _cef_completion_callback_t* callback); + +/// +// Structure to implement for visiting cookie values. The functions of this +// structure will always be called on the IO thread. +/// +typedef struct _cef_cookie_visitor_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Method that will be called once for each cookie. |count| is the 0-based + // index for the current cookie. |total| is the total number of cookies. Set + // |deleteCookie| to true (1) to delete the cookie currently being visited. + // Return false (0) to stop visiting cookies. This function may never be + // called if no cookies are found. + /// + int(CEF_CALLBACK* visit)(struct _cef_cookie_visitor_t* self, + const struct _cef_cookie_t* cookie, + int count, + int total, + int* deleteCookie); +} cef_cookie_visitor_t; + +/// +// Structure to implement to be notified of asynchronous completion via +// cef_cookie_manager_t::set_cookie(). +/// +typedef struct _cef_set_cookie_callback_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Method that will be called upon completion. |success| will be true (1) if + // the cookie was set successfully. + /// + void(CEF_CALLBACK* on_complete)(struct _cef_set_cookie_callback_t* self, + int success); +} cef_set_cookie_callback_t; + +/// +// Structure to implement to be notified of asynchronous completion via +// cef_cookie_manager_t::delete_cookies(). +/// +typedef struct _cef_delete_cookies_callback_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Method that will be called upon completion. |num_deleted| will be the + // number of cookies that were deleted. + /// + void(CEF_CALLBACK* on_complete)(struct _cef_delete_cookies_callback_t* self, + int num_deleted); +} cef_delete_cookies_callback_t; + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_ diff --git a/src/include/capi/cef_crash_util_capi.h b/src/include/capi/cef_crash_util_capi.h new file mode 100644 index 000000000..522367d30 --- /dev/null +++ b/src/include/capi/cef_crash_util_capi.h @@ -0,0 +1,151 @@ +// Copyright (c) 2019 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=d8c4816346fdf48b987c88a94c51c9d67624abe0$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_CRASH_UTIL_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_CRASH_UTIL_CAPI_H_ +#pragma once + +#include "include/capi/cef_base_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/// +// Crash reporting is configured using an INI-style config file named +// "crash_reporter.cfg". On Windows and Linux this file must be placed next to +// the main application executable. On macOS this file must be placed in the +// top-level app bundle Resources directory (e.g. +// ".app/Contents/Resources"). File contents are as follows: +// +// # Comments start with a hash character and must be on their own line. +// +// [Config] +// ProductName= +// ProductVersion= +// AppName= +// ExternalHandler= +// BrowserCrashForwardingEnabled= +// ServerURL= +// RateLimitEnabled= +// MaxUploadsPerDay= +// MaxDatabaseSizeInMb= +// MaxDatabaseAgeInDays= +// +// [CrashKeys] +// my_key1= +// my_key2= +// +// Config section: +// +// If "ProductName" and/or "ProductVersion" are set then the specified values +// will be included in the crash dump metadata. On macOS if these values are set +// to NULL then they will be retrieved from the Info.plist file using the +// "CFBundleName" and "CFBundleShortVersionString" keys respectively. +// +// If "AppName" is set on Windows then crash report information (metrics, +// database and dumps) will be stored locally on disk under the +// "C:\Users\[CurrentUser]\AppData\Local\[AppName]\User Data" folder. On other +// platforms the CefSettings.user_data_path value will be used. +// +// If "ExternalHandler" is set on Windows then the specified exe will be +// launched as the crashpad-handler instead of re-launching the main process +// exe. The value can be an absolute path or a path relative to the main exe +// directory. On Linux the CefSettings.browser_subprocess_path value will be +// used. On macOS the existing subprocess app bundle will be used. +// +// If "BrowserCrashForwardingEnabled" is set to true (1) on macOS then browser +// process crashes will be forwarded to the system crash reporter. This results +// in the crash UI dialog being displayed to the user and crash reports being +// logged under "~/Library/Logs/DiagnosticReports". Forwarding of crash reports +// from non-browser processes and Debug builds is always disabled. +// +// If "ServerURL" is set then crashes will be uploaded as a multi-part POST +// request to the specified URL. Otherwise, reports will only be stored locally +// on disk. +// +// If "RateLimitEnabled" is set to true (1) then crash report uploads will be +// rate limited as follows: +// 1. If "MaxUploadsPerDay" is set to a positive value then at most the +// specified number of crashes will be uploaded in each 24 hour period. +// 2. If crash upload fails due to a network or server error then an +// incremental backoff delay up to a maximum of 24 hours will be applied for +// retries. +// 3. If a backoff delay is applied and "MaxUploadsPerDay" is > 1 then the +// "MaxUploadsPerDay" value will be reduced to 1 until the client is +// restarted. This helps to avoid an upload flood when the network or +// server error is resolved. +// Rate limiting is not supported on Linux. +// +// If "MaxDatabaseSizeInMb" is set to a positive value then crash report storage +// on disk will be limited to that size in megabytes. For example, on Windows +// each dump is about 600KB so a "MaxDatabaseSizeInMb" value of 20 equates to +// about 34 crash reports stored on disk. Not supported on Linux. +// +// If "MaxDatabaseAgeInDays" is set to a positive value then crash reports older +// than the specified age in days will be deleted. Not supported on Linux. +// +// CrashKeys section: +// +// A maximum of 26 crash keys of each size can be specified for use by the +// application. Crash key values will be truncated based on the specified size +// (small = 64 bytes, medium = 256 bytes, large = 1024 bytes). The value of +// crash keys can be set from any thread or process using the +// CefSetCrashKeyValue function. These key/value pairs will be sent to the crash +// server along with the crash dump file. +/// +CEF_EXPORT int cef_crash_reporting_enabled(); + +/// +// Sets or clears a specific key-value pair from the crash metadata. +/// +CEF_EXPORT void cef_set_crash_key_value(const cef_string_t* key, + const cef_string_t* value); + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_CRASH_UTIL_CAPI_H_ diff --git a/src/include/capi/cef_dialog_handler_capi.h b/src/include/capi/cef_dialog_handler_capi.h new file mode 100644 index 000000000..f18491100 --- /dev/null +++ b/src/include/capi/cef_dialog_handler_capi.h @@ -0,0 +1,116 @@ +// Copyright (c) 2019 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=23627ca4a51e3256889c05360f3fe143172f4ad6$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_DIALOG_HANDLER_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_DIALOG_HANDLER_CAPI_H_ +#pragma once + +#include "include/capi/cef_base_capi.h" +#include "include/capi/cef_browser_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/// +// Callback structure for asynchronous continuation of file dialog requests. +/// +typedef struct _cef_file_dialog_callback_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Continue the file selection. |selected_accept_filter| should be the 0-based + // index of the value selected from the accept filters array passed to + // cef_dialog_handler_t::OnFileDialog. |file_paths| should be a single value + // or a list of values depending on the dialog mode. An NULL |file_paths| + // value is treated the same as calling cancel(). + /// + void(CEF_CALLBACK* cont)(struct _cef_file_dialog_callback_t* self, + int selected_accept_filter, + cef_string_list_t file_paths); + + /// + // Cancel the file selection. + /// + void(CEF_CALLBACK* cancel)(struct _cef_file_dialog_callback_t* self); +} cef_file_dialog_callback_t; + +/// +// Implement this structure to handle dialog events. The functions of this +// structure will be called on the browser process UI thread. +/// +typedef struct _cef_dialog_handler_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Called to run a file chooser dialog. |mode| represents the type of dialog + // to display. |title| to the title to be used for the dialog and may be NULL + // to show the default title ("Open" or "Save" depending on the mode). + // |default_file_path| is the path with optional directory and/or file name + // component that should be initially selected in the dialog. |accept_filters| + // are used to restrict the selectable file types and may any combination of + // (a) valid lower-cased MIME types (e.g. "text/*" or "image/*"), (b) + // individual file extensions (e.g. ".txt" or ".png"), or (c) combined + // description and file extension delimited using "|" and ";" (e.g. "Image + // Types|.png;.gif;.jpg"). |selected_accept_filter| is the 0-based index of + // the filter that should be selected by default. To display a custom dialog + // return true (1) and execute |callback| either inline or at a later time. To + // display the default dialog return false (0). + /// + int(CEF_CALLBACK* on_file_dialog)( + struct _cef_dialog_handler_t* self, + struct _cef_browser_t* browser, + cef_file_dialog_mode_t mode, + const cef_string_t* title, + const cef_string_t* default_file_path, + cef_string_list_t accept_filters, + int selected_accept_filter, + struct _cef_file_dialog_callback_t* callback); +} cef_dialog_handler_t; + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_DIALOG_HANDLER_CAPI_H_ diff --git a/src/include/capi/cef_display_handler_capi.h b/src/include/capi/cef_display_handler_capi.h new file mode 100644 index 000000000..dc4e78171 --- /dev/null +++ b/src/include/capi/cef_display_handler_capi.h @@ -0,0 +1,150 @@ +// Copyright (c) 2019 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=f6998cb056849c4d73f47142988bd4900784e0c6$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_DISPLAY_HANDLER_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_DISPLAY_HANDLER_CAPI_H_ +#pragma once + +#include "include/capi/cef_base_capi.h" +#include "include/capi/cef_browser_capi.h" +#include "include/capi/cef_frame_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/// +// Implement this structure to handle events related to browser display state. +// The functions of this structure will be called on the UI thread. +/// +typedef struct _cef_display_handler_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Called when a frame's address has changed. + /// + void(CEF_CALLBACK* on_address_change)(struct _cef_display_handler_t* self, + struct _cef_browser_t* browser, + struct _cef_frame_t* frame, + const cef_string_t* url); + + /// + // Called when the page title changes. + /// + void(CEF_CALLBACK* on_title_change)(struct _cef_display_handler_t* self, + struct _cef_browser_t* browser, + const cef_string_t* title); + + /// + // Called when the page icon changes. + /// + void(CEF_CALLBACK* on_favicon_urlchange)(struct _cef_display_handler_t* self, + struct _cef_browser_t* browser, + cef_string_list_t icon_urls); + + /// + // Called when web content in the page has toggled fullscreen mode. If + // |fullscreen| is true (1) the content will automatically be sized to fill + // the browser content area. If |fullscreen| is false (0) the content will + // automatically return to its original size and position. The client is + // responsible for resizing the browser if desired. + /// + void(CEF_CALLBACK* on_fullscreen_mode_change)( + struct _cef_display_handler_t* self, + struct _cef_browser_t* browser, + int fullscreen); + + /// + // Called when the browser is about to display a tooltip. |text| contains the + // text that will be displayed in the tooltip. To handle the display of the + // tooltip yourself return true (1). Otherwise, you can optionally modify + // |text| and then return false (0) to allow the browser to display the + // tooltip. When window rendering is disabled the application is responsible + // for drawing tooltips and the return value is ignored. + /// + int(CEF_CALLBACK* on_tooltip)(struct _cef_display_handler_t* self, + struct _cef_browser_t* browser, + cef_string_t* text); + + /// + // Called when the browser receives a status message. |value| contains the + // text that will be displayed in the status message. + /// + void(CEF_CALLBACK* on_status_message)(struct _cef_display_handler_t* self, + struct _cef_browser_t* browser, + const cef_string_t* value); + + /// + // Called to display a console message. Return true (1) to stop the message + // from being output to the console. + /// + int(CEF_CALLBACK* on_console_message)(struct _cef_display_handler_t* self, + struct _cef_browser_t* browser, + cef_log_severity_t level, + const cef_string_t* message, + const cef_string_t* source, + int line); + + /// + // Called when auto-resize is enabled via + // cef_browser_host_t::SetAutoResizeEnabled and the contents have auto- + // resized. |new_size| will be the desired size in view coordinates. Return + // true (1) if the resize was handled or false (0) for default handling. + /// + int(CEF_CALLBACK* on_auto_resize)(struct _cef_display_handler_t* self, + struct _cef_browser_t* browser, + const cef_size_t* new_size); + + /// + // Called when the overall page loading progress has changed. |progress| + // ranges from 0.0 to 1.0. + /// + void(CEF_CALLBACK* on_loading_progress_change)( + struct _cef_display_handler_t* self, + struct _cef_browser_t* browser, + double progress); +} cef_display_handler_t; + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_DISPLAY_HANDLER_CAPI_H_ diff --git a/src/include/capi/cef_dom_capi.h b/src/include/capi/cef_dom_capi.h new file mode 100644 index 000000000..d2613c9c2 --- /dev/null +++ b/src/include/capi/cef_dom_capi.h @@ -0,0 +1,347 @@ +// Copyright (c) 2019 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=b8d77a12530d3da606587bf97eacf9169cae0710$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_DOM_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_DOM_CAPI_H_ +#pragma once + +#include "include/capi/cef_base_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct _cef_domdocument_t; +struct _cef_domnode_t; + +/// +// Structure to implement for visiting the DOM. The functions of this structure +// will be called on the render process main thread. +/// +typedef struct _cef_domvisitor_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Method executed for visiting the DOM. The document object passed to this + // function represents a snapshot of the DOM at the time this function is + // executed. DOM objects are only valid for the scope of this function. Do not + // keep references to or attempt to access any DOM objects outside the scope + // of this function. + /// + void(CEF_CALLBACK* visit)(struct _cef_domvisitor_t* self, + struct _cef_domdocument_t* document); +} cef_domvisitor_t; + +/// +// Structure used to represent a DOM document. The functions of this structure +// should only be called on the render process main thread thread. +/// +typedef struct _cef_domdocument_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Returns the document type. + /// + cef_dom_document_type_t(CEF_CALLBACK* get_type)( + struct _cef_domdocument_t* self); + + /// + // Returns the root document node. + /// + struct _cef_domnode_t*(CEF_CALLBACK* get_document)( + struct _cef_domdocument_t* self); + + /// + // Returns the BODY node of an HTML document. + /// + struct _cef_domnode_t*(CEF_CALLBACK* get_body)( + struct _cef_domdocument_t* self); + + /// + // Returns the HEAD node of an HTML document. + /// + struct _cef_domnode_t*(CEF_CALLBACK* get_head)( + struct _cef_domdocument_t* self); + + /// + // Returns the title of an HTML document. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_title)( + struct _cef_domdocument_t* self); + + /// + // Returns the document element with the specified ID value. + /// + struct _cef_domnode_t*(CEF_CALLBACK* get_element_by_id)( + struct _cef_domdocument_t* self, + const cef_string_t* id); + + /// + // Returns the node that currently has keyboard focus. + /// + struct _cef_domnode_t*(CEF_CALLBACK* get_focused_node)( + struct _cef_domdocument_t* self); + + /// + // Returns true (1) if a portion of the document is selected. + /// + int(CEF_CALLBACK* has_selection)(struct _cef_domdocument_t* self); + + /// + // Returns the selection offset within the start node. + /// + int(CEF_CALLBACK* get_selection_start_offset)( + struct _cef_domdocument_t* self); + + /// + // Returns the selection offset within the end node. + /// + int(CEF_CALLBACK* get_selection_end_offset)(struct _cef_domdocument_t* self); + + /// + // Returns the contents of this selection as markup. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_selection_as_markup)( + struct _cef_domdocument_t* self); + + /// + // Returns the contents of this selection as text. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_selection_as_text)( + struct _cef_domdocument_t* self); + + /// + // Returns the base URL for the document. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_base_url)( + struct _cef_domdocument_t* self); + + /// + // Returns a complete URL based on the document base URL and the specified + // partial URL. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_complete_url)( + struct _cef_domdocument_t* self, + const cef_string_t* partialURL); +} cef_domdocument_t; + +/// +// Structure used to represent a DOM node. The functions of this structure +// should only be called on the render process main thread. +/// +typedef struct _cef_domnode_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Returns the type for this node. + /// + cef_dom_node_type_t(CEF_CALLBACK* get_type)(struct _cef_domnode_t* self); + + /// + // Returns true (1) if this is a text node. + /// + int(CEF_CALLBACK* is_text)(struct _cef_domnode_t* self); + + /// + // Returns true (1) if this is an element node. + /// + int(CEF_CALLBACK* is_element)(struct _cef_domnode_t* self); + + /// + // Returns true (1) if this is an editable node. + /// + int(CEF_CALLBACK* is_editable)(struct _cef_domnode_t* self); + + /// + // Returns true (1) if this is a form control element node. + /// + int(CEF_CALLBACK* is_form_control_element)(struct _cef_domnode_t* self); + + /// + // Returns the type of this form control element node. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_form_control_element_type)( + struct _cef_domnode_t* self); + + /// + // Returns true (1) if this object is pointing to the same handle as |that| + // object. + /// + int(CEF_CALLBACK* is_same)(struct _cef_domnode_t* self, + struct _cef_domnode_t* that); + + /// + // Returns the name of this node. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_name)(struct _cef_domnode_t* self); + + /// + // Returns the value of this node. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_value)(struct _cef_domnode_t* self); + + /// + // Set the value of this node. Returns true (1) on success. + /// + int(CEF_CALLBACK* set_value)(struct _cef_domnode_t* self, + const cef_string_t* value); + + /// + // Returns the contents of this node as markup. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_as_markup)( + struct _cef_domnode_t* self); + + /// + // Returns the document associated with this node. + /// + struct _cef_domdocument_t*(CEF_CALLBACK* get_document)( + struct _cef_domnode_t* self); + + /// + // Returns the parent node. + /// + struct _cef_domnode_t*(CEF_CALLBACK* get_parent)(struct _cef_domnode_t* self); + + /// + // Returns the previous sibling node. + /// + struct _cef_domnode_t*(CEF_CALLBACK* get_previous_sibling)( + struct _cef_domnode_t* self); + + /// + // Returns the next sibling node. + /// + struct _cef_domnode_t*(CEF_CALLBACK* get_next_sibling)( + struct _cef_domnode_t* self); + + /// + // Returns true (1) if this node has child nodes. + /// + int(CEF_CALLBACK* has_children)(struct _cef_domnode_t* self); + + /// + // Return the first child node. + /// + struct _cef_domnode_t*(CEF_CALLBACK* get_first_child)( + struct _cef_domnode_t* self); + + /// + // Returns the last child node. + /// + struct _cef_domnode_t*(CEF_CALLBACK* get_last_child)( + struct _cef_domnode_t* self); + + // The following functions are valid only for element nodes. + + /// + // Returns the tag name of this element. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_element_tag_name)( + struct _cef_domnode_t* self); + + /// + // Returns true (1) if this element has attributes. + /// + int(CEF_CALLBACK* has_element_attributes)(struct _cef_domnode_t* self); + + /// + // Returns true (1) if this element has an attribute named |attrName|. + /// + int(CEF_CALLBACK* has_element_attribute)(struct _cef_domnode_t* self, + const cef_string_t* attrName); + + /// + // Returns the element attribute named |attrName|. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_element_attribute)( + struct _cef_domnode_t* self, + const cef_string_t* attrName); + + /// + // Returns a map of all element attributes. + /// + void(CEF_CALLBACK* get_element_attributes)(struct _cef_domnode_t* self, + cef_string_map_t attrMap); + + /// + // Set the value for the element attribute named |attrName|. Returns true (1) + // on success. + /// + int(CEF_CALLBACK* set_element_attribute)(struct _cef_domnode_t* self, + const cef_string_t* attrName, + const cef_string_t* value); + + /// + // Returns the inner text of the element. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_element_inner_text)( + struct _cef_domnode_t* self); + + /// + // Returns the bounds of the element. + /// + cef_rect_t(CEF_CALLBACK* get_element_bounds)(struct _cef_domnode_t* self); +} cef_domnode_t; + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_DOM_CAPI_H_ diff --git a/src/include/capi/cef_download_handler_capi.h b/src/include/capi/cef_download_handler_capi.h new file mode 100644 index 000000000..79ffe3743 --- /dev/null +++ b/src/include/capi/cef_download_handler_capi.h @@ -0,0 +1,138 @@ +// Copyright (c) 2019 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=52e904750160e4056c422794565956ae8161b50d$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_DOWNLOAD_HANDLER_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_DOWNLOAD_HANDLER_CAPI_H_ +#pragma once + +#include "include/capi/cef_base_capi.h" +#include "include/capi/cef_browser_capi.h" +#include "include/capi/cef_download_item_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/// +// Callback structure used to asynchronously continue a download. +/// +typedef struct _cef_before_download_callback_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Call to continue the download. Set |download_path| to the full file path + // for the download including the file name or leave blank to use the + // suggested name and the default temp directory. Set |show_dialog| to true + // (1) if you do wish to show the default "Save As" dialog. + /// + void(CEF_CALLBACK* cont)(struct _cef_before_download_callback_t* self, + const cef_string_t* download_path, + int show_dialog); +} cef_before_download_callback_t; + +/// +// Callback structure used to asynchronously cancel a download. +/// +typedef struct _cef_download_item_callback_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Call to cancel the download. + /// + void(CEF_CALLBACK* cancel)(struct _cef_download_item_callback_t* self); + + /// + // Call to pause the download. + /// + void(CEF_CALLBACK* pause)(struct _cef_download_item_callback_t* self); + + /// + // Call to resume the download. + /// + void(CEF_CALLBACK* resume)(struct _cef_download_item_callback_t* self); +} cef_download_item_callback_t; + +/// +// Structure used to handle file downloads. The functions of this structure will +// called on the browser process UI thread. +/// +typedef struct _cef_download_handler_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Called before a download begins. |suggested_name| is the suggested name for + // the download file. By default the download will be canceled. Execute + // |callback| either asynchronously or in this function to continue the + // download if desired. Do not keep a reference to |download_item| outside of + // this function. + /// + void(CEF_CALLBACK* on_before_download)( + struct _cef_download_handler_t* self, + struct _cef_browser_t* browser, + struct _cef_download_item_t* download_item, + const cef_string_t* suggested_name, + struct _cef_before_download_callback_t* callback); + + /// + // Called when a download's status or progress information has been updated. + // This may be called multiple times before and after on_before_download(). + // Execute |callback| either asynchronously or in this function to cancel the + // download if desired. Do not keep a reference to |download_item| outside of + // this function. + /// + void(CEF_CALLBACK* on_download_updated)( + struct _cef_download_handler_t* self, + struct _cef_browser_t* browser, + struct _cef_download_item_t* download_item, + struct _cef_download_item_callback_t* callback); +} cef_download_handler_t; + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_DOWNLOAD_HANDLER_CAPI_H_ diff --git a/src/include/capi/cef_download_item_capi.h b/src/include/capi/cef_download_item_capi.h new file mode 100644 index 000000000..72f2d8c15 --- /dev/null +++ b/src/include/capi/cef_download_item_capi.h @@ -0,0 +1,162 @@ +// Copyright (c) 2019 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=2893ea0d3375b93d2b28ac6fdcd6cdae75df544e$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_DOWNLOAD_ITEM_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_DOWNLOAD_ITEM_CAPI_H_ +#pragma once + +#include "include/capi/cef_base_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/// +// Structure used to represent a download item. +/// +typedef struct _cef_download_item_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Returns true (1) if this object is valid. Do not call any other functions + // if this function returns false (0). + /// + int(CEF_CALLBACK* is_valid)(struct _cef_download_item_t* self); + + /// + // Returns true (1) if the download is in progress. + /// + int(CEF_CALLBACK* is_in_progress)(struct _cef_download_item_t* self); + + /// + // Returns true (1) if the download is complete. + /// + int(CEF_CALLBACK* is_complete)(struct _cef_download_item_t* self); + + /// + // Returns true (1) if the download has been canceled or interrupted. + /// + int(CEF_CALLBACK* is_canceled)(struct _cef_download_item_t* self); + + /// + // Returns a simple speed estimate in bytes/s. + /// + int64(CEF_CALLBACK* get_current_speed)(struct _cef_download_item_t* self); + + /// + // Returns the rough percent complete or -1 if the receive total size is + // unknown. + /// + int(CEF_CALLBACK* get_percent_complete)(struct _cef_download_item_t* self); + + /// + // Returns the total number of bytes. + /// + int64(CEF_CALLBACK* get_total_bytes)(struct _cef_download_item_t* self); + + /// + // Returns the number of received bytes. + /// + int64(CEF_CALLBACK* get_received_bytes)(struct _cef_download_item_t* self); + + /// + // Returns the time that the download started. + /// + cef_time_t(CEF_CALLBACK* get_start_time)(struct _cef_download_item_t* self); + + /// + // Returns the time that the download ended. + /// + cef_time_t(CEF_CALLBACK* get_end_time)(struct _cef_download_item_t* self); + + /// + // Returns the full path to the downloaded or downloading file. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_full_path)( + struct _cef_download_item_t* self); + + /// + // Returns the unique identifier for this download. + /// + uint32(CEF_CALLBACK* get_id)(struct _cef_download_item_t* self); + + /// + // Returns the URL. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_url)( + struct _cef_download_item_t* self); + + /// + // Returns the original URL before any redirections. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_original_url)( + struct _cef_download_item_t* self); + + /// + // Returns the suggested file name. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_suggested_file_name)( + struct _cef_download_item_t* self); + + /// + // Returns the content disposition. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_content_disposition)( + struct _cef_download_item_t* self); + + /// + // Returns the mime type. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_mime_type)( + struct _cef_download_item_t* self); +} cef_download_item_t; + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_DOWNLOAD_ITEM_CAPI_H_ diff --git a/src/include/capi/cef_drag_data_capi.h b/src/include/capi/cef_drag_data_capi.h new file mode 100644 index 000000000..b6e0b8a07 --- /dev/null +++ b/src/include/capi/cef_drag_data_capi.h @@ -0,0 +1,228 @@ +// Copyright (c) 2019 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=c083246c8f51462b31039ce5e7031ca6c13ea071$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_DRAG_DATA_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_DRAG_DATA_CAPI_H_ +#pragma once + +#include "include/capi/cef_base_capi.h" +#include "include/capi/cef_image_capi.h" +#include "include/capi/cef_stream_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/// +// Structure used to represent drag data. The functions of this structure may be +// called on any thread. +/// +typedef struct _cef_drag_data_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Returns a copy of the current object. + /// + struct _cef_drag_data_t*(CEF_CALLBACK* clone)(struct _cef_drag_data_t* self); + + /// + // Returns true (1) if this object is read-only. + /// + int(CEF_CALLBACK* is_read_only)(struct _cef_drag_data_t* self); + + /// + // Returns true (1) if the drag data is a link. + /// + int(CEF_CALLBACK* is_link)(struct _cef_drag_data_t* self); + + /// + // Returns true (1) if the drag data is a text or html fragment. + /// + int(CEF_CALLBACK* is_fragment)(struct _cef_drag_data_t* self); + + /// + // Returns true (1) if the drag data is a file. + /// + int(CEF_CALLBACK* is_file)(struct _cef_drag_data_t* self); + + /// + // Return the link URL that is being dragged. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_link_url)( + struct _cef_drag_data_t* self); + + /// + // Return the title associated with the link being dragged. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_link_title)( + struct _cef_drag_data_t* self); + + /// + // Return the metadata, if any, associated with the link being dragged. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_link_metadata)( + struct _cef_drag_data_t* self); + + /// + // Return the plain text fragment that is being dragged. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_fragment_text)( + struct _cef_drag_data_t* self); + + /// + // Return the text/html fragment that is being dragged. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_fragment_html)( + struct _cef_drag_data_t* self); + + /// + // Return the base URL that the fragment came from. This value is used for + // resolving relative URLs and may be NULL. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_fragment_base_url)( + struct _cef_drag_data_t* self); + + /// + // Return the name of the file being dragged out of the browser window. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_file_name)( + struct _cef_drag_data_t* self); + + /// + // Write the contents of the file being dragged out of the web view into + // |writer|. Returns the number of bytes sent to |writer|. If |writer| is NULL + // this function will return the size of the file contents in bytes. Call + // get_file_name() to get a suggested name for the file. + /// + size_t(CEF_CALLBACK* get_file_contents)(struct _cef_drag_data_t* self, + struct _cef_stream_writer_t* writer); + + /// + // Retrieve the list of file names that are being dragged into the browser + // window. + /// + int(CEF_CALLBACK* get_file_names)(struct _cef_drag_data_t* self, + cef_string_list_t names); + + /// + // Set the link URL that is being dragged. + /// + void(CEF_CALLBACK* set_link_url)(struct _cef_drag_data_t* self, + const cef_string_t* url); + + /// + // Set the title associated with the link being dragged. + /// + void(CEF_CALLBACK* set_link_title)(struct _cef_drag_data_t* self, + const cef_string_t* title); + + /// + // Set the metadata associated with the link being dragged. + /// + void(CEF_CALLBACK* set_link_metadata)(struct _cef_drag_data_t* self, + const cef_string_t* data); + + /// + // Set the plain text fragment that is being dragged. + /// + void(CEF_CALLBACK* set_fragment_text)(struct _cef_drag_data_t* self, + const cef_string_t* text); + + /// + // Set the text/html fragment that is being dragged. + /// + void(CEF_CALLBACK* set_fragment_html)(struct _cef_drag_data_t* self, + const cef_string_t* html); + + /// + // Set the base URL that the fragment came from. + /// + void(CEF_CALLBACK* set_fragment_base_url)(struct _cef_drag_data_t* self, + const cef_string_t* base_url); + + /// + // Reset the file contents. You should do this before calling + // cef_browser_host_t::DragTargetDragEnter as the web view does not allow us + // to drag in this kind of data. + /// + void(CEF_CALLBACK* reset_file_contents)(struct _cef_drag_data_t* self); + + /// + // Add a file that is being dragged into the webview. + /// + void(CEF_CALLBACK* add_file)(struct _cef_drag_data_t* self, + const cef_string_t* path, + const cef_string_t* display_name); + + /// + // Get the image representation of drag data. May return NULL if no image + // representation is available. + /// + struct _cef_image_t*(CEF_CALLBACK* get_image)(struct _cef_drag_data_t* self); + + /// + // Get the image hotspot (drag start location relative to image dimensions). + /// + cef_point_t(CEF_CALLBACK* get_image_hotspot)(struct _cef_drag_data_t* self); + + /// + // Returns true (1) if an image representation of drag data is available. + /// + int(CEF_CALLBACK* has_image)(struct _cef_drag_data_t* self); +} cef_drag_data_t; + +/// +// Create a new cef_drag_data_t object. +/// +CEF_EXPORT cef_drag_data_t* cef_drag_data_create(); + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_DRAG_DATA_CAPI_H_ diff --git a/src/include/capi/cef_drag_handler_capi.h b/src/include/capi/cef_drag_handler_capi.h new file mode 100644 index 000000000..a05d36d46 --- /dev/null +++ b/src/include/capi/cef_drag_handler_capi.h @@ -0,0 +1,90 @@ +// Copyright (c) 2019 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=22ebb1d811a4e0a834eb115859d797c72a5c4ca3$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_DRAG_HANDLER_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_DRAG_HANDLER_CAPI_H_ +#pragma once + +#include "include/capi/cef_base_capi.h" +#include "include/capi/cef_browser_capi.h" +#include "include/capi/cef_drag_data_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/// +// Implement this structure to handle events related to dragging. The functions +// of this structure will be called on the UI thread. +/// +typedef struct _cef_drag_handler_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Called when an external drag event enters the browser window. |dragData| + // contains the drag event data and |mask| represents the type of drag + // operation. Return false (0) for default drag handling behavior or true (1) + // to cancel the drag event. + /// + int(CEF_CALLBACK* on_drag_enter)(struct _cef_drag_handler_t* self, + struct _cef_browser_t* browser, + struct _cef_drag_data_t* dragData, + cef_drag_operations_mask_t mask); + + /// + // Called whenever draggable regions for the browser window change. These can + // be specified using the '-webkit-app-region: drag/no-drag' CSS-property. If + // draggable regions are never defined in a document this function will also + // never be called. If the last draggable region is removed from a document + // this function will be called with an NULL vector. + /// + void(CEF_CALLBACK* on_draggable_regions_changed)( + struct _cef_drag_handler_t* self, + struct _cef_browser_t* browser, + size_t regionsCount, + cef_draggable_region_t const* regions); +} cef_drag_handler_t; + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_DRAG_HANDLER_CAPI_H_ diff --git a/src/include/capi/cef_extension_capi.h b/src/include/capi/cef_extension_capi.h new file mode 100644 index 000000000..e5cb9f6f2 --- /dev/null +++ b/src/include/capi/cef_extension_capi.h @@ -0,0 +1,130 @@ +// Copyright (c) 2019 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=09d865515163b7b61509e7a5fd849a446ea2ac9d$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_EXTENSION_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_EXTENSION_CAPI_H_ +#pragma once + +#include "include/capi/cef_base_capi.h" +#include "include/capi/cef_values_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct _cef_extension_handler_t; +struct _cef_request_context_t; + +/// +// Object representing an extension. Methods may be called on any thread unless +// otherwise indicated. +/// +typedef struct _cef_extension_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Returns the unique extension identifier. This is calculated based on the + // extension public key, if available, or on the extension path. See + // https://developer.chrome.com/extensions/manifest/key for details. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_identifier)( + struct _cef_extension_t* self); + + /// + // Returns the absolute path to the extension directory on disk. This value + // will be prefixed with PK_DIR_RESOURCES if a relative path was passed to + // cef_request_tContext::LoadExtension. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t(CEF_CALLBACK* get_path)(struct _cef_extension_t* self); + + /// + // Returns the extension manifest contents as a cef_dictionary_value_t object. + // See https://developer.chrome.com/extensions/manifest for details. + /// + struct _cef_dictionary_value_t*(CEF_CALLBACK* get_manifest)( + struct _cef_extension_t* self); + + /// + // Returns true (1) if this object is the same extension as |that| object. + // Extensions are considered the same if identifier, path and loader context + // match. + /// + int(CEF_CALLBACK* is_same)(struct _cef_extension_t* self, + struct _cef_extension_t* that); + + /// + // Returns the handler for this extension. Will return NULL for internal + // extensions or if no handler was passed to + // cef_request_tContext::LoadExtension. + /// + struct _cef_extension_handler_t*(CEF_CALLBACK* get_handler)( + struct _cef_extension_t* self); + + /// + // Returns the request context that loaded this extension. Will return NULL + // for internal extensions or if the extension has been unloaded. See the + // cef_request_tContext::LoadExtension documentation for more information + // about loader contexts. Must be called on the browser process UI thread. + /// + struct _cef_request_context_t*(CEF_CALLBACK* get_loader_context)( + struct _cef_extension_t* self); + + /// + // Returns true (1) if this extension is currently loaded. Must be called on + // the browser process UI thread. + /// + int(CEF_CALLBACK* is_loaded)(struct _cef_extension_t* self); + + /// + // Unload this extension if it is not an internal extension and is currently + // loaded. Will result in a call to + // cef_extension_tHandler::OnExtensionUnloaded on success. + /// + void(CEF_CALLBACK* unload)(struct _cef_extension_t* self); +} cef_extension_t; + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_EXTENSION_CAPI_H_ diff --git a/src/include/capi/cef_extension_handler_capi.h b/src/include/capi/cef_extension_handler_capi.h new file mode 100644 index 000000000..d413bdffd --- /dev/null +++ b/src/include/capi/cef_extension_handler_capi.h @@ -0,0 +1,210 @@ +// Copyright (c) 2019 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// +// $hash=490353d0ad05316191a2eae5ec19f1cde468f2d2$ +// + +#ifndef CEF_INCLUDE_CAPI_CEF_EXTENSION_HANDLER_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_EXTENSION_HANDLER_CAPI_H_ +#pragma once + +#include "include/capi/cef_base_capi.h" +#include "include/capi/cef_browser_capi.h" +#include "include/capi/cef_extension_capi.h" +#include "include/capi/cef_stream_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct _cef_client_t; + +/// +// Callback structure used for asynchronous continuation of +// cef_extension_tHandler::GetExtensionResource. +/// +typedef struct _cef_get_extension_resource_callback_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Continue the request. Read the resource contents from |stream|. + /// + void(CEF_CALLBACK* cont)(struct _cef_get_extension_resource_callback_t* self, + struct _cef_stream_reader_t* stream); + + /// + // Cancel the request. + /// + void(CEF_CALLBACK* cancel)( + struct _cef_get_extension_resource_callback_t* self); +} cef_get_extension_resource_callback_t; + +/// +// Implement this structure to handle events related to browser extensions. The +// functions of this structure will be called on the UI thread. See +// cef_request_tContext::LoadExtension for information about extension loading. +/// +typedef struct _cef_extension_handler_t { + /// + // Base structure. + /// + cef_base_ref_counted_t base; + + /// + // Called if the cef_request_tContext::LoadExtension request fails. |result| + // will be the error code. + /// + void(CEF_CALLBACK* on_extension_load_failed)( + struct _cef_extension_handler_t* self, + cef_errorcode_t result); + + /// + // Called if the cef_request_tContext::LoadExtension request succeeds. + // |extension| is the loaded extension. + /// + void(CEF_CALLBACK* on_extension_loaded)(struct _cef_extension_handler_t* self, + struct _cef_extension_t* extension); + + /// + // Called after the cef_extension_t::Unload request has completed. + /// + void(CEF_CALLBACK* on_extension_unloaded)( + struct _cef_extension_handler_t* self, + struct _cef_extension_t* extension); + + /// + // Called when an extension needs a browser to host a background script + // specified via the "background" manifest key. The browser will have no + // visible window and cannot be displayed. |extension| is the extension that + // is loading the background script. |url| is an internally generated + // reference to an HTML page that will be used to load the background script + // via a