chore: nvm
This commit is contained in:
parent
b2c8a104dc
commit
62fa73c89f
|
|
@ -1,3 +0,0 @@
|
|||
*.lib filter=lfs diff=lfs merge=lfs -text
|
||||
*.dll filter=lfs diff=lfs merge=lfs -text
|
||||
*.pak filter=lfs diff=lfs merge=lfs -text
|
||||
BIN
libcef/bin/chrome_elf.dll (Stored with Git LFS)
BIN
libcef/bin/chrome_elf.dll (Stored with Git LFS)
Binary file not shown.
BIN
libcef/bin/d3dcompiler_47.dll (Stored with Git LFS)
BIN
libcef/bin/d3dcompiler_47.dll (Stored with Git LFS)
Binary file not shown.
BIN
libcef/bin/dxcompiler.dll (Stored with Git LFS)
BIN
libcef/bin/dxcompiler.dll (Stored with Git LFS)
Binary file not shown.
BIN
libcef/bin/dxil.dll (Stored with Git LFS)
BIN
libcef/bin/dxil.dll (Stored with Git LFS)
Binary file not shown.
BIN
libcef/bin/libEGL.dll (Stored with Git LFS)
BIN
libcef/bin/libEGL.dll (Stored with Git LFS)
Binary file not shown.
BIN
libcef/bin/libGLESv2.dll (Stored with Git LFS)
BIN
libcef/bin/libGLESv2.dll (Stored with Git LFS)
Binary file not shown.
BIN
libcef/bin/libcef.dll (Stored with Git LFS)
BIN
libcef/bin/libcef.dll (Stored with Git LFS)
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
libcef/bin/vk_swiftshader.dll (Stored with Git LFS)
BIN
libcef/bin/vk_swiftshader.dll (Stored with Git LFS)
Binary file not shown.
|
|
@ -1 +0,0 @@
|
|||
{"file_format_version": "1.0.0", "ICD": {"library_path": ".\\vk_swiftshader.dll", "api_version": "1.0.5"}}
|
||||
BIN
libcef/bin/vulkan-1.dll (Stored with Git LFS)
BIN
libcef/bin/vulkan-1.dll (Stored with Git LFS)
Binary file not shown.
|
|
@ -1,97 +0,0 @@
|
|||
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
|
||||
// Google Inc. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_ATOMIC_FLAG_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_ATOMIC_FLAG_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/synchronization/atomic_flag.h"
|
||||
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <atomic>
|
||||
|
||||
#include "include/base/cef_thread_checker.h"
|
||||
|
||||
namespace base {
|
||||
|
||||
///
|
||||
/// A flag that can safely be set from one thread and read from other threads.
|
||||
///
|
||||
/// This class IS NOT intended for synchronization between threads.
|
||||
///
|
||||
class AtomicFlag {
|
||||
public:
|
||||
AtomicFlag();
|
||||
|
||||
AtomicFlag(const AtomicFlag&) = delete;
|
||||
AtomicFlag& operator=(const AtomicFlag&) = delete;
|
||||
|
||||
~AtomicFlag();
|
||||
|
||||
///
|
||||
/// Set the flag. Must always be called from the same thread.
|
||||
///
|
||||
void Set();
|
||||
|
||||
///
|
||||
/// Returns true iff the flag was set. If this returns true, the current
|
||||
/// thread is guaranteed to be synchronized with all memory operations on the
|
||||
/// thread which invoked Set() up until at least the first call to Set() on
|
||||
/// it.
|
||||
///
|
||||
bool IsSet() const {
|
||||
// Inline here: this has a measurable performance impact on base::WeakPtr.
|
||||
return flag_.load(std::memory_order_acquire) != 0;
|
||||
}
|
||||
|
||||
///
|
||||
/// Resets the flag. Be careful when using this: callers might not expect
|
||||
/// IsSet() to return false after returning true once.
|
||||
///
|
||||
void UnsafeResetForTesting();
|
||||
|
||||
private:
|
||||
std::atomic<uint_fast8_t> flag_{0};
|
||||
base::ThreadChecker set_thread_checker_;
|
||||
};
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_ATOMIC_FLAG_H_
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
|
||||
// Google Inc. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// This is a low level implementation of atomic semantics for reference
|
||||
// counting. Please use cef_ref_counted.h directly instead.
|
||||
//
|
||||
// The Chromium implementation includes annotations to avoid some false
|
||||
// positives when using data race detection tools. Annotations are not
|
||||
// currently supported by the CEF implementation.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_ATOMIC_REF_COUNT_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_ATOMIC_REF_COUNT_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/atomic_ref_count.h"
|
||||
|
||||
#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 <atomic>
|
||||
|
||||
namespace base {
|
||||
|
||||
class AtomicRefCount {
|
||||
public:
|
||||
constexpr AtomicRefCount() : ref_count_(0) {}
|
||||
explicit constexpr AtomicRefCount(int initial_value)
|
||||
: ref_count_(initial_value) {}
|
||||
|
||||
///
|
||||
/// Increment a reference count.
|
||||
/// Returns the previous value of the count.
|
||||
///
|
||||
int Increment() { return Increment(1); }
|
||||
|
||||
///
|
||||
/// Increment a reference count by "increment", which must exceed 0.
|
||||
/// Returns the previous value of the count.
|
||||
///
|
||||
int Increment(int increment) {
|
||||
return ref_count_.fetch_add(increment, std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
///
|
||||
/// Decrement a reference count, and return whether the result is non-zero.
|
||||
/// Insert barriers to ensure that state written before the reference count
|
||||
/// became zero will be visible to a thread that has just made the count zero.
|
||||
///
|
||||
bool Decrement() {
|
||||
// TODO(jbroman): Technically this doesn't need to be an acquire operation
|
||||
// unless the result is 1 (i.e., the ref count did indeed reach zero).
|
||||
// However, there are toolchain issues that make that not work as well at
|
||||
// present (notably TSAN doesn't like it).
|
||||
return ref_count_.fetch_sub(1, std::memory_order_acq_rel) != 1;
|
||||
}
|
||||
|
||||
///
|
||||
/// Return whether the reference count is one. If the reference count is used
|
||||
/// in the conventional way, a refrerence count of 1 implies that the current
|
||||
/// thread owns the reference and no other thread shares it. This call
|
||||
/// performs the test for a reference count of one, and performs the memory
|
||||
/// barrier needed for the owning thread to act on the object, knowing that it
|
||||
/// has exclusive access to the object.
|
||||
///
|
||||
bool IsOne() const { return ref_count_.load(std::memory_order_acquire) == 1; }
|
||||
|
||||
///
|
||||
/// Return whether the reference count is zero. With conventional object
|
||||
/// referencing counting, the object will be destroyed, so the reference count
|
||||
/// should never be zero. Hence this is generally used for a debug check.
|
||||
///
|
||||
bool IsZero() const {
|
||||
return ref_count_.load(std::memory_order_acquire) == 0;
|
||||
}
|
||||
|
||||
///
|
||||
/// Returns the current reference count (with no barriers). This is subtle,
|
||||
/// and should be used only for debugging.
|
||||
///
|
||||
int SubtleRefCountForDebug() const {
|
||||
return ref_count_.load(std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
private:
|
||||
std::atomic_int ref_count_;
|
||||
};
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_ATOMIC_REF_COUNT_H_
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
|
||||
// Google Inc. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// base::AutoReset<> is useful for setting a variable to a new value only within
|
||||
// a particular scope. An base::AutoReset<> object resets a variable to its
|
||||
// original value upon destruction, making it an alternative to writing
|
||||
// "var = false;" or "var = old_val;" at all of a block's exit points.
|
||||
//
|
||||
// This should be obvious, but note that an base::AutoReset<> instance should
|
||||
// have a shorter lifetime than its scoped_variable, to prevent invalid memory
|
||||
// writes when the base::AutoReset<> object is destroyed.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_AUTO_RESET_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_AUTO_RESET_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/auto_reset.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 <utility>
|
||||
|
||||
namespace base {
|
||||
|
||||
template <typename T>
|
||||
class AutoReset {
|
||||
public:
|
||||
template <typename U>
|
||||
AutoReset(T* scoped_variable, U&& new_value)
|
||||
: scoped_variable_(scoped_variable),
|
||||
original_value_(
|
||||
std::exchange(*scoped_variable_, std::forward<U>(new_value))) {}
|
||||
|
||||
AutoReset(AutoReset&& other)
|
||||
: scoped_variable_(std::exchange(other.scoped_variable_, nullptr)),
|
||||
original_value_(std::move(other.original_value_)) {}
|
||||
|
||||
AutoReset& operator=(AutoReset&& rhs) {
|
||||
scoped_variable_ = std::exchange(rhs.scoped_variable_, nullptr);
|
||||
original_value_ = std::move(rhs.original_value_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
~AutoReset() {
|
||||
if (scoped_variable_) {
|
||||
*scoped_variable_ = std::move(original_value_);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
T* scoped_variable_;
|
||||
T original_value_;
|
||||
};
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_AUTO_RESET_H_
|
||||
|
|
@ -1,390 +0,0 @@
|
|||
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
|
||||
// Google Inc. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
///
|
||||
/// \file
|
||||
/// base::BindOnce() and base::BindRepeating() are helpers for creating
|
||||
/// base::OnceCallback and base::RepeatingCallback objects respectively.
|
||||
///
|
||||
/// For a runnable object of n-arity, the base::Bind*() family allows partial
|
||||
/// application of the first m arguments. The remaining n - m arguments must be
|
||||
/// passed when invoking the callback with Run().
|
||||
///
|
||||
/// <pre>
|
||||
/// // The first argument is bound at callback creation; the remaining
|
||||
/// // two must be passed when calling Run() on the callback object.
|
||||
/// base::OnceCallback<long(int, long)> cb = base::BindOnce(
|
||||
/// [](short x, int y, long z) { return x * y * z; }, 42);
|
||||
/// </pre>
|
||||
///
|
||||
/// When binding to a method, the receiver object must also be specified at
|
||||
/// callback creation time. When Run() is invoked, the method will be invoked on
|
||||
/// the specified receiver object.
|
||||
///
|
||||
/// <pre>
|
||||
/// class C : public base::RefCounted<C> { void F(); };
|
||||
/// auto instance = base::MakeRefCounted<C>();
|
||||
/// auto cb = base::BindOnce(&C::F, instance);
|
||||
/// std::move(cb).Run(); // Identical to instance->F()
|
||||
/// </pre>
|
||||
///
|
||||
/// See https://chromium.googlesource.com/chromium/src/+/lkgr/docs/callback.md
|
||||
/// for the full documentation.
|
||||
///
|
||||
|
||||
// Implementation notes
|
||||
//
|
||||
// If you're reading the implementation, before proceeding further, you should
|
||||
// read the top comment of base/internal/cef_bind_internal.h for a definition
|
||||
// of common terms and concepts.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_BIND_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_BIND_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/functional/bind.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include "include/base/cef_build.h"
|
||||
#include "include/base/cef_compiler_specific.h"
|
||||
#include "include/base/internal/cef_bind_internal.h"
|
||||
|
||||
#if defined(OS_APPLE) && !HAS_FEATURE(objc_arc)
|
||||
#include "include/base/internal/cef_scoped_block_mac.h"
|
||||
#endif
|
||||
|
||||
namespace base {
|
||||
|
||||
///
|
||||
/// Bind as OnceCallback.
|
||||
///
|
||||
template <typename Functor, typename... Args>
|
||||
inline OnceCallback<cef_internal::MakeUnboundRunType<Functor, Args...>>
|
||||
BindOnce(Functor&& functor, Args&&... args) {
|
||||
static_assert(!cef_internal::IsOnceCallback<std::decay_t<Functor>>() ||
|
||||
(std::is_rvalue_reference<Functor&&>() &&
|
||||
!std::is_const<std::remove_reference_t<Functor>>()),
|
||||
"BindOnce requires non-const rvalue for OnceCallback binding."
|
||||
" I.e.: base::BindOnce(std::move(callback)).");
|
||||
static_assert(
|
||||
std::conjunction<cef_internal::AssertBindArgIsNotBasePassed<
|
||||
std::decay_t<Args>>...>::value,
|
||||
"Use std::move() instead of base::Passed() with base::BindOnce()");
|
||||
|
||||
return cef_internal::BindImpl<OnceCallback>(std::forward<Functor>(functor),
|
||||
std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
///
|
||||
/// Bind as RepeatingCallback.
|
||||
///
|
||||
template <typename Functor, typename... Args>
|
||||
inline RepeatingCallback<cef_internal::MakeUnboundRunType<Functor, Args...>>
|
||||
BindRepeating(Functor&& functor, Args&&... args) {
|
||||
static_assert(
|
||||
!cef_internal::IsOnceCallback<std::decay_t<Functor>>(),
|
||||
"BindRepeating cannot bind OnceCallback. Use BindOnce with std::move().");
|
||||
|
||||
return cef_internal::BindImpl<RepeatingCallback>(
|
||||
std::forward<Functor>(functor), std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
///
|
||||
/// Special cases for binding to a base::Callback without extra bound arguments.
|
||||
/// We CHECK() the validity of callback to guard against null pointers
|
||||
/// accidentally ending up in posted tasks, causing hard-to-debug crashes.
|
||||
///
|
||||
template <typename Signature>
|
||||
OnceCallback<Signature> BindOnce(OnceCallback<Signature> callback) {
|
||||
CHECK(callback);
|
||||
return callback;
|
||||
}
|
||||
|
||||
template <typename Signature>
|
||||
OnceCallback<Signature> BindOnce(RepeatingCallback<Signature> callback) {
|
||||
CHECK(callback);
|
||||
return callback;
|
||||
}
|
||||
|
||||
template <typename Signature>
|
||||
RepeatingCallback<Signature> BindRepeating(
|
||||
RepeatingCallback<Signature> callback) {
|
||||
CHECK(callback);
|
||||
return callback;
|
||||
}
|
||||
|
||||
///
|
||||
/// Unretained() allows binding a non-refcounted class, and to disable
|
||||
/// refcounting on arguments that are refcounted objects.
|
||||
///
|
||||
/// EXAMPLE OF Unretained():
|
||||
///
|
||||
/// <pre>
|
||||
/// class Foo {
|
||||
/// public:
|
||||
/// void func() { cout << "Foo:f" << endl; }
|
||||
/// };
|
||||
///
|
||||
/// // In some function somewhere.
|
||||
/// Foo foo;
|
||||
/// OnceClosure foo_callback =
|
||||
/// BindOnce(&Foo::func, Unretained(&foo));
|
||||
/// std::move(foo_callback).Run(); // Prints "Foo:f".
|
||||
/// </pre>
|
||||
///
|
||||
/// Without the Unretained() wrapper on |&foo|, the above call would fail
|
||||
/// to compile because Foo does not support the AddRef() and Release() methods.
|
||||
///
|
||||
template <typename T>
|
||||
inline cef_internal::UnretainedWrapper<T> Unretained(T* o) {
|
||||
return cef_internal::UnretainedWrapper<T>(o);
|
||||
}
|
||||
|
||||
///
|
||||
/// RetainedRef() accepts a ref counted object and retains a reference to it.
|
||||
/// When the callback is called, the object is passed as a raw pointer.
|
||||
///
|
||||
/// EXAMPLE OF RetainedRef():
|
||||
///
|
||||
/// <pre>
|
||||
/// void foo(RefCountedBytes* bytes) {}
|
||||
///
|
||||
/// scoped_refptr<RefCountedBytes> bytes = ...;
|
||||
/// OnceClosure callback = BindOnce(&foo, base::RetainedRef(bytes));
|
||||
/// std::move(callback).Run();
|
||||
/// </pre>
|
||||
///
|
||||
/// Without RetainedRef, the scoped_refptr would try to implicitly convert to
|
||||
/// a raw pointer and fail compilation:
|
||||
///
|
||||
/// <pre>
|
||||
/// OnceClosure callback = BindOnce(&foo, bytes); // ERROR!
|
||||
/// </pre>
|
||||
///
|
||||
template <typename T>
|
||||
inline cef_internal::RetainedRefWrapper<T> RetainedRef(T* o) {
|
||||
return cef_internal::RetainedRefWrapper<T>(o);
|
||||
}
|
||||
template <typename T>
|
||||
inline cef_internal::RetainedRefWrapper<T> RetainedRef(scoped_refptr<T> o) {
|
||||
return cef_internal::RetainedRefWrapper<T>(std::move(o));
|
||||
}
|
||||
|
||||
///
|
||||
/// Owned() transfers ownership of an object to the callback resulting from
|
||||
/// bind; the object will be deleted when the callback is deleted.
|
||||
///
|
||||
/// EXAMPLE OF Owned():
|
||||
///
|
||||
/// <pre>
|
||||
/// void foo(int* arg) { cout << *arg << endl }
|
||||
///
|
||||
/// int* pn = new int(1);
|
||||
/// RepeatingClosure foo_callback = BindRepeating(&foo, Owned(pn));
|
||||
///
|
||||
/// foo_callback.Run(); // Prints "1"
|
||||
/// foo_callback.Run(); // Prints "1"
|
||||
/// *pn = 2;
|
||||
/// foo_callback.Run(); // Prints "2"
|
||||
///
|
||||
/// foo_callback.Reset(); // |pn| is deleted. Also will happen when
|
||||
/// // |foo_callback| goes out of scope.
|
||||
/// </pre>
|
||||
///
|
||||
/// Without Owned(), someone would have to know to delete |pn| when the last
|
||||
/// reference to the callback is deleted.
|
||||
///
|
||||
template <typename T>
|
||||
inline cef_internal::OwnedWrapper<T> Owned(T* o) {
|
||||
return cef_internal::OwnedWrapper<T>(o);
|
||||
}
|
||||
|
||||
template <typename T, typename Deleter>
|
||||
inline cef_internal::OwnedWrapper<T, Deleter> Owned(
|
||||
std::unique_ptr<T, Deleter>&& ptr) {
|
||||
return cef_internal::OwnedWrapper<T, Deleter>(std::move(ptr));
|
||||
}
|
||||
|
||||
///
|
||||
/// OwnedRef() stores an object in the callback resulting from
|
||||
/// bind and passes a reference to the object to the bound function.
|
||||
///
|
||||
/// EXAMPLE OF OwnedRef():
|
||||
///
|
||||
/// <pre>
|
||||
/// void foo(int& arg) { cout << ++arg << endl }
|
||||
///
|
||||
/// int counter = 0;
|
||||
/// RepeatingClosure foo_callback = BindRepeating(&foo, OwnedRef(counter));
|
||||
///
|
||||
/// foo_callback.Run(); // Prints "1"
|
||||
/// foo_callback.Run(); // Prints "2"
|
||||
/// foo_callback.Run(); // Prints "3"
|
||||
///
|
||||
/// cout << counter; // Prints "0", OwnedRef creates a copy of counter.
|
||||
/// </pre>
|
||||
///
|
||||
/// Supports OnceCallbacks as well, useful to pass placeholder arguments:
|
||||
///
|
||||
/// <pre>
|
||||
/// void bar(int& ignore, const std::string& s) { cout << s << endl }
|
||||
///
|
||||
/// OnceClosure bar_callback = BindOnce(&bar, OwnedRef(0), "Hello");
|
||||
///
|
||||
/// std::move(bar_callback).Run(); // Prints "Hello"
|
||||
/// </pre>
|
||||
///
|
||||
/// Without OwnedRef() it would not be possible to pass a mutable reference to
|
||||
/// an object owned by the callback.
|
||||
///
|
||||
template <typename T>
|
||||
cef_internal::OwnedRefWrapper<std::decay_t<T>> OwnedRef(T&& t) {
|
||||
return cef_internal::OwnedRefWrapper<std::decay_t<T>>(std::forward<T>(t));
|
||||
}
|
||||
|
||||
///
|
||||
/// Passed() is for transferring movable-but-not-copyable types (eg. unique_ptr)
|
||||
/// through a RepeatingCallback. Logically, this signifies a destructive
|
||||
/// transfer of the state of the argument into the target function. Invoking
|
||||
/// RepeatingCallback::Run() twice on a callback that was created with a
|
||||
/// Passed() argument will CHECK() because the first invocation would have
|
||||
/// already transferred ownership to the target function.
|
||||
///
|
||||
/// Note that Passed() is not necessary with BindOnce(), as std::move() does the
|
||||
/// same thing. Avoid Passed() in favor of std::move() with BindOnce().
|
||||
///
|
||||
/// EXAMPLE OF Passed():
|
||||
///
|
||||
/// <pre>
|
||||
/// void TakesOwnership(std::unique_ptr<Foo> arg) { }
|
||||
/// std::unique_ptr<Foo> CreateFoo() { return std::make_unique<Foo>();
|
||||
/// }
|
||||
///
|
||||
/// auto f = std::make_unique<Foo>();
|
||||
///
|
||||
/// // |cb| is given ownership of Foo(). |f| is now NULL.
|
||||
/// // You can use std::move(f) in place of &f, but it's more verbose.
|
||||
/// RepeatingClosure cb = BindRepeating(&TakesOwnership, Passed(&f));
|
||||
///
|
||||
/// // Run was never called so |cb| still owns Foo() and deletes
|
||||
/// // it on Reset().
|
||||
/// cb.Reset();
|
||||
///
|
||||
/// // |cb| is given a new Foo created by CreateFoo().
|
||||
/// cb = BindRepeating(&TakesOwnership, Passed(CreateFoo()));
|
||||
///
|
||||
/// // |arg| in TakesOwnership() is given ownership of Foo(). |cb|
|
||||
/// // no longer owns Foo() and, if reset, would not delete Foo().
|
||||
/// cb.Run(); // Foo() is now transferred to |arg| and deleted.
|
||||
/// cb.Run(); // This CHECK()s since Foo() already been used once.
|
||||
/// </pre>
|
||||
///
|
||||
/// We offer 2 syntaxes for calling Passed(). The first takes an rvalue and is
|
||||
/// best suited for use with the return value of a function or other temporary
|
||||
/// rvalues. The second takes a pointer to the scoper and is just syntactic
|
||||
/// sugar to avoid having to write Passed(std::move(scoper)).
|
||||
///
|
||||
/// Both versions of Passed() prevent T from being an lvalue reference. The
|
||||
/// first via use of enable_if, and the second takes a T* which will not bind to
|
||||
/// T&.
|
||||
///
|
||||
template <typename T,
|
||||
std::enable_if_t<!std::is_lvalue_reference<T>::value>* = nullptr>
|
||||
inline cef_internal::PassedWrapper<T> Passed(T&& scoper) {
|
||||
return cef_internal::PassedWrapper<T>(std::move(scoper));
|
||||
}
|
||||
template <typename T>
|
||||
inline cef_internal::PassedWrapper<T> Passed(T* scoper) {
|
||||
return cef_internal::PassedWrapper<T>(std::move(*scoper));
|
||||
}
|
||||
|
||||
///
|
||||
/// IgnoreResult() is used to adapt a function or callback with a return type to
|
||||
/// one with a void return. This is most useful if you have a function with,
|
||||
/// say, a pesky ignorable bool return that you want to use with PostTask or
|
||||
/// something else that expect a callback with a void return.
|
||||
///
|
||||
/// EXAMPLE OF IgnoreResult():
|
||||
///
|
||||
/// <pre>
|
||||
/// int DoSomething(int arg) { cout << arg << endl; }
|
||||
///
|
||||
/// // Assign to a callback with a void return type.
|
||||
/// OnceCallback<void(int)> cb = BindOnce(IgnoreResult(&DoSomething));
|
||||
/// std::move(cb).Run(1); // Prints "1".
|
||||
///
|
||||
/// // Prints "2" on |ml|.
|
||||
/// ml->PostTask(FROM_HERE, BindOnce(IgnoreResult(&DoSomething), 2);
|
||||
/// </pre>
|
||||
///
|
||||
template <typename T>
|
||||
inline cef_internal::IgnoreResultHelper<T> IgnoreResult(T data) {
|
||||
return cef_internal::IgnoreResultHelper<T>(std::move(data));
|
||||
}
|
||||
|
||||
#if defined(OS_APPLE) && !HAS_FEATURE(objc_arc)
|
||||
|
||||
///
|
||||
/// RetainBlock() is used to adapt an Objective-C block when Automated Reference
|
||||
/// Counting (ARC) is disabled. This is unnecessary when ARC is enabled, as the
|
||||
/// BindOnce and BindRepeating already support blocks then.
|
||||
///
|
||||
/// EXAMPLE OF RetainBlock():
|
||||
///
|
||||
/// <pre>
|
||||
/// // Wrap the block and bind it to a callback.
|
||||
/// OnceCallback<void(int)> cb =
|
||||
/// BindOnce(RetainBlock(^(int n) { NSLog(@"%d", n); }));
|
||||
/// std::move(cb).Run(1); // Logs "1".
|
||||
/// </pre>
|
||||
///
|
||||
template <typename R, typename... Args>
|
||||
base::mac::ScopedBlock<R (^)(Args...)> RetainBlock(R (^block)(Args...)) {
|
||||
return base::mac::ScopedBlock<R (^)(Args...)>(block,
|
||||
base::scoped_policy::RETAIN);
|
||||
}
|
||||
|
||||
#endif // defined(OS_APPLE) && !HAS_FEATURE(objc_arc)
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_BIND_H_
|
||||
|
|
@ -1,263 +0,0 @@
|
|||
// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
/// \file
|
||||
/// This file adds defines about the platform we're currently building on.
|
||||
///
|
||||
/// <pre>
|
||||
/// Operating System:
|
||||
/// OS_AIX / OS_ANDROID / OS_ASMJS / OS_FREEBSD / OS_FUCHSIA / OS_IOS /
|
||||
/// OS_LINUX / OS_MAC / OS_NACL (SFI or NONSFI) / OS_NETBSD / OS_OPENBSD /
|
||||
/// OS_QNX / OS_SOLARIS / OS_WIN
|
||||
/// Operating System family:
|
||||
/// OS_APPLE: IOS or MAC
|
||||
/// OS_BSD: FREEBSD or NETBSD or OPENBSD
|
||||
/// OS_POSIX: AIX or ANDROID or ASMJS or CHROMEOS or FREEBSD or IOS or LINUX
|
||||
/// or MAC or NACL or NETBSD or OPENBSD or QNX or SOLARIS
|
||||
///
|
||||
/// /!\ Note: OS_CHROMEOS is set by the build system, not this file
|
||||
///
|
||||
/// Compiler:
|
||||
/// COMPILER_MSVC / COMPILER_GCC
|
||||
///
|
||||
/// Processor:
|
||||
/// ARCH_CPU_ARM64 / ARCH_CPU_ARMEL / ARCH_CPU_MIPS / ARCH_CPU_MIPS64 /
|
||||
/// ARCH_CPU_MIPS64EL / ARCH_CPU_MIPSEL / ARCH_CPU_PPC64 / ARCH_CPU_S390 /
|
||||
/// ARCH_CPU_S390X / ARCH_CPU_X86 / ARCH_CPU_X86_64
|
||||
/// Processor family:
|
||||
/// ARCH_CPU_ARM_FAMILY: ARMEL or ARM64
|
||||
/// ARCH_CPU_MIPS_FAMILY: MIPS64EL or MIPSEL or MIPS64 or MIPS
|
||||
/// ARCH_CPU_PPC64_FAMILY: PPC64
|
||||
/// ARCH_CPU_S390_FAMILY: S390 or S390X
|
||||
/// ARCH_CPU_X86_FAMILY: X86 or X86_64
|
||||
/// Processor features:
|
||||
/// ARCH_CPU_31_BITS / ARCH_CPU_32_BITS / ARCH_CPU_64_BITS
|
||||
/// ARCH_CPU_BIG_ENDIAN / ARCH_CPU_LITTLE_ENDIAN
|
||||
/// </pre>
|
||||
///
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_BUILD_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_BUILD_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "build/build_config.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.
|
||||
|
||||
// A set of macros to use for platform detection.
|
||||
#if defined(ANDROID)
|
||||
#define OS_ANDROID 1
|
||||
#elif defined(__APPLE__)
|
||||
// Only include TargetConditionals after testing ANDROID as some Android builds
|
||||
// on the Mac have this header available and it's not needed unless the target
|
||||
// is really an Apple platform.
|
||||
#include <TargetConditionals.h>
|
||||
#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
|
||||
#define OS_IOS 1
|
||||
#else
|
||||
#define OS_MAC 1
|
||||
// For backwards compatibility.
|
||||
#define OS_MACOSX 1
|
||||
#endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
|
||||
#elif defined(__linux__)
|
||||
#if !defined(OS_CHROMEOS)
|
||||
// Do not define OS_LINUX on Chrome OS build.
|
||||
// The OS_CHROMEOS macro is defined in GN.
|
||||
#define OS_LINUX 1
|
||||
#endif // !defined(OS_CHROMEOS)
|
||||
// Include a system header to pull in features.h for glibc/uclibc macros.
|
||||
#include <unistd.h>
|
||||
#if defined(__GLIBC__) && !defined(__UCLIBC__)
|
||||
// We really are using glibc, not uClibc pretending to be glibc.
|
||||
#define LIBC_GLIBC 1
|
||||
#endif
|
||||
#elif defined(_WIN32)
|
||||
#define OS_WIN 1
|
||||
#elif defined(__Fuchsia__)
|
||||
#define OS_FUCHSIA 1
|
||||
#elif defined(__FreeBSD__)
|
||||
#define OS_FREEBSD 1
|
||||
#elif defined(__NetBSD__)
|
||||
#define OS_NETBSD 1
|
||||
#elif defined(__OpenBSD__)
|
||||
#define OS_OPENBSD 1
|
||||
#elif defined(__sun)
|
||||
#define OS_SOLARIS 1
|
||||
#elif defined(__QNXNTO__)
|
||||
#define OS_QNX 1
|
||||
#elif defined(_AIX)
|
||||
#define OS_AIX 1
|
||||
#elif defined(__asmjs__) || defined(__wasm__)
|
||||
#define OS_ASMJS 1
|
||||
#else
|
||||
#error Please add support for your platform in include/base/cef_build.h
|
||||
#endif
|
||||
// NOTE: Adding a new port? Please follow
|
||||
// https://chromium.googlesource.com/chromium/src/+/master/docs/new_port_policy.md
|
||||
|
||||
#if defined(OS_MAC) || defined(OS_IOS)
|
||||
#define OS_APPLE 1
|
||||
#endif
|
||||
|
||||
// For access to standard BSD features, use OS_BSD instead of a
|
||||
// more specific macro.
|
||||
#if defined(OS_FREEBSD) || defined(OS_NETBSD) || defined(OS_OPENBSD)
|
||||
#define OS_BSD 1
|
||||
#endif
|
||||
|
||||
// For access to standard POSIXish features, use OS_POSIX instead of a
|
||||
// more specific macro.
|
||||
#if defined(OS_AIX) || defined(OS_ANDROID) || defined(OS_ASMJS) || \
|
||||
defined(OS_FREEBSD) || defined(OS_IOS) || defined(OS_LINUX) || \
|
||||
defined(OS_CHROMEOS) || defined(OS_MAC) || defined(OS_NACL) || \
|
||||
defined(OS_NETBSD) || defined(OS_OPENBSD) || defined(OS_QNX) || \
|
||||
defined(OS_SOLARIS)
|
||||
#define OS_POSIX 1
|
||||
#endif
|
||||
|
||||
// Compiler detection. Note: clang masquerades as GCC on POSIX and as MSVC on
|
||||
// Windows.
|
||||
#if defined(__GNUC__)
|
||||
#define COMPILER_GCC 1
|
||||
#elif defined(_MSC_VER)
|
||||
#define COMPILER_MSVC 1
|
||||
#else
|
||||
#error Please add support for your compiler in build/build_config.h
|
||||
#endif
|
||||
|
||||
// Processor architecture detection. For more info on what's defined, see:
|
||||
// http://msdn.microsoft.com/en-us/library/b0084kay.aspx
|
||||
// http://www.agner.org/optimize/calling_conventions.pdf
|
||||
// or with gcc, run: "echo | gcc -E -dM -"
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
#define ARCH_CPU_X86_FAMILY 1
|
||||
#define ARCH_CPU_X86_64 1
|
||||
#define ARCH_CPU_64_BITS 1
|
||||
#define ARCH_CPU_LITTLE_ENDIAN 1
|
||||
#elif defined(_M_IX86) || defined(__i386__)
|
||||
#define ARCH_CPU_X86_FAMILY 1
|
||||
#define ARCH_CPU_X86 1
|
||||
#define ARCH_CPU_32_BITS 1
|
||||
#define ARCH_CPU_LITTLE_ENDIAN 1
|
||||
#elif defined(__s390x__)
|
||||
#define ARCH_CPU_S390_FAMILY 1
|
||||
#define ARCH_CPU_S390X 1
|
||||
#define ARCH_CPU_64_BITS 1
|
||||
#define ARCH_CPU_BIG_ENDIAN 1
|
||||
#elif defined(__s390__)
|
||||
#define ARCH_CPU_S390_FAMILY 1
|
||||
#define ARCH_CPU_S390 1
|
||||
#define ARCH_CPU_31_BITS 1
|
||||
#define ARCH_CPU_BIG_ENDIAN 1
|
||||
#elif (defined(__PPC64__) || defined(__PPC__)) && defined(__BIG_ENDIAN__)
|
||||
#define ARCH_CPU_PPC64_FAMILY 1
|
||||
#define ARCH_CPU_PPC64 1
|
||||
#define ARCH_CPU_64_BITS 1
|
||||
#define ARCH_CPU_BIG_ENDIAN 1
|
||||
#elif defined(__PPC64__)
|
||||
#define ARCH_CPU_PPC64_FAMILY 1
|
||||
#define ARCH_CPU_PPC64 1
|
||||
#define ARCH_CPU_64_BITS 1
|
||||
#define ARCH_CPU_LITTLE_ENDIAN 1
|
||||
#elif defined(__ARMEL__)
|
||||
#define ARCH_CPU_ARM_FAMILY 1
|
||||
#define ARCH_CPU_ARMEL 1
|
||||
#define ARCH_CPU_32_BITS 1
|
||||
#define ARCH_CPU_LITTLE_ENDIAN 1
|
||||
#elif defined(__aarch64__) || defined(_M_ARM64)
|
||||
#define ARCH_CPU_ARM_FAMILY 1
|
||||
#define ARCH_CPU_ARM64 1
|
||||
#define ARCH_CPU_64_BITS 1
|
||||
#define ARCH_CPU_LITTLE_ENDIAN 1
|
||||
#elif defined(__pnacl__) || defined(__asmjs__) || defined(__wasm__)
|
||||
#define ARCH_CPU_32_BITS 1
|
||||
#define ARCH_CPU_LITTLE_ENDIAN 1
|
||||
#elif defined(__MIPSEL__)
|
||||
#if defined(__LP64__)
|
||||
#define ARCH_CPU_MIPS_FAMILY 1
|
||||
#define ARCH_CPU_MIPS64EL 1
|
||||
#define ARCH_CPU_64_BITS 1
|
||||
#define ARCH_CPU_LITTLE_ENDIAN 1
|
||||
#else
|
||||
#define ARCH_CPU_MIPS_FAMILY 1
|
||||
#define ARCH_CPU_MIPSEL 1
|
||||
#define ARCH_CPU_32_BITS 1
|
||||
#define ARCH_CPU_LITTLE_ENDIAN 1
|
||||
#endif
|
||||
#elif defined(__MIPSEB__)
|
||||
#if defined(__LP64__)
|
||||
#define ARCH_CPU_MIPS_FAMILY 1
|
||||
#define ARCH_CPU_MIPS64 1
|
||||
#define ARCH_CPU_64_BITS 1
|
||||
#define ARCH_CPU_BIG_ENDIAN 1
|
||||
#else
|
||||
#define ARCH_CPU_MIPS_FAMILY 1
|
||||
#define ARCH_CPU_MIPS 1
|
||||
#define ARCH_CPU_32_BITS 1
|
||||
#define ARCH_CPU_BIG_ENDIAN 1
|
||||
#endif
|
||||
#else
|
||||
#error Please add support for your architecture in include/base/cef_build.h
|
||||
#endif
|
||||
|
||||
// Type detection for wchar_t.
|
||||
#if defined(OS_WIN)
|
||||
#define WCHAR_T_IS_16_BIT
|
||||
#elif defined(OS_FUCHSIA)
|
||||
#define WCHAR_T_IS_32_BIT
|
||||
#elif defined(OS_POSIX) && defined(COMPILER_GCC) && defined(__WCHAR_MAX__) && \
|
||||
(__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff)
|
||||
#define WCHAR_T_IS_32_BIT
|
||||
#elif defined(OS_POSIX) && defined(COMPILER_GCC) && defined(__WCHAR_MAX__) && \
|
||||
(__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff)
|
||||
// On Posix, we'll detect short wchar_t, but projects aren't guaranteed to
|
||||
// compile in this mode (in particular, Chrome doesn't). This is intended for
|
||||
// other projects using base who manage their own dependencies and make sure
|
||||
// short wchar works for them.
|
||||
#define WCHAR_T_IS_16_BIT
|
||||
#else
|
||||
#error Please add support for your compiler in include/base/cef_build.h
|
||||
#endif
|
||||
|
||||
#if defined(OS_ANDROID)
|
||||
// The compiler thinks std::string::const_iterator and "const char*" are
|
||||
// equivalent types.
|
||||
#define STD_STRING_ITERATOR_IS_CHAR_POINTER
|
||||
// The compiler thinks std::u16string::const_iterator and "char16_t*" are
|
||||
// equivalent types.
|
||||
#define BASE_STRING16_ITERATOR_IS_CHAR16_POINTER
|
||||
#endif
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_BUILD_H_
|
||||
|
|
@ -1,250 +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.
|
||||
|
||||
/// \file
|
||||
/// A callback is similar in concept to a function pointer: it wraps a runnable
|
||||
/// object such as a function, method, lambda, or even another callback,
|
||||
/// allowing the runnable object to be invoked later via the callback object.
|
||||
///
|
||||
/// Unlike function pointers, callbacks are created with base::BindOnce() or
|
||||
/// base::BindRepeating() and support partial function application.
|
||||
///
|
||||
/// A base::OnceCallback may be Run() at most once; a base::RepeatingCallback
|
||||
/// may be Run() any number of times. |is_null()| is guaranteed to return true
|
||||
/// for a moved-from callback.
|
||||
///
|
||||
/// <pre>
|
||||
/// // The lambda takes two arguments, but the first argument |x| is bound at
|
||||
/// // callback creation.
|
||||
/// base::OnceCallback<int(int)> cb = base::BindOnce([] (int x, int y) {
|
||||
/// return x + y;
|
||||
/// }, 1);
|
||||
/// // Run() only needs the remaining unbound argument |y|.
|
||||
/// printf("1 + 2 = %d\n", std::move(cb).Run(2)); // Prints 3
|
||||
/// printf("cb is null? %s\n",
|
||||
/// cb.is_null() ? "true" : "false"); // Prints true
|
||||
/// std::move(cb).Run(2); // Crashes since |cb| has already run.
|
||||
/// </pre>
|
||||
///
|
||||
/// Callbacks also support cancellation. A common use is binding the receiver
|
||||
/// object as a WeakPtr<T>. If that weak pointer is invalidated, calling Run()
|
||||
/// will be a no-op. Note that |IsCancelled()| and |is_null()| are distinct:
|
||||
/// simply cancelling a callback will not also make it null.
|
||||
///
|
||||
/// See https://chromium.googlesource.com/chromium/src/+/lkgr/docs/callback.md
|
||||
/// for the full documentation.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_CALLBACK_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_CALLBACK_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/functional/callback.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "include/base/cef_bind.h"
|
||||
#include "include/base/cef_callback_forward.h"
|
||||
#include "include/base/cef_logging.h"
|
||||
#include "include/base/internal/cef_callback_internal.h"
|
||||
|
||||
namespace base {
|
||||
|
||||
template <typename R, typename... Args>
|
||||
class OnceCallback<R(Args...)> : public cef_internal::CallbackBase {
|
||||
public:
|
||||
using ResultType = R;
|
||||
using RunType = R(Args...);
|
||||
using PolymorphicInvoke = R (*)(cef_internal::BindStateBase*,
|
||||
cef_internal::PassingType<Args>...);
|
||||
|
||||
constexpr OnceCallback() = default;
|
||||
OnceCallback(std::nullptr_t) = delete;
|
||||
|
||||
explicit OnceCallback(cef_internal::BindStateBase* bind_state)
|
||||
: cef_internal::CallbackBase(bind_state) {}
|
||||
|
||||
OnceCallback(const OnceCallback&) = delete;
|
||||
OnceCallback& operator=(const OnceCallback&) = delete;
|
||||
|
||||
OnceCallback(OnceCallback&&) noexcept = default;
|
||||
OnceCallback& operator=(OnceCallback&&) noexcept = default;
|
||||
|
||||
OnceCallback(RepeatingCallback<RunType> other)
|
||||
: cef_internal::CallbackBase(std::move(other)) {}
|
||||
|
||||
OnceCallback& operator=(RepeatingCallback<RunType> other) {
|
||||
static_cast<cef_internal::CallbackBase&>(*this) = std::move(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
R Run(Args... args) const& {
|
||||
static_assert(!sizeof(*this),
|
||||
"OnceCallback::Run() may only be invoked on a non-const "
|
||||
"rvalue, i.e. std::move(callback).Run().");
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
R Run(Args... args) && {
|
||||
// Move the callback instance into a local variable before the invocation,
|
||||
// that ensures the internal state is cleared after the invocation.
|
||||
// It's not safe to touch |this| after the invocation, since running the
|
||||
// bound function may destroy |this|.
|
||||
OnceCallback cb = std::move(*this);
|
||||
PolymorphicInvoke f =
|
||||
reinterpret_cast<PolymorphicInvoke>(cb.polymorphic_invoke());
|
||||
return f(cb.bind_state_.get(), std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
// Then() returns a new OnceCallback that receives the same arguments as
|
||||
// |this|, and with the return type of |then|. The returned callback will:
|
||||
// 1) Run the functor currently bound to |this| callback.
|
||||
// 2) Run the |then| callback with the result from step 1 as its single
|
||||
// argument.
|
||||
// 3) Return the value from running the |then| callback.
|
||||
//
|
||||
// Since this method generates a callback that is a replacement for `this`,
|
||||
// `this` will be consumed and reset to a null callback to ensure the
|
||||
// originally-bound functor can be run at most once.
|
||||
template <typename ThenR, typename... ThenArgs>
|
||||
OnceCallback<ThenR(Args...)> Then(OnceCallback<ThenR(ThenArgs...)> then) && {
|
||||
CHECK(then);
|
||||
return BindOnce(
|
||||
cef_internal::ThenHelper<
|
||||
OnceCallback, OnceCallback<ThenR(ThenArgs...)>>::CreateTrampoline(),
|
||||
std::move(*this), std::move(then));
|
||||
}
|
||||
|
||||
// This overload is required; even though RepeatingCallback is implicitly
|
||||
// convertible to OnceCallback, that conversion will not used when matching
|
||||
// for template argument deduction.
|
||||
template <typename ThenR, typename... ThenArgs>
|
||||
OnceCallback<ThenR(Args...)> Then(
|
||||
RepeatingCallback<ThenR(ThenArgs...)> then) && {
|
||||
CHECK(then);
|
||||
return BindOnce(
|
||||
cef_internal::ThenHelper<
|
||||
OnceCallback,
|
||||
RepeatingCallback<ThenR(ThenArgs...)>>::CreateTrampoline(),
|
||||
std::move(*this), std::move(then));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename R, typename... Args>
|
||||
class RepeatingCallback<R(Args...)>
|
||||
: public cef_internal::CallbackBaseCopyable {
|
||||
public:
|
||||
using ResultType = R;
|
||||
using RunType = R(Args...);
|
||||
using PolymorphicInvoke = R (*)(cef_internal::BindStateBase*,
|
||||
cef_internal::PassingType<Args>...);
|
||||
|
||||
constexpr RepeatingCallback() = default;
|
||||
RepeatingCallback(std::nullptr_t) = delete;
|
||||
|
||||
explicit RepeatingCallback(cef_internal::BindStateBase* bind_state)
|
||||
: cef_internal::CallbackBaseCopyable(bind_state) {}
|
||||
|
||||
// Copyable and movable.
|
||||
RepeatingCallback(const RepeatingCallback&) = default;
|
||||
RepeatingCallback& operator=(const RepeatingCallback&) = default;
|
||||
RepeatingCallback(RepeatingCallback&&) noexcept = default;
|
||||
RepeatingCallback& operator=(RepeatingCallback&&) noexcept = default;
|
||||
|
||||
bool operator==(const RepeatingCallback& other) const {
|
||||
return EqualsInternal(other);
|
||||
}
|
||||
|
||||
bool operator!=(const RepeatingCallback& other) const {
|
||||
return !operator==(other);
|
||||
}
|
||||
|
||||
R Run(Args... args) const& {
|
||||
PolymorphicInvoke f =
|
||||
reinterpret_cast<PolymorphicInvoke>(this->polymorphic_invoke());
|
||||
return f(this->bind_state_.get(), std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
R Run(Args... args) && {
|
||||
// Move the callback instance into a local variable before the invocation,
|
||||
// that ensures the internal state is cleared after the invocation.
|
||||
// It's not safe to touch |this| after the invocation, since running the
|
||||
// bound function may destroy |this|.
|
||||
RepeatingCallback cb = std::move(*this);
|
||||
PolymorphicInvoke f =
|
||||
reinterpret_cast<PolymorphicInvoke>(cb.polymorphic_invoke());
|
||||
return f(std::move(cb).bind_state_.get(), std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
// Then() returns a new RepeatingCallback that receives the same arguments as
|
||||
// |this|, and with the return type of |then|. The
|
||||
// returned callback will:
|
||||
// 1) Run the functor currently bound to |this| callback.
|
||||
// 2) Run the |then| callback with the result from step 1 as its single
|
||||
// argument.
|
||||
// 3) Return the value from running the |then| callback.
|
||||
//
|
||||
// If called on an rvalue (e.g. std::move(cb).Then(...)), this method
|
||||
// generates a callback that is a replacement for `this`. Therefore, `this`
|
||||
// will be consumed and reset to a null callback to ensure the
|
||||
// originally-bound functor will be run at most once.
|
||||
template <typename ThenR, typename... ThenArgs>
|
||||
RepeatingCallback<ThenR(Args...)> Then(
|
||||
RepeatingCallback<ThenR(ThenArgs...)> then) const& {
|
||||
CHECK(then);
|
||||
return BindRepeating(
|
||||
cef_internal::ThenHelper<
|
||||
RepeatingCallback,
|
||||
RepeatingCallback<ThenR(ThenArgs...)>>::CreateTrampoline(),
|
||||
*this, std::move(then));
|
||||
}
|
||||
|
||||
template <typename ThenR, typename... ThenArgs>
|
||||
RepeatingCallback<ThenR(Args...)> Then(
|
||||
RepeatingCallback<ThenR(ThenArgs...)> then) && {
|
||||
CHECK(then);
|
||||
return BindRepeating(
|
||||
cef_internal::ThenHelper<
|
||||
RepeatingCallback,
|
||||
RepeatingCallback<ThenR(ThenArgs...)>>::CreateTrampoline(),
|
||||
std::move(*this), std::move(then));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_CALLBACK_H_
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
|
||||
// Google Inc. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef INCLUDE_BASE_CEF_CALLBACK_FORWARD_H_
|
||||
#define INCLUDE_BASE_CEF_CALLBACK_FORWARD_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/functional/callback_forward.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
namespace base {
|
||||
|
||||
template <typename Signature>
|
||||
class OnceCallback;
|
||||
|
||||
template <typename Signature>
|
||||
class RepeatingCallback;
|
||||
|
||||
///
|
||||
/// Syntactic sugar to make OnceClosure<void()> and RepeatingClosure<void()>
|
||||
/// easier to declare since they will be used in a lot of APIs with delayed
|
||||
/// execution.
|
||||
///
|
||||
using OnceClosure = OnceCallback<void()>;
|
||||
using RepeatingClosure = RepeatingCallback<void()>;
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !!USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // INCLUDE_BASE_CEF_CALLBACK_FORWARD_H_
|
||||
|
|
@ -1,261 +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.
|
||||
|
||||
// This defines helpful methods for dealing with Callbacks. Because Callbacks
|
||||
// are implemented using templates, with a class per callback signature, adding
|
||||
// methods to Callback<> itself is unattractive (lots of extra code gets
|
||||
// generated). Instead, consider adding methods here.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_CALLBACK_HELPERS_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_CALLBACK_HELPERS_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/functional/callback_helpers.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include "include/base/cef_bind.h"
|
||||
#include "include/base/cef_callback.h"
|
||||
#include "include/base/cef_logging.h"
|
||||
|
||||
namespace base {
|
||||
|
||||
namespace internal {
|
||||
|
||||
template <typename T>
|
||||
struct IsBaseCallbackImpl : std::false_type {};
|
||||
|
||||
template <typename R, typename... Args>
|
||||
struct IsBaseCallbackImpl<OnceCallback<R(Args...)>> : std::true_type {};
|
||||
|
||||
template <typename R, typename... Args>
|
||||
struct IsBaseCallbackImpl<RepeatingCallback<R(Args...)>> : std::true_type {};
|
||||
|
||||
template <typename T>
|
||||
struct IsOnceCallbackImpl : std::false_type {};
|
||||
|
||||
template <typename R, typename... Args>
|
||||
struct IsOnceCallbackImpl<OnceCallback<R(Args...)>> : std::true_type {};
|
||||
|
||||
} // namespace internal
|
||||
|
||||
///
|
||||
/// IsBaseCallback<T>::value is true when T is any of the Closure or Callback
|
||||
/// family of types.
|
||||
///
|
||||
template <typename T>
|
||||
using IsBaseCallback = internal::IsBaseCallbackImpl<std::decay_t<T>>;
|
||||
|
||||
///
|
||||
/// IsOnceCallback<T>::value is true when T is a OnceClosure or OnceCallback
|
||||
/// type.
|
||||
///
|
||||
template <typename T>
|
||||
using IsOnceCallback = internal::IsOnceCallbackImpl<std::decay_t<T>>;
|
||||
|
||||
///
|
||||
/// SFINAE friendly enabler allowing to overload methods for both Repeating and
|
||||
/// OnceCallbacks.
|
||||
///
|
||||
/// Usage:
|
||||
/// <pre>
|
||||
/// template <template <typename> class CallbackType,
|
||||
/// ... other template args ...,
|
||||
/// typename = EnableIfIsBaseCallback<CallbackType>>
|
||||
/// void DoStuff(CallbackType<...> cb, ...);
|
||||
/// </pre>
|
||||
///
|
||||
template <template <typename> class CallbackType>
|
||||
using EnableIfIsBaseCallback =
|
||||
std::enable_if_t<IsBaseCallback<CallbackType<void()>>::value>;
|
||||
|
||||
namespace internal {
|
||||
|
||||
template <typename... Args>
|
||||
class OnceCallbackHolder final {
|
||||
public:
|
||||
OnceCallbackHolder(OnceCallback<void(Args...)> callback,
|
||||
bool ignore_extra_runs)
|
||||
: callback_(std::move(callback)), ignore_extra_runs_(ignore_extra_runs) {
|
||||
DCHECK(callback_);
|
||||
}
|
||||
OnceCallbackHolder(const OnceCallbackHolder&) = delete;
|
||||
OnceCallbackHolder& operator=(const OnceCallbackHolder&) = delete;
|
||||
|
||||
void Run(Args... args) {
|
||||
if (has_run_.exchange(true)) {
|
||||
CHECK(ignore_extra_runs_) << "Both OnceCallbacks returned by "
|
||||
"base::SplitOnceCallback() were run. "
|
||||
"At most one of the pair should be run.";
|
||||
return;
|
||||
}
|
||||
DCHECK(callback_);
|
||||
std::move(callback_).Run(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
private:
|
||||
volatile std::atomic_bool has_run_{false};
|
||||
base::OnceCallback<void(Args...)> callback_;
|
||||
const bool ignore_extra_runs_;
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
||||
///
|
||||
/// Wraps the given OnceCallback into a RepeatingCallback that relays its
|
||||
/// invocation to the original OnceCallback on the first invocation. The
|
||||
/// following invocations are just ignored.
|
||||
///
|
||||
/// Note that this deliberately subverts the Once/Repeating paradigm of
|
||||
/// Callbacks but helps ease the migration from old-style Callbacks. Avoid if
|
||||
/// possible; use if necessary for migration.
|
||||
///
|
||||
// TODO(tzik): Remove it. https://crbug.com/730593
|
||||
template <typename... Args>
|
||||
RepeatingCallback<void(Args...)> AdaptCallbackForRepeating(
|
||||
OnceCallback<void(Args...)> callback) {
|
||||
using Helper = internal::OnceCallbackHolder<Args...>;
|
||||
return base::BindRepeating(
|
||||
&Helper::Run, std::make_unique<Helper>(std::move(callback),
|
||||
/*ignore_extra_runs=*/true));
|
||||
}
|
||||
|
||||
///
|
||||
/// Wraps the given OnceCallback and returns two OnceCallbacks with an identical
|
||||
/// signature. On first invokation of either returned callbacks, the original
|
||||
/// callback is invoked. Invoking the remaining callback results in a crash.
|
||||
///
|
||||
template <typename... Args>
|
||||
std::pair<OnceCallback<void(Args...)>, OnceCallback<void(Args...)>>
|
||||
SplitOnceCallback(OnceCallback<void(Args...)> callback) {
|
||||
using Helper = internal::OnceCallbackHolder<Args...>;
|
||||
auto wrapped_once = base::BindRepeating(
|
||||
&Helper::Run, std::make_unique<Helper>(std::move(callback),
|
||||
/*ignore_extra_runs=*/false));
|
||||
return std::make_pair(wrapped_once, wrapped_once);
|
||||
}
|
||||
|
||||
///
|
||||
/// ScopedClosureRunner is akin to std::unique_ptr<> for Closures. It ensures
|
||||
/// that the Closure is executed no matter how the current scope exits.
|
||||
/// If you are looking for "ScopedCallback", "CallbackRunner", or
|
||||
/// "CallbackScoper" this is the class you want.
|
||||
///
|
||||
class ScopedClosureRunner {
|
||||
public:
|
||||
ScopedClosureRunner();
|
||||
explicit ScopedClosureRunner(OnceClosure closure);
|
||||
ScopedClosureRunner(ScopedClosureRunner&& other);
|
||||
// Runs the current closure if it's set, then replaces it with the closure
|
||||
// from |other|. This is akin to how unique_ptr frees the contained pointer in
|
||||
// its move assignment operator. If you need to explicitly avoid running any
|
||||
// current closure, use ReplaceClosure().
|
||||
ScopedClosureRunner& operator=(ScopedClosureRunner&& other);
|
||||
~ScopedClosureRunner();
|
||||
|
||||
explicit operator bool() const { return !!closure_; }
|
||||
|
||||
// Calls the current closure and resets it, so it wont be called again.
|
||||
void RunAndReset();
|
||||
|
||||
// Replaces closure with the new one releasing the old one without calling it.
|
||||
void ReplaceClosure(OnceClosure closure);
|
||||
|
||||
// Releases the Closure without calling.
|
||||
[[nodiscard]] OnceClosure Release();
|
||||
|
||||
private:
|
||||
OnceClosure closure_;
|
||||
};
|
||||
|
||||
///
|
||||
/// Creates a null callback.
|
||||
///
|
||||
class NullCallback {
|
||||
public:
|
||||
template <typename R, typename... Args>
|
||||
operator RepeatingCallback<R(Args...)>() const {
|
||||
return RepeatingCallback<R(Args...)>();
|
||||
}
|
||||
template <typename R, typename... Args>
|
||||
operator OnceCallback<R(Args...)>() const {
|
||||
return OnceCallback<R(Args...)>();
|
||||
}
|
||||
};
|
||||
|
||||
///
|
||||
/// Creates a callback that does nothing when called.
|
||||
///
|
||||
class DoNothing {
|
||||
public:
|
||||
template <typename... Args>
|
||||
operator RepeatingCallback<void(Args...)>() const {
|
||||
return Repeatedly<Args...>();
|
||||
}
|
||||
template <typename... Args>
|
||||
operator OnceCallback<void(Args...)>() const {
|
||||
return Once<Args...>();
|
||||
}
|
||||
// Explicit way of specifying a specific callback type when the compiler can't
|
||||
// deduce it.
|
||||
template <typename... Args>
|
||||
static RepeatingCallback<void(Args...)> Repeatedly() {
|
||||
return BindRepeating([](Args... args) {});
|
||||
}
|
||||
template <typename... Args>
|
||||
static OnceCallback<void(Args...)> Once() {
|
||||
return BindOnce([](Args... args) {});
|
||||
}
|
||||
};
|
||||
|
||||
///
|
||||
/// Useful for creating a Closure that will delete a pointer when invoked. Only
|
||||
/// use this when necessary. In most cases MessageLoop::DeleteSoon() is a better
|
||||
/// fit.
|
||||
///
|
||||
template <typename T>
|
||||
void DeletePointer(T* obj) {
|
||||
delete obj;
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_CALLBACK_HELPERS_H_
|
||||
|
|
@ -1,403 +0,0 @@
|
|||
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2013
|
||||
// Google Inc. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
///
|
||||
/// \file
|
||||
/// A container for a list of callbacks. Provides callers the ability to
|
||||
/// manually or automatically unregister callbacks at any time, including during
|
||||
/// callback notification.
|
||||
///
|
||||
/// TYPICAL USAGE:
|
||||
///
|
||||
/// <pre>
|
||||
/// class MyWidget {
|
||||
/// public:
|
||||
/// using CallbackList = base::RepeatingCallbackList<void(const Foo&)>;
|
||||
///
|
||||
/// // Registers |cb| to be called whenever NotifyFoo() is executed.
|
||||
/// CallbackListSubscription RegisterCallback(CallbackList::CallbackType cb) {
|
||||
/// return callback_list_.Add(std::move(cb));
|
||||
/// }
|
||||
///
|
||||
/// private:
|
||||
/// // Calls all registered callbacks, with |foo| as the supplied arg.
|
||||
/// void NotifyFoo(const Foo& foo) {
|
||||
/// callback_list_.Notify(foo);
|
||||
/// }
|
||||
///
|
||||
/// CallbackList callback_list_;
|
||||
/// };
|
||||
///
|
||||
///
|
||||
/// class MyWidgetListener {
|
||||
/// private:
|
||||
/// void OnFoo(const Foo& foo) {
|
||||
/// // Called whenever MyWidget::NotifyFoo() is executed, unless
|
||||
/// // |foo_subscription_| has been destroyed.
|
||||
/// }
|
||||
///
|
||||
/// // Automatically deregisters the callback when deleted (e.g. in
|
||||
/// // ~MyWidgetListener()). Unretained(this) is safe here since the
|
||||
/// // ScopedClosureRunner does not outlive |this|.
|
||||
/// CallbackListSubscription foo_subscription_ =
|
||||
/// MyWidget::Get()->RegisterCallback(
|
||||
/// base::BindRepeating(&MyWidgetListener::OnFoo,
|
||||
/// base::Unretained(this)));
|
||||
/// };
|
||||
/// </pre>
|
||||
///
|
||||
/// UNSUPPORTED:
|
||||
///
|
||||
/// * Destroying the CallbackList during callback notification.
|
||||
///
|
||||
/// This is possible to support, but not currently necessary.
|
||||
///
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_CALLBACK_LIST_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_CALLBACK_LIST_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/functional/callback_list.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include <algorithm>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "include/base/cef_auto_reset.h"
|
||||
#include "include/base/cef_bind.h"
|
||||
#include "include/base/cef_callback.h"
|
||||
#include "include/base/cef_callback_helpers.h"
|
||||
#include "include/base/cef_logging.h"
|
||||
#include "include/base/cef_weak_ptr.h"
|
||||
|
||||
namespace base {
|
||||
namespace internal {
|
||||
template <typename CallbackListImpl>
|
||||
class CallbackListBase;
|
||||
} // namespace internal
|
||||
|
||||
template <typename Signature>
|
||||
class OnceCallbackList;
|
||||
|
||||
template <typename Signature>
|
||||
class RepeatingCallbackList;
|
||||
|
||||
// A trimmed-down version of ScopedClosureRunner that can be used to guarantee a
|
||||
// closure is run on destruction. This is designed to be used by
|
||||
// CallbackListBase to run CancelCallback() when this subscription dies;
|
||||
// consumers can avoid callbacks on dead objects by ensuring the subscription
|
||||
// returned by CallbackListBase::Add() does not outlive the bound object in the
|
||||
// callback. A typical way to do this is to bind a callback to a member function
|
||||
// on `this` and store the returned subscription as a member variable.
|
||||
class CallbackListSubscription {
|
||||
public:
|
||||
CallbackListSubscription();
|
||||
CallbackListSubscription(CallbackListSubscription&& subscription);
|
||||
CallbackListSubscription& operator=(CallbackListSubscription&& subscription);
|
||||
~CallbackListSubscription();
|
||||
|
||||
explicit operator bool() const { return !!closure_; }
|
||||
|
||||
private:
|
||||
template <typename T>
|
||||
friend class internal::CallbackListBase;
|
||||
|
||||
explicit CallbackListSubscription(base::OnceClosure closure);
|
||||
|
||||
void Run();
|
||||
|
||||
OnceClosure closure_;
|
||||
};
|
||||
|
||||
namespace internal {
|
||||
|
||||
// From base/stl_util.h.
|
||||
template <class T, class Allocator, class Predicate>
|
||||
size_t EraseIf(std::list<T, Allocator>& container, Predicate pred) {
|
||||
size_t old_size = container.size();
|
||||
container.remove_if(pred);
|
||||
return old_size - container.size();
|
||||
}
|
||||
|
||||
// A traits class to break circular type dependencies between CallbackListBase
|
||||
// and its subclasses.
|
||||
template <typename CallbackList>
|
||||
struct CallbackListTraits;
|
||||
|
||||
// NOTE: It's important that Callbacks provide iterator stability when items are
|
||||
// added to the end, so e.g. a std::vector<> is not suitable here.
|
||||
template <typename Signature>
|
||||
struct CallbackListTraits<OnceCallbackList<Signature>> {
|
||||
using CallbackType = OnceCallback<Signature>;
|
||||
using Callbacks = std::list<CallbackType>;
|
||||
};
|
||||
template <typename Signature>
|
||||
struct CallbackListTraits<RepeatingCallbackList<Signature>> {
|
||||
using CallbackType = RepeatingCallback<Signature>;
|
||||
using Callbacks = std::list<CallbackType>;
|
||||
};
|
||||
|
||||
template <typename CallbackListImpl>
|
||||
class CallbackListBase {
|
||||
public:
|
||||
using CallbackType =
|
||||
typename CallbackListTraits<CallbackListImpl>::CallbackType;
|
||||
static_assert(IsBaseCallback<CallbackType>::value, "");
|
||||
|
||||
// TODO(crbug.com/1103086): Update references to use this directly and by
|
||||
// value, then remove.
|
||||
using Subscription = CallbackListSubscription;
|
||||
|
||||
CallbackListBase() = default;
|
||||
CallbackListBase(const CallbackListBase&) = delete;
|
||||
CallbackListBase& operator=(const CallbackListBase&) = delete;
|
||||
|
||||
~CallbackListBase() {
|
||||
// Destroying the list during iteration is unsupported and will cause a UAF.
|
||||
CHECK(!iterating_);
|
||||
}
|
||||
|
||||
// Registers |cb| for future notifications. Returns a CallbackListSubscription
|
||||
// whose destruction will cancel |cb|.
|
||||
[[nodiscard]] CallbackListSubscription Add(CallbackType cb) {
|
||||
DCHECK(!cb.is_null());
|
||||
return CallbackListSubscription(base::BindOnce(
|
||||
&CallbackListBase::CancelCallback, weak_ptr_factory_.GetWeakPtr(),
|
||||
callbacks_.insert(callbacks_.end(), std::move(cb))));
|
||||
}
|
||||
|
||||
// Registers |cb| for future notifications. Provides no way for the caller to
|
||||
// cancel, so this is only safe for cases where the callback is guaranteed to
|
||||
// live at least as long as this list (e.g. if it's bound on the same object
|
||||
// that owns the list).
|
||||
// TODO(pkasting): Attempt to use Add() instead and see if callers can relax
|
||||
// other lifetime/ordering mechanisms as a result.
|
||||
void AddUnsafe(CallbackType cb) {
|
||||
DCHECK(!cb.is_null());
|
||||
callbacks_.push_back(std::move(cb));
|
||||
}
|
||||
|
||||
// Registers |removal_callback| to be run after elements are removed from the
|
||||
// list of registered callbacks.
|
||||
void set_removal_callback(const RepeatingClosure& removal_callback) {
|
||||
removal_callback_ = removal_callback;
|
||||
}
|
||||
|
||||
// Returns whether the list of registered callbacks is empty (from an external
|
||||
// perspective -- meaning no remaining callbacks are live).
|
||||
bool empty() const {
|
||||
return std::all_of(callbacks_.cbegin(), callbacks_.cend(),
|
||||
[](const auto& callback) { return callback.is_null(); });
|
||||
}
|
||||
|
||||
// Calls all registered callbacks that are not canceled beforehand. If any
|
||||
// callbacks are unregistered, notifies any registered removal callback at the
|
||||
// end.
|
||||
//
|
||||
// Arguments must be copyable, since they must be supplied to all callbacks.
|
||||
// Move-only types would be destructively modified by passing them to the
|
||||
// first callback and not reach subsequent callbacks as intended.
|
||||
//
|
||||
// Notify() may be called re-entrantly, in which case the nested call
|
||||
// completes before the outer one continues. Callbacks are only ever added at
|
||||
// the end and canceled callbacks are not pruned from the list until the
|
||||
// outermost iteration completes, so existing iterators should never be
|
||||
// invalidated. However, this does mean that a callback added during a nested
|
||||
// call can be notified by outer calls -- meaning it will be notified about
|
||||
// things that happened before it was added -- if its subscription outlives
|
||||
// the reentrant Notify() call.
|
||||
template <typename... RunArgs>
|
||||
void Notify(RunArgs&&... args) {
|
||||
if (empty()) {
|
||||
return; // Nothing to do.
|
||||
}
|
||||
|
||||
{
|
||||
AutoReset<bool> iterating(&iterating_, true);
|
||||
|
||||
// Skip any callbacks that are canceled during iteration.
|
||||
// NOTE: Since RunCallback() may call Add(), it's not safe to cache the
|
||||
// value of callbacks_.end() across loop iterations.
|
||||
const auto next_valid = [this](const auto it) {
|
||||
return std::find_if_not(it, callbacks_.end(), [](const auto& callback) {
|
||||
return callback.is_null();
|
||||
});
|
||||
};
|
||||
for (auto it = next_valid(callbacks_.begin()); it != callbacks_.end();
|
||||
it = next_valid(it)) {
|
||||
// NOTE: Intentionally does not call std::forward<RunArgs>(args)...,
|
||||
// since that would allow move-only arguments.
|
||||
static_cast<CallbackListImpl*>(this)->RunCallback(it++, args...);
|
||||
}
|
||||
}
|
||||
|
||||
// Re-entrant invocations shouldn't prune anything from the list. This can
|
||||
// invalidate iterators from underneath higher call frames. It's safe to
|
||||
// simply do nothing, since the outermost frame will continue through here
|
||||
// and prune all null callbacks below.
|
||||
if (iterating_) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Any null callbacks remaining in the list were canceled due to
|
||||
// Subscription destruction during iteration, and can safely be erased now.
|
||||
const size_t erased_callbacks =
|
||||
EraseIf(callbacks_, [](const auto& cb) { return cb.is_null(); });
|
||||
|
||||
// Run |removal_callback_| if any callbacks were canceled. Note that we
|
||||
// cannot simply compare list sizes before and after iterating, since
|
||||
// notification may result in Add()ing new callbacks as well as canceling
|
||||
// them. Also note that if this is a OnceCallbackList, the OnceCallbacks
|
||||
// that were executed above have all been removed regardless of whether
|
||||
// they're counted in |erased_callbacks_|.
|
||||
if (removal_callback_ &&
|
||||
(erased_callbacks || IsOnceCallback<CallbackType>::value)) {
|
||||
removal_callback_.Run(); // May delete |this|!
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
using Callbacks = typename CallbackListTraits<CallbackListImpl>::Callbacks;
|
||||
|
||||
// Holds non-null callbacks, which will be called during Notify().
|
||||
Callbacks callbacks_;
|
||||
|
||||
private:
|
||||
// Cancels the callback pointed to by |it|, which is guaranteed to be valid.
|
||||
void CancelCallback(const typename Callbacks::iterator& it) {
|
||||
if (static_cast<CallbackListImpl*>(this)->CancelNullCallback(it)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (iterating_) {
|
||||
// Calling erase() here is unsafe, since the loop in Notify() may be
|
||||
// referencing this same iterator, e.g. if adjacent callbacks'
|
||||
// Subscriptions are both destroyed when the first one is Run(). Just
|
||||
// reset the callback and let Notify() clean it up at the end.
|
||||
it->Reset();
|
||||
} else {
|
||||
callbacks_.erase(it);
|
||||
if (removal_callback_) {
|
||||
removal_callback_.Run(); // May delete |this|!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set while Notify() is traversing |callbacks_|. Used primarily to avoid
|
||||
// invalidating iterators that may be in use.
|
||||
bool iterating_ = false;
|
||||
|
||||
// Called after elements are removed from |callbacks_|.
|
||||
RepeatingClosure removal_callback_;
|
||||
|
||||
WeakPtrFactory<CallbackListBase> weak_ptr_factory_{this};
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
||||
template <typename Signature>
|
||||
class OnceCallbackList
|
||||
: public internal::CallbackListBase<OnceCallbackList<Signature>> {
|
||||
private:
|
||||
friend internal::CallbackListBase<OnceCallbackList>;
|
||||
using Traits = internal::CallbackListTraits<OnceCallbackList>;
|
||||
|
||||
// Runs the current callback, which may cancel it or any other callbacks.
|
||||
template <typename... RunArgs>
|
||||
void RunCallback(typename Traits::Callbacks::iterator it, RunArgs&&... args) {
|
||||
// OnceCallbacks still have Subscriptions with outstanding iterators;
|
||||
// splice() removes them from |callbacks_| without invalidating those.
|
||||
null_callbacks_.splice(null_callbacks_.end(), this->callbacks_, it);
|
||||
|
||||
// NOTE: Intentionally does not call std::forward<RunArgs>(args)...; see
|
||||
// comments in Notify().
|
||||
std::move(*it).Run(args...);
|
||||
}
|
||||
|
||||
// If |it| refers to an already-canceled callback, does any necessary cleanup
|
||||
// and returns true. Otherwise returns false.
|
||||
bool CancelNullCallback(const typename Traits::Callbacks::iterator& it) {
|
||||
if (it->is_null()) {
|
||||
null_callbacks_.erase(it);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Holds null callbacks whose Subscriptions are still alive, so the
|
||||
// Subscriptions will still contain valid iterators. Only needed for
|
||||
// OnceCallbacks, since RepeatingCallbacks are not canceled except by
|
||||
// Subscription destruction.
|
||||
typename Traits::Callbacks null_callbacks_;
|
||||
};
|
||||
|
||||
template <typename Signature>
|
||||
class RepeatingCallbackList
|
||||
: public internal::CallbackListBase<RepeatingCallbackList<Signature>> {
|
||||
private:
|
||||
friend internal::CallbackListBase<RepeatingCallbackList>;
|
||||
using Traits = internal::CallbackListTraits<RepeatingCallbackList>;
|
||||
// Runs the current callback, which may cancel it or any other callbacks.
|
||||
template <typename... RunArgs>
|
||||
void RunCallback(typename Traits::Callbacks::iterator it, RunArgs&&... args) {
|
||||
// NOTE: Intentionally does not call std::forward<RunArgs>(args)...; see
|
||||
// comments in Notify().
|
||||
it->Run(args...);
|
||||
}
|
||||
|
||||
// If |it| refers to an already-canceled callback, does any necessary cleanup
|
||||
// and returns true. Otherwise returns false.
|
||||
bool CancelNullCallback(const typename Traits::Callbacks::iterator& it) {
|
||||
// Because at most one Subscription can point to a given callback, and
|
||||
// RepeatingCallbacks are only reset by CancelCallback(), no one should be
|
||||
// able to request cancellation of a canceled RepeatingCallback.
|
||||
DCHECK(!it->is_null());
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
///
|
||||
/// Syntactic sugar to parallel that used for Callbacks.
|
||||
///
|
||||
using OnceClosureList = OnceCallbackList<void()>;
|
||||
using RepeatingClosureList = RepeatingCallbackList<void()>;
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_CALLBACK_LIST_H_
|
||||
|
|
@ -1,195 +0,0 @@
|
|||
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
|
||||
// Google Inc. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
///
|
||||
/// \file
|
||||
/// CancelableCallback is a wrapper around base::Callback that allows
|
||||
/// cancellation of a callback. CancelableCallback takes a reference on the
|
||||
/// wrapped callback until this object is destroyed or Reset()/Cancel() are
|
||||
/// called.
|
||||
///
|
||||
/// NOTE:
|
||||
///
|
||||
/// Calling CancelableCallback::Cancel() brings the object back to its natural,
|
||||
/// default-constructed state, i.e., CancelableCallback::callback() will return
|
||||
/// a null callback.
|
||||
///
|
||||
/// THREAD-SAFETY:
|
||||
///
|
||||
/// CancelableCallback objects must be created on, posted to, cancelled on, and
|
||||
/// destroyed on the same thread.
|
||||
///
|
||||
///
|
||||
/// EXAMPLE USAGE:
|
||||
///
|
||||
/// In the following example, the test is verifying that RunIntensiveTest()
|
||||
/// Quit()s the message loop within 4 seconds. The cancelable callback is posted
|
||||
/// to the message loop, the intensive test runs, the message loop is run,
|
||||
/// then the callback is cancelled.
|
||||
///
|
||||
/// <pre>
|
||||
/// RunLoop run_loop;
|
||||
///
|
||||
/// void TimeoutCallback(const std::string& timeout_message) {
|
||||
/// FAIL() << timeout_message;
|
||||
/// run_loop.QuitWhenIdle();
|
||||
/// }
|
||||
///
|
||||
/// CancelableOnceClosure timeout(
|
||||
/// base::BindOnce(&TimeoutCallback, "Test timed out."));
|
||||
/// ThreadTaskRunnerHandle::Get()->PostDelayedTask(FROM_HERE,
|
||||
/// timeout.callback(),
|
||||
/// TimeDelta::FromSeconds(4));
|
||||
/// RunIntensiveTest();
|
||||
/// run_loop.Run();
|
||||
/// // Hopefully this is hit before the timeout callback runs.
|
||||
/// timeout.Cancel();
|
||||
/// </pre>
|
||||
///
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_CANCELABLE_CALLBACK_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_CANCELABLE_CALLBACK_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/cancelable_callback.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "include/base/cef_bind.h"
|
||||
#include "include/base/cef_callback.h"
|
||||
#include "include/base/cef_compiler_specific.h"
|
||||
#include "include/base/cef_logging.h"
|
||||
#include "include/base/cef_weak_ptr.h"
|
||||
#include "include/base/internal/cef_callback_internal.h"
|
||||
|
||||
namespace base {
|
||||
namespace internal {
|
||||
|
||||
template <typename CallbackType>
|
||||
class CancelableCallbackImpl {
|
||||
public:
|
||||
CancelableCallbackImpl() = default;
|
||||
CancelableCallbackImpl(const CancelableCallbackImpl&) = delete;
|
||||
CancelableCallbackImpl& operator=(const CancelableCallbackImpl&) = delete;
|
||||
|
||||
// |callback| must not be null.
|
||||
explicit CancelableCallbackImpl(CallbackType callback)
|
||||
: callback_(std::move(callback)) {
|
||||
DCHECK(callback_);
|
||||
}
|
||||
|
||||
~CancelableCallbackImpl() = default;
|
||||
|
||||
// Cancels and drops the reference to the wrapped callback.
|
||||
void Cancel() {
|
||||
weak_ptr_factory_.InvalidateWeakPtrs();
|
||||
callback_.Reset();
|
||||
}
|
||||
|
||||
// Returns true if the wrapped callback has been cancelled.
|
||||
bool IsCancelled() const { return callback_.is_null(); }
|
||||
|
||||
// Sets |callback| as the closure that may be cancelled. |callback| may not
|
||||
// be null. Outstanding and any previously wrapped callbacks are cancelled.
|
||||
void Reset(CallbackType callback) {
|
||||
DCHECK(callback);
|
||||
// Outstanding tasks (e.g., posted to a message loop) must not be called.
|
||||
Cancel();
|
||||
callback_ = std::move(callback);
|
||||
}
|
||||
|
||||
// Returns a callback that can be disabled by calling Cancel().
|
||||
CallbackType callback() const {
|
||||
if (!callback_) {
|
||||
return CallbackType();
|
||||
}
|
||||
CallbackType forwarder;
|
||||
MakeForwarder(&forwarder);
|
||||
return forwarder;
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename... Args>
|
||||
void MakeForwarder(RepeatingCallback<void(Args...)>* out) const {
|
||||
using ForwarderType = void (CancelableCallbackImpl::*)(Args...);
|
||||
ForwarderType forwarder = &CancelableCallbackImpl::ForwardRepeating;
|
||||
*out = BindRepeating(forwarder, weak_ptr_factory_.GetWeakPtr());
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
void MakeForwarder(OnceCallback<void(Args...)>* out) const {
|
||||
using ForwarderType = void (CancelableCallbackImpl::*)(Args...);
|
||||
ForwarderType forwarder = &CancelableCallbackImpl::ForwardOnce;
|
||||
*out = BindOnce(forwarder, weak_ptr_factory_.GetWeakPtr());
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
void ForwardRepeating(Args... args) {
|
||||
callback_.Run(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
void ForwardOnce(Args... args) {
|
||||
weak_ptr_factory_.InvalidateWeakPtrs();
|
||||
std::move(callback_).Run(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
// The stored closure that may be cancelled.
|
||||
CallbackType callback_;
|
||||
mutable base::WeakPtrFactory<CancelableCallbackImpl> weak_ptr_factory_{this};
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
||||
///
|
||||
/// Consider using base::WeakPtr directly instead of base::CancelableCallback
|
||||
/// for the task cancellation.
|
||||
///
|
||||
template <typename Signature>
|
||||
using CancelableOnceCallback =
|
||||
internal::CancelableCallbackImpl<OnceCallback<Signature>>;
|
||||
using CancelableOnceClosure = CancelableOnceCallback<void()>;
|
||||
|
||||
template <typename Signature>
|
||||
using CancelableRepeatingCallback =
|
||||
internal::CancelableCallbackImpl<RepeatingCallback<Signature>>;
|
||||
using CancelableRepeatingClosure = CancelableRepeatingCallback<void()>;
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_CANCELABLE_CALLBACK_H_
|
||||
|
|
@ -1,382 +0,0 @@
|
|||
// Copyright (c) 2021 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_COMPILER_SPECIFIC_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_COMPILER_SPECIFIC_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/compiler_specific.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include "include/base/cef_build.h"
|
||||
|
||||
// This is a wrapper around `__has_cpp_attribute`, which can be used to test for
|
||||
// the presence of an attribute. In case the compiler does not support this
|
||||
// macro it will simply evaluate to 0.
|
||||
//
|
||||
// References:
|
||||
// https://wg21.link/sd6#testing-for-the-presence-of-an-attribute-__has_cpp_attribute
|
||||
// https://wg21.link/cpp.cond#:__has_cpp_attribute
|
||||
#if defined(__has_cpp_attribute)
|
||||
#define HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
|
||||
#else
|
||||
#define HAS_CPP_ATTRIBUTE(x) 0
|
||||
#endif
|
||||
|
||||
// A wrapper around `__has_builtin`, similar to HAS_CPP_ATTRIBUTE.
|
||||
#if defined(__has_builtin)
|
||||
#define HAS_BUILTIN(x) __has_builtin(x)
|
||||
#else
|
||||
#define HAS_BUILTIN(x) 0
|
||||
#endif
|
||||
|
||||
// __has_feature and __has_attribute don't exist for MSVC.
|
||||
#if !defined(__has_feature)
|
||||
#define __has_feature(x) 0
|
||||
#endif // !defined(__has_feature)
|
||||
|
||||
#if !defined(__has_attribute)
|
||||
#define __has_attribute(x) 0
|
||||
#endif // !defined(__has_attribute)
|
||||
|
||||
// Annotate a function indicating it should not be inlined.
|
||||
// Use like:
|
||||
// NOINLINE void DoStuff() { ... }
|
||||
#if defined(COMPILER_GCC)
|
||||
#define NOINLINE __attribute__((noinline))
|
||||
#elif defined(COMPILER_MSVC)
|
||||
#define NOINLINE __declspec(noinline)
|
||||
#else
|
||||
#define NOINLINE
|
||||
#endif
|
||||
|
||||
#if defined(COMPILER_GCC) && defined(NDEBUG)
|
||||
#define ALWAYS_INLINE inline __attribute__((__always_inline__))
|
||||
#elif defined(COMPILER_MSVC) && defined(NDEBUG)
|
||||
#define ALWAYS_INLINE __forceinline
|
||||
#else
|
||||
#define ALWAYS_INLINE inline
|
||||
#endif
|
||||
|
||||
// Annotate a function indicating it should never be tail called. Useful to make
|
||||
// sure callers of the annotated function are never omitted from call-stacks.
|
||||
// To provide the complementary behavior (prevent the annotated function from
|
||||
// being omitted) look at NOINLINE. Also note that this doesn't prevent code
|
||||
// folding of multiple identical caller functions into a single signature. To
|
||||
// prevent code folding, see NO_CODE_FOLDING() in base/debug/alias.h.
|
||||
// Use like:
|
||||
// void NOT_TAIL_CALLED FooBar();
|
||||
#if defined(__clang__) && __has_attribute(not_tail_called)
|
||||
#define NOT_TAIL_CALLED __attribute__((not_tail_called))
|
||||
#else
|
||||
#define NOT_TAIL_CALLED
|
||||
#endif
|
||||
|
||||
// Specify memory alignment for structs, classes, etc.
|
||||
// Use like:
|
||||
// class ALIGNAS(16) MyClass { ... }
|
||||
// ALIGNAS(16) int array[4];
|
||||
//
|
||||
// In most places you can use the C++11 keyword "alignas", which is preferred.
|
||||
//
|
||||
// But compilers have trouble mixing __attribute__((...)) syntax with
|
||||
// alignas(...) syntax.
|
||||
//
|
||||
// Doesn't work in clang or gcc:
|
||||
// struct alignas(16) __attribute__((packed)) S { char c; };
|
||||
// Works in clang but not gcc:
|
||||
// struct __attribute__((packed)) alignas(16) S2 { char c; };
|
||||
// Works in clang and gcc:
|
||||
// struct alignas(16) S3 { char c; } __attribute__((packed));
|
||||
//
|
||||
// There are also some attributes that must be specified *before* a class
|
||||
// definition: visibility (used for exporting functions/classes) is one of
|
||||
// these attributes. This means that it is not possible to use alignas() with a
|
||||
// class that is marked as exported.
|
||||
#if defined(COMPILER_MSVC)
|
||||
#define ALIGNAS(byte_alignment) __declspec(align(byte_alignment))
|
||||
#elif defined(COMPILER_GCC)
|
||||
#define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment)))
|
||||
#endif
|
||||
|
||||
// In case the compiler supports it NO_UNIQUE_ADDRESS evaluates to the C++20
|
||||
// attribute [[no_unique_address]]. This allows annotating data members so that
|
||||
// they need not have an address distinct from all other non-static data members
|
||||
// of its class.
|
||||
//
|
||||
// References:
|
||||
// * https://en.cppreference.com/w/cpp/language/attributes/no_unique_address
|
||||
// * https://wg21.link/dcl.attr.nouniqueaddr
|
||||
#if HAS_CPP_ATTRIBUTE(no_unique_address)
|
||||
#define NO_UNIQUE_ADDRESS [[no_unique_address]]
|
||||
#else
|
||||
#define NO_UNIQUE_ADDRESS
|
||||
#endif
|
||||
|
||||
// Tell the compiler a function is using a printf-style format string.
|
||||
// |format_param| is the one-based index of the format string parameter;
|
||||
// |dots_param| is the one-based index of the "..." parameter.
|
||||
// For v*printf functions (which take a va_list), pass 0 for dots_param.
|
||||
// (This is undocumented but matches what the system C headers do.)
|
||||
// For member functions, the implicit this parameter counts as index 1.
|
||||
#if defined(COMPILER_GCC) || defined(__clang__)
|
||||
#define PRINTF_FORMAT(format_param, dots_param) \
|
||||
__attribute__((format(printf, format_param, dots_param)))
|
||||
#else
|
||||
#define PRINTF_FORMAT(format_param, dots_param)
|
||||
#endif
|
||||
|
||||
// WPRINTF_FORMAT is the same, but for wide format strings.
|
||||
// This doesn't appear to yet be implemented in any compiler.
|
||||
// See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38308 .
|
||||
#define WPRINTF_FORMAT(format_param, dots_param)
|
||||
// If available, it would look like:
|
||||
// __attribute__((format(wprintf, format_param, dots_param)))
|
||||
|
||||
// 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
|
||||
|
||||
// MemorySanitizer annotations.
|
||||
#if defined(MEMORY_SANITIZER) && !defined(OS_NACL)
|
||||
#include <sanitizer/msan_interface.h>
|
||||
|
||||
// Mark a memory region fully initialized.
|
||||
// Use this to annotate code that deliberately reads uninitialized data, for
|
||||
// example a GC scavenging root set pointers from the stack.
|
||||
#define MSAN_UNPOISON(p, size) __msan_unpoison(p, size)
|
||||
|
||||
// Check a memory region for initializedness, as if it was being used here.
|
||||
// If any bits are uninitialized, crash with an MSan report.
|
||||
// Use this to sanitize data which MSan won't be able to track, e.g. before
|
||||
// passing data to another process via shared memory.
|
||||
#define MSAN_CHECK_MEM_IS_INITIALIZED(p, size) \
|
||||
__msan_check_mem_is_initialized(p, size)
|
||||
#else // MEMORY_SANITIZER
|
||||
#define MSAN_UNPOISON(p, size)
|
||||
#define MSAN_CHECK_MEM_IS_INITIALIZED(p, size)
|
||||
#endif // MEMORY_SANITIZER
|
||||
|
||||
// DISABLE_CFI_PERF -- Disable Control Flow Integrity for perf reasons.
|
||||
#if !defined(DISABLE_CFI_PERF)
|
||||
#if defined(__clang__) && defined(OFFICIAL_BUILD)
|
||||
#define DISABLE_CFI_PERF __attribute__((no_sanitize("cfi")))
|
||||
#else
|
||||
#define DISABLE_CFI_PERF
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// DISABLE_CFI_ICALL -- Disable Control Flow Integrity indirect call checks.
|
||||
#if !defined(DISABLE_CFI_ICALL)
|
||||
#if defined(OS_WIN)
|
||||
// Windows also needs __declspec(guard(nocf)).
|
||||
#define DISABLE_CFI_ICALL NO_SANITIZE("cfi-icall") __declspec(guard(nocf))
|
||||
#else
|
||||
#define DISABLE_CFI_ICALL NO_SANITIZE("cfi-icall")
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(DISABLE_CFI_ICALL)
|
||||
#define DISABLE_CFI_ICALL
|
||||
#endif
|
||||
|
||||
// Macro useful for writing cross-platform function pointers.
|
||||
#if !defined(CDECL)
|
||||
#if defined(OS_WIN)
|
||||
#define CDECL __cdecl
|
||||
#else // defined(OS_WIN)
|
||||
#define CDECL
|
||||
#endif // defined(OS_WIN)
|
||||
#endif // !defined(CDECL)
|
||||
|
||||
// Macro for hinting that an expression is likely to be false.
|
||||
#if !defined(UNLIKELY)
|
||||
#if defined(COMPILER_GCC) || defined(__clang__)
|
||||
#define UNLIKELY(x) __builtin_expect(!!(x), 0)
|
||||
#else
|
||||
#define UNLIKELY(x) (x)
|
||||
#endif // defined(COMPILER_GCC)
|
||||
#endif // !defined(UNLIKELY)
|
||||
|
||||
#if !defined(LIKELY)
|
||||
#if defined(COMPILER_GCC) || defined(__clang__)
|
||||
#define LIKELY(x) __builtin_expect(!!(x), 1)
|
||||
#else
|
||||
#define LIKELY(x) (x)
|
||||
#endif // defined(COMPILER_GCC)
|
||||
#endif // !defined(LIKELY)
|
||||
|
||||
// Compiler feature-detection.
|
||||
// clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension
|
||||
#if defined(__has_feature)
|
||||
#define HAS_FEATURE(FEATURE) __has_feature(FEATURE)
|
||||
#else
|
||||
#define HAS_FEATURE(FEATURE) 0
|
||||
#endif
|
||||
|
||||
#if defined(COMPILER_GCC)
|
||||
#define PRETTY_FUNCTION __PRETTY_FUNCTION__
|
||||
#elif defined(COMPILER_MSVC)
|
||||
#define PRETTY_FUNCTION __FUNCSIG__
|
||||
#else
|
||||
// See https://en.cppreference.com/w/c/language/function_definition#func
|
||||
#define PRETTY_FUNCTION __func__
|
||||
#endif
|
||||
|
||||
#if !defined(CPU_ARM_NEON)
|
||||
#if defined(__arm__)
|
||||
#if !defined(__ARMEB__) && !defined(__ARM_EABI__) && !defined(__EABI__) && \
|
||||
!defined(__VFP_FP__) && !defined(_WIN32_WCE) && !defined(ANDROID)
|
||||
#error Chromium does not support middle endian architecture
|
||||
#endif
|
||||
#if defined(__ARM_NEON__)
|
||||
#define CPU_ARM_NEON 1
|
||||
#endif
|
||||
#endif // defined(__arm__)
|
||||
#endif // !defined(CPU_ARM_NEON)
|
||||
|
||||
#if !defined(HAVE_MIPS_MSA_INTRINSICS)
|
||||
#if defined(__mips_msa) && defined(__mips_isa_rev) && (__mips_isa_rev >= 5)
|
||||
#define HAVE_MIPS_MSA_INTRINSICS 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__clang__) && __has_attribute(uninitialized)
|
||||
// Attribute "uninitialized" disables -ftrivial-auto-var-init=pattern for
|
||||
// the specified variable.
|
||||
// Library-wide alternative is
|
||||
// 'configs -= [ "//build/config/compiler:default_init_stack_vars" ]' in .gn
|
||||
// file.
|
||||
//
|
||||
// See "init_stack_vars" in build/config/compiler/BUILD.gn and
|
||||
// http://crbug.com/977230
|
||||
// "init_stack_vars" is enabled for non-official builds and we hope to enable it
|
||||
// in official build in 2020 as well. The flag writes fixed pattern into
|
||||
// uninitialized parts of all local variables. In rare cases such initialization
|
||||
// is undesirable and attribute can be used:
|
||||
// 1. Degraded performance
|
||||
// In most cases compiler is able to remove additional stores. E.g. if memory is
|
||||
// never accessed or properly initialized later. Preserved stores mostly will
|
||||
// not affect program performance. However if compiler failed on some
|
||||
// performance critical code we can get a visible regression in a benchmark.
|
||||
// 2. memset, memcpy calls
|
||||
// Compiler may replaces some memory writes with memset or memcpy calls. This is
|
||||
// not -ftrivial-auto-var-init specific, but it can happen more likely with the
|
||||
// flag. It can be a problem if code is not linked with C run-time library.
|
||||
//
|
||||
// Note: The flag is security risk mitigation feature. So in future the
|
||||
// attribute uses should be avoided when possible. However to enable this
|
||||
// mitigation on the most of the code we need to be less strict now and minimize
|
||||
// number of exceptions later. So if in doubt feel free to use attribute, but
|
||||
// please document the problem for someone who is going to cleanup it later.
|
||||
// E.g. platform, bot, benchmark or test name in patch description or next to
|
||||
// the attribute.
|
||||
#define STACK_UNINITIALIZED __attribute__((uninitialized))
|
||||
#else
|
||||
#define STACK_UNINITIALIZED
|
||||
#endif
|
||||
|
||||
// The ANALYZER_ASSUME_TRUE(bool arg) macro adds compiler-specific hints
|
||||
// to Clang which control what code paths are statically analyzed,
|
||||
// and is meant to be used in conjunction with assert & assert-like functions.
|
||||
// The expression is passed straight through if analysis isn't enabled.
|
||||
//
|
||||
// ANALYZER_SKIP_THIS_PATH() suppresses static analysis for the current
|
||||
// codepath and any other branching codepaths that might follow.
|
||||
#if defined(__clang_analyzer__)
|
||||
|
||||
inline constexpr bool AnalyzerNoReturn() __attribute__((analyzer_noreturn)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
inline constexpr bool AnalyzerAssumeTrue(bool arg) {
|
||||
// AnalyzerNoReturn() is invoked and analysis is terminated if |arg| is
|
||||
// false.
|
||||
return arg || AnalyzerNoReturn();
|
||||
}
|
||||
|
||||
#define ANALYZER_ASSUME_TRUE(arg) ::AnalyzerAssumeTrue(!!(arg))
|
||||
#define ANALYZER_SKIP_THIS_PATH() static_cast<void>(::AnalyzerNoReturn())
|
||||
#define ANALYZER_ALLOW_UNUSED(var) static_cast<void>(var);
|
||||
|
||||
#else // !defined(__clang_analyzer__)
|
||||
|
||||
#define ANALYZER_ASSUME_TRUE(arg) (arg)
|
||||
#define ANALYZER_SKIP_THIS_PATH()
|
||||
#define ANALYZER_ALLOW_UNUSED(var) static_cast<void>(var);
|
||||
|
||||
#endif // defined(__clang_analyzer__)
|
||||
|
||||
// Use nomerge attribute to disable optimization of merging multiple same calls.
|
||||
#if defined(__clang__) && __has_attribute(nomerge)
|
||||
#define NOMERGE [[clang::nomerge]]
|
||||
#else
|
||||
#define NOMERGE
|
||||
#endif
|
||||
|
||||
// Marks a type as being eligible for the "trivial" ABI despite having a
|
||||
// non-trivial destructor or copy/move constructor. Such types can be relocated
|
||||
// after construction by simply copying their memory, which makes them eligible
|
||||
// to be passed in registers. The canonical example is std::unique_ptr.
|
||||
//
|
||||
// Use with caution; this has some subtle effects on constructor/destructor
|
||||
// ordering and will be very incorrect if the type relies on its address
|
||||
// remaining constant. When used as a function argument (by value), the value
|
||||
// may be constructed in the caller's stack frame, passed in a register, and
|
||||
// then used and destructed in the callee's stack frame. A similar thing can
|
||||
// occur when values are returned.
|
||||
//
|
||||
// TRIVIAL_ABI is not needed for types which have a trivial destructor and
|
||||
// copy/move constructors, such as base::TimeTicks and other POD.
|
||||
//
|
||||
// It is also not likely to be effective on types too large to be passed in one
|
||||
// or two registers on typical target ABIs.
|
||||
//
|
||||
// See also:
|
||||
// https://clang.llvm.org/docs/AttributeReference.html#trivial-abi
|
||||
// https://libcxx.llvm.org/docs/DesignDocs/UniquePtrTrivialAbi.html
|
||||
#if defined(__clang__) && __has_attribute(trivial_abi)
|
||||
#define TRIVIAL_ABI [[clang::trivial_abi]]
|
||||
#else
|
||||
#define TRIVIAL_ABI
|
||||
#endif
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
#endif // CEF_INCLUDE_BASE_CEF_COMPILER_SPECIFIC_H_
|
||||
|
|
@ -1,182 +0,0 @@
|
|||
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
|
||||
// Google Inc. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_LOCK_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_LOCK_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/synchronization/lock.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include "include/base/cef_logging.h"
|
||||
#include "include/base/cef_platform_thread.h"
|
||||
#include "include/base/internal/cef_lock_impl.h"
|
||||
|
||||
namespace base {
|
||||
namespace cef_internal {
|
||||
|
||||
///
|
||||
/// A convenient wrapper for an OS specific critical section. The only real
|
||||
/// intelligence in this class is in debug mode for the support for the
|
||||
/// AssertAcquired() method.
|
||||
///
|
||||
class Lock {
|
||||
public:
|
||||
#if !DCHECK_IS_ON() // Optimized wrapper implementation
|
||||
Lock() : lock_() {}
|
||||
|
||||
Lock(const Lock&) = delete;
|
||||
Lock& operator=(const Lock&) = delete;
|
||||
|
||||
~Lock() {}
|
||||
void Acquire() { lock_.Lock(); }
|
||||
void Release() { lock_.Unlock(); }
|
||||
|
||||
///
|
||||
/// If the lock is not held, take it and return true. If the lock is already
|
||||
/// held by another thread, immediately return false. This must not be called
|
||||
/// by a thread already holding the lock (what happens is undefined and an
|
||||
/// assertion may fail).
|
||||
///
|
||||
bool Try() { return lock_.Try(); }
|
||||
|
||||
// Null implementation if not debug.
|
||||
void AssertAcquired() const {}
|
||||
#else
|
||||
Lock();
|
||||
~Lock();
|
||||
|
||||
// NOTE: Although windows critical sections support recursive locks, we do not
|
||||
// allow this, and we will commonly fire a DCHECK() if a thread attempts to
|
||||
// acquire the lock a second time (while already holding it).
|
||||
void Acquire() {
|
||||
lock_.Lock();
|
||||
CheckUnheldAndMark();
|
||||
}
|
||||
void Release() {
|
||||
CheckHeldAndUnmark();
|
||||
lock_.Unlock();
|
||||
}
|
||||
|
||||
bool Try() {
|
||||
bool rv = lock_.Try();
|
||||
if (rv) {
|
||||
CheckUnheldAndMark();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
void AssertAcquired() const;
|
||||
#endif // !DCHECK_IS_ON()
|
||||
|
||||
private:
|
||||
#if DCHECK_IS_ON()
|
||||
// Members and routines taking care of locks assertions.
|
||||
// Note that this checks for recursive locks and allows them
|
||||
// if the variable is set. This is allowed by the underlying implementation
|
||||
// on windows but not on Posix, so we're doing unneeded checks on Posix.
|
||||
// It's worth it to share the code.
|
||||
void CheckHeldAndUnmark();
|
||||
void CheckUnheldAndMark();
|
||||
|
||||
// All private data is implicitly protected by lock_.
|
||||
// Be VERY careful to only access members under that lock.
|
||||
base::PlatformThreadRef owning_thread_ref_;
|
||||
#endif // DCHECK_IS_ON()
|
||||
|
||||
// Platform specific underlying lock implementation.
|
||||
LockImpl lock_;
|
||||
};
|
||||
|
||||
///
|
||||
/// A helper class that acquires the given Lock while the AutoLock is in scope.
|
||||
///
|
||||
class AutoLock {
|
||||
public:
|
||||
struct AlreadyAcquired {};
|
||||
|
||||
explicit AutoLock(Lock& lock) : lock_(lock) { lock_.Acquire(); }
|
||||
|
||||
AutoLock(Lock& lock, const AlreadyAcquired&) : lock_(lock) {
|
||||
lock_.AssertAcquired();
|
||||
}
|
||||
|
||||
AutoLock(const AutoLock&) = delete;
|
||||
AutoLock& operator=(const AutoLock&) = delete;
|
||||
|
||||
~AutoLock() {
|
||||
lock_.AssertAcquired();
|
||||
lock_.Release();
|
||||
}
|
||||
|
||||
private:
|
||||
Lock& lock_;
|
||||
};
|
||||
|
||||
///
|
||||
/// AutoUnlock is a helper that will Release() the |lock| argument in the
|
||||
/// constructor, and re-Acquire() it in the destructor.
|
||||
///
|
||||
class AutoUnlock {
|
||||
public:
|
||||
explicit AutoUnlock(Lock& lock) : lock_(lock) {
|
||||
// We require our caller to have the lock.
|
||||
lock_.AssertAcquired();
|
||||
lock_.Release();
|
||||
}
|
||||
|
||||
AutoUnlock(const AutoUnlock&) = delete;
|
||||
AutoUnlock& operator=(const AutoUnlock&) = delete;
|
||||
|
||||
~AutoUnlock() { lock_.Acquire(); }
|
||||
|
||||
private:
|
||||
Lock& lock_;
|
||||
};
|
||||
|
||||
} // namespace cef_internal
|
||||
|
||||
// Implement classes in the cef_internal namespace and then expose them to the
|
||||
// base namespace. This avoids conflicts with the base.lib implementation when
|
||||
// linking sandbox support on Windows.
|
||||
using cef_internal::AutoLock;
|
||||
using cef_internal::AutoUnlock;
|
||||
using cef_internal::Lock;
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_LOCK_H_
|
||||
|
|
@ -1,785 +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.
|
||||
|
||||
///
|
||||
/// \file
|
||||
/// A bunch of macros for logging.
|
||||
///
|
||||
/// NOTE: The contents of this file are only available to applications that link
|
||||
/// against the libcef_dll_wrapper target.
|
||||
///
|
||||
/// WARNING: Logging macros should not be used in the main/browser process
|
||||
/// before calling CefInitialize or in sub-processes before calling
|
||||
/// CefExecuteProcess.
|
||||
///
|
||||
/// INSTRUCTIONS:
|
||||
///
|
||||
/// The way to log things is to stream things to LOG(<a particular severity
|
||||
/// level>). E.g.,
|
||||
///
|
||||
/// <pre>
|
||||
/// LOG(INFO) << "Found " << num_cookies << " cookies";
|
||||
/// </pre>
|
||||
///
|
||||
/// You can also do conditional logging:
|
||||
///
|
||||
/// <pre>
|
||||
/// LOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
|
||||
/// </pre>
|
||||
///
|
||||
/// The CHECK(condition) macro is active in both debug and release builds and
|
||||
/// effectively performs a LOG(FATAL) which terminates the process and
|
||||
/// generates a crashdump unless a debugger is attached.
|
||||
///
|
||||
/// There are also "debug mode" logging macros like the ones above:
|
||||
///
|
||||
/// <pre>
|
||||
/// DLOG(INFO) << "Found cookies";
|
||||
///
|
||||
/// DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
|
||||
/// </pre>
|
||||
///
|
||||
/// All "debug mode" logging is compiled away to nothing for non-debug mode
|
||||
/// compiles. LOG_IF and development flags also work well together
|
||||
/// because the code can be compiled away sometimes.
|
||||
///
|
||||
/// We also have
|
||||
///
|
||||
/// <pre>
|
||||
/// LOG_ASSERT(assertion);
|
||||
/// DLOG_ASSERT(assertion);
|
||||
/// </pre>
|
||||
///
|
||||
/// which is syntactic sugar for "{,D}LOG_IF(FATAL, assert fails) << assertion;"
|
||||
///
|
||||
/// There are "verbose level" logging macros. They look like
|
||||
///
|
||||
/// <pre>
|
||||
/// VLOG(1) << "I'm printed when you run the program with --v=1 or more";
|
||||
/// VLOG(2) << "I'm printed when you run the program with --v=2 or more";
|
||||
/// </pre>
|
||||
///
|
||||
/// These always log at the INFO log level (when they log at all).
|
||||
/// The verbose logging can also be turned on module-by-module. For instance,
|
||||
/// <pre>
|
||||
/// --vmodule=profile=2,icon_loader=1,browser_*=3,*/chromeos/*=4 --v=0
|
||||
/// </pre>
|
||||
/// will cause:
|
||||
/// 1. VLOG(2) and lower messages to be printed from profile.{h,cc}
|
||||
/// 2. VLOG(1) and lower messages to be printed from icon_loader.{h,cc}
|
||||
/// 3. VLOG(3) and lower messages to be printed from files prefixed with
|
||||
/// "browser"
|
||||
/// 4. VLOG(4) and lower messages to be printed from files under a
|
||||
/// "chromeos" directory.
|
||||
/// 5. VLOG(0) and lower messages to be printed from elsewhere
|
||||
///
|
||||
/// The wildcarding functionality shown by (c) supports both '*' (match
|
||||
/// 0 or more characters) and '?' (match any single character)
|
||||
/// wildcards. Any pattern containing a forward or backward slash will
|
||||
/// be tested against the whole pathname and not just the module.
|
||||
/// E.g., "*/foo/bar/*=2" would change the logging level for all code
|
||||
/// in source files under a "foo/bar" directory.
|
||||
///
|
||||
/// There's also VLOG_IS_ON(n) "verbose level" condition macro. To be used as
|
||||
///
|
||||
/// <pre>
|
||||
/// if (VLOG_IS_ON(2)) {
|
||||
/// // do some logging preparation and logging
|
||||
/// // that can't be accomplished with just VLOG(2) << ...;
|
||||
/// }
|
||||
/// </pre>
|
||||
///
|
||||
/// There is also a VLOG_IF "verbose level" condition macro for sample
|
||||
/// cases, when some extra computation and preparation for logs is not
|
||||
/// needed.
|
||||
///
|
||||
/// <pre>
|
||||
/// VLOG_IF(1, (size > 1024))
|
||||
/// << "I'm printed when size is more than 1024 and when you run the "
|
||||
/// "program with --v=1 or more";
|
||||
/// </pre>
|
||||
///
|
||||
/// We also override the standard 'assert' to use 'DLOG_ASSERT'.
|
||||
///
|
||||
/// Lastly, there is:
|
||||
///
|
||||
/// <pre>
|
||||
/// PLOG(ERROR) << "Couldn't do foo";
|
||||
/// DPLOG(ERROR) << "Couldn't do foo";
|
||||
/// PLOG_IF(ERROR, cond) << "Couldn't do foo";
|
||||
/// DPLOG_IF(ERROR, cond) << "Couldn't do foo";
|
||||
/// PCHECK(condition) << "Couldn't do foo";
|
||||
/// DPCHECK(condition) << "Couldn't do foo";
|
||||
/// </pre>
|
||||
///
|
||||
/// which append the last system error to the message in string form (taken from
|
||||
/// GetLastError() on Windows and errno on POSIX).
|
||||
///
|
||||
/// The supported severity levels for macros that allow you to specify one
|
||||
/// are (in increasing order of severity) INFO, WARNING, ERROR, and FATAL.
|
||||
///
|
||||
/// Very important: logging a message at the FATAL severity level causes
|
||||
/// the program to terminate (after the message is logged).
|
||||
///
|
||||
/// There is the special severity of DFATAL, which logs FATAL in debug mode,
|
||||
/// ERROR in normal mode.
|
||||
///
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_LOGGING_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_LOGGING_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/logging.h"
|
||||
#include "base/notreached.h"
|
||||
#elif defined(DCHECK)
|
||||
// Do nothing if the macros provided by this header already exist.
|
||||
// This can happen in cases where Chromium code is used directly by the
|
||||
// client application. When using Chromium code directly always include
|
||||
// the Chromium header first to avoid type conflicts.
|
||||
|
||||
// Always define the DCHECK_IS_ON macro which is used from other CEF headers.
|
||||
#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
|
||||
#define DCHECK_IS_ON() false
|
||||
#else
|
||||
#define DCHECK_IS_ON() true
|
||||
#endif
|
||||
|
||||
#else // !defined(DCHECK)
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "include/base/cef_build.h"
|
||||
#include "include/internal/cef_logging_internal.h"
|
||||
|
||||
namespace cef {
|
||||
namespace logging {
|
||||
|
||||
// Gets the current log level.
|
||||
inline int GetMinLogLevel() {
|
||||
return cef_get_min_log_level();
|
||||
}
|
||||
|
||||
// Gets the current vlog level for the given file (usually taken from
|
||||
// __FILE__). Note that |N| is the size *with* the null terminator.
|
||||
template <size_t N>
|
||||
int GetVlogLevel(const char (&file)[N]) {
|
||||
return cef_get_vlog_level(file, N);
|
||||
}
|
||||
|
||||
typedef int LogSeverity;
|
||||
const LogSeverity LOG_VERBOSE = -1; // This is level 1 verbosity
|
||||
// Note: the log severities are used to index into the array of names,
|
||||
// see log_severity_names.
|
||||
const LogSeverity LOG_INFO = 0;
|
||||
const LogSeverity LOG_WARNING = 1;
|
||||
const LogSeverity LOG_ERROR = 2;
|
||||
const LogSeverity LOG_FATAL = 3;
|
||||
const LogSeverity LOG_NUM_SEVERITIES = 4;
|
||||
|
||||
// LOG_DFATAL is LOG_FATAL in debug mode, ERROR in normal mode
|
||||
#ifdef NDEBUG
|
||||
const LogSeverity LOG_DFATAL = LOG_ERROR;
|
||||
#else
|
||||
const LogSeverity LOG_DFATAL = LOG_FATAL;
|
||||
#endif
|
||||
|
||||
// A few definitions of macros that don't generate much code. These are used
|
||||
// by LOG() and LOG_IF, etc. Since these are used all over our code, it's
|
||||
// better to have compact code for these operations.
|
||||
#define COMPACT_GOOGLE_LOG_EX_INFO(ClassName, ...) \
|
||||
::cef::logging::ClassName(__FILE__, __LINE__, ::cef::logging::LOG_INFO, \
|
||||
##__VA_ARGS__)
|
||||
#define COMPACT_GOOGLE_LOG_EX_WARNING(ClassName, ...) \
|
||||
::cef::logging::ClassName(__FILE__, __LINE__, ::cef::logging::LOG_WARNING, \
|
||||
##__VA_ARGS__)
|
||||
#define COMPACT_GOOGLE_LOG_EX_ERROR(ClassName, ...) \
|
||||
::cef::logging::ClassName(__FILE__, __LINE__, ::cef::logging::LOG_ERROR, \
|
||||
##__VA_ARGS__)
|
||||
#define COMPACT_GOOGLE_LOG_EX_FATAL(ClassName, ...) \
|
||||
::cef::logging::ClassName(__FILE__, __LINE__, ::cef::logging::LOG_FATAL, \
|
||||
##__VA_ARGS__)
|
||||
#define COMPACT_GOOGLE_LOG_EX_DFATAL(ClassName, ...) \
|
||||
::cef::logging::ClassName(__FILE__, __LINE__, ::cef::logging::LOG_DFATAL, \
|
||||
##__VA_ARGS__)
|
||||
|
||||
#define COMPACT_GOOGLE_LOG_INFO COMPACT_GOOGLE_LOG_EX_INFO(LogMessage)
|
||||
#define COMPACT_GOOGLE_LOG_WARNING COMPACT_GOOGLE_LOG_EX_WARNING(LogMessage)
|
||||
#define COMPACT_GOOGLE_LOG_ERROR COMPACT_GOOGLE_LOG_EX_ERROR(LogMessage)
|
||||
#define COMPACT_GOOGLE_LOG_FATAL COMPACT_GOOGLE_LOG_EX_FATAL(LogMessage)
|
||||
#define COMPACT_GOOGLE_LOG_DFATAL COMPACT_GOOGLE_LOG_EX_DFATAL(LogMessage)
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// wingdi.h defines ERROR to be 0. When we call LOG(ERROR), it gets
|
||||
// substituted with 0, and it expands to COMPACT_GOOGLE_LOG_0. To allow us
|
||||
// to keep using this syntax, we define this macro to do the same thing
|
||||
// as COMPACT_GOOGLE_LOG_ERROR, and also define ERROR the same way that
|
||||
// the Windows SDK does for consistency.
|
||||
#define ERROR 0
|
||||
#define COMPACT_GOOGLE_LOG_EX_0(ClassName, ...) \
|
||||
COMPACT_GOOGLE_LOG_EX_ERROR(ClassName, ##__VA_ARGS__)
|
||||
#define COMPACT_GOOGLE_LOG_0 COMPACT_GOOGLE_LOG_ERROR
|
||||
// Needed for LOG_IS_ON(ERROR).
|
||||
const LogSeverity LOG_0 = LOG_ERROR;
|
||||
#endif
|
||||
|
||||
// As special cases, we can assume that LOG_IS_ON(FATAL) always holds. Also,
|
||||
// LOG_IS_ON(DFATAL) always holds in debug mode. In particular, CHECK()s will
|
||||
// always fire if they fail.
|
||||
#define LOG_IS_ON(severity) \
|
||||
((::cef::logging::LOG_##severity) >= ::cef::logging::GetMinLogLevel())
|
||||
|
||||
// We can't do any caching tricks with VLOG_IS_ON() like the
|
||||
// google-glog version since it requires GCC extensions. This means
|
||||
// that using the v-logging functions in conjunction with --vmodule
|
||||
// may be slow.
|
||||
#define VLOG_IS_ON(verboselevel) \
|
||||
((verboselevel) <= ::cef::logging::GetVlogLevel(__FILE__))
|
||||
|
||||
// Helper macro which avoids evaluating the arguments to a stream if
|
||||
// the condition doesn't hold.
|
||||
#define LAZY_STREAM(stream, condition) \
|
||||
!(condition) ? (void)0 : ::cef::logging::LogMessageVoidify() & (stream)
|
||||
|
||||
// We use the preprocessor's merging operator, "##", so that, e.g.,
|
||||
// LOG(INFO) becomes the token COMPACT_GOOGLE_LOG_INFO. There's some funny
|
||||
// subtle difference between ostream member streaming functions (e.g.,
|
||||
// ostream::operator<<(int) and ostream non-member streaming functions
|
||||
// (e.g., ::operator<<(ostream&, string&): it turns out that it's
|
||||
// impossible to stream something like a string directly to an unnamed
|
||||
// ostream. We employ a neat hack by calling the stream() member
|
||||
// function of LogMessage which seems to avoid the problem.
|
||||
#define LOG_STREAM(severity) COMPACT_GOOGLE_LOG_##severity.stream()
|
||||
|
||||
#define LOG(severity) LAZY_STREAM(LOG_STREAM(severity), LOG_IS_ON(severity))
|
||||
#define LOG_IF(severity, condition) \
|
||||
LAZY_STREAM(LOG_STREAM(severity), LOG_IS_ON(severity) && (condition))
|
||||
|
||||
#define SYSLOG(severity) LOG(severity)
|
||||
#define SYSLOG_IF(severity, condition) LOG_IF(severity, condition)
|
||||
|
||||
// The VLOG macros log with negative verbosities.
|
||||
#define VLOG_STREAM(verbose_level) \
|
||||
cef::logging::LogMessage(__FILE__, __LINE__, -verbose_level).stream()
|
||||
|
||||
#define VLOG(verbose_level) \
|
||||
LAZY_STREAM(VLOG_STREAM(verbose_level), VLOG_IS_ON(verbose_level))
|
||||
|
||||
#define VLOG_IF(verbose_level, condition) \
|
||||
LAZY_STREAM(VLOG_STREAM(verbose_level), \
|
||||
VLOG_IS_ON(verbose_level) && (condition))
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#define VPLOG_STREAM(verbose_level) \
|
||||
cef::logging::Win32ErrorLogMessage(__FILE__, __LINE__, -verbose_level, \
|
||||
::cef::logging::GetLastSystemErrorCode()) \
|
||||
.stream()
|
||||
#elif defined(OS_POSIX)
|
||||
#define VPLOG_STREAM(verbose_level) \
|
||||
cef::logging::ErrnoLogMessage(__FILE__, __LINE__, -verbose_level, \
|
||||
::cef::logging::GetLastSystemErrorCode()) \
|
||||
.stream()
|
||||
#endif
|
||||
|
||||
#define VPLOG(verbose_level) \
|
||||
LAZY_STREAM(VPLOG_STREAM(verbose_level), VLOG_IS_ON(verbose_level))
|
||||
|
||||
#define VPLOG_IF(verbose_level, condition) \
|
||||
LAZY_STREAM(VPLOG_STREAM(verbose_level), \
|
||||
VLOG_IS_ON(verbose_level) && (condition))
|
||||
|
||||
// TODO(akalin): Add more VLOG variants, e.g. VPLOG.
|
||||
|
||||
#define LOG_ASSERT(condition) \
|
||||
LOG_IF(FATAL, !(condition)) << "Assert failed: " #condition ". "
|
||||
#define SYSLOG_ASSERT(condition) \
|
||||
SYSLOG_IF(FATAL, !(condition)) << "Assert failed: " #condition ". "
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#define PLOG_STREAM(severity) \
|
||||
COMPACT_GOOGLE_LOG_EX_##severity(Win32ErrorLogMessage, \
|
||||
::cef::logging::GetLastSystemErrorCode()) \
|
||||
.stream()
|
||||
#elif defined(OS_POSIX)
|
||||
#define PLOG_STREAM(severity) \
|
||||
COMPACT_GOOGLE_LOG_EX_##severity(ErrnoLogMessage, \
|
||||
::cef::logging::GetLastSystemErrorCode()) \
|
||||
.stream()
|
||||
#endif
|
||||
|
||||
#define PLOG(severity) LAZY_STREAM(PLOG_STREAM(severity), LOG_IS_ON(severity))
|
||||
|
||||
#define PLOG_IF(severity, condition) \
|
||||
LAZY_STREAM(PLOG_STREAM(severity), LOG_IS_ON(severity) && (condition))
|
||||
|
||||
// The actual stream used isn't important.
|
||||
#define EAT_STREAM_PARAMETERS \
|
||||
true ? (void)0 : ::cef::logging::LogMessageVoidify() & LOG_STREAM(FATAL)
|
||||
|
||||
// CHECK dies with a fatal error if condition is not true. It is *not*
|
||||
// controlled by NDEBUG, so the check will be executed regardless of
|
||||
// compilation mode.
|
||||
//
|
||||
// We make sure CHECK et al. always evaluates their arguments, as
|
||||
// doing CHECK(FunctionWithSideEffect()) is a common idiom.
|
||||
|
||||
#define CHECK(condition) \
|
||||
LAZY_STREAM(LOG_STREAM(FATAL), !(condition)) \
|
||||
<< "Check failed: " #condition ". "
|
||||
|
||||
#define PCHECK(condition) \
|
||||
LAZY_STREAM(PLOG_STREAM(FATAL), !(condition)) \
|
||||
<< "Check failed: " #condition ". "
|
||||
|
||||
// Helper macro for binary operators.
|
||||
// Don't use this macro directly in your code, use CHECK_EQ et al below.
|
||||
//
|
||||
// TODO(akalin): Rewrite this so that constructs like if (...)
|
||||
// CHECK_EQ(...) else { ... } work properly.
|
||||
#define CHECK_OP(name, op, val1, val2) \
|
||||
if (std::string* _result = cef::logging::Check##name##Impl( \
|
||||
(val1), (val2), #val1 " " #op " " #val2)) \
|
||||
cef::logging::LogMessage(__FILE__, __LINE__, _result).stream()
|
||||
|
||||
// Build the error message string. This is separate from the "Impl"
|
||||
// function template because it is not performance critical and so can
|
||||
// be out of line, while the "Impl" code should be inline. Caller
|
||||
// takes ownership of the returned string.
|
||||
template <class t1, class t2>
|
||||
std::string* MakeCheckOpString(const t1& v1, const t2& v2, const char* names) {
|
||||
std::ostringstream ss;
|
||||
ss << names << " (" << v1 << " vs. " << v2 << ")";
|
||||
std::string* msg = new std::string(ss.str());
|
||||
return msg;
|
||||
}
|
||||
|
||||
// MSVC doesn't like complex extern templates and DLLs.
|
||||
#if !defined(COMPILER_MSVC)
|
||||
// Commonly used instantiations of MakeCheckOpString<>. Explicitly instantiated
|
||||
// in logging.cc.
|
||||
extern template std::string* MakeCheckOpString<int, int>(const int&,
|
||||
const int&,
|
||||
const char* names);
|
||||
extern template std::string* MakeCheckOpString<unsigned long, unsigned long>(
|
||||
const unsigned long&,
|
||||
const unsigned long&,
|
||||
const char* names);
|
||||
extern template std::string* MakeCheckOpString<unsigned long, unsigned int>(
|
||||
const unsigned long&,
|
||||
const unsigned int&,
|
||||
const char* names);
|
||||
extern template std::string* MakeCheckOpString<unsigned int, unsigned long>(
|
||||
const unsigned int&,
|
||||
const unsigned long&,
|
||||
const char* names);
|
||||
extern template std::string* MakeCheckOpString<std::string, std::string>(
|
||||
const std::string&,
|
||||
const std::string&,
|
||||
const char* name);
|
||||
#endif
|
||||
|
||||
// Helper functions for CHECK_OP macro.
|
||||
// The (int, int) specialization works around the issue that the compiler
|
||||
// will not instantiate the template version of the function on values of
|
||||
// unnamed enum type - see comment below.
|
||||
#define DEFINE_CHECK_OP_IMPL(name, op) \
|
||||
template <class t1, class t2> \
|
||||
inline std::string* Check##name##Impl(const t1& v1, const t2& v2, \
|
||||
const char* names) { \
|
||||
if (v1 op v2) \
|
||||
return NULL; \
|
||||
else \
|
||||
return MakeCheckOpString(v1, v2, names); \
|
||||
} \
|
||||
inline std::string* Check##name##Impl(int v1, int v2, const char* names) { \
|
||||
if (v1 op v2) \
|
||||
return NULL; \
|
||||
else \
|
||||
return MakeCheckOpString(v1, v2, names); \
|
||||
}
|
||||
DEFINE_CHECK_OP_IMPL(EQ, ==)
|
||||
DEFINE_CHECK_OP_IMPL(NE, !=)
|
||||
DEFINE_CHECK_OP_IMPL(LE, <=)
|
||||
DEFINE_CHECK_OP_IMPL(LT, <)
|
||||
DEFINE_CHECK_OP_IMPL(GE, >=)
|
||||
DEFINE_CHECK_OP_IMPL(GT, >)
|
||||
#undef DEFINE_CHECK_OP_IMPL
|
||||
|
||||
#define CHECK_EQ(val1, val2) CHECK_OP(EQ, ==, val1, val2)
|
||||
#define CHECK_NE(val1, val2) CHECK_OP(NE, !=, val1, val2)
|
||||
#define CHECK_LE(val1, val2) CHECK_OP(LE, <=, val1, val2)
|
||||
#define CHECK_LT(val1, val2) CHECK_OP(LT, <, val1, val2)
|
||||
#define CHECK_GE(val1, val2) CHECK_OP(GE, >=, val1, val2)
|
||||
#define CHECK_GT(val1, val2) CHECK_OP(GT, >, val1, val2)
|
||||
|
||||
#if defined(NDEBUG)
|
||||
#define ENABLE_DLOG 0
|
||||
#else
|
||||
#define ENABLE_DLOG 1
|
||||
#endif
|
||||
|
||||
#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
|
||||
#define DCHECK_IS_ON() 0
|
||||
#else
|
||||
#define DCHECK_IS_ON() 1
|
||||
#endif
|
||||
|
||||
// Definitions for DLOG et al.
|
||||
|
||||
#if ENABLE_DLOG
|
||||
|
||||
#define DLOG_IS_ON(severity) LOG_IS_ON(severity)
|
||||
#define DLOG_IF(severity, condition) LOG_IF(severity, condition)
|
||||
#define DLOG_ASSERT(condition) LOG_ASSERT(condition)
|
||||
#define DPLOG_IF(severity, condition) PLOG_IF(severity, condition)
|
||||
#define DVLOG_IF(verboselevel, condition) VLOG_IF(verboselevel, condition)
|
||||
#define DVPLOG_IF(verboselevel, condition) VPLOG_IF(verboselevel, condition)
|
||||
|
||||
#else // ENABLE_DLOG
|
||||
|
||||
// If ENABLE_DLOG is off, we want to avoid emitting any references to
|
||||
// |condition| (which may reference a variable defined only if NDEBUG
|
||||
// is not defined). Contrast this with DCHECK et al., which has
|
||||
// different behavior.
|
||||
|
||||
#define DLOG_IS_ON(severity) false
|
||||
#define DLOG_IF(severity, condition) EAT_STREAM_PARAMETERS
|
||||
#define DLOG_ASSERT(condition) EAT_STREAM_PARAMETERS
|
||||
#define DPLOG_IF(severity, condition) EAT_STREAM_PARAMETERS
|
||||
#define DVLOG_IF(verboselevel, condition) EAT_STREAM_PARAMETERS
|
||||
#define DVPLOG_IF(verboselevel, condition) EAT_STREAM_PARAMETERS
|
||||
|
||||
#endif // ENABLE_DLOG
|
||||
|
||||
// DEBUG_MODE is for uses like
|
||||
// if (DEBUG_MODE) foo.CheckThatFoo();
|
||||
// instead of
|
||||
// #ifndef NDEBUG
|
||||
// foo.CheckThatFoo();
|
||||
// #endif
|
||||
//
|
||||
// We tie its state to ENABLE_DLOG.
|
||||
enum { DEBUG_MODE = ENABLE_DLOG };
|
||||
|
||||
#undef ENABLE_DLOG
|
||||
|
||||
#define DLOG(severity) LAZY_STREAM(LOG_STREAM(severity), DLOG_IS_ON(severity))
|
||||
|
||||
#define DPLOG(severity) LAZY_STREAM(PLOG_STREAM(severity), DLOG_IS_ON(severity))
|
||||
|
||||
#define DVLOG(verboselevel) DVLOG_IF(verboselevel, VLOG_IS_ON(verboselevel))
|
||||
|
||||
#define DVPLOG(verboselevel) DVPLOG_IF(verboselevel, VLOG_IS_ON(verboselevel))
|
||||
|
||||
// Definitions for DCHECK et al.
|
||||
|
||||
#if DCHECK_IS_ON()
|
||||
|
||||
#define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \
|
||||
COMPACT_GOOGLE_LOG_EX_FATAL(ClassName, ##__VA_ARGS__)
|
||||
#define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_FATAL
|
||||
const LogSeverity LOG_DCHECK = LOG_FATAL;
|
||||
|
||||
#else // DCHECK_IS_ON()
|
||||
|
||||
// These are just dummy values.
|
||||
#define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \
|
||||
COMPACT_GOOGLE_LOG_EX_INFO(ClassName, ##__VA_ARGS__)
|
||||
#define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_INFO
|
||||
const LogSeverity LOG_DCHECK = LOG_INFO;
|
||||
|
||||
#endif // DCHECK_IS_ON()
|
||||
|
||||
// DCHECK et al. make sure to reference |condition| regardless of
|
||||
// whether DCHECKs are enabled; this is so that we don't get unused
|
||||
// variable warnings if the only use of a variable is in a DCHECK.
|
||||
// This behavior is different from DLOG_IF et al.
|
||||
|
||||
#define DCHECK(condition) \
|
||||
LAZY_STREAM(LOG_STREAM(DCHECK), DCHECK_IS_ON() && !(condition)) \
|
||||
<< "Check failed: " #condition ". "
|
||||
|
||||
#define DPCHECK(condition) \
|
||||
LAZY_STREAM(PLOG_STREAM(DCHECK), DCHECK_IS_ON() && !(condition)) \
|
||||
<< "Check failed: " #condition ". "
|
||||
|
||||
// Helper macro for binary operators.
|
||||
// Don't use this macro directly in your code, use DCHECK_EQ et al below.
|
||||
#define DCHECK_OP(name, op, val1, val2) \
|
||||
if (DCHECK_IS_ON()) \
|
||||
if (std::string* _result = cef::logging::Check##name##Impl( \
|
||||
(val1), (val2), #val1 " " #op " " #val2)) \
|
||||
cef::logging::LogMessage(__FILE__, __LINE__, ::cef::logging::LOG_DCHECK, \
|
||||
_result) \
|
||||
.stream()
|
||||
|
||||
// Equality/Inequality checks - compare two values, and log a
|
||||
// LOG_DCHECK message including the two values when the result is not
|
||||
// as expected. The values must have operator<<(ostream, ...)
|
||||
// defined.
|
||||
//
|
||||
// You may append to the error message like so:
|
||||
// DCHECK_NE(1, 2) << ": The world must be ending!";
|
||||
//
|
||||
// We are very careful to ensure that each argument is evaluated exactly
|
||||
// once, and that anything which is legal to pass as a function argument is
|
||||
// legal here. In particular, the arguments may be temporary expressions
|
||||
// which will end up being destroyed at the end of the apparent statement,
|
||||
// for example:
|
||||
// DCHECK_EQ(string("abc")[1], 'b');
|
||||
//
|
||||
// WARNING: These may not compile correctly if one of the arguments is a pointer
|
||||
// and the other is NULL. To work around this, simply static_cast NULL to the
|
||||
// type of the desired pointer.
|
||||
|
||||
#define DCHECK_EQ(val1, val2) DCHECK_OP(EQ, ==, val1, val2)
|
||||
#define DCHECK_NE(val1, val2) DCHECK_OP(NE, !=, val1, val2)
|
||||
#define DCHECK_LE(val1, val2) DCHECK_OP(LE, <=, val1, val2)
|
||||
#define DCHECK_LT(val1, val2) DCHECK_OP(LT, <, val1, val2)
|
||||
#define DCHECK_GE(val1, val2) DCHECK_OP(GE, >=, val1, val2)
|
||||
#define DCHECK_GT(val1, val2) DCHECK_OP(GT, >, val1, val2)
|
||||
|
||||
#define NOTREACHED() DCHECK(false)
|
||||
|
||||
// Redefine the standard assert to use our nice log files
|
||||
#undef assert
|
||||
#define assert(x) DLOG_ASSERT(x)
|
||||
|
||||
// This class more or less represents a particular log message. You
|
||||
// create an instance of LogMessage and then stream stuff to it.
|
||||
// When you finish streaming to it, ~LogMessage is called and the
|
||||
// full message gets streamed to the appropriate destination.
|
||||
//
|
||||
// You shouldn't actually use LogMessage's constructor to log things,
|
||||
// though. You should use the LOG() macro (and variants thereof)
|
||||
// above.
|
||||
class LogMessage {
|
||||
public:
|
||||
// Used for LOG(severity).
|
||||
LogMessage(const char* file, int line, LogSeverity severity);
|
||||
|
||||
// Used for CHECK_EQ(), etc. Takes ownership of the given string.
|
||||
// Implied severity = LOG_FATAL.
|
||||
LogMessage(const char* file, int line, std::string* result);
|
||||
|
||||
// Used for DCHECK_EQ(), etc. Takes ownership of the given string.
|
||||
LogMessage(const char* file,
|
||||
int line,
|
||||
LogSeverity severity,
|
||||
std::string* result);
|
||||
|
||||
LogMessage(const LogMessage&) = delete;
|
||||
LogMessage& operator=(const LogMessage&) = delete;
|
||||
|
||||
~LogMessage();
|
||||
|
||||
std::ostream& stream() { return stream_; }
|
||||
|
||||
private:
|
||||
LogSeverity severity_;
|
||||
std::ostringstream stream_;
|
||||
|
||||
// The file and line information passed in to the constructor.
|
||||
const char* file_;
|
||||
const int line_;
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// Stores the current value of GetLastError in the constructor and restores
|
||||
// it in the destructor by calling SetLastError.
|
||||
// This is useful since the LogMessage class uses a lot of Win32 calls
|
||||
// that will lose the value of GLE and the code that called the log function
|
||||
// will have lost the thread error value when the log call returns.
|
||||
class SaveLastError {
|
||||
public:
|
||||
SaveLastError();
|
||||
~SaveLastError();
|
||||
|
||||
unsigned long get_error() const { return last_error_; }
|
||||
|
||||
protected:
|
||||
unsigned long last_error_;
|
||||
};
|
||||
|
||||
SaveLastError last_error_;
|
||||
#endif
|
||||
};
|
||||
|
||||
// A non-macro interface to the log facility; (useful
|
||||
// when the logging level is not a compile-time constant).
|
||||
inline void LogAtLevel(int const log_level, std::string const& msg) {
|
||||
LogMessage(__FILE__, __LINE__, log_level).stream() << msg;
|
||||
}
|
||||
|
||||
// This class is used to explicitly ignore values in the conditional
|
||||
// logging macros. This avoids compiler warnings like "value computed
|
||||
// is not used" and "statement has no effect".
|
||||
class LogMessageVoidify {
|
||||
public:
|
||||
LogMessageVoidify() {}
|
||||
// This has to be an operator with a precedence lower than << but
|
||||
// higher than ?:
|
||||
void operator&(std::ostream&) {}
|
||||
};
|
||||
|
||||
#if defined(OS_WIN)
|
||||
typedef unsigned long SystemErrorCode;
|
||||
#elif defined(OS_POSIX)
|
||||
typedef int SystemErrorCode;
|
||||
#endif
|
||||
|
||||
// Alias for ::GetLastError() on Windows and errno on POSIX. Avoids having to
|
||||
// pull in windows.h just for GetLastError() and DWORD.
|
||||
SystemErrorCode GetLastSystemErrorCode();
|
||||
std::string SystemErrorCodeToString(SystemErrorCode error_code);
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// Appends a formatted system message of the GetLastError() type.
|
||||
class Win32ErrorLogMessage {
|
||||
public:
|
||||
Win32ErrorLogMessage(const char* file,
|
||||
int line,
|
||||
LogSeverity severity,
|
||||
SystemErrorCode err);
|
||||
|
||||
Win32ErrorLogMessage(const Win32ErrorLogMessage&) = delete;
|
||||
Win32ErrorLogMessage& operator=(const Win32ErrorLogMessage&) = delete;
|
||||
|
||||
// Appends the error message before destructing the encapsulated class.
|
||||
~Win32ErrorLogMessage();
|
||||
|
||||
std::ostream& stream() { return log_message_.stream(); }
|
||||
|
||||
private:
|
||||
SystemErrorCode err_;
|
||||
LogMessage log_message_;
|
||||
};
|
||||
#elif defined(OS_POSIX)
|
||||
// Appends a formatted system message of the errno type
|
||||
class ErrnoLogMessage {
|
||||
public:
|
||||
ErrnoLogMessage(const char* file,
|
||||
int line,
|
||||
LogSeverity severity,
|
||||
SystemErrorCode err);
|
||||
|
||||
ErrnoLogMessage(const ErrnoLogMessage&) = delete;
|
||||
ErrnoLogMessage& operator=(const ErrnoLogMessage&) = delete;
|
||||
|
||||
// Appends the error message before destructing the encapsulated class.
|
||||
~ErrnoLogMessage();
|
||||
|
||||
std::ostream& stream() { return log_message_.stream(); }
|
||||
|
||||
private:
|
||||
SystemErrorCode err_;
|
||||
LogMessage log_message_;
|
||||
};
|
||||
#endif // OS_WIN
|
||||
|
||||
} // namespace logging
|
||||
} // namespace cef
|
||||
|
||||
// These functions are provided as a convenience for logging, which is where we
|
||||
// use streams (it is against Google style to use streams in other places). It
|
||||
// is designed to allow you to emit non-ASCII Unicode strings to the log file,
|
||||
// which is normally ASCII. It is relatively slow, so try not to use it for
|
||||
// common cases. Non-ASCII characters will be converted to UTF-8 by these
|
||||
// operators.
|
||||
std::ostream& operator<<(std::ostream& out, const wchar_t* wstr);
|
||||
inline std::ostream& operator<<(std::ostream& out, const std::wstring& wstr) {
|
||||
return out << wstr.c_str();
|
||||
}
|
||||
#if defined(WCHAR_T_IS_32_BIT)
|
||||
std::ostream& operator<<(std::ostream& out, const char16_t* wstr);
|
||||
#elif defined(WCHAR_T_IS_16_BIT)
|
||||
inline std::ostream& operator<<(std::ostream& out, const char16_t* wstr) {
|
||||
return operator<<(out, reinterpret_cast<const wchar_t*>(wstr));
|
||||
}
|
||||
#endif
|
||||
|
||||
// The NOTIMPLEMENTED() macro annotates codepaths which have
|
||||
// not been implemented yet.
|
||||
//
|
||||
// The implementation of this macro is controlled by NOTIMPLEMENTED_POLICY:
|
||||
// 0 -- Do nothing (stripped by compiler)
|
||||
// 1 -- Warn at compile time
|
||||
// 2 -- Fail at compile time
|
||||
// 3 -- Fail at runtime (DCHECK)
|
||||
// 4 -- [default] LOG(ERROR) at runtime
|
||||
// 5 -- LOG(ERROR) at runtime, only once per call-site
|
||||
|
||||
#ifndef NOTIMPLEMENTED_POLICY
|
||||
#if defined(OS_ANDROID) && defined(OFFICIAL_BUILD)
|
||||
#define NOTIMPLEMENTED_POLICY 0
|
||||
#else
|
||||
// Select default policy: LOG(ERROR)
|
||||
#define NOTIMPLEMENTED_POLICY 4
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(COMPILER_GCC)
|
||||
// On Linux, with GCC, we can use __PRETTY_FUNCTION__ to get the demangled name
|
||||
// of the current function in the NOTIMPLEMENTED message.
|
||||
#define NOTIMPLEMENTED_MSG "Not implemented reached in " << __PRETTY_FUNCTION__
|
||||
#else
|
||||
#define NOTIMPLEMENTED_MSG "NOT IMPLEMENTED"
|
||||
#endif
|
||||
|
||||
#if NOTIMPLEMENTED_POLICY == 0
|
||||
#define NOTIMPLEMENTED() EAT_STREAM_PARAMETERS
|
||||
#elif NOTIMPLEMENTED_POLICY == 1
|
||||
// TODO, figure out how to generate a warning
|
||||
#define NOTIMPLEMENTED() COMPILE_ASSERT(false, NOT_IMPLEMENTED)
|
||||
#elif NOTIMPLEMENTED_POLICY == 2
|
||||
#define NOTIMPLEMENTED() COMPILE_ASSERT(false, NOT_IMPLEMENTED)
|
||||
#elif NOTIMPLEMENTED_POLICY == 3
|
||||
#define NOTIMPLEMENTED() NOTREACHED()
|
||||
#elif NOTIMPLEMENTED_POLICY == 4
|
||||
#define NOTIMPLEMENTED() LOG(ERROR) << NOTIMPLEMENTED_MSG
|
||||
#elif NOTIMPLEMENTED_POLICY == 5
|
||||
#define NOTIMPLEMENTED() \
|
||||
do { \
|
||||
static bool logged_once = false; \
|
||||
LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG; \
|
||||
logged_once = true; \
|
||||
} while (0); \
|
||||
EAT_STREAM_PARAMETERS
|
||||
#endif
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_LOGGING_H_
|
||||
|
|
@ -1,63 +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_MACROS_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_MACROS_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(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.
|
||||
|
||||
// ALL DISALLOW_xxx MACROS ARE DEPRECATED; DO NOT USE IN NEW CODE.
|
||||
// Use explicit deletions instead. For more information see
|
||||
// https://chromium.googlesource.com/chromium/src/+/lkgr/styleguide/c++/c++-dos-and-donts.md#explicitly-declare-class-copyability_movability
|
||||
|
||||
// DEPRECATED: See above. Makes a class uncopyable.
|
||||
#define DISALLOW_COPY(TypeName) TypeName(const TypeName&) = delete
|
||||
|
||||
// DEPRECATED: See above. Makes a class unassignable.
|
||||
#define DISALLOW_ASSIGN(TypeName) TypeName& operator=(const TypeName&) = delete
|
||||
|
||||
// DEPRECATED: See above. Makes a class uncopyable and unassignable.
|
||||
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
|
||||
DISALLOW_COPY(TypeName); \
|
||||
DISALLOW_ASSIGN(TypeName)
|
||||
|
||||
// DEPRECATED: See above. Disallow all implicit constructors, namely the
|
||||
// default constructor, copy constructor and operator= functions.
|
||||
#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
|
||||
TypeName() = delete; \
|
||||
DISALLOW_COPY_AND_ASSIGN(TypeName)
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_MACROS_H_
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
|
||||
// Google Inc. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// WARNING: You should *NOT* be using this class directly. PlatformThread is
|
||||
// the low-level platform-specific abstraction to the OS's threading interface.
|
||||
// You should instead be using a message-loop driven Thread, see thread.h.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_PLATFORM_THREAD_H_
|
||||
#define CEF_INCLUDE_BASE_PLATFORM_THREAD_H_
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/threading/platform_thread.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include "include/base/cef_build.h"
|
||||
#include "include/internal/cef_thread_internal.h"
|
||||
|
||||
namespace base {
|
||||
|
||||
///
|
||||
/// Used for logging. Always an integer value.
|
||||
///
|
||||
typedef cef_platform_thread_id_t PlatformThreadId;
|
||||
|
||||
///
|
||||
/// Used for thread checking and debugging.
|
||||
/// Meant to be as fast as possible.
|
||||
/// These are produced by PlatformThread::CurrentRef(), and used to later
|
||||
/// check if we are on the same thread or not by using ==. These are safe
|
||||
/// to copy between threads, but can't be copied to another process as they
|
||||
/// have no meaning there. Also, the internal identifier can be re-used
|
||||
/// after a thread dies, so a PlatformThreadRef cannot be reliably used
|
||||
/// to distinguish a new thread from an old, dead thread.
|
||||
///
|
||||
class PlatformThreadRef {
|
||||
public:
|
||||
typedef cef_platform_thread_handle_t RefType;
|
||||
|
||||
PlatformThreadRef() : id_(0) {}
|
||||
|
||||
explicit PlatformThreadRef(RefType id) : id_(id) {}
|
||||
|
||||
bool operator==(PlatformThreadRef other) const { return id_ == other.id_; }
|
||||
|
||||
bool is_null() const { return id_ == 0; }
|
||||
|
||||
private:
|
||||
RefType id_;
|
||||
};
|
||||
|
||||
///
|
||||
/// A namespace for low-level thread functions.
|
||||
/// Chromium uses a class with static methods but CEF uses an actual namespace
|
||||
/// to avoid linker problems with the sandbox libaries on Windows.
|
||||
///
|
||||
namespace PlatformThread {
|
||||
|
||||
///
|
||||
/// Gets the current thread id, which may be useful for logging purposes.
|
||||
///
|
||||
inline PlatformThreadId CurrentId() {
|
||||
return cef_get_current_platform_thread_id();
|
||||
}
|
||||
|
||||
///
|
||||
/// Gets the current thread reference, which can be used to check if
|
||||
/// we're on the right thread quickly.
|
||||
///
|
||||
inline PlatformThreadRef CurrentRef() {
|
||||
return PlatformThreadRef(cef_get_current_platform_thread_handle());
|
||||
}
|
||||
|
||||
} // namespace PlatformThread
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_PLATFORM_THREAD_H_
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
// Copyright (c) 2021 Marshall A. Greenblatt. Portions copyright (c) 2015
|
||||
// Google Inc. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef INCLUDE_BASE_CEF_PTR_UTIL_H_
|
||||
#define INCLUDE_BASE_CEF_PTR_UTIL_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/memory/ptr_util.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
namespace base {
|
||||
|
||||
///
|
||||
/// Helper to transfer ownership of a raw pointer to a std::unique_ptr<T>.
|
||||
/// Note that std::unique_ptr<T> has very different semantics from
|
||||
/// std::unique_ptr<T[]>: do not use this helper for array allocations.
|
||||
///
|
||||
template <typename T>
|
||||
std::unique_ptr<T> WrapUnique(T* ptr) {
|
||||
return std::unique_ptr<T>(ptr);
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // INCLUDE_BASE_CEF_PTR_UTIL_H_
|
||||
|
|
@ -1,511 +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_REF_COUNTED_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_REF_COUNTED_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/memory/ref_counted.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "include/base/cef_atomic_ref_count.h"
|
||||
#include "include/base/cef_build.h"
|
||||
#include "include/base/cef_compiler_specific.h"
|
||||
#include "include/base/cef_logging.h"
|
||||
#include "include/base/cef_scoped_refptr.h"
|
||||
#include "include/base/cef_thread_checker.h"
|
||||
|
||||
namespace base {
|
||||
namespace cef_subtle {
|
||||
|
||||
class RefCountedBase {
|
||||
public:
|
||||
bool HasOneRef() const { return ref_count_ == 1; }
|
||||
bool HasAtLeastOneRef() const { return ref_count_ >= 1; }
|
||||
|
||||
protected:
|
||||
explicit RefCountedBase(StartRefCountFromZeroTag) {
|
||||
#if DCHECK_IS_ON()
|
||||
thread_checker_.DetachFromThread();
|
||||
#endif
|
||||
}
|
||||
|
||||
explicit RefCountedBase(StartRefCountFromOneTag) : ref_count_(1) {
|
||||
#if DCHECK_IS_ON()
|
||||
needs_adopt_ref_ = true;
|
||||
thread_checker_.DetachFromThread();
|
||||
#endif
|
||||
}
|
||||
|
||||
RefCountedBase(const RefCountedBase&) = delete;
|
||||
RefCountedBase& operator=(const RefCountedBase&) = delete;
|
||||
|
||||
~RefCountedBase() {
|
||||
#if DCHECK_IS_ON()
|
||||
DCHECK(in_dtor_) << "RefCounted object deleted without calling Release()";
|
||||
#endif
|
||||
}
|
||||
|
||||
void AddRef() const {
|
||||
#if DCHECK_IS_ON()
|
||||
DCHECK(!in_dtor_);
|
||||
DCHECK(!needs_adopt_ref_)
|
||||
<< "This RefCounted object is created with non-zero reference count."
|
||||
<< " The first reference to such a object has to be made by AdoptRef or"
|
||||
<< " MakeRefCounted.";
|
||||
if (ref_count_ >= 1) {
|
||||
DCHECK(CalledOnValidThread());
|
||||
}
|
||||
#endif
|
||||
|
||||
AddRefImpl();
|
||||
}
|
||||
|
||||
// Returns true if the object should self-delete.
|
||||
bool Release() const {
|
||||
ReleaseImpl();
|
||||
|
||||
#if DCHECK_IS_ON()
|
||||
DCHECK(!in_dtor_);
|
||||
if (ref_count_ == 0) {
|
||||
in_dtor_ = true;
|
||||
}
|
||||
|
||||
if (ref_count_ >= 1) {
|
||||
DCHECK(CalledOnValidThread());
|
||||
}
|
||||
if (ref_count_ == 1) {
|
||||
thread_checker_.DetachFromThread();
|
||||
}
|
||||
#endif
|
||||
|
||||
return ref_count_ == 0;
|
||||
}
|
||||
|
||||
// Returns true if it is safe to read or write the object, from a thread
|
||||
// safety standpoint. Should be DCHECK'd from the methods of RefCounted
|
||||
// classes if there is a danger of objects being shared across threads.
|
||||
//
|
||||
// This produces fewer false positives than adding a separate ThreadChecker
|
||||
// into the subclass, because it automatically detaches from the thread when
|
||||
// the reference count is 1 (and never fails if there is only one reference).
|
||||
//
|
||||
// This means unlike a separate ThreadChecker, it will permit a singly
|
||||
// referenced object to be passed between threads (not holding a reference on
|
||||
// the sending thread), but will trap if the sending thread holds onto a
|
||||
// reference, or if the object is accessed from multiple threads
|
||||
// simultaneously.
|
||||
bool IsOnValidThread() const {
|
||||
#if DCHECK_IS_ON()
|
||||
return ref_count_ <= 1 || CalledOnValidThread();
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename U>
|
||||
friend scoped_refptr<U> base::AdoptRef(U*);
|
||||
|
||||
void Adopted() const {
|
||||
#if DCHECK_IS_ON()
|
||||
DCHECK(needs_adopt_ref_);
|
||||
needs_adopt_ref_ = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(ARCH_CPU_64_BITS)
|
||||
void AddRefImpl() const;
|
||||
void ReleaseImpl() const;
|
||||
#else
|
||||
void AddRefImpl() const { ++ref_count_; }
|
||||
void ReleaseImpl() const { --ref_count_; }
|
||||
#endif
|
||||
|
||||
#if DCHECK_IS_ON()
|
||||
bool CalledOnValidThread() const;
|
||||
#endif
|
||||
|
||||
mutable uint32_t ref_count_ = 0;
|
||||
static_assert(std::is_unsigned<decltype(ref_count_)>::value,
|
||||
"ref_count_ must be an unsigned type.");
|
||||
|
||||
#if DCHECK_IS_ON()
|
||||
mutable bool needs_adopt_ref_ = false;
|
||||
mutable bool in_dtor_ = false;
|
||||
mutable ThreadChecker thread_checker_;
|
||||
#endif
|
||||
};
|
||||
|
||||
class RefCountedThreadSafeBase {
|
||||
public:
|
||||
bool HasOneRef() const;
|
||||
bool HasAtLeastOneRef() const;
|
||||
|
||||
protected:
|
||||
explicit constexpr RefCountedThreadSafeBase(StartRefCountFromZeroTag) {}
|
||||
explicit constexpr RefCountedThreadSafeBase(StartRefCountFromOneTag)
|
||||
: ref_count_(1) {
|
||||
#if DCHECK_IS_ON()
|
||||
needs_adopt_ref_ = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
RefCountedThreadSafeBase(const RefCountedThreadSafeBase&) = delete;
|
||||
RefCountedThreadSafeBase& operator=(const RefCountedThreadSafeBase&) = delete;
|
||||
|
||||
#if DCHECK_IS_ON()
|
||||
~RefCountedThreadSafeBase();
|
||||
#else
|
||||
~RefCountedThreadSafeBase() = default;
|
||||
#endif
|
||||
|
||||
// Release and AddRef are suitable for inlining on X86 because they generate
|
||||
// very small code threads. On other platforms (ARM), it causes a size
|
||||
// regression and is probably not worth it.
|
||||
#if defined(ARCH_CPU_X86_FAMILY)
|
||||
// Returns true if the object should self-delete.
|
||||
bool Release() const { return ReleaseImpl(); }
|
||||
void AddRef() const { AddRefImpl(); }
|
||||
void AddRefWithCheck() const { AddRefWithCheckImpl(); }
|
||||
#else
|
||||
// Returns true if the object should self-delete.
|
||||
bool Release() const;
|
||||
void AddRef() const;
|
||||
void AddRefWithCheck() const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
template <typename U>
|
||||
friend scoped_refptr<U> base::AdoptRef(U*);
|
||||
|
||||
void Adopted() const {
|
||||
#if DCHECK_IS_ON()
|
||||
DCHECK(needs_adopt_ref_);
|
||||
needs_adopt_ref_ = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void AddRefImpl() const {
|
||||
#if DCHECK_IS_ON()
|
||||
DCHECK(!in_dtor_);
|
||||
DCHECK(!needs_adopt_ref_)
|
||||
<< "This RefCounted object is created with non-zero reference count."
|
||||
<< " The first reference to such a object has to be made by AdoptRef or"
|
||||
<< " MakeRefCounted.";
|
||||
#endif
|
||||
ref_count_.Increment();
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void AddRefWithCheckImpl() const {
|
||||
#if DCHECK_IS_ON()
|
||||
DCHECK(!in_dtor_);
|
||||
DCHECK(!needs_adopt_ref_)
|
||||
<< "This RefCounted object is created with non-zero reference count."
|
||||
<< " The first reference to such a object has to be made by AdoptRef or"
|
||||
<< " MakeRefCounted.";
|
||||
#endif
|
||||
CHECK(ref_count_.Increment() > 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE bool ReleaseImpl() const {
|
||||
#if DCHECK_IS_ON()
|
||||
DCHECK(!in_dtor_);
|
||||
DCHECK(!ref_count_.IsZero());
|
||||
#endif
|
||||
if (!ref_count_.Decrement()) {
|
||||
#if DCHECK_IS_ON()
|
||||
in_dtor_ = true;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
mutable AtomicRefCount ref_count_{0};
|
||||
#if DCHECK_IS_ON()
|
||||
mutable bool needs_adopt_ref_ = false;
|
||||
mutable bool in_dtor_ = false;
|
||||
#endif
|
||||
};
|
||||
|
||||
// ScopedAllowCrossThreadRefCountAccess disables the check documented on
|
||||
// RefCounted below for rare pre-existing use cases where thread-safety was
|
||||
// guaranteed through other means (e.g. explicit sequencing of calls across
|
||||
// execution threads when bouncing between threads in order). New callers
|
||||
// should refrain from using this (callsites handling thread-safety through
|
||||
// locks should use RefCountedThreadSafe per the overhead of its atomics being
|
||||
// negligible compared to locks anyways and callsites doing explicit sequencing
|
||||
// should properly std::move() the ref to avoid hitting this check).
|
||||
// TODO(tzik): Cleanup existing use cases and remove
|
||||
// ScopedAllowCrossThreadRefCountAccess.
|
||||
class ScopedAllowCrossThreadRefCountAccess final {
|
||||
public:
|
||||
#if DCHECK_IS_ON()
|
||||
ScopedAllowCrossThreadRefCountAccess();
|
||||
~ScopedAllowCrossThreadRefCountAccess();
|
||||
#else
|
||||
ScopedAllowCrossThreadRefCountAccess() {}
|
||||
~ScopedAllowCrossThreadRefCountAccess() {}
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace cef_subtle
|
||||
|
||||
using ScopedAllowCrossThreadRefCountAccess =
|
||||
cef_subtle::ScopedAllowCrossThreadRefCountAccess;
|
||||
|
||||
///
|
||||
/// The reference count starts from zero by default, and we intended to migrate
|
||||
/// to start-from-one ref count. Put REQUIRE_ADOPTION_FOR_REFCOUNTED_TYPE() to
|
||||
/// the ref counted class to opt-in.
|
||||
///
|
||||
/// If an object has start-from-one ref count, the first scoped_refptr need to
|
||||
/// be created by base::AdoptRef() or base::MakeRefCounted(). We can use
|
||||
/// base::MakeRefCounted() to create create both type of ref counted object.
|
||||
///
|
||||
/// The motivations to use start-from-one ref count are:
|
||||
/// - Start-from-one ref count doesn't need the ref count increment for the
|
||||
/// first reference.
|
||||
/// - It can detect an invalid object acquisition for a being-deleted object
|
||||
/// that has zero ref count. That tends to happen on custom deleter that
|
||||
/// delays the deletion.
|
||||
/// TODO(tzik): Implement invalid acquisition detection.
|
||||
/// - Behavior parity to Blink's WTF::RefCounted, whose count starts from one.
|
||||
/// And start-from-one ref count is a step to merge WTF::RefCounted into
|
||||
/// base::RefCounted.
|
||||
///
|
||||
#define REQUIRE_ADOPTION_FOR_REFCOUNTED_TYPE() \
|
||||
static constexpr ::base::cef_subtle::StartRefCountFromOneTag \
|
||||
kRefCountPreference = ::base::cef_subtle::kStartRefCountFromOneTag
|
||||
|
||||
template <class T, typename Traits>
|
||||
class RefCounted;
|
||||
|
||||
///
|
||||
/// Default traits for RefCounted<T>. Deletes the object when its ref count
|
||||
/// reaches 0. Overload to delete it on a different thread etc.
|
||||
///
|
||||
template <typename T>
|
||||
struct DefaultRefCountedTraits {
|
||||
static void Destruct(const T* x) {
|
||||
RefCounted<T, DefaultRefCountedTraits>::DeleteInternal(x);
|
||||
}
|
||||
};
|
||||
|
||||
///
|
||||
/// A base class for reference counted classes. Otherwise, known as a cheap
|
||||
/// knock-off of WebKit's RefCounted<T> class. To use this, just extend your
|
||||
/// class from it like so:
|
||||
///
|
||||
/// <pre>
|
||||
/// class MyFoo : public base::RefCounted<MyFoo> {
|
||||
/// ...
|
||||
/// private:
|
||||
/// friend class base::RefCounted<MyFoo>;
|
||||
/// ~MyFoo();
|
||||
/// };
|
||||
/// </pre>
|
||||
///
|
||||
/// Usage Notes:
|
||||
/// 1. You should always make your destructor non-public, to avoid any code
|
||||
/// deleting the object accidentally while there are references to it.
|
||||
/// 2. You should always make the ref-counted base class a friend of your class,
|
||||
/// so that it can access the destructor.
|
||||
///
|
||||
/// The ref count manipulation to RefCounted is NOT thread safe and has DCHECKs
|
||||
/// to trap unsafe cross thread usage. A subclass instance of RefCounted can be
|
||||
/// passed to another execution thread only when its ref count is 1. If the ref
|
||||
/// count is more than 1, the RefCounted class verifies the ref updates are made
|
||||
/// on the same execution thread as the previous ones. The subclass can also
|
||||
/// manually call IsOnValidThread to trap other non-thread-safe accesses; see
|
||||
/// the documentation for that method.
|
||||
///
|
||||
template <class T, typename Traits = DefaultRefCountedTraits<T>>
|
||||
class RefCounted : public cef_subtle::RefCountedBase {
|
||||
public:
|
||||
static constexpr cef_subtle::StartRefCountFromZeroTag kRefCountPreference =
|
||||
cef_subtle::kStartRefCountFromZeroTag;
|
||||
|
||||
RefCounted() : cef_subtle::RefCountedBase(T::kRefCountPreference) {}
|
||||
|
||||
RefCounted(const RefCounted&) = delete;
|
||||
RefCounted& operator=(const RefCounted&) = delete;
|
||||
|
||||
void AddRef() const { cef_subtle::RefCountedBase::AddRef(); }
|
||||
|
||||
void Release() const {
|
||||
if (cef_subtle::RefCountedBase::Release()) {
|
||||
// Prune the code paths which the static analyzer may take to simulate
|
||||
// object destruction. Use-after-free errors aren't possible given the
|
||||
// lifetime guarantees of the refcounting system.
|
||||
ANALYZER_SKIP_THIS_PATH();
|
||||
|
||||
Traits::Destruct(static_cast<const T*>(this));
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
~RefCounted() = default;
|
||||
|
||||
private:
|
||||
friend struct DefaultRefCountedTraits<T>;
|
||||
template <typename U>
|
||||
static void DeleteInternal(const U* x) {
|
||||
delete x;
|
||||
}
|
||||
};
|
||||
|
||||
// Forward declaration.
|
||||
template <class T, typename Traits>
|
||||
class RefCountedThreadSafe;
|
||||
|
||||
///
|
||||
/// Default traits for RefCountedThreadSafe<T>. Deletes the object when its ref
|
||||
/// count reaches 0. Overload to delete it on a different thread etc.
|
||||
///
|
||||
template <typename T>
|
||||
struct DefaultRefCountedThreadSafeTraits {
|
||||
static void Destruct(const T* x) {
|
||||
// Delete through RefCountedThreadSafe to make child classes only need to be
|
||||
// friend with RefCountedThreadSafe instead of this struct, which is an
|
||||
// implementation detail.
|
||||
RefCountedThreadSafe<T, DefaultRefCountedThreadSafeTraits>::DeleteInternal(
|
||||
x);
|
||||
}
|
||||
};
|
||||
|
||||
///
|
||||
/// A thread-safe variant of RefCounted<T>
|
||||
///
|
||||
/// <pre>
|
||||
/// class MyFoo : public base::RefCountedThreadSafe<MyFoo> {
|
||||
/// ...
|
||||
/// };
|
||||
/// </pre>
|
||||
///
|
||||
/// If you're using the default trait, then you should add compile time
|
||||
/// asserts that no one else is deleting your object. i.e.
|
||||
/// <pre>
|
||||
/// private:
|
||||
/// friend class base::RefCountedThreadSafe<MyFoo>;
|
||||
/// ~MyFoo();
|
||||
/// </pre>
|
||||
///
|
||||
/// We can use REQUIRE_ADOPTION_FOR_REFCOUNTED_TYPE() with RefCountedThreadSafe
|
||||
/// too. See the comment above the RefCounted definition for details.
|
||||
///
|
||||
template <class T, typename Traits = DefaultRefCountedThreadSafeTraits<T>>
|
||||
class RefCountedThreadSafe : public cef_subtle::RefCountedThreadSafeBase {
|
||||
public:
|
||||
static constexpr cef_subtle::StartRefCountFromZeroTag kRefCountPreference =
|
||||
cef_subtle::kStartRefCountFromZeroTag;
|
||||
|
||||
explicit RefCountedThreadSafe()
|
||||
: cef_subtle::RefCountedThreadSafeBase(T::kRefCountPreference) {}
|
||||
|
||||
RefCountedThreadSafe(const RefCountedThreadSafe&) = delete;
|
||||
RefCountedThreadSafe& operator=(const RefCountedThreadSafe&) = delete;
|
||||
|
||||
void AddRef() const { AddRefImpl(T::kRefCountPreference); }
|
||||
|
||||
void Release() const {
|
||||
if (cef_subtle::RefCountedThreadSafeBase::Release()) {
|
||||
ANALYZER_SKIP_THIS_PATH();
|
||||
Traits::Destruct(static_cast<const T*>(this));
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
~RefCountedThreadSafe() = default;
|
||||
|
||||
private:
|
||||
friend struct DefaultRefCountedThreadSafeTraits<T>;
|
||||
template <typename U>
|
||||
static void DeleteInternal(const U* x) {
|
||||
delete x;
|
||||
}
|
||||
|
||||
void AddRefImpl(cef_subtle::StartRefCountFromZeroTag) const {
|
||||
cef_subtle::RefCountedThreadSafeBase::AddRef();
|
||||
}
|
||||
|
||||
void AddRefImpl(cef_subtle::StartRefCountFromOneTag) const {
|
||||
cef_subtle::RefCountedThreadSafeBase::AddRefWithCheck();
|
||||
}
|
||||
};
|
||||
|
||||
///
|
||||
/// A thread-safe wrapper for some piece of data so we can place other
|
||||
/// things in scoped_refptrs<>.
|
||||
///
|
||||
template <typename T>
|
||||
class RefCountedData
|
||||
: public base::RefCountedThreadSafe<base::RefCountedData<T>> {
|
||||
public:
|
||||
RefCountedData() : data() {}
|
||||
RefCountedData(const T& in_value) : data(in_value) {}
|
||||
RefCountedData(T&& in_value) : data(std::move(in_value)) {}
|
||||
template <typename... Args>
|
||||
explicit RefCountedData(std::in_place_t, Args&&... args)
|
||||
: data(std::forward<Args>(args)...) {}
|
||||
|
||||
T data;
|
||||
|
||||
private:
|
||||
friend class base::RefCountedThreadSafe<base::RefCountedData<T>>;
|
||||
~RefCountedData() = default;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
bool operator==(const RefCountedData<T>& lhs, const RefCountedData<T>& rhs) {
|
||||
return lhs.data == rhs.data;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool operator!=(const RefCountedData<T>& lhs, const RefCountedData<T>& rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_REF_COUNTED_H_
|
||||
|
|
@ -1,420 +0,0 @@
|
|||
// Copyright (c) 2017 Marshall A. Greenblatt. Portions copyright (c) 2011
|
||||
// Google Inc. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_SCOPED_REFPTR_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_SCOPED_REFPTR_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iosfwd>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include "include/base/cef_logging.h"
|
||||
|
||||
template <class T>
|
||||
class scoped_refptr;
|
||||
|
||||
namespace base {
|
||||
|
||||
template <class, typename>
|
||||
class RefCounted;
|
||||
template <class, typename>
|
||||
class RefCountedThreadSafe;
|
||||
class SequencedTaskRunner;
|
||||
class WrappedPromise;
|
||||
|
||||
template <typename T>
|
||||
scoped_refptr<T> AdoptRef(T* t);
|
||||
|
||||
namespace internal {
|
||||
|
||||
class BasePromise;
|
||||
|
||||
} // namespace internal
|
||||
|
||||
namespace cef_subtle {
|
||||
|
||||
enum AdoptRefTag { kAdoptRefTag };
|
||||
enum StartRefCountFromZeroTag { kStartRefCountFromZeroTag };
|
||||
enum StartRefCountFromOneTag { kStartRefCountFromOneTag };
|
||||
|
||||
template <typename T, typename U, typename V>
|
||||
constexpr bool IsRefCountPreferenceOverridden(const T*,
|
||||
const RefCounted<U, V>*) {
|
||||
return !std::is_same<std::decay_t<decltype(T::kRefCountPreference)>,
|
||||
std::decay_t<decltype(U::kRefCountPreference)>>::value;
|
||||
}
|
||||
|
||||
template <typename T, typename U, typename V>
|
||||
constexpr bool IsRefCountPreferenceOverridden(
|
||||
const T*,
|
||||
const RefCountedThreadSafe<U, V>*) {
|
||||
return !std::is_same<std::decay_t<decltype(T::kRefCountPreference)>,
|
||||
std::decay_t<decltype(U::kRefCountPreference)>>::value;
|
||||
}
|
||||
|
||||
constexpr bool IsRefCountPreferenceOverridden(...) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace cef_subtle
|
||||
|
||||
// Creates a scoped_refptr from a raw pointer without incrementing the reference
|
||||
// count. Use this only for a newly created object whose reference count starts
|
||||
// from 1 instead of 0.
|
||||
template <typename T>
|
||||
scoped_refptr<T> AdoptRef(T* obj) {
|
||||
using Tag = std::decay_t<decltype(T::kRefCountPreference)>;
|
||||
static_assert(std::is_same<cef_subtle::StartRefCountFromOneTag, Tag>::value,
|
||||
"Use AdoptRef only if the reference count starts from one.");
|
||||
|
||||
DCHECK(obj);
|
||||
DCHECK(obj->HasOneRef());
|
||||
obj->Adopted();
|
||||
return scoped_refptr<T>(obj, cef_subtle::kAdoptRefTag);
|
||||
}
|
||||
|
||||
namespace cef_subtle {
|
||||
|
||||
template <typename T>
|
||||
scoped_refptr<T> AdoptRefIfNeeded(T* obj, StartRefCountFromZeroTag) {
|
||||
return scoped_refptr<T>(obj);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
scoped_refptr<T> AdoptRefIfNeeded(T* obj, StartRefCountFromOneTag) {
|
||||
return AdoptRef(obj);
|
||||
}
|
||||
|
||||
} // namespace cef_subtle
|
||||
|
||||
// Constructs an instance of T, which is a ref counted type, and wraps the
|
||||
// object into a scoped_refptr<T>.
|
||||
template <typename T, typename... Args>
|
||||
scoped_refptr<T> MakeRefCounted(Args&&... args) {
|
||||
T* obj = new T(std::forward<Args>(args)...);
|
||||
return cef_subtle::AdoptRefIfNeeded(obj, T::kRefCountPreference);
|
||||
}
|
||||
|
||||
// Takes an instance of T, which is a ref counted type, and wraps the object
|
||||
// into a scoped_refptr<T>.
|
||||
template <typename T>
|
||||
scoped_refptr<T> WrapRefCounted(T* t) {
|
||||
return scoped_refptr<T>(t);
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
||||
///
|
||||
/// A smart pointer class for reference counted objects. Use this class instead
|
||||
/// of calling AddRef and Release manually on a reference counted object to
|
||||
/// avoid common memory leaks caused by forgetting to Release an object
|
||||
/// reference. Sample usage:
|
||||
///
|
||||
/// <pre>
|
||||
/// class MyFoo : public RefCounted<MyFoo> {
|
||||
/// ...
|
||||
/// private:
|
||||
/// friend class RefCounted<MyFoo>; // Allow destruction by RefCounted<>.
|
||||
/// ~MyFoo(); // Destructor must be
|
||||
/// private/protected.
|
||||
/// };
|
||||
///
|
||||
/// void some_function() {
|
||||
/// scoped_refptr<MyFoo> foo = MakeRefCounted<MyFoo>();
|
||||
/// foo->Method(param);
|
||||
/// // |foo| is released when this function returns
|
||||
/// }
|
||||
///
|
||||
/// void some_other_function() {
|
||||
/// scoped_refptr<MyFoo> foo = MakeRefCounted<MyFoo>();
|
||||
/// ...
|
||||
/// foo.reset(); // explicitly releases |foo|
|
||||
/// ...
|
||||
/// if (foo)
|
||||
/// foo->Method(param);
|
||||
/// }
|
||||
/// </pre>
|
||||
///
|
||||
/// The above examples show how scoped_refptr<T> acts like a pointer to T.
|
||||
/// Given two scoped_refptr<T> classes, it is also possible to exchange
|
||||
/// references between the two objects, like so:
|
||||
///
|
||||
/// <pre>
|
||||
/// {
|
||||
/// scoped_refptr<MyFoo> a = MakeRefCounted<MyFoo>();
|
||||
/// scoped_refptr<MyFoo> b;
|
||||
///
|
||||
/// b.swap(a);
|
||||
/// // now, |b| references the MyFoo object, and |a| references nullptr.
|
||||
/// }
|
||||
/// </pre>
|
||||
///
|
||||
/// To make both |a| and |b| in the above example reference the same MyFoo
|
||||
/// object, simply use the assignment operator:
|
||||
///
|
||||
/// <pre>
|
||||
/// {
|
||||
/// scoped_refptr<MyFoo> a = MakeRefCounted<MyFoo>();
|
||||
/// scoped_refptr<MyFoo> b;
|
||||
///
|
||||
/// b = a;
|
||||
/// // now, |a| and |b| each own a reference to the same MyFoo object.
|
||||
/// }
|
||||
/// </pre>
|
||||
///
|
||||
/// Also see Chromium's ownership and calling conventions:
|
||||
/// https://chromium.googlesource.com/chromium/src/+/lkgr/styleguide/c++/c++.md#object-ownership-and-calling-conventions
|
||||
/// Specifically:
|
||||
/// If the function (at least sometimes) takes a ref on a refcounted object,
|
||||
/// declare the param as scoped_refptr<T>. The caller can decide whether it
|
||||
/// wishes to transfer ownership (by calling std::move(t) when passing t) or
|
||||
/// retain its ref (by simply passing t directly).
|
||||
/// In other words, use scoped_refptr like you would a std::unique_ptr except
|
||||
/// in the odd case where it's required to hold on to a ref while handing one
|
||||
/// to another component (if a component merely needs to use t on the stack
|
||||
/// without keeping a ref: pass t as a raw T*).
|
||||
///
|
||||
template <class T>
|
||||
class TRIVIAL_ABI scoped_refptr {
|
||||
public:
|
||||
typedef T element_type;
|
||||
|
||||
constexpr scoped_refptr() = default;
|
||||
|
||||
// Allow implicit construction from nullptr.
|
||||
constexpr scoped_refptr(std::nullptr_t) {}
|
||||
|
||||
// Constructs from a raw pointer. Note that this constructor allows implicit
|
||||
// conversion from T* to scoped_refptr<T> which is strongly discouraged. If
|
||||
// you are creating a new ref-counted object please use
|
||||
// base::MakeRefCounted<T>() or base::WrapRefCounted<T>(). Otherwise you
|
||||
// should move or copy construct from an existing scoped_refptr<T> to the
|
||||
// ref-counted object.
|
||||
scoped_refptr(T* p) : ptr_(p) {
|
||||
if (ptr_) {
|
||||
AddRef(ptr_);
|
||||
}
|
||||
}
|
||||
|
||||
// Copy constructor. This is required in addition to the copy conversion
|
||||
// constructor below.
|
||||
scoped_refptr(const scoped_refptr& r) : scoped_refptr(r.ptr_) {}
|
||||
|
||||
// Copy conversion constructor.
|
||||
template <typename U,
|
||||
typename = typename std::enable_if<
|
||||
std::is_convertible<U*, T*>::value>::type>
|
||||
scoped_refptr(const scoped_refptr<U>& r) : scoped_refptr(r.ptr_) {}
|
||||
|
||||
// Move constructor. This is required in addition to the move conversion
|
||||
// constructor below.
|
||||
scoped_refptr(scoped_refptr&& r) noexcept : ptr_(r.ptr_) { r.ptr_ = nullptr; }
|
||||
|
||||
// Move conversion constructor.
|
||||
template <typename U,
|
||||
typename = typename std::enable_if<
|
||||
std::is_convertible<U*, T*>::value>::type>
|
||||
scoped_refptr(scoped_refptr<U>&& r) noexcept : ptr_(r.ptr_) {
|
||||
r.ptr_ = nullptr;
|
||||
}
|
||||
|
||||
~scoped_refptr() {
|
||||
static_assert(!base::cef_subtle::IsRefCountPreferenceOverridden(
|
||||
static_cast<T*>(nullptr), static_cast<T*>(nullptr)),
|
||||
"It's unsafe to override the ref count preference."
|
||||
" Please remove REQUIRE_ADOPTION_FOR_REFCOUNTED_TYPE"
|
||||
" from subclasses.");
|
||||
if (ptr_) {
|
||||
Release(ptr_);
|
||||
}
|
||||
}
|
||||
|
||||
T* get() const { return ptr_; }
|
||||
|
||||
T& operator*() const {
|
||||
DCHECK(ptr_);
|
||||
return *ptr_;
|
||||
}
|
||||
|
||||
T* operator->() const {
|
||||
DCHECK(ptr_);
|
||||
return ptr_;
|
||||
}
|
||||
|
||||
scoped_refptr& operator=(std::nullptr_t) {
|
||||
reset();
|
||||
return *this;
|
||||
}
|
||||
|
||||
scoped_refptr& operator=(T* p) { return *this = scoped_refptr(p); }
|
||||
|
||||
// Unified assignment operator.
|
||||
scoped_refptr& operator=(scoped_refptr r) noexcept {
|
||||
swap(r);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Sets managed object to null and releases reference to the previous managed
|
||||
// object, if it existed.
|
||||
void reset() { scoped_refptr().swap(*this); }
|
||||
|
||||
// Returns the owned pointer (if any), releasing ownership to the caller. The
|
||||
// caller is responsible for managing the lifetime of the reference.
|
||||
[[nodiscard]] T* release();
|
||||
|
||||
void swap(scoped_refptr& r) noexcept { std::swap(ptr_, r.ptr_); }
|
||||
|
||||
explicit operator bool() const { return ptr_ != nullptr; }
|
||||
|
||||
template <typename U>
|
||||
bool operator==(const scoped_refptr<U>& rhs) const {
|
||||
return ptr_ == rhs.get();
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
bool operator!=(const scoped_refptr<U>& rhs) const {
|
||||
return !operator==(rhs);
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
bool operator<(const scoped_refptr<U>& rhs) const {
|
||||
return ptr_ < rhs.get();
|
||||
}
|
||||
|
||||
protected:
|
||||
T* ptr_ = nullptr;
|
||||
|
||||
private:
|
||||
template <typename U>
|
||||
friend scoped_refptr<U> base::AdoptRef(U*);
|
||||
friend class ::base::SequencedTaskRunner;
|
||||
|
||||
// Friend access so these classes can use the constructor below as part of a
|
||||
// binary size optimization.
|
||||
friend class ::base::internal::BasePromise;
|
||||
friend class ::base::WrappedPromise;
|
||||
|
||||
scoped_refptr(T* p, base::cef_subtle::AdoptRefTag) : ptr_(p) {}
|
||||
|
||||
// Friend required for move constructors that set r.ptr_ to null.
|
||||
template <typename U>
|
||||
friend class scoped_refptr;
|
||||
|
||||
// Non-inline helpers to allow:
|
||||
// class Opaque;
|
||||
// extern template class scoped_refptr<Opaque>;
|
||||
// Otherwise the compiler will complain that Opaque is an incomplete type.
|
||||
static void AddRef(T* ptr);
|
||||
static void Release(T* ptr);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
T* scoped_refptr<T>::release() {
|
||||
T* ptr = ptr_;
|
||||
ptr_ = nullptr;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
// static
|
||||
template <typename T>
|
||||
void scoped_refptr<T>::AddRef(T* ptr) {
|
||||
ptr->AddRef();
|
||||
}
|
||||
|
||||
// static
|
||||
template <typename T>
|
||||
void scoped_refptr<T>::Release(T* ptr) {
|
||||
ptr->Release();
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
bool operator==(const scoped_refptr<T>& lhs, const U* rhs) {
|
||||
return lhs.get() == rhs;
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
bool operator==(const T* lhs, const scoped_refptr<U>& rhs) {
|
||||
return lhs == rhs.get();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool operator==(const scoped_refptr<T>& lhs, std::nullptr_t null) {
|
||||
return !static_cast<bool>(lhs);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool operator==(std::nullptr_t null, const scoped_refptr<T>& rhs) {
|
||||
return !static_cast<bool>(rhs);
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
bool operator!=(const scoped_refptr<T>& lhs, const U* rhs) {
|
||||
return !operator==(lhs, rhs);
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
bool operator!=(const T* lhs, const scoped_refptr<U>& rhs) {
|
||||
return !operator==(lhs, rhs);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool operator!=(const scoped_refptr<T>& lhs, std::nullptr_t null) {
|
||||
return !operator==(lhs, null);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool operator!=(std::nullptr_t null, const scoped_refptr<T>& rhs) {
|
||||
return !operator==(null, rhs);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const scoped_refptr<T>& p) {
|
||||
return out << p.get();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void swap(scoped_refptr<T>& lhs, scoped_refptr<T>& rhs) noexcept {
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_SCOPED_REFPTR_H_
|
||||
|
|
@ -1,125 +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_THREAD_CHECKER_H_
|
||||
#define CEF_INCLUDE_BASE_THREAD_CHECKER_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/threading/thread_checker.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include "include/base/cef_logging.h"
|
||||
#include "include/base/internal/cef_thread_checker_impl.h"
|
||||
|
||||
///
|
||||
/// Apart from debug builds, we also enable the thread checker in
|
||||
/// builds with DCHECK_ALWAYS_ON so that trybots and waterfall bots
|
||||
/// with this define will get the same level of thread checking as
|
||||
/// debug bots.
|
||||
///
|
||||
#if DCHECK_IS_ON()
|
||||
#define ENABLE_THREAD_CHECKER 1
|
||||
#else
|
||||
#define ENABLE_THREAD_CHECKER 0
|
||||
#endif
|
||||
|
||||
namespace base {
|
||||
|
||||
namespace cef_internal {
|
||||
|
||||
///
|
||||
/// Do nothing implementation, for use in release mode.
|
||||
///
|
||||
/// Note: You should almost always use the ThreadChecker class to get the
|
||||
/// right version for your build configuration.
|
||||
///
|
||||
class ThreadCheckerDoNothing {
|
||||
public:
|
||||
bool CalledOnValidThread() const { return true; }
|
||||
|
||||
void DetachFromThread() {}
|
||||
};
|
||||
|
||||
} // namespace cef_internal
|
||||
|
||||
///
|
||||
/// ThreadChecker is a helper class used to help verify that some methods of a
|
||||
/// class are called from the same thread. It provides identical functionality
|
||||
/// to base::NonThreadSafe, but it is meant to be held as a member variable,
|
||||
/// rather than inherited from base::NonThreadSafe.
|
||||
///
|
||||
/// While inheriting from base::NonThreadSafe may give a clear indication about
|
||||
/// the thread-safety of a class, it may also lead to violations of the style
|
||||
/// guide with regard to multiple inheritance. The choice between having a
|
||||
/// ThreadChecker member and inheriting from base::NonThreadSafe should be based
|
||||
/// on whether:
|
||||
/// - Derived classes need to know the thread they belong to, as opposed to
|
||||
/// having that functionality fully encapsulated in the base class.
|
||||
/// - Derived classes should be able to reassign the base class to another
|
||||
/// thread, via DetachFromThread.
|
||||
///
|
||||
/// If neither of these are true, then having a ThreadChecker member and calling
|
||||
/// CalledOnValidThread is the preferable solution.
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// <pre>
|
||||
/// class MyClass {
|
||||
/// public:
|
||||
/// void Foo() {
|
||||
/// DCHECK(thread_checker_.CalledOnValidThread());
|
||||
/// ... (do stuff) ...
|
||||
/// }
|
||||
///
|
||||
/// private:
|
||||
/// ThreadChecker thread_checker_;
|
||||
/// }
|
||||
/// </pre>
|
||||
///
|
||||
/// In Release mode, CalledOnValidThread will always return true.
|
||||
///
|
||||
#if ENABLE_THREAD_CHECKER
|
||||
class ThreadChecker : public cef_internal::ThreadCheckerImpl {};
|
||||
#else
|
||||
class ThreadChecker : public cef_internal::ThreadCheckerDoNothing {};
|
||||
#endif // ENABLE_THREAD_CHECKER
|
||||
|
||||
#undef ENABLE_THREAD_CHECKER
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_THREAD_CHECKER_H_
|
||||
|
|
@ -1,384 +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.
|
||||
|
||||
///
|
||||
/// \file
|
||||
/// Trace events are for tracking application performance and resource usage.
|
||||
/// Macros are provided to track:
|
||||
/// Begin and end of function calls
|
||||
/// Counters
|
||||
///
|
||||
/// Events are issued against categories. Whereas LOG's categories are
|
||||
/// statically defined, TRACE categories are created implicitly with a string.
|
||||
/// For example: <pre>
|
||||
/// TRACE_EVENT_INSTANT0("MY_SUBSYSTEM", "SomeImportantEvent")
|
||||
/// </pre>
|
||||
///
|
||||
/// Events can be INSTANT, or can be pairs of BEGIN and END in the same scope:
|
||||
/// <pre>
|
||||
/// TRACE_EVENT_BEGIN0("MY_SUBSYSTEM", "SomethingCostly")
|
||||
/// doSomethingCostly()
|
||||
/// TRACE_EVENT_END0("MY_SUBSYSTEM", "SomethingCostly")
|
||||
/// </pre>
|
||||
/// Note: Our tools can't always determine the correct BEGIN/END pairs unless
|
||||
/// these are used in the same scope. Use ASYNC_BEGIN/ASYNC_END macros if you
|
||||
/// need them to be in separate scopes.
|
||||
///
|
||||
/// A common use case is to trace entire function scopes. This issues a trace
|
||||
/// BEGIN and END automatically:
|
||||
/// <pre>
|
||||
/// void doSomethingCostly() {
|
||||
/// TRACE_EVENT0("MY_SUBSYSTEM", "doSomethingCostly");
|
||||
/// ...
|
||||
/// }
|
||||
/// </pre>
|
||||
///
|
||||
/// Additional parameters can be associated with an event:
|
||||
/// <pre>
|
||||
/// void doSomethingCostly2(int howMuch) {
|
||||
/// TRACE_EVENT1("MY_SUBSYSTEM", "doSomethingCostly",
|
||||
/// "howMuch", howMuch);
|
||||
/// ...
|
||||
/// }
|
||||
/// </pre>
|
||||
///
|
||||
/// The trace system will automatically add to this information the current
|
||||
/// process id, thread id, and a timestamp in microseconds.
|
||||
///
|
||||
/// To trace an asynchronous procedure such as an IPC send/receive, use
|
||||
/// ASYNC_BEGIN and ASYNC_END:
|
||||
/// <pre>
|
||||
/// [single threaded sender code]
|
||||
/// static int send_count = 0;
|
||||
/// ++send_count;
|
||||
/// TRACE_EVENT_ASYNC_BEGIN0("ipc", "message", send_count);
|
||||
/// Send(new MyMessage(send_count));
|
||||
/// [receive code]
|
||||
/// void OnMyMessage(send_count) {
|
||||
/// TRACE_EVENT_ASYNC_END0("ipc", "message", send_count);
|
||||
/// }
|
||||
/// </pre>
|
||||
/// The third parameter is a unique ID to match ASYNC_BEGIN/ASYNC_END pairs.
|
||||
/// ASYNC_BEGIN and ASYNC_END can occur on any thread of any traced process.
|
||||
/// Pointers can be used for the ID parameter, and they will be mangled
|
||||
/// internally so that the same pointer on two different processes will not
|
||||
/// match. For example:
|
||||
/// <pre>
|
||||
/// class MyTracedClass {
|
||||
/// public:
|
||||
/// MyTracedClass() {
|
||||
/// TRACE_EVENT_ASYNC_BEGIN0("category", "MyTracedClass", this);
|
||||
/// }
|
||||
/// ~MyTracedClass() {
|
||||
/// TRACE_EVENT_ASYNC_END0("category", "MyTracedClass", this);
|
||||
/// }
|
||||
/// }
|
||||
/// </pre>
|
||||
///
|
||||
/// The trace event also supports counters, which is a way to track a quantity
|
||||
/// as it varies over time. Counters are created with the following macro:
|
||||
/// <pre>
|
||||
/// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter", g_myCounterValue);
|
||||
/// </pre>
|
||||
///
|
||||
/// Counters are process-specific. The macro itself can be issued from any
|
||||
/// thread, however.
|
||||
///
|
||||
/// Sometimes, you want to track two counters at once. You can do this with two
|
||||
/// counter macros:
|
||||
/// <pre>
|
||||
/// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter0", g_myCounterValue[0]);
|
||||
/// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter1", g_myCounterValue[1]);
|
||||
/// </pre>
|
||||
/// Or you can do it with a combined macro:
|
||||
/// <pre>
|
||||
/// TRACE_COUNTER2("MY_SUBSYSTEM", "myCounter",
|
||||
/// "bytesPinned", g_myCounterValue[0],
|
||||
/// "bytesAllocated", g_myCounterValue[1]);
|
||||
/// </pre>
|
||||
/// This indicates to the tracing UI that these counters should be displayed
|
||||
/// in a single graph, as a summed area chart.
|
||||
///
|
||||
/// Since counters are in a global namespace, you may want to disembiguate with
|
||||
/// a unique ID, by using the TRACE_COUNTER_ID* variations.
|
||||
///
|
||||
/// By default, trace collection is compiled in, but turned off at runtime.
|
||||
/// Collecting trace data is the responsibility of the embedding application. In
|
||||
/// CEF's case, calling BeginTracing will turn on tracing on all active
|
||||
/// processes.
|
||||
///
|
||||
///
|
||||
/// Memory scoping note:
|
||||
/// Tracing copies the pointers, not the string content, of the strings passed
|
||||
/// in for category, name, and arg_names. Thus, the following code will cause
|
||||
/// problems:
|
||||
/// <pre>
|
||||
/// char* str = strdup("impprtantName");
|
||||
/// TRACE_EVENT_INSTANT0("SUBSYSTEM", str); // BAD!
|
||||
/// free(str); // Trace system now has dangling pointer
|
||||
/// </pre>
|
||||
///
|
||||
///
|
||||
/// Thread Safety:
|
||||
/// All macros are thread safe and can be used from any process.
|
||||
///
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_TRACE_EVENT_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_TRACE_EVENT_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
/// When building CEF include the Chromium header directly.
|
||||
#include "base/trace_event/trace_event.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include "include/internal/cef_trace_event_internal.h"
|
||||
|
||||
///
|
||||
/// Records a pair of begin and end events called "name" for the current
|
||||
/// scope, with 0, 1 or 2 associated arguments. If the category is not
|
||||
/// enabled, then this does nothing.
|
||||
/// - category and name strings must have application lifetime (statics or
|
||||
/// literals). They may not include " chars.
|
||||
///
|
||||
#define TRACE_EVENT0(category, name) \
|
||||
cef_trace_event_begin(category, name, NULL, 0, NULL, 0); \
|
||||
CEF_INTERNAL_TRACE_END_ON_SCOPE_CLOSE(category, name)
|
||||
#define TRACE_EVENT1(category, name, arg1_name, arg1_val) \
|
||||
cef_trace_event_begin(category, name, arg1_name, arg1_val, NULL, 0); \
|
||||
CEF_INTERNAL_TRACE_END_ON_SCOPE_CLOSE(category, name)
|
||||
#define TRACE_EVENT2(category, name, arg1_name, arg1_val, arg2_name, arg2_val) \
|
||||
cef_trace_event_begin(category, name, arg1_name, arg1_val, arg2_name, \
|
||||
arg2_val); \
|
||||
CEF_INTERNAL_TRACE_END_ON_SCOPE_CLOSE(category, name)
|
||||
|
||||
// Implementation detail: trace event macros create temporary variable names.
|
||||
// These macros give each temporary variable a unique name based on the line
|
||||
// number to prevent name collisions.
|
||||
#define CEF_INTERNAL_TRACE_EVENT_UID3(a, b) cef_trace_event_unique_##a##b
|
||||
#define CEF_INTERNAL_TRACE_EVENT_UID2(a, b) CEF_INTERNAL_TRACE_EVENT_UID3(a, b)
|
||||
#define CEF_INTERNAL_TRACE_EVENT_UID(name_prefix) \
|
||||
CEF_INTERNAL_TRACE_EVENT_UID2(name_prefix, __LINE__)
|
||||
|
||||
// Implementation detail: internal macro to end end event when the scope ends.
|
||||
#define CEF_INTERNAL_TRACE_END_ON_SCOPE_CLOSE(category, name) \
|
||||
cef_trace_event::CefTraceEndOnScopeClose CEF_INTERNAL_TRACE_EVENT_UID( \
|
||||
profileScope)(category, name)
|
||||
|
||||
///
|
||||
/// Records a single event called "name" immediately, with 0, 1 or 2
|
||||
/// associated arguments. If the category is not enabled, then this
|
||||
/// does nothing.
|
||||
/// - category and name strings must have application lifetime (statics or
|
||||
/// literals). They may not include " chars.
|
||||
///
|
||||
#define TRACE_EVENT_INSTANT0(category, name) \
|
||||
cef_trace_event_instant(category, name, NULL, 0, NULL, 0)
|
||||
#define TRACE_EVENT_INSTANT1(category, name, arg1_name, arg1_val) \
|
||||
cef_trace_event_instant(category, name, arg1_name, arg1_val, NULL, 0)
|
||||
#define TRACE_EVENT_INSTANT2(category, name, arg1_name, arg1_val, arg2_name, \
|
||||
arg2_val) \
|
||||
cef_trace_event_instant(category, name, arg1_name, arg1_val, arg2_name, \
|
||||
arg2_val)
|
||||
|
||||
///
|
||||
/// Records a single BEGIN event called "name" immediately, with 0, 1 or 2
|
||||
/// associated arguments. If the category is not enabled, then this
|
||||
/// does nothing.
|
||||
/// - category and name strings must have application lifetime (statics or
|
||||
/// literals). They may not include " chars.
|
||||
///
|
||||
#define TRACE_EVENT_BEGIN0(category, name) \
|
||||
cef_trace_event_begin(category, name, NULL, 0, NULL, 0)
|
||||
#define TRACE_EVENT_BEGIN1(category, name, arg1_name, arg1_val) \
|
||||
cef_trace_event_begin(category, name, arg1_name, arg1_val, NULL, 0)
|
||||
#define TRACE_EVENT_BEGIN2(category, name, arg1_name, arg1_val, arg2_name, \
|
||||
arg2_val) \
|
||||
cef_trace_event_begin(category, name, arg1_name, arg1_val, arg2_name, \
|
||||
arg2_val)
|
||||
|
||||
///
|
||||
/// Records a single END event for "name" immediately. If the category
|
||||
/// is not enabled, then this does nothing.
|
||||
/// - category and name strings must have application lifetime (statics or
|
||||
/// literals). They may not include " chars.
|
||||
///
|
||||
#define TRACE_EVENT_END0(category, name) \
|
||||
cef_trace_event_end(category, name, NULL, 0, NULL, 0)
|
||||
#define TRACE_EVENT_END1(category, name, arg1_name, arg1_val) \
|
||||
cef_trace_event_end(category, name, arg1_name, arg1_val, NULL, 0)
|
||||
#define TRACE_EVENT_END2(category, name, arg1_name, arg1_val, arg2_name, \
|
||||
arg2_val) \
|
||||
cef_trace_event_end(category, name, arg1_name, arg1_val, arg2_name, arg2_val)
|
||||
|
||||
///
|
||||
/// Records the value of a counter called "name" immediately. Value
|
||||
/// must be representable as a 32 bit integer.
|
||||
/// - category and name strings must have application lifetime (statics or
|
||||
/// literals). They may not include " chars.
|
||||
///
|
||||
#define TRACE_COUNTER1(category, name, value) \
|
||||
cef_trace_counter(category, name, NULL, value, NULL, 0)
|
||||
|
||||
///
|
||||
/// Records the values of a multi-parted counter called "name" immediately.
|
||||
/// The UI will treat value1 and value2 as parts of a whole, displaying their
|
||||
/// values as a stacked-bar chart.
|
||||
/// - category and name strings must have application lifetime (statics or
|
||||
/// literals). They may not include " chars.
|
||||
///
|
||||
#define TRACE_COUNTER2(category, name, value1_name, value1_val, value2_name, \
|
||||
value2_val) \
|
||||
cef_trace_counter(category, name, value1_name, value1_val, value2_name, \
|
||||
value2_val)
|
||||
|
||||
///
|
||||
/// Records the value of a counter called "name" immediately. Value
|
||||
/// must be representable as a 32 bit integer.
|
||||
/// - category and name strings must have application lifetime (statics or
|
||||
/// literals). They may not include " chars.
|
||||
/// - |id| is used to disambiguate counters with the same name. It must either
|
||||
/// be a pointer or an integer value up to 64 bits. If it's a pointer, the
|
||||
/// bits will be xored with a hash of the process ID so that the same pointer
|
||||
/// on two different processes will not collide.
|
||||
///
|
||||
#define TRACE_COUNTER_ID1(category, name, id, value) \
|
||||
cef_trace_counter_id(category, name, id, NULL, value, NULL, 0)
|
||||
|
||||
///
|
||||
/// Records the values of a multi-parted counter called "name" immediately.
|
||||
/// The UI will treat value1 and value2 as parts of a whole, displaying their
|
||||
/// values as a stacked-bar chart.
|
||||
/// - category and name strings must have application lifetime (statics or
|
||||
/// literals). They may not include " chars.
|
||||
/// - |id| is used to disambiguate counters with the same name. It must either
|
||||
/// be a pointer or an integer value up to 64 bits. If it's a pointer, the
|
||||
/// bits will be xored with a hash of the process ID so that the same pointer
|
||||
/// on two different processes will not collide.
|
||||
///
|
||||
#define TRACE_COUNTER_ID2(category, name, id, value1_name, value1_val, \
|
||||
value2_name, value2_val) \
|
||||
cef_trace_counter_id(category, name, id, value1_name, value1_val, \
|
||||
value2_name, value2_val)
|
||||
|
||||
///
|
||||
/// Records a single ASYNC_BEGIN event called "name" immediately, with 0, 1 or 2
|
||||
/// associated arguments. If the category is not enabled, then this
|
||||
/// does nothing.
|
||||
/// - category and name strings must have application lifetime (statics or
|
||||
/// literals). They may not include " chars.
|
||||
/// - |id| is used to match the ASYNC_BEGIN event with the ASYNC_END event.
|
||||
/// ASYNC events are considered to match if their category, name and id values
|
||||
/// all match. |id| must either be a pointer or an integer value up to 64
|
||||
/// bits. If it's a pointer, the bits will be xored with a hash of the process
|
||||
/// ID sothat the same pointer on two different processes will not collide.
|
||||
/// An asynchronous operation can consist of multiple phases. The first phase is
|
||||
/// defined by the ASYNC_BEGIN calls. Additional phases can be defined using the
|
||||
/// ASYNC_STEP_BEGIN macros. When the operation completes, call ASYNC_END.
|
||||
/// An async operation can span threads and processes, but all events in that
|
||||
/// operation must use the same |name| and |id|. Each event can have its own
|
||||
/// args.
|
||||
///
|
||||
#define TRACE_EVENT_ASYNC_BEGIN0(category, name, id) \
|
||||
cef_trace_event_async_begin(category, name, id, NULL, 0, NULL, 0)
|
||||
#define TRACE_EVENT_ASYNC_BEGIN1(category, name, id, arg1_name, arg1_val) \
|
||||
cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, NULL, 0)
|
||||
#define TRACE_EVENT_ASYNC_BEGIN2(category, name, id, arg1_name, arg1_val, \
|
||||
arg2_name, arg2_val) \
|
||||
cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, \
|
||||
arg2_name, arg2_val)
|
||||
|
||||
///
|
||||
/// Records a single ASYNC_STEP_INTO event for |step| immediately. If the
|
||||
/// category is not enabled, then this does nothing. The |name| and |id| must
|
||||
/// match the ASYNC_BEGIN event above. The |step| param identifies this step
|
||||
/// within the async event. This should be called at the beginning of the next
|
||||
/// phase of an asynchronous operation. The ASYNC_BEGIN event must not have any
|
||||
/// ASYNC_STEP_PAST events.
|
||||
///
|
||||
#define TRACE_EVENT_ASYNC_STEP_INTO0(category, name, id, step) \
|
||||
cef_trace_event_async_step_into(category, name, id, step, NULL, 0)
|
||||
#define TRACE_EVENT_ASYNC_STEP_INTO1(category, name, id, step, arg1_name, \
|
||||
arg1_val) \
|
||||
cef_trace_event_async_step_into(category, name, id, step, arg1_name, arg1_val)
|
||||
|
||||
///
|
||||
/// Records a single ASYNC_STEP_PAST event for |step| immediately. If the
|
||||
/// category is not enabled, then this does nothing. The |name| and |id| must
|
||||
/// match the ASYNC_BEGIN event above. The |step| param identifies this step
|
||||
/// within the async event. This should be called at the beginning of the next
|
||||
/// phase of an asynchronous operation. The ASYNC_BEGIN event must not have any
|
||||
/// ASYNC_STEP_INTO events.
|
||||
///
|
||||
#define TRACE_EVENT_ASYNC_STEP_PAST0(category, name, id, step) \
|
||||
cef_trace_event_async_step_past(category, name, id, step, NULL, 0)
|
||||
#define TRACE_EVENT_ASYNC_STEP_PAST1(category, name, id, step, arg1_name, \
|
||||
arg1_val) \
|
||||
cef_trace_event_async_step_past(category, name, id, step, arg1_name, arg1_val)
|
||||
|
||||
///
|
||||
/// Records a single ASYNC_END event for "name" immediately. If the category
|
||||
/// is not enabled, then this does nothing.
|
||||
///
|
||||
#define TRACE_EVENT_ASYNC_END0(category, name, id) \
|
||||
cef_trace_event_async_end(category, name, id, NULL, 0, NULL, 0)
|
||||
#define TRACE_EVENT_ASYNC_END1(category, name, id, arg1_name, arg1_val) \
|
||||
cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, NULL, 0)
|
||||
#define TRACE_EVENT_ASYNC_END2(category, name, id, arg1_name, arg1_val, \
|
||||
arg2_name, arg2_val) \
|
||||
cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, \
|
||||
arg2_name, arg2_val)
|
||||
|
||||
namespace cef_trace_event {
|
||||
|
||||
///
|
||||
/// Used by TRACE_EVENTx macro. Do not use directly.
|
||||
///
|
||||
class CefTraceEndOnScopeClose {
|
||||
public:
|
||||
CefTraceEndOnScopeClose(const char* category, const char* name)
|
||||
: category_(category), name_(name) {}
|
||||
~CefTraceEndOnScopeClose() {
|
||||
cef_trace_event_end(category_, name_, NULL, 0, NULL, 0);
|
||||
}
|
||||
|
||||
private:
|
||||
const char* category_;
|
||||
const char* name_;
|
||||
};
|
||||
|
||||
} // namespace cef_trace_event
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_TRACE_EVENT_H_
|
||||
|
|
@ -1,152 +0,0 @@
|
|||
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
|
||||
// Google Inc. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
///
|
||||
/// \file
|
||||
/// Use std::tuple as tuple type. This file contains helper functions for
|
||||
/// working with std::tuples.
|
||||
/// The functions DispatchToMethod and DispatchToFunction take a function
|
||||
/// pointer or instance and method pointer, and unpack a tuple into arguments to
|
||||
/// the call.
|
||||
///
|
||||
/// Example usage:
|
||||
/// <pre>
|
||||
/// // These two methods of creating a Tuple are identical.
|
||||
/// std::tuple<int, const char*> tuple_a(1, "wee");
|
||||
/// std::tuple<int, const char*> tuple_b = std::make_tuple(1, "wee");
|
||||
///
|
||||
/// void SomeFunc(int a, const char* b) { }
|
||||
/// DispatchToFunction(&SomeFunc, tuple_a); // SomeFunc(1, "wee")
|
||||
/// DispatchToFunction(
|
||||
/// &SomeFunc, std::make_tuple(10, "foo")); // SomeFunc(10, "foo")
|
||||
///
|
||||
/// struct { void SomeMeth(int a, int b, int c) { } } foo;
|
||||
/// DispatchToMethod(&foo, &Foo::SomeMeth, std::make_tuple(1, 2, 3));
|
||||
/// // foo->SomeMeth(1, 2, 3);
|
||||
/// </pre>
|
||||
///
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_TUPLE_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_TUPLE_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/tuple.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include <stddef.h>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
|
||||
#include "include/base/cef_build.h"
|
||||
|
||||
namespace base {
|
||||
|
||||
// Dispatchers ----------------------------------------------------------------
|
||||
//
|
||||
// Helper functions that call the given method on an object, with the unpacked
|
||||
// tuple arguments. Notice that they all have the same number of arguments,
|
||||
// so you need only write:
|
||||
// DispatchToMethod(object, &Object::method, args);
|
||||
// This is very useful for templated dispatchers, since they don't need to know
|
||||
// what type |args| is.
|
||||
|
||||
// Non-Static Dispatchers with no out params.
|
||||
|
||||
template <typename ObjT, typename Method, typename Tuple, size_t... Ns>
|
||||
inline void DispatchToMethodImpl(const ObjT& obj,
|
||||
Method method,
|
||||
Tuple&& args,
|
||||
std::index_sequence<Ns...>) {
|
||||
(obj->*method)(std::get<Ns>(std::forward<Tuple>(args))...);
|
||||
}
|
||||
|
||||
template <typename ObjT, typename Method, typename Tuple>
|
||||
inline void DispatchToMethod(const ObjT& obj, Method method, Tuple&& args) {
|
||||
constexpr size_t size = std::tuple_size<std::decay_t<Tuple>>::value;
|
||||
DispatchToMethodImpl(obj, method, std::forward<Tuple>(args),
|
||||
std::make_index_sequence<size>());
|
||||
}
|
||||
|
||||
// Static Dispatchers with no out params.
|
||||
|
||||
template <typename Function, typename Tuple, size_t... Ns>
|
||||
inline void DispatchToFunctionImpl(Function function,
|
||||
Tuple&& args,
|
||||
std::index_sequence<Ns...>) {
|
||||
(*function)(std::get<Ns>(std::forward<Tuple>(args))...);
|
||||
}
|
||||
|
||||
template <typename Function, typename Tuple>
|
||||
inline void DispatchToFunction(Function function, Tuple&& args) {
|
||||
constexpr size_t size = std::tuple_size<std::decay_t<Tuple>>::value;
|
||||
DispatchToFunctionImpl(function, std::forward<Tuple>(args),
|
||||
std::make_index_sequence<size>());
|
||||
}
|
||||
|
||||
// Dispatchers with out parameters.
|
||||
|
||||
template <typename ObjT,
|
||||
typename Method,
|
||||
typename InTuple,
|
||||
typename OutTuple,
|
||||
size_t... InNs,
|
||||
size_t... OutNs>
|
||||
inline void DispatchToMethodImpl(const ObjT& obj,
|
||||
Method method,
|
||||
InTuple&& in,
|
||||
OutTuple* out,
|
||||
std::index_sequence<InNs...>,
|
||||
std::index_sequence<OutNs...>) {
|
||||
(obj->*method)(std::get<InNs>(std::forward<InTuple>(in))...,
|
||||
&std::get<OutNs>(*out)...);
|
||||
}
|
||||
|
||||
template <typename ObjT, typename Method, typename InTuple, typename OutTuple>
|
||||
inline void DispatchToMethod(const ObjT& obj,
|
||||
Method method,
|
||||
InTuple&& in,
|
||||
OutTuple* out) {
|
||||
constexpr size_t in_size = std::tuple_size<std::decay_t<InTuple>>::value;
|
||||
constexpr size_t out_size = std::tuple_size<OutTuple>::value;
|
||||
DispatchToMethodImpl(obj, method, std::forward<InTuple>(in), out,
|
||||
std::make_index_sequence<in_size>(),
|
||||
std::make_index_sequence<out_size>());
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_TUPLE_H_
|
||||
|
|
@ -1,469 +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.
|
||||
|
||||
///
|
||||
/// \file
|
||||
/// Weak pointers are pointers to an object that do not affect its lifetime.
|
||||
/// They may be invalidated (i.e. reset to nullptr) by the object, or its
|
||||
/// owner, at any time, most commonly when the object is about to be deleted.
|
||||
///
|
||||
/// Weak pointers are useful when an object needs to be accessed safely by one
|
||||
/// or more objects other than its owner, and those callers can cope with the
|
||||
/// object vanishing and e.g. tasks posted to it being silently dropped.
|
||||
/// Reference-counting such an object would complicate the ownership graph and
|
||||
/// make it harder to reason about the object's lifetime.
|
||||
///
|
||||
/// EXAMPLE:
|
||||
///
|
||||
/// <pre>
|
||||
/// class Controller {
|
||||
/// public:
|
||||
/// void SpawnWorker() { Worker::StartNew(weak_factory_.GetWeakPtr()); }
|
||||
/// void WorkComplete(const Result& result) { ... }
|
||||
/// private:
|
||||
/// // Member variables should appear before the WeakPtrFactory, to ensure
|
||||
/// // that any WeakPtrs to Controller are invalidated before its members
|
||||
/// // variable's destructors are executed, rendering them invalid.
|
||||
/// WeakPtrFactory<Controller> weak_factory_{this};
|
||||
/// };
|
||||
///
|
||||
/// class Worker {
|
||||
/// public:
|
||||
/// static void StartNew(WeakPtr<Controller> controller) {
|
||||
/// Worker* worker = new Worker(std::move(controller));
|
||||
/// // Kick off asynchronous processing...
|
||||
/// }
|
||||
/// private:
|
||||
/// Worker(WeakPtr<Controller> controller)
|
||||
/// : controller_(std::move(controller)) {}
|
||||
/// void DidCompleteAsynchronousProcessing(const Result& result) {
|
||||
/// if (controller_)
|
||||
/// controller_->WorkComplete(result);
|
||||
/// }
|
||||
/// WeakPtr<Controller> controller_;
|
||||
/// };
|
||||
/// </pre>
|
||||
///
|
||||
/// With this implementation a caller may use SpawnWorker() to dispatch multiple
|
||||
/// Workers and subsequently delete the Controller, without waiting for all
|
||||
/// Workers to have completed.
|
||||
///
|
||||
/// <b>IMPORTANT: Thread-safety</b>
|
||||
///
|
||||
/// Weak pointers may be passed safely between threads, but must always be
|
||||
/// dereferenced and invalidated on the same ThreaddTaskRunner otherwise
|
||||
/// checking the pointer would be racey.
|
||||
///
|
||||
/// To ensure correct use, the first time a WeakPtr issued by a WeakPtrFactory
|
||||
/// is dereferenced, the factory and its WeakPtrs become bound to the calling
|
||||
/// thread or current ThreaddWorkerPool token, and cannot be dereferenced or
|
||||
/// invalidated on any other task runner. Bound WeakPtrs can still be handed
|
||||
/// off to other task runners, e.g. to use to post tasks back to object on the
|
||||
/// bound thread.
|
||||
///
|
||||
/// If all WeakPtr objects are destroyed or invalidated then the factory is
|
||||
/// unbound from the ThreadedTaskRunner/Thread. The WeakPtrFactory may then be
|
||||
/// destroyed, or new WeakPtr objects may be used, from a different thread.
|
||||
///
|
||||
/// Thus, at least one WeakPtr object must exist and have been dereferenced on
|
||||
/// the correct thread to enforce that other WeakPtr objects will enforce they
|
||||
/// are used on the desired thread.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_CEF_WEAK_PTR_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_WEAK_PTR_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
|
||||
#include "include/base/cef_atomic_flag.h"
|
||||
#include "include/base/cef_logging.h"
|
||||
#include "include/base/cef_ref_counted.h"
|
||||
#include "include/base/cef_thread_checker.h"
|
||||
|
||||
namespace base {
|
||||
|
||||
template <typename T>
|
||||
class SupportsWeakPtr;
|
||||
template <typename T>
|
||||
class WeakPtr;
|
||||
|
||||
namespace cef_internal {
|
||||
// These classes are part of the WeakPtr implementation.
|
||||
// DO NOT USE THESE CLASSES DIRECTLY YOURSELF.
|
||||
|
||||
class WeakReference {
|
||||
public:
|
||||
// Although Flag is bound to a specific ThreaddTaskRunner, it may be
|
||||
// deleted from another via base::WeakPtr::~WeakPtr().
|
||||
class Flag : public RefCountedThreadSafe<Flag> {
|
||||
public:
|
||||
Flag();
|
||||
|
||||
void Invalidate();
|
||||
bool IsValid() const;
|
||||
|
||||
bool MaybeValid() const;
|
||||
|
||||
void DetachFromThread();
|
||||
|
||||
private:
|
||||
friend class base::RefCountedThreadSafe<Flag>;
|
||||
|
||||
~Flag();
|
||||
|
||||
base::ThreadChecker thread_checker_;
|
||||
AtomicFlag invalidated_;
|
||||
};
|
||||
|
||||
WeakReference();
|
||||
explicit WeakReference(const scoped_refptr<Flag>& flag);
|
||||
~WeakReference();
|
||||
|
||||
WeakReference(WeakReference&& other) noexcept;
|
||||
WeakReference(const WeakReference& other);
|
||||
WeakReference& operator=(WeakReference&& other) noexcept = default;
|
||||
WeakReference& operator=(const WeakReference& other) = default;
|
||||
|
||||
bool IsValid() const;
|
||||
bool MaybeValid() const;
|
||||
|
||||
private:
|
||||
scoped_refptr<const Flag> flag_;
|
||||
};
|
||||
|
||||
class WeakReferenceOwner {
|
||||
public:
|
||||
WeakReferenceOwner();
|
||||
~WeakReferenceOwner();
|
||||
|
||||
WeakReference GetRef() const;
|
||||
|
||||
bool HasRefs() const { return !flag_->HasOneRef(); }
|
||||
|
||||
void Invalidate();
|
||||
|
||||
private:
|
||||
scoped_refptr<WeakReference::Flag> flag_;
|
||||
};
|
||||
|
||||
// This class simplifies the implementation of WeakPtr's type conversion
|
||||
// constructor by avoiding the need for a public accessor for ref_. A
|
||||
// WeakPtr<T> cannot access the private members of WeakPtr<U>, so this
|
||||
// base class gives us a way to access ref_ in a protected fashion.
|
||||
class WeakPtrBase {
|
||||
public:
|
||||
WeakPtrBase();
|
||||
~WeakPtrBase();
|
||||
|
||||
WeakPtrBase(const WeakPtrBase& other) = default;
|
||||
WeakPtrBase(WeakPtrBase&& other) noexcept = default;
|
||||
WeakPtrBase& operator=(const WeakPtrBase& other) = default;
|
||||
WeakPtrBase& operator=(WeakPtrBase&& other) noexcept = default;
|
||||
|
||||
void reset() {
|
||||
ref_ = cef_internal::WeakReference();
|
||||
ptr_ = 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
WeakPtrBase(const WeakReference& ref, uintptr_t ptr);
|
||||
|
||||
WeakReference ref_;
|
||||
|
||||
// This pointer is only valid when ref_.is_valid() is true. Otherwise, its
|
||||
// value is undefined (as opposed to nullptr).
|
||||
uintptr_t ptr_;
|
||||
};
|
||||
|
||||
// This class provides a common implementation of common functions that would
|
||||
// otherwise get instantiated separately for each distinct instantiation of
|
||||
// SupportsWeakPtr<>.
|
||||
class SupportsWeakPtrBase {
|
||||
public:
|
||||
// A safe static downcast of a WeakPtr<Base> to WeakPtr<Derived>. This
|
||||
// conversion will only compile if there is exists a Base which inherits
|
||||
// from SupportsWeakPtr<Base>. See base::AsWeakPtr() below for a helper
|
||||
// function that makes calling this easier.
|
||||
//
|
||||
// Precondition: t != nullptr
|
||||
template <typename Derived>
|
||||
static WeakPtr<Derived> StaticAsWeakPtr(Derived* t) {
|
||||
static_assert(
|
||||
std::is_base_of<cef_internal::SupportsWeakPtrBase, Derived>::value,
|
||||
"AsWeakPtr argument must inherit from SupportsWeakPtr");
|
||||
return AsWeakPtrImpl<Derived>(t);
|
||||
}
|
||||
|
||||
private:
|
||||
// This template function uses type inference to find a Base of Derived
|
||||
// which is an instance of SupportsWeakPtr<Base>. We can then safely
|
||||
// static_cast the Base* to a Derived*.
|
||||
template <typename Derived, typename Base>
|
||||
static WeakPtr<Derived> AsWeakPtrImpl(SupportsWeakPtr<Base>* t) {
|
||||
WeakPtr<Base> ptr = t->AsWeakPtr();
|
||||
return WeakPtr<Derived>(
|
||||
ptr.ref_, static_cast<Derived*>(reinterpret_cast<Base*>(ptr.ptr_)));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace cef_internal
|
||||
|
||||
template <typename T>
|
||||
class WeakPtrFactory;
|
||||
|
||||
///
|
||||
/// The WeakPtr class holds a weak reference to |T*|.
|
||||
///
|
||||
/// This class is designed to be used like a normal pointer. You should always
|
||||
/// null-test an object of this class before using it or invoking a method that
|
||||
/// may result in the underlying object being destroyed.
|
||||
///
|
||||
/// EXAMPLE:
|
||||
///
|
||||
/// <pre>
|
||||
/// class Foo { ... };
|
||||
/// WeakPtr<Foo> foo;
|
||||
/// if (foo)
|
||||
/// foo->method();
|
||||
/// </pre>
|
||||
///
|
||||
template <typename T>
|
||||
class WeakPtr : public cef_internal::WeakPtrBase {
|
||||
public:
|
||||
WeakPtr() = default;
|
||||
WeakPtr(std::nullptr_t) {}
|
||||
|
||||
///
|
||||
/// Allow conversion from U to T provided U "is a" T. Note that this
|
||||
/// is separate from the (implicit) copy and move constructors.
|
||||
///
|
||||
template <typename U>
|
||||
WeakPtr(const WeakPtr<U>& other) : WeakPtrBase(other) {
|
||||
// Need to cast from U* to T* to do pointer adjustment in case of multiple
|
||||
// inheritance. This also enforces the "U is a T" rule.
|
||||
T* t = reinterpret_cast<U*>(other.ptr_);
|
||||
ptr_ = reinterpret_cast<uintptr_t>(t);
|
||||
}
|
||||
template <typename U>
|
||||
WeakPtr(WeakPtr<U>&& other) noexcept : WeakPtrBase(std::move(other)) {
|
||||
// Need to cast from U* to T* to do pointer adjustment in case of multiple
|
||||
// inheritance. This also enforces the "U is a T" rule.
|
||||
T* t = reinterpret_cast<U*>(other.ptr_);
|
||||
ptr_ = reinterpret_cast<uintptr_t>(t);
|
||||
}
|
||||
|
||||
T* get() const {
|
||||
return ref_.IsValid() ? reinterpret_cast<T*>(ptr_) : nullptr;
|
||||
}
|
||||
|
||||
T& operator*() const {
|
||||
CHECK(ref_.IsValid());
|
||||
return *get();
|
||||
}
|
||||
T* operator->() const {
|
||||
CHECK(ref_.IsValid());
|
||||
return get();
|
||||
}
|
||||
|
||||
///
|
||||
/// Allow conditionals to test validity, e.g. `if (weak_ptr) {...}`;
|
||||
///
|
||||
explicit operator bool() const { return get() != nullptr; }
|
||||
|
||||
///
|
||||
/// Returns false if the WeakPtr is confirmed to be invalid. This call is safe
|
||||
/// to make from any thread, e.g. to optimize away unnecessary work, but
|
||||
/// operator bool() must always be called, on the correct thread, before
|
||||
/// actually using the pointer.
|
||||
///
|
||||
/// Warning: as with any object, this call is only thread-safe if the WeakPtr
|
||||
/// instance isn't being re-assigned or reset() racily with this call.
|
||||
///
|
||||
bool MaybeValid() const { return ref_.MaybeValid(); }
|
||||
|
||||
///
|
||||
/// Returns whether the object |this| points to has been invalidated. This can
|
||||
/// be used to distinguish a WeakPtr to a destroyed object from one that has
|
||||
/// been explicitly set to null.
|
||||
///
|
||||
bool WasInvalidated() const { return ptr_ && !ref_.IsValid(); }
|
||||
|
||||
private:
|
||||
friend class cef_internal::SupportsWeakPtrBase;
|
||||
template <typename U>
|
||||
friend class WeakPtr;
|
||||
friend class SupportsWeakPtr<T>;
|
||||
friend class WeakPtrFactory<T>;
|
||||
|
||||
WeakPtr(const cef_internal::WeakReference& ref, T* ptr)
|
||||
: WeakPtrBase(ref, reinterpret_cast<uintptr_t>(ptr)) {}
|
||||
};
|
||||
|
||||
///
|
||||
/// Allow callers to compare WeakPtrs against nullptr to test validity.
|
||||
///
|
||||
template <class T>
|
||||
bool operator!=(const WeakPtr<T>& weak_ptr, std::nullptr_t) {
|
||||
return !(weak_ptr == nullptr);
|
||||
}
|
||||
template <class T>
|
||||
bool operator!=(std::nullptr_t, const WeakPtr<T>& weak_ptr) {
|
||||
return weak_ptr != nullptr;
|
||||
}
|
||||
template <class T>
|
||||
bool operator==(const WeakPtr<T>& weak_ptr, std::nullptr_t) {
|
||||
return weak_ptr.get() == nullptr;
|
||||
}
|
||||
template <class T>
|
||||
bool operator==(std::nullptr_t, const WeakPtr<T>& weak_ptr) {
|
||||
return weak_ptr == nullptr;
|
||||
}
|
||||
|
||||
namespace cef_internal {
|
||||
class WeakPtrFactoryBase {
|
||||
protected:
|
||||
WeakPtrFactoryBase(uintptr_t ptr);
|
||||
~WeakPtrFactoryBase();
|
||||
cef_internal::WeakReferenceOwner weak_reference_owner_;
|
||||
uintptr_t ptr_;
|
||||
};
|
||||
} // namespace cef_internal
|
||||
|
||||
///
|
||||
/// A class may be composed of a WeakPtrFactory and thereby control how it
|
||||
/// exposes weak pointers to itself. This is helpful if you only need weak
|
||||
/// pointers within the implementation of a class. This class is also useful
|
||||
/// when working with primitive types. For example, you could have a
|
||||
/// WeakPtrFactory<bool> that is used to pass around a weak reference to a
|
||||
/// bool.
|
||||
///
|
||||
template <class T>
|
||||
class WeakPtrFactory : public cef_internal::WeakPtrFactoryBase {
|
||||
public:
|
||||
WeakPtrFactory() = delete;
|
||||
|
||||
explicit WeakPtrFactory(T* ptr)
|
||||
: WeakPtrFactoryBase(reinterpret_cast<uintptr_t>(ptr)) {}
|
||||
|
||||
WeakPtrFactory(const WeakPtrFactory&) = delete;
|
||||
WeakPtrFactory& operator=(const WeakPtrFactory&) = delete;
|
||||
|
||||
~WeakPtrFactory() = default;
|
||||
|
||||
WeakPtr<T> GetWeakPtr() const {
|
||||
return WeakPtr<T>(weak_reference_owner_.GetRef(),
|
||||
reinterpret_cast<T*>(ptr_));
|
||||
}
|
||||
|
||||
///
|
||||
/// Call this method to invalidate all existing weak pointers.
|
||||
///
|
||||
void InvalidateWeakPtrs() {
|
||||
DCHECK(ptr_);
|
||||
weak_reference_owner_.Invalidate();
|
||||
}
|
||||
|
||||
///
|
||||
/// Call this method to determine if any weak pointers exist.
|
||||
///
|
||||
bool HasWeakPtrs() const {
|
||||
DCHECK(ptr_);
|
||||
return weak_reference_owner_.HasRefs();
|
||||
}
|
||||
};
|
||||
|
||||
///
|
||||
/// A class may extend from SupportsWeakPtr to let others take weak pointers to
|
||||
/// it. This avoids the class itself implementing boilerplate to dispense weak
|
||||
/// pointers. However, since SupportsWeakPtr's destructor won't invalidate
|
||||
/// weak pointers to the class until after the derived class' members have been
|
||||
/// destroyed, its use can lead to subtle use-after-destroy issues.
|
||||
///
|
||||
template <class T>
|
||||
class SupportsWeakPtr : public cef_internal::SupportsWeakPtrBase {
|
||||
public:
|
||||
SupportsWeakPtr() = default;
|
||||
|
||||
SupportsWeakPtr(const SupportsWeakPtr&) = delete;
|
||||
SupportsWeakPtr& operator=(const SupportsWeakPtr&) = delete;
|
||||
|
||||
WeakPtr<T> AsWeakPtr() {
|
||||
return WeakPtr<T>(weak_reference_owner_.GetRef(), static_cast<T*>(this));
|
||||
}
|
||||
|
||||
protected:
|
||||
~SupportsWeakPtr() = default;
|
||||
|
||||
private:
|
||||
cef_internal::WeakReferenceOwner weak_reference_owner_;
|
||||
};
|
||||
|
||||
///
|
||||
/// Helper function that uses type deduction to safely return a WeakPtr<Derived>
|
||||
/// when Derived doesn't directly extend SupportsWeakPtr<Derived>, instead it
|
||||
/// extends a Base that extends SupportsWeakPtr<Base>.
|
||||
///
|
||||
/// EXAMPLE:
|
||||
/// <pre>
|
||||
/// class Base : public base::SupportsWeakPtr<Producer> {};
|
||||
/// class Derived : public Base {};
|
||||
///
|
||||
/// Derived derived;
|
||||
/// base::WeakPtr<Derived> ptr = base::AsWeakPtr(&derived);
|
||||
/// </pre>
|
||||
///
|
||||
/// Note that the following doesn't work (invalid type conversion) since
|
||||
/// Derived::AsWeakPtr() is WeakPtr<Base> SupportsWeakPtr<Base>::AsWeakPtr(),
|
||||
/// and there's no way to safely cast WeakPtr<Base> to WeakPtr<Derived> at
|
||||
/// the caller.
|
||||
///
|
||||
/// <pre>
|
||||
/// base::WeakPtr<Derived> ptr = derived.AsWeakPtr(); // Fails.
|
||||
/// </pre>
|
||||
///
|
||||
template <typename Derived>
|
||||
WeakPtr<Derived> AsWeakPtr(Derived* t) {
|
||||
return cef_internal::SupportsWeakPtrBase::StaticAsWeakPtr<Derived>(t);
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_WEAK_PTR_H_
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
Files in this directory have been copied from other locations in the Chromium
|
||||
source tree. They have been modified only to the extent necessary to work in
|
||||
the CEF Binary Distribution directory structure. Below is a listing of the
|
||||
original file locations.
|
||||
|
||||
../net/base/net_error_list.h
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,275 +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_bind.h or
|
||||
// base/cef_callback.h instead.
|
||||
|
||||
// This file contains utility functions and classes that help the
|
||||
// implementation, and management of the Callback objects.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_INTERNAL_CEF_CALLBACK_INTERNAL_H_
|
||||
#define CEF_INCLUDE_BASE_INTERNAL_CEF_CALLBACK_INTERNAL_H_
|
||||
|
||||
#include "include/base/cef_callback_forward.h"
|
||||
#include "include/base/cef_ref_counted.h"
|
||||
|
||||
namespace base {
|
||||
|
||||
struct FakeBindState;
|
||||
|
||||
namespace cef_internal {
|
||||
|
||||
class BindStateBase;
|
||||
class FinallyExecutorCommon;
|
||||
class ThenAndCatchExecutorCommon;
|
||||
|
||||
template <typename ReturnType>
|
||||
class PostTaskExecutor;
|
||||
|
||||
template <typename Functor, typename... BoundArgs>
|
||||
struct BindState;
|
||||
|
||||
class CallbackBase;
|
||||
class CallbackBaseCopyable;
|
||||
|
||||
struct BindStateBaseRefCountTraits {
|
||||
static void Destruct(const BindStateBase*);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
using PassingType = std::conditional_t<std::is_scalar<T>::value, T, T&&>;
|
||||
|
||||
// BindStateBase is used to provide an opaque handle that the Callback
|
||||
// class can use to represent a function object with bound arguments. It
|
||||
// behaves as an existential type that is used by a corresponding
|
||||
// DoInvoke function to perform the function execution. This allows
|
||||
// us to shield the Callback class from the types of the bound argument via
|
||||
// "type erasure."
|
||||
// At the base level, the only task is to add reference counting data. Avoid
|
||||
// using or inheriting any virtual functions. Creating a vtable for every
|
||||
// BindState template instantiation results in a lot of bloat. Its only task is
|
||||
// to call the destructor which can be done with a function pointer.
|
||||
class BindStateBase
|
||||
: public RefCountedThreadSafe<BindStateBase, BindStateBaseRefCountTraits> {
|
||||
public:
|
||||
REQUIRE_ADOPTION_FOR_REFCOUNTED_TYPE();
|
||||
|
||||
enum CancellationQueryMode {
|
||||
IS_CANCELLED,
|
||||
MAYBE_VALID,
|
||||
};
|
||||
|
||||
using InvokeFuncStorage = void (*)();
|
||||
|
||||
BindStateBase(const BindStateBase&) = delete;
|
||||
BindStateBase& operator=(const BindStateBase&) = delete;
|
||||
|
||||
private:
|
||||
BindStateBase(InvokeFuncStorage polymorphic_invoke,
|
||||
void (*destructor)(const BindStateBase*));
|
||||
BindStateBase(InvokeFuncStorage polymorphic_invoke,
|
||||
void (*destructor)(const BindStateBase*),
|
||||
bool (*query_cancellation_traits)(const BindStateBase*,
|
||||
CancellationQueryMode mode));
|
||||
|
||||
~BindStateBase() = default;
|
||||
|
||||
friend struct BindStateBaseRefCountTraits;
|
||||
friend class RefCountedThreadSafe<BindStateBase, BindStateBaseRefCountTraits>;
|
||||
|
||||
friend class CallbackBase;
|
||||
friend class CallbackBaseCopyable;
|
||||
|
||||
// Allowlist subclasses that access the destructor of BindStateBase.
|
||||
template <typename Functor, typename... BoundArgs>
|
||||
friend struct BindState;
|
||||
friend struct ::base::FakeBindState;
|
||||
|
||||
bool IsCancelled() const {
|
||||
return query_cancellation_traits_(this, IS_CANCELLED);
|
||||
}
|
||||
|
||||
bool MaybeValid() const {
|
||||
return query_cancellation_traits_(this, MAYBE_VALID);
|
||||
}
|
||||
|
||||
// In C++, it is safe to cast function pointers to function pointers of
|
||||
// another type. It is not okay to use void*. We create a InvokeFuncStorage
|
||||
// that that can store our function pointer, and then cast it back to
|
||||
// the original type on usage.
|
||||
InvokeFuncStorage polymorphic_invoke_;
|
||||
|
||||
// Pointer to a function that will properly destroy |this|.
|
||||
void (*destructor_)(const BindStateBase*);
|
||||
bool (*query_cancellation_traits_)(const BindStateBase*,
|
||||
CancellationQueryMode mode);
|
||||
};
|
||||
|
||||
// Holds the Callback methods that don't require specialization to reduce
|
||||
// template bloat.
|
||||
// CallbackBase<MoveOnly> is a direct base class of MoveOnly callbacks, and
|
||||
// CallbackBase<Copyable> uses CallbackBase<MoveOnly> for its implementation.
|
||||
class CallbackBase {
|
||||
public:
|
||||
inline CallbackBase(CallbackBase&& c) noexcept;
|
||||
CallbackBase& operator=(CallbackBase&& c) noexcept;
|
||||
|
||||
explicit CallbackBase(const CallbackBaseCopyable& c);
|
||||
CallbackBase& operator=(const CallbackBaseCopyable& c);
|
||||
|
||||
explicit CallbackBase(CallbackBaseCopyable&& c) noexcept;
|
||||
CallbackBase& operator=(CallbackBaseCopyable&& c) noexcept;
|
||||
|
||||
// Returns true if Callback is null (doesn't refer to anything).
|
||||
bool is_null() const { return !bind_state_; }
|
||||
explicit operator bool() const { return !is_null(); }
|
||||
|
||||
// Returns true if the callback invocation will be nop due to an cancellation.
|
||||
// It's invalid to call this on uninitialized callback.
|
||||
//
|
||||
// Must be called on the Callback's destination sequence.
|
||||
bool IsCancelled() const;
|
||||
|
||||
// If this returns false, the callback invocation will be a nop due to a
|
||||
// cancellation. This may(!) still return true, even on a cancelled callback.
|
||||
//
|
||||
// This function is thread-safe.
|
||||
bool MaybeValid() const;
|
||||
|
||||
// Returns the Callback into an uninitialized state.
|
||||
void Reset();
|
||||
|
||||
protected:
|
||||
friend class FinallyExecutorCommon;
|
||||
friend class ThenAndCatchExecutorCommon;
|
||||
|
||||
template <typename ReturnType>
|
||||
friend class PostTaskExecutor;
|
||||
|
||||
using InvokeFuncStorage = BindStateBase::InvokeFuncStorage;
|
||||
|
||||
// Returns true if this callback equals |other|. |other| may be null.
|
||||
bool EqualsInternal(const CallbackBase& other) const;
|
||||
|
||||
constexpr inline CallbackBase();
|
||||
|
||||
// Allow initializing of |bind_state_| via the constructor to avoid default
|
||||
// initialization of the scoped_refptr.
|
||||
explicit inline CallbackBase(BindStateBase* bind_state);
|
||||
|
||||
InvokeFuncStorage polymorphic_invoke() const {
|
||||
return bind_state_->polymorphic_invoke_;
|
||||
}
|
||||
|
||||
// Force the destructor to be instantiated inside this translation unit so
|
||||
// that our subclasses will not get inlined versions. Avoids more template
|
||||
// bloat.
|
||||
~CallbackBase();
|
||||
|
||||
scoped_refptr<BindStateBase> bind_state_;
|
||||
};
|
||||
|
||||
constexpr CallbackBase::CallbackBase() = default;
|
||||
CallbackBase::CallbackBase(CallbackBase&&) noexcept = default;
|
||||
CallbackBase::CallbackBase(BindStateBase* bind_state)
|
||||
: bind_state_(AdoptRef(bind_state)) {}
|
||||
|
||||
// CallbackBase<Copyable> is a direct base class of Copyable Callbacks.
|
||||
class CallbackBaseCopyable : public CallbackBase {
|
||||
public:
|
||||
CallbackBaseCopyable(const CallbackBaseCopyable& c);
|
||||
CallbackBaseCopyable(CallbackBaseCopyable&& c) noexcept = default;
|
||||
CallbackBaseCopyable& operator=(const CallbackBaseCopyable& c);
|
||||
CallbackBaseCopyable& operator=(CallbackBaseCopyable&& c) noexcept;
|
||||
|
||||
protected:
|
||||
constexpr CallbackBaseCopyable() = default;
|
||||
explicit CallbackBaseCopyable(BindStateBase* bind_state)
|
||||
: CallbackBase(bind_state) {}
|
||||
~CallbackBaseCopyable() = default;
|
||||
};
|
||||
|
||||
// Helpers for the `Then()` implementation.
|
||||
template <typename OriginalCallback, typename ThenCallback>
|
||||
struct ThenHelper;
|
||||
|
||||
// Specialization when original callback returns `void`.
|
||||
template <template <typename> class OriginalCallback,
|
||||
template <typename>
|
||||
class ThenCallback,
|
||||
typename... OriginalArgs,
|
||||
typename ThenR,
|
||||
typename... ThenArgs>
|
||||
struct ThenHelper<OriginalCallback<void(OriginalArgs...)>,
|
||||
ThenCallback<ThenR(ThenArgs...)>> {
|
||||
static_assert(sizeof...(ThenArgs) == 0,
|
||||
"|then| callback cannot accept parameters if |this| has a "
|
||||
"void return type.");
|
||||
|
||||
static auto CreateTrampoline() {
|
||||
return [](OriginalCallback<void(OriginalArgs...)> c1,
|
||||
ThenCallback<ThenR(ThenArgs...)> c2, OriginalArgs... c1_args) {
|
||||
std::move(c1).Run(std::forward<OriginalArgs>(c1_args)...);
|
||||
return std::move(c2).Run();
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
// Specialization when original callback returns a non-void type.
|
||||
template <template <typename> class OriginalCallback,
|
||||
template <typename>
|
||||
class ThenCallback,
|
||||
typename OriginalR,
|
||||
typename... OriginalArgs,
|
||||
typename ThenR,
|
||||
typename... ThenArgs>
|
||||
struct ThenHelper<OriginalCallback<OriginalR(OriginalArgs...)>,
|
||||
ThenCallback<ThenR(ThenArgs...)>> {
|
||||
static_assert(sizeof...(ThenArgs) == 1,
|
||||
"|then| callback must accept exactly one parameter if |this| "
|
||||
"has a non-void return type.");
|
||||
// TODO(dcheng): This should probably check is_convertible as well (same with
|
||||
// `AssertBindArgsValidity`).
|
||||
static_assert(std::is_constructible<ThenArgs..., OriginalR&&>::value,
|
||||
"|then| callback's parameter must be constructible from "
|
||||
"return type of |this|.");
|
||||
|
||||
static auto CreateTrampoline() {
|
||||
return [](OriginalCallback<OriginalR(OriginalArgs...)> c1,
|
||||
ThenCallback<ThenR(ThenArgs...)> c2, OriginalArgs... c1_args) {
|
||||
return std::move(c2).Run(
|
||||
std::move(c1).Run(std::forward<OriginalArgs>(c1_args)...));
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace cef_internal
|
||||
} // namespace base
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_INTERNAL_CEF_CALLBACK_INTERNAL_H_
|
||||
|
|
@ -1,87 +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_lock.h instead.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_INTERNAL_CEF_LOCK_IMPL_H_
|
||||
#define CEF_INCLUDE_BASE_INTERNAL_CEF_LOCK_IMPL_H_
|
||||
|
||||
#include "include/base/cef_build.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <windows.h>
|
||||
#elif defined(OS_POSIX)
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
namespace base {
|
||||
namespace cef_internal {
|
||||
|
||||
// This class implements the underlying platform-specific spin-lock mechanism
|
||||
// used for the Lock class. Most users should not use LockImpl directly, but
|
||||
// should instead use Lock.
|
||||
class LockImpl {
|
||||
public:
|
||||
#if defined(OS_WIN)
|
||||
typedef CRITICAL_SECTION NativeHandle;
|
||||
#elif defined(OS_POSIX)
|
||||
typedef pthread_mutex_t NativeHandle;
|
||||
#endif
|
||||
|
||||
LockImpl();
|
||||
|
||||
LockImpl(const LockImpl&) = delete;
|
||||
LockImpl& operator=(const LockImpl&) = delete;
|
||||
|
||||
~LockImpl();
|
||||
|
||||
// If the lock is not held, take it and return true. If the lock is already
|
||||
// held by something else, immediately return false.
|
||||
bool Try();
|
||||
|
||||
// Take the lock, blocking until it is available if necessary.
|
||||
void Lock();
|
||||
|
||||
// Release the lock. This must only be called by the lock's holder: after
|
||||
// a successful call to Try, or a call to Lock.
|
||||
void Unlock();
|
||||
|
||||
// Return the native underlying lock.
|
||||
// TODO(awalker): refactor lock and condition variables so that this is
|
||||
// unnecessary.
|
||||
NativeHandle* native_handle() { return &native_handle_; }
|
||||
|
||||
private:
|
||||
NativeHandle native_handle_;
|
||||
};
|
||||
|
||||
} // namespace cef_internal
|
||||
} // namespace base
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_INTERNAL_CEF_LOCK_IMPL_H_
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,73 +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_callback.h instead.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_INTERNAL_CEF_RAW_SCOPED_REFPTR_MISMATCH_CHECKER_H_
|
||||
#define CEF_INCLUDE_BASE_INTERNAL_CEF_RAW_SCOPED_REFPTR_MISMATCH_CHECKER_H_
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
// It is dangerous to post a task with a T* argument where T is a subtype of
|
||||
// RefCounted(Base|ThreadSafeBase), since by the time the parameter is used, the
|
||||
// object may already have been deleted since it was not held with a
|
||||
// scoped_refptr. Example: http://crbug.com/27191
|
||||
// The following set of traits are designed to generate a compile error
|
||||
// whenever this antipattern is attempted.
|
||||
|
||||
namespace base {
|
||||
|
||||
// This is a base internal implementation file used by task.h and callback.h.
|
||||
// Not for public consumption, so we wrap it in namespace internal.
|
||||
namespace cef_internal {
|
||||
|
||||
template <typename T, typename = void>
|
||||
struct IsRefCountedType : std::false_type {};
|
||||
|
||||
template <typename T>
|
||||
struct IsRefCountedType<T,
|
||||
std::void_t<decltype(std::declval<T*>()->AddRef()),
|
||||
decltype(std::declval<T*>()->Release())>>
|
||||
: std::true_type {};
|
||||
|
||||
// Human readable translation: you needed to be a scoped_refptr if you are a raw
|
||||
// pointer type and are convertible to a RefCounted(Base|ThreadSafeBase) type.
|
||||
template <typename T>
|
||||
struct NeedsScopedRefptrButGetsRawPtr
|
||||
: std::conjunction<std::is_pointer<T>,
|
||||
IsRefCountedType<std::remove_pointer_t<T>>> {
|
||||
static_assert(!std::is_reference<T>::value,
|
||||
"NeedsScopedRefptrButGetsRawPtr requires non-reference type.");
|
||||
};
|
||||
|
||||
} // namespace cef_internal
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_INTERNAL_CEF_RAW_SCOPED_REFPTR_MISMATCH_CHECKER_H_
|
||||
|
|
@ -1,53 +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/memory/scoped_policy.h
|
||||
// instead.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_INTERNAL_CEF_SCOPED_POLICY_H_
|
||||
#define CEF_INCLUDE_BASE_INTERNAL_CEF_SCOPED_POLICY_H_
|
||||
|
||||
namespace base {
|
||||
namespace scoped_policy {
|
||||
|
||||
// Defines the ownership policy for a scoped object.
|
||||
enum OwnershipPolicy {
|
||||
// The scoped object takes ownership of an object by taking over an existing
|
||||
// ownership claim.
|
||||
ASSUME,
|
||||
|
||||
// The scoped object will retain the object and any initial ownership is
|
||||
// not changed.
|
||||
RETAIN
|
||||
};
|
||||
|
||||
} // namespace scoped_policy
|
||||
} // namespace base
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_INTERNAL_CEF_SCOPED_POLICY_H_
|
||||
|
|
@ -1,72 +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_thread_checker.h
|
||||
// instead.
|
||||
|
||||
#ifndef CEF_INCLUDE_BASE_INTERNAL_THREAD_CHECKER_IMPL_H_
|
||||
#define CEF_INCLUDE_BASE_INTERNAL_THREAD_CHECKER_IMPL_H_
|
||||
|
||||
#include "include/base/cef_lock.h"
|
||||
#include "include/base/cef_platform_thread.h"
|
||||
|
||||
namespace base {
|
||||
namespace cef_internal {
|
||||
|
||||
// Real implementation of ThreadChecker, for use in debug mode, or
|
||||
// for temporary use in release mode (e.g. to CHECK on a threading issue
|
||||
// seen only in the wild).
|
||||
//
|
||||
// Note: You should almost always use the ThreadChecker class to get the
|
||||
// right version for your build configuration.
|
||||
class ThreadCheckerImpl {
|
||||
public:
|
||||
ThreadCheckerImpl();
|
||||
~ThreadCheckerImpl();
|
||||
|
||||
bool CalledOnValidThread() const;
|
||||
|
||||
// Changes the thread that is checked for in CalledOnValidThread. This may
|
||||
// be useful when an object may be created on one thread and then used
|
||||
// exclusively on another thread.
|
||||
void DetachFromThread();
|
||||
|
||||
private:
|
||||
void EnsureThreadIdAssigned() const;
|
||||
|
||||
mutable base::Lock lock_;
|
||||
// This is mutable so that CalledOnValidThread can set it.
|
||||
// It's guarded by |lock_|.
|
||||
mutable PlatformThreadRef valid_thread_id_;
|
||||
};
|
||||
|
||||
} // namespace cef_internal
|
||||
} // namespace base
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_INTERNAL_THREAD_CHECKER_IMPL_H_
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
// Copyright (c) 2024 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=6ea5d772fb4961ae4a658b4b730aa608fa93309f$
|
||||
//
|
||||
|
||||
#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_
|
||||
|
|
@ -1,194 +0,0 @@
|
|||
// Copyright (c) 2024 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=b9a2bad4a30bcb99384197c9f7409116dc5b376e$
|
||||
//
|
||||
|
||||
#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
|
||||
/// cef_settings_t.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
|
||||
/// cef_settings_t.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 cef_settings_t.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 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. Returns
|
||||
/// true (1) if initialization succeeds. Returns false (0) if initialization
|
||||
/// fails or if early exit is desired (for example, due to process singleton
|
||||
/// relaunch behavior). If this function returns false (0) then the application
|
||||
/// should exit immediately without calling any other CEF functions. 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 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. Do not call any other
|
||||
/// CEF functions after calling this function.
|
||||
///
|
||||
CEF_EXPORT void cef_shutdown(void);
|
||||
|
||||
///
|
||||
/// 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
|
||||
/// cef_settings_t.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 cef_settings_t.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
|
||||
/// cef_settings_t.multi_threaded_message_loop value of false (0). This function
|
||||
/// will not block.
|
||||
///
|
||||
CEF_EXPORT void cef_do_message_loop_work(void);
|
||||
|
||||
///
|
||||
/// 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
|
||||
/// cef_settings_t.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(void);
|
||||
|
||||
///
|
||||
/// 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(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
// Copyright (c) 2024 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=d98482eba93dcd8b6a6f69b2732162733c73203d$
|
||||
//
|
||||
|
||||
#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.
|
||||
///
|
||||
typedef struct _cef_audio_handler_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Called on the UI thread to allow configuration of audio stream parameters.
|
||||
/// Return true (1) to proceed with audio stream capture, or false (0) to
|
||||
/// cancel it. All members of |params| can optionally be configured here, but
|
||||
/// they are also pre-filled with some sensible defaults.
|
||||
///
|
||||
int(CEF_CALLBACK* get_audio_parameters)(struct _cef_audio_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_audio_parameters_t* params);
|
||||
|
||||
///
|
||||
/// Called on a browser audio capture thread when the browser starts streaming
|
||||
/// audio. OnAudioStreamStopped will always be called after
|
||||
/// OnAudioStreamStarted; both functions may be called multiple times for the
|
||||
/// same browser. |params| contains the audio parameters like sample rate and
|
||||
/// channel layout. |channels| is the number of channels.
|
||||
///
|
||||
void(CEF_CALLBACK* on_audio_stream_started)(
|
||||
struct _cef_audio_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_audio_parameters_t* params,
|
||||
int channels);
|
||||
|
||||
///
|
||||
/// Called on the audio stream thread when a PCM packet is received for the
|
||||
/// stream. |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,
|
||||
const float** data,
|
||||
int frames,
|
||||
int64_t pts);
|
||||
|
||||
///
|
||||
/// Called on the UI thread when the stream 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);
|
||||
|
||||
///
|
||||
/// Called on the UI or audio stream thread when an error occurred. During the
|
||||
/// stream creation phase this callback will be called on the UI thread while
|
||||
/// in the capturing phase it will be called on the audio stream thread. The
|
||||
/// stream will be stopped immediately.
|
||||
///
|
||||
void(CEF_CALLBACK* on_audio_stream_error)(struct _cef_audio_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_string_t* message);
|
||||
} cef_audio_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_AUDIO_HANDLER_CAPI_H_
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
// Copyright (c) 2024 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=b63947918eca8c31790cae16b2e8a0be7e9464dd$
|
||||
//
|
||||
|
||||
#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_
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
// 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 <stdint.h>
|
||||
|
||||
#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<size_t*>(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_
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,177 +0,0 @@
|
|||
// Copyright (c) 2024 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=d958d5bed7f909f6313facef3440fb8ba07a5c01$
|
||||
//
|
||||
|
||||
#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_client_capi.h"
|
||||
#include "include/capi/cef_command_line_capi.h"
|
||||
#include "include/capi/cef_preference_capi.h"
|
||||
#include "include/capi/cef_request_context_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;
|
||||
|
||||
///
|
||||
/// Provides an opportunity to register custom preferences prior to global and
|
||||
/// request context initialization.
|
||||
///
|
||||
/// If |type| is CEF_PREFERENCES_TYPE_GLOBAL the registered preferences can be
|
||||
/// accessed via cef_preference_manager_t::GetGlobalPreferences after
|
||||
/// OnContextInitialized is called. Global preferences are registered a single
|
||||
/// time at application startup. See related cef_settings_t.cache_path and
|
||||
/// cef_settings_t.persist_user_preferences configuration.
|
||||
///
|
||||
/// If |type| is CEF_PREFERENCES_TYPE_REQUEST_CONTEXT the preferences can be
|
||||
/// accessed via the cef_request_context_t after
|
||||
/// cef_request_context_handler_t::OnRequestContextInitialized is called.
|
||||
/// Request context preferences are registered each time a new
|
||||
/// cef_request_context_t is created. It is intended but not required that all
|
||||
/// request contexts have the same registered preferences. See related
|
||||
/// cef_request_context_settings_t.cache_path and
|
||||
/// cef_request_context_settings_t.persist_user_preferences configuration.
|
||||
///
|
||||
/// Do not keep a reference to the |registrar| object. This function is called
|
||||
/// on the browser process UI thread.
|
||||
///
|
||||
void(CEF_CALLBACK* on_register_custom_preferences)(
|
||||
struct _cef_browser_process_handler_t* self,
|
||||
cef_preferences_type_t type,
|
||||
struct _cef_preference_registrar_t* registrar);
|
||||
|
||||
///
|
||||
/// 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 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);
|
||||
|
||||
///
|
||||
/// Implement this function to provide app-specific behavior when an already
|
||||
/// running app is relaunched with the same CefSettings.root_cache_path value.
|
||||
/// For example, activate an existing app window or create a new app window.
|
||||
/// |command_line| will be read-only. Do not keep a reference to
|
||||
/// |command_line| outside of this function. Return true (1) if the relaunch
|
||||
/// is handled or false (0) for default relaunch behavior. Default behavior
|
||||
/// will create a new default styled Chrome window.
|
||||
///
|
||||
/// To avoid cache corruption only a single app instance is allowed to run for
|
||||
/// a given CefSettings.root_cache_path value. On relaunch the app checks a
|
||||
/// process singleton lock and then forwards the new launch arguments to the
|
||||
/// already running app process before exiting early. Client apps should
|
||||
/// therefore check the cef_initialize() return value for early exit before
|
||||
/// proceeding.
|
||||
///
|
||||
/// This function will be called on the browser process UI thread.
|
||||
///
|
||||
int(CEF_CALLBACK* on_already_running_app_relaunch)(
|
||||
struct _cef_browser_process_handler_t* self,
|
||||
struct _cef_command_line_t* command_line,
|
||||
const cef_string_t* current_directory);
|
||||
|
||||
///
|
||||
/// Called from any thread when work has been scheduled for the browser
|
||||
/// process main (UI) thread. This callback is used in combination with
|
||||
/// cef_settings_t.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_t delay_ms);
|
||||
|
||||
///
|
||||
/// Return the default client for use with a newly created browser window
|
||||
/// (cef_browser_t object). If null is returned the cef_browser_t will be
|
||||
/// unmanaged (no callbacks will be executed for that cef_browser_t) and
|
||||
/// application shutdown will be blocked until the browser window is closed
|
||||
/// manually. This function is currently only used with the Chrome runtime
|
||||
/// when creating new browser windows via Chrome UI.
|
||||
///
|
||||
struct _cef_client_t*(CEF_CALLBACK* get_default_client)(
|
||||
struct _cef_browser_process_handler_t* self);
|
||||
|
||||
///
|
||||
/// Return the default handler for use with a new user or incognito profile
|
||||
/// (cef_request_context_t object). If null is returned the
|
||||
/// cef_request_context_t will be unmanaged (no callbacks will be executed for
|
||||
/// that cef_request_context_t). This function is currently only used with the
|
||||
/// Chrome runtime when creating new browser windows via Chrome UI.
|
||||
///
|
||||
struct _cef_request_context_handler_t*(
|
||||
CEF_CALLBACK* get_default_request_context_handler)(
|
||||
struct _cef_browser_process_handler_t* self);
|
||||
} cef_browser_process_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_BROWSER_PROCESS_HANDLER_CAPI_H_
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
// Copyright (c) 2024 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=46bc048bec64590735298a95633167d66e445844$
|
||||
//
|
||||
|
||||
#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_
|
||||
|
|
@ -1,210 +0,0 @@
|
|||
// Copyright (c) 2024 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=09bd4140605645c9dfbd81e7e22d029d0bb50129$
|
||||
//
|
||||
|
||||
#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_command_handler_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_frame_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_permission_handler_capi.h"
|
||||
#include "include/capi/cef_print_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 commands. If no handler is provided the default
|
||||
/// implementation will be used.
|
||||
///
|
||||
struct _cef_command_handler_t*(CEF_CALLBACK* get_command_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 events related to cef_frame_t lifespan. This
|
||||
/// function will be called once during cef_browser_t creation and the result
|
||||
/// will be cached for performance reasons.
|
||||
///
|
||||
struct _cef_frame_handler_t*(CEF_CALLBACK* get_frame_handler)(
|
||||
struct _cef_client_t* self);
|
||||
|
||||
///
|
||||
/// Return the handler for permission requests.
|
||||
///
|
||||
struct _cef_permission_handler_t*(CEF_CALLBACK* get_permission_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 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_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. It is safe to
|
||||
/// keep a reference to |message| outside of this callback.
|
||||
///
|
||||
int(CEF_CALLBACK* on_process_message_received)(
|
||||
struct _cef_client_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
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_
|
||||
|
|
@ -1,120 +0,0 @@
|
|||
// Copyright (c) 2024 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=dd183a473b1e8c5ee8bdcf99949fc5274c4cc892$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_COMMAND_HANDLER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_COMMAND_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 events related to commands. The functions
|
||||
/// of this structure will be called on the UI thread.
|
||||
///
|
||||
typedef struct _cef_command_handler_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Called to execute a Chrome command triggered via menu selection or
|
||||
/// keyboard shortcut. Values for |command_id| can be found in the
|
||||
/// cef_command_ids.h file. |disposition| provides information about the
|
||||
/// intended command target. Return true (1) if the command was handled or
|
||||
/// false (0) for the default implementation. For context menu commands this
|
||||
/// will be called after cef_context_menu_handler_t::OnContextMenuCommand.
|
||||
/// Only used with the Chrome runtime.
|
||||
///
|
||||
int(CEF_CALLBACK* on_chrome_command)(
|
||||
struct _cef_command_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
int command_id,
|
||||
cef_window_open_disposition_t disposition);
|
||||
|
||||
///
|
||||
/// Called to check if a Chrome app menu item should be visible. Values for
|
||||
/// |command_id| can be found in the cef_command_ids.h file. Only called for
|
||||
/// menu items that would be visible by default. Only used with the Chrome
|
||||
/// runtime.
|
||||
///
|
||||
int(CEF_CALLBACK* is_chrome_app_menu_item_visible)(
|
||||
struct _cef_command_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
int command_id);
|
||||
|
||||
///
|
||||
/// Called to check if a Chrome app menu item should be enabled. Values for
|
||||
/// |command_id| can be found in the cef_command_ids.h file. Only called for
|
||||
/// menu items that would be enabled by default. Only used with the Chrome
|
||||
/// runtime.
|
||||
///
|
||||
int(CEF_CALLBACK* is_chrome_app_menu_item_enabled)(
|
||||
struct _cef_command_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
int command_id);
|
||||
|
||||
///
|
||||
/// Called during browser creation to check if a Chrome page action icon
|
||||
/// should be visible. Only called for icons that would be visible by default.
|
||||
/// Only used with the Chrome runtime.
|
||||
///
|
||||
int(CEF_CALLBACK* is_chrome_page_action_icon_visible)(
|
||||
struct _cef_command_handler_t* self,
|
||||
cef_chrome_page_action_icon_type_t icon_type);
|
||||
|
||||
///
|
||||
/// Called during browser creation to check if a Chrome toolbar button should
|
||||
/// be visible. Only called for buttons that would be visible by default. Only
|
||||
/// used with the Chrome runtime.
|
||||
///
|
||||
int(CEF_CALLBACK* is_chrome_toolbar_button_visible)(
|
||||
struct _cef_command_handler_t* self,
|
||||
cef_chrome_toolbar_button_type_t button_type);
|
||||
} cef_command_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_COMMAND_HANDLER_CAPI_H_
|
||||
|
|
@ -1,215 +0,0 @@
|
|||
// Copyright (c) 2024 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=fce786b3f054d6581438e2906b77e573c797372a$
|
||||
//
|
||||
|
||||
#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 should be lowercase ASCII and will be converted to
|
||||
/// such if necessary. Switch values will retain the original case and UTF8
|
||||
/// encoding. 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.
|
||||
///
|
||||
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. If
|
||||
/// the switch has no value pass an NULL value string.
|
||||
///
|
||||
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(void);
|
||||
|
||||
///
|
||||
/// 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(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_COMMAND_LINE_CAPI_H_
|
||||
|
|
@ -1,367 +0,0 @@
|
|||
// Copyright (c) 2024 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=3ae7dbb24ec7a95a2f4d4e390c9b6622221c2f42$
|
||||
//
|
||||
|
||||
#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;
|
||||
|
||||
///
|
||||
/// Callback structure used for continuation of custom quick menu display.
|
||||
///
|
||||
typedef struct _cef_run_quick_menu_callback_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Complete quick menu display by selecting the specified |command_id| and
|
||||
/// |event_flags|.
|
||||
///
|
||||
void(CEF_CALLBACK* cont)(struct _cef_run_quick_menu_callback_t* self,
|
||||
int command_id,
|
||||
cef_event_flags_t event_flags);
|
||||
|
||||
///
|
||||
/// Cancel quick menu display.
|
||||
///
|
||||
void(CEF_CALLBACK* cancel)(struct _cef_run_quick_menu_callback_t* self);
|
||||
} cef_run_quick_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 canceled 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);
|
||||
|
||||
///
|
||||
/// Called to allow custom display of the quick menu for a windowless browser.
|
||||
/// |location| is the top left corner of the selected region. |size| is the
|
||||
/// size of the selected region. |edit_state_flags| is a combination of flags
|
||||
/// that represent the state of the quick menu. Return true (1) if the menu
|
||||
/// will be handled and execute |callback| either synchronously or
|
||||
/// asynchronously with the selected command ID. Return false (0) to cancel
|
||||
/// the menu.
|
||||
///
|
||||
int(CEF_CALLBACK* run_quick_menu)(
|
||||
struct _cef_context_menu_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
const cef_point_t* location,
|
||||
const cef_size_t* size,
|
||||
cef_quick_menu_edit_state_flags_t edit_state_flags,
|
||||
struct _cef_run_quick_menu_callback_t* callback);
|
||||
|
||||
///
|
||||
/// Called to execute a command selected from the quick menu for a windowless
|
||||
/// browser. Return true (1) if the command was handled or false (0) for the
|
||||
/// default implementation. See cef_menu_id_t for command IDs that have
|
||||
/// default implementations.
|
||||
///
|
||||
int(CEF_CALLBACK* on_quick_menu_command)(
|
||||
struct _cef_context_menu_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
int command_id,
|
||||
cef_event_flags_t event_flags);
|
||||
|
||||
///
|
||||
/// Called when the quick menu for a windowless browser is dismissed
|
||||
/// irregardless of whether the menu was canceled or a command was selected.
|
||||
///
|
||||
void(CEF_CALLBACK* on_quick_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 functions 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.
|
||||
///
|
||||
int(CEF_CALLBACK* is_custom_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_
|
||||
|
|
@ -1,199 +0,0 @@
|
|||
// Copyright (c) 2024 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=76ba2e59636aa71c8c6286093198a1e64d012c62$
|
||||
//
|
||||
|
||||
#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;
|
||||
|
||||
///
|
||||
/// Visit all cookies on the UI 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 UI 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 UI 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 UI 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);
|
||||
|
||||
///
|
||||
/// Flush the backing store (if any) to disk. If |callback| is non-NULL it
|
||||
/// will be executed asnychronously on the UI 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
|
||||
/// cef_settings_t.cache_path if specified or in memory otherwise. If |callback|
|
||||
/// is non-NULL it will be executed asnychronously on the UI thread after the
|
||||
/// manager's storage has been initialized. Using this function is equivalent to
|
||||
/// calling cef_request_context_t::cef_request_context_get_global_context()-
|
||||
/// >GetDefaultCookieManager().
|
||||
///
|
||||
CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_global_manager(
|
||||
struct _cef_completion_callback_t* callback);
|
||||
|
||||
///
|
||||
/// Structure to implement for visiting cookie values. The functions of this
|
||||
/// structure will always be called on the UI 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_
|
||||
|
|
@ -1,154 +0,0 @@
|
|||
// Copyright (c) 2024 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=46a6432f66cce88d8597c3d070681b09a712dc54$
|
||||
//
|
||||
|
||||
#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.
|
||||
/// "<appname>.app/Contents/Resources"). File contents are as follows:
|
||||
///
|
||||
/// <pre>
|
||||
/// # Comments start with a hash character and must be on their own line.
|
||||
///
|
||||
/// [Config]
|
||||
/// ProductName=<Value of the "prod" crash key; defaults to "cef">
|
||||
/// ProductVersion=<Value of the "ver" crash key; defaults to the CEF version>
|
||||
/// AppName=<Windows only; App-specific folder name component for storing crash
|
||||
/// information; default to "CEF">
|
||||
/// ExternalHandler=<Windows only; Name of the external handler exe to use
|
||||
/// instead of re-launching the main exe; default to empty>
|
||||
/// BrowserCrashForwardingEnabled=<macOS only; True if browser process crashes
|
||||
/// should be forwarded to the system crash
|
||||
/// reporter; default to false>
|
||||
/// ServerURL=<crash server URL; default to empty>
|
||||
/// RateLimitEnabled=<True if uploads should be rate limited; default to true>
|
||||
/// MaxUploadsPerDay=<Max uploads per 24 hours, used if rate limit is enabled;
|
||||
/// default to 5>
|
||||
/// MaxDatabaseSizeInMb=<Total crash report disk usage greater than this value
|
||||
/// will cause older reports to be deleted; default to 20>
|
||||
/// MaxDatabaseAgeInDays=<Crash reports older than this value will be deleted;
|
||||
/// default to 5>
|
||||
///
|
||||
/// [CrashKeys]
|
||||
/// my_key1=<small|medium|large>
|
||||
/// my_key2=<small|medium|large>
|
||||
/// </pre>
|
||||
///
|
||||
/// <b>Config section:</b>
|
||||
///
|
||||
/// 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 cef_settings_t.root_cache_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 cef_settings_t.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.
|
||||
///
|
||||
/// <b>CrashKeys section:</b>
|
||||
///
|
||||
/// 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(void);
|
||||
|
||||
///
|
||||
/// 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_
|
||||
|
|
@ -1,148 +0,0 @@
|
|||
// Copyright (c) 2024 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=dd94c50619e92bf5bed4fe61479813ee559f779d$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_DEVTOOLS_MESSAGE_OBSERVER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_DEVTOOLS_MESSAGE_OBSERVER_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _cef_browser_t;
|
||||
|
||||
///
|
||||
/// Callback structure for cef_browser_host_t::AddDevToolsMessageObserver. The
|
||||
/// functions of this structure will be called on the browser process UI thread.
|
||||
///
|
||||
typedef struct _cef_dev_tools_message_observer_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Method that will be called on receipt of a DevTools protocol message.
|
||||
/// |browser| is the originating browser instance. |message| is a UTF8-encoded
|
||||
/// JSON dictionary representing either a function result or an event.
|
||||
/// |message| is only valid for the scope of this callback and should be
|
||||
/// copied if necessary. Return true (1) if the message was handled or false
|
||||
/// (0) if the message should be further processed and passed to the
|
||||
/// OnDevToolsMethodResult or OnDevToolsEvent functions as appropriate.
|
||||
///
|
||||
/// Method result dictionaries include an "id" (int) value that identifies the
|
||||
/// orginating function call sent from
|
||||
/// cef_browser_host_t::SendDevToolsMessage, and optionally either a "result"
|
||||
/// (dictionary) or "error" (dictionary) value. The "error" dictionary will
|
||||
/// contain "code" (int) and "message" (string) values. Event dictionaries
|
||||
/// include a "function" (string) value and optionally a "params" (dictionary)
|
||||
/// value. See the DevTools protocol documentation at
|
||||
/// https://chromedevtools.github.io/devtools-protocol/ for details of
|
||||
/// supported function calls and the expected "result" or "params" dictionary
|
||||
/// contents. JSON dictionaries can be parsed using the CefParseJSON function
|
||||
/// if desired, however be aware of performance considerations when parsing
|
||||
/// large messages (some of which may exceed 1MB in size).
|
||||
///
|
||||
int(CEF_CALLBACK* on_dev_tools_message)(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const void* message,
|
||||
size_t message_size);
|
||||
|
||||
///
|
||||
/// Method that will be called after attempted execution of a DevTools
|
||||
/// protocol function. |browser| is the originating browser instance.
|
||||
/// |message_id| is the "id" value that identifies the originating function
|
||||
/// call message. If the function succeeded |success| will be true (1) and
|
||||
/// |result| will be the UTF8-encoded JSON "result" dictionary value (which
|
||||
/// may be NULL). If the function failed |success| will be false (0) and
|
||||
/// |result| will be the UTF8-encoded JSON "error" dictionary value. |result|
|
||||
/// is only valid for the scope of this callback and should be copied if
|
||||
/// necessary. See the OnDevToolsMessage documentation for additional details
|
||||
/// on |result| contents.
|
||||
///
|
||||
void(CEF_CALLBACK* on_dev_tools_method_result)(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
int message_id,
|
||||
int success,
|
||||
const void* result,
|
||||
size_t result_size);
|
||||
|
||||
///
|
||||
/// Method that will be called on receipt of a DevTools protocol event.
|
||||
/// |browser| is the originating browser instance. |function| is the
|
||||
/// "function" value. |params| is the UTF8-encoded JSON "params" dictionary
|
||||
/// value (which may be NULL). |params| is only valid for the scope of this
|
||||
/// callback and should be copied if necessary. See the OnDevToolsMessage
|
||||
/// documentation for additional details on |params| contents.
|
||||
///
|
||||
void(CEF_CALLBACK* on_dev_tools_event)(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_string_t* method,
|
||||
const void* params,
|
||||
size_t params_size);
|
||||
|
||||
///
|
||||
/// Method that will be called when the DevTools agent has attached. |browser|
|
||||
/// is the originating browser instance. This will generally occur in response
|
||||
/// to the first message sent while the agent is detached.
|
||||
///
|
||||
void(CEF_CALLBACK* on_dev_tools_agent_attached)(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
|
||||
///
|
||||
/// Method that will be called when the DevTools agent has detached. |browser|
|
||||
/// is the originating browser instance. Any function results that were
|
||||
/// pending before the agent became detached will not be delivered, and any
|
||||
/// active event subscriptions will be canceled.
|
||||
///
|
||||
void(CEF_CALLBACK* on_dev_tools_agent_detached)(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
} cef_dev_tools_message_observer_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_DEVTOOLS_MESSAGE_OBSERVER_CAPI_H_
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
// Copyright (c) 2024 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=5644fdc2453dd083079bf9e3616b687eeb49f250$
|
||||
//
|
||||
|
||||
#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. |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,
|
||||
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"). 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,
|
||||
struct _cef_file_dialog_callback_t* callback);
|
||||
} cef_dialog_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_DIALOG_HANDLER_CAPI_H_
|
||||
|
|
@ -1,178 +0,0 @@
|
|||
// Copyright (c) 2024 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=5a99c5e88ea0e123087234b2795fa625fed183f2$
|
||||
//
|
||||
|
||||
#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. With the Alloy
|
||||
/// runtime the client is responsible for triggering the fullscreen transition
|
||||
/// (for example, by calling cef_window_t::SetFullscreen when using Views).
|
||||
/// With the Chrome runtime the fullscreen transition will be triggered
|
||||
/// automatically. The cef_window_delegate_t::OnWindowFullscreenTransition
|
||||
/// function will be called during the fullscreen transition for notification
|
||||
/// purposes.
|
||||
///
|
||||
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);
|
||||
|
||||
///
|
||||
/// Called when the browser's cursor has changed. If |type| is CT_CUSTOM then
|
||||
/// |custom_cursor_info| will be populated with the custom cursor information.
|
||||
/// Return true (1) if the cursor change was handled or false (0) for default
|
||||
/// handling.
|
||||
///
|
||||
int(CEF_CALLBACK* on_cursor_change)(
|
||||
struct _cef_display_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_cursor_handle_t cursor,
|
||||
cef_cursor_type_t type,
|
||||
const cef_cursor_info_t* custom_cursor_info);
|
||||
|
||||
///
|
||||
/// Called when the browser's access to an audio and/or video source has
|
||||
/// changed.
|
||||
///
|
||||
void(CEF_CALLBACK* on_media_access_change)(
|
||||
struct _cef_display_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
int has_video_access,
|
||||
int has_audio_access);
|
||||
} cef_display_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_DISPLAY_HANDLER_CAPI_H_
|
||||
|
|
@ -1,345 +0,0 @@
|
|||
// Copyright (c) 2024 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=a4d2f79163205ed4367916546240a6aedc2165f9$
|
||||
//
|
||||
|
||||
#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.
|
||||
///
|
||||
cef_dom_form_control_type_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);
|
||||
|
||||
///
|
||||
/// 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 in device pixels. Use
|
||||
/// "window.devicePixelRatio" to convert to/from CSS pixels.
|
||||
///
|
||||
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_
|
||||
|
|
@ -1,150 +0,0 @@
|
|||
// Copyright (c) 2024 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=60a08a60be70e8fe5df17f18f8e5758e1830d5e1$
|
||||
//
|
||||
|
||||
#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 in response to a user-initiated action
|
||||
/// (e.g. alt + link click or link click that returns a `Content-Disposition:
|
||||
/// attachment` response from the server). |url| is the target download URL
|
||||
/// and |request_function| is the target function (GET, POST, etc). Return
|
||||
/// true (1) to proceed with the download or false (0) to cancel the download.
|
||||
///
|
||||
int(CEF_CALLBACK* can_download)(struct _cef_download_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_string_t* url,
|
||||
const cef_string_t* request_method);
|
||||
|
||||
///
|
||||
/// 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_
|
||||
|
|
@ -1,174 +0,0 @@
|
|||
// Copyright (c) 2024 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=9af8ade3addfd112db41792c4e80682a8143e8c4$
|
||||
//
|
||||
|
||||
#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.
|
||||
///
|
||||
int(CEF_CALLBACK* is_canceled)(struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
/// Returns true (1) if the download has been interrupted.
|
||||
///
|
||||
int(CEF_CALLBACK* is_interrupted)(struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
/// Returns the most recent interrupt reason.
|
||||
///
|
||||
cef_download_interrupt_reason_t(CEF_CALLBACK* get_interrupt_reason)(
|
||||
struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
/// Returns a simple speed estimate in bytes/s.
|
||||
///
|
||||
int64_t(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_t(CEF_CALLBACK* get_total_bytes)(struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
/// Returns the number of received bytes.
|
||||
///
|
||||
int64_t(CEF_CALLBACK* get_received_bytes)(struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
/// Returns the time that the download started.
|
||||
///
|
||||
cef_basetime_t(CEF_CALLBACK* get_start_time)(
|
||||
struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
/// Returns the time that the download ended.
|
||||
///
|
||||
cef_basetime_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_t(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_
|
||||
|
|
@ -1,240 +0,0 @@
|
|||
// Copyright (c) 2024 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=a096775255ddc4d7616095e48e7370bd87bf4bb5$
|
||||
//
|
||||
|
||||
#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);
|
||||
|
||||
///
|
||||
/// Retrieve the list of file paths that are being dragged into the browser
|
||||
/// window.
|
||||
///
|
||||
int(CEF_CALLBACK* get_file_paths)(struct _cef_drag_data_t* self,
|
||||
cef_string_list_t paths);
|
||||
|
||||
///
|
||||
/// 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);
|
||||
|
||||
///
|
||||
/// Clear list of filenames.
|
||||
///
|
||||
void(CEF_CALLBACK* clear_filenames)(struct _cef_drag_data_t* self);
|
||||
|
||||
///
|
||||
/// 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(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_DRAG_DATA_CAPI_H_
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
// Copyright (c) 2024 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=0723a2a59d46e465ac94f198351dc871f0b35b96$
|
||||
//
|
||||
|
||||
#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"
|
||||
#include "include/capi/cef_frame_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,
|
||||
struct _cef_frame_t* frame,
|
||||
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_
|
||||
|
|
@ -1,130 +0,0 @@
|
|||
// Copyright (c) 2024 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=0ca2b788f70f8c9f5b2706d691d8e063be00ed19$
|
||||
//
|
||||
|
||||
#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_context_t::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_context_t::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_context_t::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_handler_t::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_
|
||||
|
|
@ -1,212 +0,0 @@
|
|||
// Copyright (c) 2024 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=5cfff4465a586d2b2ea7b54a9549096faec415f6$
|
||||
//
|
||||
|
||||
#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_handler_t::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_context_t::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_context_t::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_context_t::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 "<script>" src attribute. To allow creation of the browser
|
||||
/// optionally modify |client| and |settings| and return false (0). To cancel
|
||||
/// creation of the browser (and consequently cancel load of the background
|
||||
/// script) return true (1). Successful creation will be indicated by a call
|
||||
/// to cef_life_span_handler_t::OnAfterCreated, and
|
||||
/// cef_browser_host_t::IsBackgroundHost will return true (1) for the
|
||||
/// resulting browser. See https://developer.chrome.com/extensions/event_pages
|
||||
/// for more information about extension background script usage.
|
||||
///
|
||||
int(CEF_CALLBACK* on_before_background_browser)(
|
||||
struct _cef_extension_handler_t* self,
|
||||
struct _cef_extension_t* extension,
|
||||
const cef_string_t* url,
|
||||
struct _cef_client_t** client,
|
||||
struct _cef_browser_settings_t* settings);
|
||||
|
||||
///
|
||||
/// Called when an extension API (e.g. chrome.tabs.create) requests creation
|
||||
/// of a new browser. |extension| and |browser| are the source of the API
|
||||
/// call. |active_browser| may optionally be specified via the windowId
|
||||
/// property or returned via the get_active_browser() callback and provides
|
||||
/// the default |client| and |settings| values for the new browser. |index| is
|
||||
/// the position value optionally specified via the index property. |url| is
|
||||
/// the URL that will be loaded in the browser. |active| is true (1) if the
|
||||
/// new browser should be active when opened. To allow creation of the
|
||||
/// browser optionally modify |windowInfo|, |client| and |settings| and return
|
||||
/// false (0). To cancel creation of the browser return true (1). Successful
|
||||
/// creation will be indicated by a call to
|
||||
/// cef_life_span_handler_t::OnAfterCreated. Any modifications to |windowInfo|
|
||||
/// will be ignored if |active_browser| is wrapped in a cef_browser_view_t.
|
||||
///
|
||||
int(CEF_CALLBACK* on_before_browser)(
|
||||
struct _cef_extension_handler_t* self,
|
||||
struct _cef_extension_t* extension,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_browser_t* active_browser,
|
||||
int index,
|
||||
const cef_string_t* url,
|
||||
int active,
|
||||
struct _cef_window_info_t* windowInfo,
|
||||
struct _cef_client_t** client,
|
||||
struct _cef_browser_settings_t* settings);
|
||||
|
||||
///
|
||||
/// Called when no tabId is specified to an extension API call that accepts a
|
||||
/// tabId parameter (e.g. chrome.tabs.*). |extension| and |browser| are the
|
||||
/// source of the API call. Return the browser that will be acted on by the
|
||||
/// API call or return NULL to act on |browser|. The returned browser must
|
||||
/// share the same cef_request_context_t as |browser|. Incognito browsers
|
||||
/// should not be considered unless the source extension has incognito access
|
||||
/// enabled, in which case |include_incognito| will be true (1).
|
||||
///
|
||||
struct _cef_browser_t*(CEF_CALLBACK* get_active_browser)(
|
||||
struct _cef_extension_handler_t* self,
|
||||
struct _cef_extension_t* extension,
|
||||
struct _cef_browser_t* browser,
|
||||
int include_incognito);
|
||||
|
||||
///
|
||||
/// Called when the tabId associated with |target_browser| is specified to an
|
||||
/// extension API call that accepts a tabId parameter (e.g. chrome.tabs.*).
|
||||
/// |extension| and |browser| are the source of the API call. Return true (1)
|
||||
/// to allow access of false (0) to deny access. Access to incognito browsers
|
||||
/// should not be allowed unless the source extension has incognito access
|
||||
/// enabled, in which case |include_incognito| will be true (1).
|
||||
///
|
||||
int(CEF_CALLBACK* can_access_browser)(struct _cef_extension_handler_t* self,
|
||||
struct _cef_extension_t* extension,
|
||||
struct _cef_browser_t* browser,
|
||||
int include_incognito,
|
||||
struct _cef_browser_t* target_browser);
|
||||
|
||||
///
|
||||
/// Called to retrieve an extension resource that would normally be loaded
|
||||
/// from disk (e.g. if a file parameter is specified to
|
||||
/// chrome.tabs.executeScript). |extension| and |browser| are the source of
|
||||
/// the resource request. |file| is the requested relative file path. To
|
||||
/// handle the resource request return true (1) and execute |callback| either
|
||||
/// synchronously or asynchronously. For the default behavior which reads the
|
||||
/// resource from the extension directory on disk return false (0).
|
||||
/// Localization substitutions will not be applied to resources handled via
|
||||
/// this function.
|
||||
///
|
||||
int(CEF_CALLBACK* get_extension_resource)(
|
||||
struct _cef_extension_handler_t* self,
|
||||
struct _cef_extension_t* extension,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_string_t* file,
|
||||
struct _cef_get_extension_resource_callback_t* callback);
|
||||
} cef_extension_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_EXTENSION_HANDLER_CAPI_H_
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
// Copyright (c) 2024 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=e10581d1f6aeb104646ae106aaa5fb36016643dd$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_FILE_UTIL_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_FILE_UTIL_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Creates a directory and all parent directories if they don't already exist.
|
||||
/// Returns true (1) on successful creation or if the directory already exists.
|
||||
/// The directory is only readable by the current user. Calling this function on
|
||||
/// the browser process UI or IO threads is not allowed.
|
||||
///
|
||||
CEF_EXPORT int cef_create_directory(const cef_string_t* full_path);
|
||||
|
||||
///
|
||||
/// Get the temporary directory provided by the system.
|
||||
///
|
||||
/// WARNING: In general, you should use the temp directory variants below
|
||||
/// instead of this function. Those variants will ensure that the proper
|
||||
/// permissions are set so that other users on the system can't edit them while
|
||||
/// they're open (which could lead to security issues).
|
||||
///
|
||||
CEF_EXPORT int cef_get_temp_directory(cef_string_t* temp_dir);
|
||||
|
||||
///
|
||||
/// Creates a new directory. On Windows if |prefix| is provided the new
|
||||
/// directory name is in the format of "prefixyyyy". Returns true (1) on success
|
||||
/// and sets |new_temp_path| to the full path of the directory that was created.
|
||||
/// The directory is only readable by the current user. Calling this function on
|
||||
/// the browser process UI or IO threads is not allowed.
|
||||
///
|
||||
CEF_EXPORT int cef_create_new_temp_directory(const cef_string_t* prefix,
|
||||
cef_string_t* new_temp_path);
|
||||
|
||||
///
|
||||
/// Creates a directory within another directory. Extra characters will be
|
||||
/// appended to |prefix| to ensure that the new directory does not have the same
|
||||
/// name as an existing directory. Returns true (1) on success and sets
|
||||
/// |new_dir| to the full path of the directory that was created. The directory
|
||||
/// is only readable by the current user. Calling this function on the browser
|
||||
/// process UI or IO threads is not allowed.
|
||||
///
|
||||
CEF_EXPORT int cef_create_temp_directory_in_directory(
|
||||
const cef_string_t* base_dir,
|
||||
const cef_string_t* prefix,
|
||||
cef_string_t* new_dir);
|
||||
|
||||
///
|
||||
/// Returns true (1) if the given path exists and is a directory. Calling this
|
||||
/// function on the browser process UI or IO threads is not allowed.
|
||||
///
|
||||
CEF_EXPORT int cef_directory_exists(const cef_string_t* path);
|
||||
|
||||
///
|
||||
/// Deletes the given path whether it's a file or a directory. If |path| is a
|
||||
/// directory all contents will be deleted. If |recursive| is true (1) any sub-
|
||||
/// directories and their contents will also be deleted (equivalent to executing
|
||||
/// "rm -rf", so use with caution). On POSIX environments if |path| is a
|
||||
/// symbolic link then only the symlink will be deleted. Returns true (1) on
|
||||
/// successful deletion or if |path| does not exist. Calling this function on
|
||||
/// the browser process UI or IO threads is not allowed.
|
||||
///
|
||||
CEF_EXPORT int cef_delete_file(const cef_string_t* path, int recursive);
|
||||
|
||||
///
|
||||
/// Writes the contents of |src_dir| into a zip archive at |dest_file|. If
|
||||
/// |include_hidden_files| is true (1) files starting with "." will be included.
|
||||
/// Returns true (1) on success. Calling this function on the browser process
|
||||
/// UI or IO threads is not allowed.
|
||||
///
|
||||
CEF_EXPORT int cef_zip_directory(const cef_string_t* src_dir,
|
||||
const cef_string_t* dest_file,
|
||||
int include_hidden_files);
|
||||
|
||||
///
|
||||
/// Loads the existing "Certificate Revocation Lists" file that is managed by
|
||||
/// Google Chrome. This file can generally be found in Chrome's User Data
|
||||
/// directory (e.g. "C:\Users\[User]\AppData\Local\Google\Chrome\User Data\" on
|
||||
/// Windows) and is updated periodically by Chrome's component updater service.
|
||||
/// Must be called in the browser process after the context has been
|
||||
/// initialized. See https://dev.chromium.org/Home/chromium-security/crlsets for
|
||||
/// background.
|
||||
///
|
||||
CEF_EXPORT void cef_load_crlsets_file(const cef_string_t* path);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_FILE_UTIL_CAPI_H_
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
// Copyright (c) 2024 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=da0a9242b309fbd70d19949fb1c5b4ec4475ef94$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_FIND_HANDLER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_FIND_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 events related to find results. The
|
||||
/// functions of this structure will be called on the UI thread.
|
||||
///
|
||||
typedef struct _cef_find_handler_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Called to report find results returned by cef_browser_host_t::find().
|
||||
/// |identifer| is a unique incremental identifier for the currently active
|
||||
/// search, |count| is the number of matches currently identified,
|
||||
/// |selectionRect| is the location of where the match was found (in window
|
||||
/// coordinates), |activeMatchOrdinal| is the current position in the search
|
||||
/// results, and |finalUpdate| is true (1) if this is the last find
|
||||
/// notification.
|
||||
///
|
||||
void(CEF_CALLBACK* on_find_result)(struct _cef_find_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
int identifier,
|
||||
int count,
|
||||
const cef_rect_t* selectionRect,
|
||||
int activeMatchOrdinal,
|
||||
int finalUpdate);
|
||||
} cef_find_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_FIND_HANDLER_CAPI_H_
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
// Copyright (c) 2024 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=6eefc2c650908461fb7536dd3314c77a3f89dceb$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_FOCUS_HANDLER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_FOCUS_HANDLER_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_browser_capi.h"
|
||||
#include "include/capi/cef_dom_capi.h"
|
||||
#include "include/capi/cef_frame_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Implement this structure to handle events related to focus. The functions of
|
||||
/// this structure will be called on the UI thread.
|
||||
///
|
||||
typedef struct _cef_focus_handler_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Called when the browser component is about to loose focus. For instance,
|
||||
/// if focus was on the last HTML element and the user pressed the TAB key.
|
||||
/// |next| will be true (1) if the browser is giving focus to the next
|
||||
/// component and false (0) if the browser is giving focus to the previous
|
||||
/// component.
|
||||
///
|
||||
void(CEF_CALLBACK* on_take_focus)(struct _cef_focus_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
int next);
|
||||
|
||||
///
|
||||
/// Called when the browser component is requesting focus. |source| indicates
|
||||
/// where the focus request is originating from. Return false (0) to allow the
|
||||
/// focus to be set or true (1) to cancel setting the focus.
|
||||
///
|
||||
int(CEF_CALLBACK* on_set_focus)(struct _cef_focus_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_focus_source_t source);
|
||||
|
||||
///
|
||||
/// Called when the browser component has received focus.
|
||||
///
|
||||
void(CEF_CALLBACK* on_got_focus)(struct _cef_focus_handler_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
} cef_focus_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_FOCUS_HANDLER_CAPI_H_
|
||||
|
|
@ -1,257 +0,0 @@
|
|||
// Copyright (c) 2024 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=8f347a95168778ec0e686cdef93be3bc517e2f68$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_FRAME_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_FRAME_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_dom_capi.h"
|
||||
#include "include/capi/cef_process_message_capi.h"
|
||||
#include "include/capi/cef_request_capi.h"
|
||||
#include "include/capi/cef_stream_capi.h"
|
||||
#include "include/capi/cef_string_visitor_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _cef_browser_t;
|
||||
struct _cef_urlrequest_client_t;
|
||||
struct _cef_urlrequest_t;
|
||||
struct _cef_v8context_t;
|
||||
|
||||
///
|
||||
/// Structure used to represent a frame in the 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_frame_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// True if this object is currently attached to a valid frame.
|
||||
///
|
||||
int(CEF_CALLBACK* is_valid)(struct _cef_frame_t* self);
|
||||
|
||||
///
|
||||
/// Execute undo in this frame.
|
||||
///
|
||||
void(CEF_CALLBACK* undo)(struct _cef_frame_t* self);
|
||||
|
||||
///
|
||||
/// Execute redo in this frame.
|
||||
///
|
||||
void(CEF_CALLBACK* redo)(struct _cef_frame_t* self);
|
||||
|
||||
///
|
||||
/// Execute cut in this frame.
|
||||
///
|
||||
void(CEF_CALLBACK* cut)(struct _cef_frame_t* self);
|
||||
|
||||
///
|
||||
/// Execute copy in this frame.
|
||||
///
|
||||
void(CEF_CALLBACK* copy)(struct _cef_frame_t* self);
|
||||
|
||||
///
|
||||
/// Execute paste in this frame.
|
||||
///
|
||||
void(CEF_CALLBACK* paste)(struct _cef_frame_t* self);
|
||||
|
||||
///
|
||||
/// Execute delete in this frame.
|
||||
///
|
||||
void(CEF_CALLBACK* del)(struct _cef_frame_t* self);
|
||||
|
||||
///
|
||||
/// Execute select all in this frame.
|
||||
///
|
||||
void(CEF_CALLBACK* select_all)(struct _cef_frame_t* self);
|
||||
|
||||
///
|
||||
/// Save this frame's HTML source to a temporary file and open it in the
|
||||
/// default text viewing application. This function can only be called from
|
||||
/// the browser process.
|
||||
///
|
||||
void(CEF_CALLBACK* view_source)(struct _cef_frame_t* self);
|
||||
|
||||
///
|
||||
/// Retrieve this frame's HTML source as a string sent to the specified
|
||||
/// visitor.
|
||||
///
|
||||
void(CEF_CALLBACK* get_source)(struct _cef_frame_t* self,
|
||||
struct _cef_string_visitor_t* visitor);
|
||||
|
||||
///
|
||||
/// Retrieve this frame's display text as a string sent to the specified
|
||||
/// visitor.
|
||||
///
|
||||
void(CEF_CALLBACK* get_text)(struct _cef_frame_t* self,
|
||||
struct _cef_string_visitor_t* visitor);
|
||||
|
||||
///
|
||||
/// Load the request represented by the |request| object.
|
||||
///
|
||||
/// WARNING: This function will fail with "bad IPC message" reason
|
||||
/// INVALID_INITIATOR_ORIGIN (213) unless you first navigate to the request
|
||||
/// origin using some other mechanism (LoadURL, link click, etc).
|
||||
///
|
||||
void(CEF_CALLBACK* load_request)(struct _cef_frame_t* self,
|
||||
struct _cef_request_t* request);
|
||||
|
||||
///
|
||||
/// Load the specified |url|.
|
||||
///
|
||||
void(CEF_CALLBACK* load_url)(struct _cef_frame_t* self,
|
||||
const cef_string_t* url);
|
||||
|
||||
///
|
||||
/// Execute a string of JavaScript code in this frame. The |script_url|
|
||||
/// parameter is the URL where the script in question can be found, if any.
|
||||
/// The renderer may request this URL to show the developer the source of the
|
||||
/// error. The |start_line| parameter is the base line number to use for
|
||||
/// error reporting.
|
||||
///
|
||||
void(CEF_CALLBACK* execute_java_script)(struct _cef_frame_t* self,
|
||||
const cef_string_t* code,
|
||||
const cef_string_t* script_url,
|
||||
int start_line);
|
||||
|
||||
///
|
||||
/// Returns true (1) if this is the main (top-level) frame.
|
||||
///
|
||||
int(CEF_CALLBACK* is_main)(struct _cef_frame_t* self);
|
||||
|
||||
///
|
||||
/// Returns true (1) if this is the focused frame.
|
||||
///
|
||||
int(CEF_CALLBACK* is_focused)(struct _cef_frame_t* self);
|
||||
|
||||
///
|
||||
/// Returns the name for this frame. If the frame has an assigned name (for
|
||||
/// example, set via the iframe "name" attribute) then that value will be
|
||||
/// returned. Otherwise a unique name will be constructed based on the frame
|
||||
/// parent hierarchy. The main (top-level) frame will always have an NULL name
|
||||
/// value.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_name)(struct _cef_frame_t* self);
|
||||
|
||||
///
|
||||
/// Returns the globally unique identifier for this frame or NULL if the
|
||||
/// underlying frame does not yet exist.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_identifier)(
|
||||
struct _cef_frame_t* self);
|
||||
|
||||
///
|
||||
/// Returns the parent of this frame or NULL if this is the main (top-level)
|
||||
/// frame.
|
||||
///
|
||||
struct _cef_frame_t*(CEF_CALLBACK* get_parent)(struct _cef_frame_t* self);
|
||||
|
||||
///
|
||||
/// Returns the URL currently loaded in this frame.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_url)(struct _cef_frame_t* self);
|
||||
|
||||
///
|
||||
/// Returns the browser that this frame belongs to.
|
||||
///
|
||||
struct _cef_browser_t*(CEF_CALLBACK* get_browser)(struct _cef_frame_t* self);
|
||||
|
||||
///
|
||||
/// Get the V8 context associated with the frame. This function can only be
|
||||
/// called from the render process.
|
||||
///
|
||||
struct _cef_v8context_t*(CEF_CALLBACK* get_v8context)(
|
||||
struct _cef_frame_t* self);
|
||||
|
||||
///
|
||||
/// Visit the DOM document. This function can only be called from the render
|
||||
/// process.
|
||||
///
|
||||
void(CEF_CALLBACK* visit_dom)(struct _cef_frame_t* self,
|
||||
struct _cef_domvisitor_t* visitor);
|
||||
|
||||
///
|
||||
/// Create a new URL request that will be treated as originating from this
|
||||
/// frame and the associated browser. Use cef_urlrequest_t::Create instead if
|
||||
/// you do not want the request to have this association, in which case it may
|
||||
/// be handled differently (see documentation on that function). A request
|
||||
/// created with this function may only originate from the browser process,
|
||||
/// and will behave as follows:
|
||||
/// - It may be intercepted by the client via CefResourceRequestHandler or
|
||||
/// CefSchemeHandlerFactory.
|
||||
/// - POST data may only contain a single element of type PDE_TYPE_FILE or
|
||||
/// PDE_TYPE_BYTES.
|
||||
///
|
||||
/// The |request| object will be marked as read-only after calling this
|
||||
/// function.
|
||||
///
|
||||
struct _cef_urlrequest_t*(CEF_CALLBACK* create_urlrequest)(
|
||||
struct _cef_frame_t* self,
|
||||
struct _cef_request_t* request,
|
||||
struct _cef_urlrequest_client_t* client);
|
||||
|
||||
///
|
||||
/// Send a message to the specified |target_process|. Ownership of the message
|
||||
/// contents will be transferred and the |message| reference will be
|
||||
/// invalidated. Message delivery is not guaranteed in all cases (for example,
|
||||
/// if the browser is closing, navigating, or if the target process crashes).
|
||||
/// Send an ACK message back from the target process if confirmation is
|
||||
/// required.
|
||||
///
|
||||
void(CEF_CALLBACK* send_process_message)(
|
||||
struct _cef_frame_t* self,
|
||||
cef_process_id_t target_process,
|
||||
struct _cef_process_message_t* message);
|
||||
} cef_frame_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_FRAME_CAPI_H_
|
||||
|
|
@ -1,195 +0,0 @@
|
|||
// Copyright (c) 2024 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=fc6fbee765ce2b649f5293c8c4b076d36014e4aa$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_FRAME_HANDLER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_FRAME_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 cef_frame_t life span.
|
||||
/// The order of callbacks is:
|
||||
///
|
||||
/// (1) During initial cef_browser_host_t creation and navigation of the main
|
||||
/// frame:
|
||||
/// - cef_frame_handler_t::OnFrameCreated => The initial main frame object has
|
||||
/// been created. Any commands will be queued until the frame is attached.
|
||||
/// - cef_frame_handler_t::OnMainFrameChanged => The initial main frame object
|
||||
/// has been assigned to the browser.
|
||||
/// - cef_life_span_handler_t::OnAfterCreated => The browser is now valid and
|
||||
/// can be used.
|
||||
/// - cef_frame_handler_t::OnFrameAttached => The initial main frame object is
|
||||
/// now connected to its peer in the renderer process. Commands can be routed.
|
||||
///
|
||||
/// (2) During further cef_browser_host_t navigation/loading of the main frame
|
||||
/// and/or sub-frames:
|
||||
/// - cef_frame_handler_t::OnFrameCreated => A new main frame or sub-frame
|
||||
/// object has been created. Any commands will be queued until the frame is
|
||||
/// attached.
|
||||
/// - cef_frame_handler_t::OnFrameAttached => A new main frame or sub-frame
|
||||
/// object is now connected to its peer in the renderer process. Commands can
|
||||
/// be routed.
|
||||
/// - cef_frame_handler_t::OnFrameDetached => An existing main frame or sub-
|
||||
/// frame object has lost its connection to the renderer process. If multiple
|
||||
/// objects are detached at the same time then notifications will be sent for
|
||||
/// any sub-frame objects before the main frame object. Commands can no longer
|
||||
/// be routed and will be discarded.
|
||||
/// - cef_frame_handler_t::OnMainFrameChanged => A new main frame object has
|
||||
/// been assigned to the browser. This will only occur with cross-origin
|
||||
/// navigation or re-navigation after renderer process termination (due to
|
||||
/// crashes, etc).
|
||||
///
|
||||
/// (3) During final cef_browser_host_t destruction of the main frame:
|
||||
/// - cef_frame_handler_t::OnFrameDetached => Any sub-frame objects have lost
|
||||
/// their connection to the renderer process. Commands can no longer be routed
|
||||
/// and will be discarded.
|
||||
/// - cef_life_span_handler_t::OnBeforeClose => The browser has been destroyed.
|
||||
/// - cef_frame_handler_t::OnFrameDetached => The main frame object have lost
|
||||
/// its connection to the renderer process. Notifications will be sent for any
|
||||
/// sub-frame objects before the main frame object. Commands can no longer be
|
||||
/// routed and will be discarded.
|
||||
/// - cef_frame_handler_t::OnMainFrameChanged => The final main frame object has
|
||||
/// been removed from the browser.
|
||||
///
|
||||
/// Cross-origin navigation and/or loading receives special handling.
|
||||
///
|
||||
/// When the main frame navigates to a different origin the OnMainFrameChanged
|
||||
/// callback (2) will be executed with the old and new main frame objects.
|
||||
///
|
||||
/// When a new sub-frame is loaded in, or an existing sub-frame is navigated to,
|
||||
/// a different origin from the parent frame, a temporary sub-frame object will
|
||||
/// first be created in the parent's renderer process. That temporary sub-frame
|
||||
/// will then be discarded after the real cross-origin sub-frame is created in
|
||||
/// the new/target renderer process. The client will receive cross-origin
|
||||
/// navigation callbacks (2) for the transition from the temporary sub-frame to
|
||||
/// the real sub-frame. The temporary sub-frame will not receive or execute
|
||||
/// commands during this transitional period (any sent commands will be
|
||||
/// discarded).
|
||||
///
|
||||
/// When a new popup browser is created in a different origin from the parent
|
||||
/// browser, a temporary main frame object for the popup will first be created
|
||||
/// in the parent's renderer process. That temporary main frame will then be
|
||||
/// discarded after the real cross-origin main frame is created in the
|
||||
/// new/target renderer process. The client will receive creation and initial
|
||||
/// navigation callbacks (1) for the temporary main frame, followed by cross-
|
||||
/// origin navigation callbacks (2) for the transition from the temporary main
|
||||
/// frame to the real main frame. The temporary main frame may receive and
|
||||
/// execute commands during this transitional period (any sent commands may be
|
||||
/// executed, but the behavior is potentially undesirable since they execute in
|
||||
/// the parent browser's renderer process and not the new/target renderer
|
||||
/// process).
|
||||
///
|
||||
/// Callbacks will not be executed for placeholders that may be created during
|
||||
/// pre-commit navigation for sub-frames that do not yet exist in the renderer
|
||||
/// process. Placeholders will have cef_frame_t::get_identifier() == -4.
|
||||
///
|
||||
/// The functions of this structure will be called on the UI thread unless
|
||||
/// otherwise indicated.
|
||||
///
|
||||
typedef struct _cef_frame_handler_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Called when a new frame is created. This will be the first notification
|
||||
/// that references |frame|. Any commands that require transport to the
|
||||
/// associated renderer process (LoadRequest, SendProcessMessage, GetSource,
|
||||
/// etc.) will be queued until OnFrameAttached is called for |frame|.
|
||||
///
|
||||
void(CEF_CALLBACK* on_frame_created)(struct _cef_frame_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame);
|
||||
|
||||
///
|
||||
/// Called when a frame can begin routing commands to/from the associated
|
||||
/// renderer process. |reattached| will be true (1) if the frame was re-
|
||||
/// attached after exiting the BackForwardCache. Any commands that were queued
|
||||
/// have now been dispatched.
|
||||
///
|
||||
void(CEF_CALLBACK* on_frame_attached)(struct _cef_frame_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
int reattached);
|
||||
|
||||
///
|
||||
/// Called when a frame loses its connection to the renderer process and will
|
||||
/// be destroyed. Any pending or future commands will be discarded and
|
||||
/// cef_frame_t::is_valid() will now return false (0) for |frame|. If called
|
||||
/// after cef_life_span_handler_t::on_before_close() during browser
|
||||
/// destruction then cef_browser_t::is_valid() will return false (0) for
|
||||
/// |browser|.
|
||||
///
|
||||
void(CEF_CALLBACK* on_frame_detached)(struct _cef_frame_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame);
|
||||
|
||||
///
|
||||
/// Called when the main frame changes due to (a) initial browser creation,
|
||||
/// (b) final browser destruction, (c) cross-origin navigation or (d) re-
|
||||
/// navigation after renderer process termination (due to crashes, etc).
|
||||
/// |old_frame| will be NULL and |new_frame| will be non-NULL when a main
|
||||
/// frame is assigned to |browser| for the first time. |old_frame| will be
|
||||
/// non-NULL and |new_frame| will be NULL and when a main frame is removed
|
||||
/// from |browser| for the last time. Both |old_frame| and |new_frame| will be
|
||||
/// non-NULL for cross-origin navigations or re-navigation after renderer
|
||||
/// process termination. This function will be called after on_frame_created()
|
||||
/// for |new_frame| and/or after on_frame_detached() for |old_frame|. If
|
||||
/// called after cef_life_span_handler_t::on_before_close() during browser
|
||||
/// destruction then cef_browser_t::is_valid() will return false (0) for
|
||||
/// |browser|.
|
||||
///
|
||||
void(CEF_CALLBACK* on_main_frame_changed)(struct _cef_frame_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* old_frame,
|
||||
struct _cef_frame_t* new_frame);
|
||||
} cef_frame_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_FRAME_HANDLER_CAPI_H_
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
// Copyright (c) 2024 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=990e80ab5ae04298e6b70cbc0a67115825563251$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_I18N_UTIL_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_I18N_UTIL_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Returns true (1) if the application text direction is right-to-left.
|
||||
///
|
||||
CEF_EXPORT int cef_is_rtl(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_I18N_UTIL_CAPI_H_
|
||||
|
|
@ -1,206 +0,0 @@
|
|||
// Copyright (c) 2024 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=7512ccf755017d5b1866b753890b498e8163006d$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_IMAGE_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_IMAGE_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_values_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Container for a single image represented at different scale factors. All
|
||||
/// image representations should be the same size in density independent pixel
|
||||
/// (DIP) units. For example, if the image at scale factor 1.0 is 100x100 pixels
|
||||
/// then the image at scale factor 2.0 should be 200x200 pixels -- both images
|
||||
/// will display with a DIP size of 100x100 units. The functions of this
|
||||
/// structure can be called on any browser process thread.
|
||||
///
|
||||
typedef struct _cef_image_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Returns true (1) if this Image is NULL.
|
||||
///
|
||||
int(CEF_CALLBACK* is_empty)(struct _cef_image_t* self);
|
||||
|
||||
///
|
||||
/// Returns true (1) if this Image and |that| Image share the same underlying
|
||||
/// storage. Will also return true (1) if both images are NULL.
|
||||
///
|
||||
int(CEF_CALLBACK* is_same)(struct _cef_image_t* self,
|
||||
struct _cef_image_t* that);
|
||||
|
||||
///
|
||||
/// Add a bitmap image representation for |scale_factor|. Only 32-bit
|
||||
/// RGBA/BGRA formats are supported. |pixel_width| and |pixel_height| are the
|
||||
/// bitmap representation size in pixel coordinates. |pixel_data| is the array
|
||||
/// of pixel data and should be |pixel_width| x |pixel_height| x 4 bytes in
|
||||
/// size. |color_type| and |alpha_type| values specify the pixel format.
|
||||
///
|
||||
int(CEF_CALLBACK* add_bitmap)(struct _cef_image_t* self,
|
||||
float scale_factor,
|
||||
int pixel_width,
|
||||
int pixel_height,
|
||||
cef_color_type_t color_type,
|
||||
cef_alpha_type_t alpha_type,
|
||||
const void* pixel_data,
|
||||
size_t pixel_data_size);
|
||||
|
||||
///
|
||||
/// Add a PNG image representation for |scale_factor|. |png_data| is the image
|
||||
/// data of size |png_data_size|. Any alpha transparency in the PNG data will
|
||||
/// be maintained.
|
||||
///
|
||||
int(CEF_CALLBACK* add_png)(struct _cef_image_t* self,
|
||||
float scale_factor,
|
||||
const void* png_data,
|
||||
size_t png_data_size);
|
||||
|
||||
///
|
||||
/// Create a JPEG image representation for |scale_factor|. |jpeg_data| is the
|
||||
/// image data of size |jpeg_data_size|. The JPEG format does not support
|
||||
/// transparency so the alpha byte will be set to 0xFF for all pixels.
|
||||
///
|
||||
int(CEF_CALLBACK* add_jpeg)(struct _cef_image_t* self,
|
||||
float scale_factor,
|
||||
const void* jpeg_data,
|
||||
size_t jpeg_data_size);
|
||||
|
||||
///
|
||||
/// Returns the image width in density independent pixel (DIP) units.
|
||||
///
|
||||
size_t(CEF_CALLBACK* get_width)(struct _cef_image_t* self);
|
||||
|
||||
///
|
||||
/// Returns the image height in density independent pixel (DIP) units.
|
||||
///
|
||||
size_t(CEF_CALLBACK* get_height)(struct _cef_image_t* self);
|
||||
|
||||
///
|
||||
/// Returns true (1) if this image contains a representation for
|
||||
/// |scale_factor|.
|
||||
///
|
||||
int(CEF_CALLBACK* has_representation)(struct _cef_image_t* self,
|
||||
float scale_factor);
|
||||
|
||||
///
|
||||
/// Removes the representation for |scale_factor|. Returns true (1) on
|
||||
/// success.
|
||||
///
|
||||
int(CEF_CALLBACK* remove_representation)(struct _cef_image_t* self,
|
||||
float scale_factor);
|
||||
|
||||
///
|
||||
/// Returns information for the representation that most closely matches
|
||||
/// |scale_factor|. |actual_scale_factor| is the actual scale factor for the
|
||||
/// representation. |pixel_width| and |pixel_height| are the representation
|
||||
/// size in pixel coordinates. Returns true (1) on success.
|
||||
///
|
||||
int(CEF_CALLBACK* get_representation_info)(struct _cef_image_t* self,
|
||||
float scale_factor,
|
||||
float* actual_scale_factor,
|
||||
int* pixel_width,
|
||||
int* pixel_height);
|
||||
|
||||
///
|
||||
/// Returns the bitmap representation that most closely matches
|
||||
/// |scale_factor|. Only 32-bit RGBA/BGRA formats are supported. |color_type|
|
||||
/// and |alpha_type| values specify the desired output pixel format.
|
||||
/// |pixel_width| and |pixel_height| are the output representation size in
|
||||
/// pixel coordinates. Returns a cef_binary_value_t containing the pixel data
|
||||
/// on success or NULL on failure.
|
||||
///
|
||||
struct _cef_binary_value_t*(CEF_CALLBACK* get_as_bitmap)(
|
||||
struct _cef_image_t* self,
|
||||
float scale_factor,
|
||||
cef_color_type_t color_type,
|
||||
cef_alpha_type_t alpha_type,
|
||||
int* pixel_width,
|
||||
int* pixel_height);
|
||||
|
||||
///
|
||||
/// Returns the PNG representation that most closely matches |scale_factor|.
|
||||
/// If |with_transparency| is true (1) any alpha transparency in the image
|
||||
/// will be represented in the resulting PNG data. |pixel_width| and
|
||||
/// |pixel_height| are the output representation size in pixel coordinates.
|
||||
/// Returns a cef_binary_value_t containing the PNG image data on success or
|
||||
/// NULL on failure.
|
||||
///
|
||||
struct _cef_binary_value_t*(CEF_CALLBACK* get_as_png)(
|
||||
struct _cef_image_t* self,
|
||||
float scale_factor,
|
||||
int with_transparency,
|
||||
int* pixel_width,
|
||||
int* pixel_height);
|
||||
|
||||
///
|
||||
/// Returns the JPEG representation that most closely matches |scale_factor|.
|
||||
/// |quality| determines the compression level with 0 == lowest and 100 ==
|
||||
/// highest. The JPEG format does not support alpha transparency and the alpha
|
||||
/// channel, if any, will be discarded. |pixel_width| and |pixel_height| are
|
||||
/// the output representation size in pixel coordinates. Returns a
|
||||
/// cef_binary_value_t containing the JPEG image data on success or NULL on
|
||||
/// failure.
|
||||
///
|
||||
struct _cef_binary_value_t*(CEF_CALLBACK* get_as_jpeg)(
|
||||
struct _cef_image_t* self,
|
||||
float scale_factor,
|
||||
int quality,
|
||||
int* pixel_width,
|
||||
int* pixel_height);
|
||||
} cef_image_t;
|
||||
|
||||
///
|
||||
/// Create a new cef_image_t. It will initially be NULL. Use the Add*()
|
||||
/// functions to add representations at different scale factors.
|
||||
///
|
||||
CEF_EXPORT cef_image_t* cef_image_create(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_IMAGE_CAPI_H_
|
||||
|
|
@ -1,141 +0,0 @@
|
|||
// Copyright (c) 2024 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=c6810367ba3a17824247dcb17f87040cd021c295$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_JSDIALOG_HANDLER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_JSDIALOG_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 used for asynchronous continuation of JavaScript dialog
|
||||
/// requests.
|
||||
///
|
||||
typedef struct _cef_jsdialog_callback_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Continue the JS dialog request. Set |success| to true (1) if the OK button
|
||||
/// was pressed. The |user_input| value should be specified for prompt
|
||||
/// dialogs.
|
||||
///
|
||||
void(CEF_CALLBACK* cont)(struct _cef_jsdialog_callback_t* self,
|
||||
int success,
|
||||
const cef_string_t* user_input);
|
||||
} cef_jsdialog_callback_t;
|
||||
|
||||
///
|
||||
/// Implement this structure to handle events related to JavaScript dialogs. The
|
||||
/// functions of this structure will be called on the UI thread.
|
||||
///
|
||||
typedef struct _cef_jsdialog_handler_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Called to run a JavaScript dialog. If |origin_url| is non-NULL it can be
|
||||
/// passed to the CefFormatUrlForSecurityDisplay function to retrieve a secure
|
||||
/// and user-friendly display string. The |default_prompt_text| value will be
|
||||
/// specified for prompt dialogs only. Set |suppress_message| to true (1) and
|
||||
/// return false (0) to suppress the message (suppressing messages is
|
||||
/// preferable to immediately executing the callback as this is used to detect
|
||||
/// presumably malicious behavior like spamming alert messages in
|
||||
/// onbeforeunload). Set |suppress_message| to false (0) and return false (0)
|
||||
/// to use the default implementation (the default implementation will show
|
||||
/// one modal dialog at a time and suppress any additional dialog requests
|
||||
/// until the displayed dialog is dismissed). Return true (1) if the
|
||||
/// application will use a custom dialog or if the callback has been executed
|
||||
/// immediately. Custom dialogs may be either modal or modeless. If a custom
|
||||
/// dialog is used the application must execute |callback| once the custom
|
||||
/// dialog is dismissed.
|
||||
///
|
||||
int(CEF_CALLBACK* on_jsdialog)(struct _cef_jsdialog_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_string_t* origin_url,
|
||||
cef_jsdialog_type_t dialog_type,
|
||||
const cef_string_t* message_text,
|
||||
const cef_string_t* default_prompt_text,
|
||||
struct _cef_jsdialog_callback_t* callback,
|
||||
int* suppress_message);
|
||||
|
||||
///
|
||||
/// Called to run a dialog asking the user if they want to leave a page.
|
||||
/// Return false (0) to use the default dialog implementation. Return true (1)
|
||||
/// if the application will use a custom dialog or if the callback has been
|
||||
/// executed immediately. Custom dialogs may be either modal or modeless. If a
|
||||
/// custom dialog is used the application must execute |callback| once the
|
||||
/// custom dialog is dismissed.
|
||||
///
|
||||
int(CEF_CALLBACK* on_before_unload_dialog)(
|
||||
struct _cef_jsdialog_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_string_t* message_text,
|
||||
int is_reload,
|
||||
struct _cef_jsdialog_callback_t* callback);
|
||||
|
||||
///
|
||||
/// Called to cancel any pending dialogs and reset any saved dialog state.
|
||||
/// Will be called due to events like page navigation irregardless of whether
|
||||
/// any dialogs are currently pending.
|
||||
///
|
||||
void(CEF_CALLBACK* on_reset_dialog_state)(
|
||||
struct _cef_jsdialog_handler_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
|
||||
///
|
||||
/// Called when the dialog is closed.
|
||||
///
|
||||
void(CEF_CALLBACK* on_dialog_closed)(struct _cef_jsdialog_handler_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
} cef_jsdialog_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_JSDIALOG_HANDLER_CAPI_H_
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
// Copyright (c) 2024 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=0bfe161c51cc6378b2e8e2e2b2c017b750b46864$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_KEYBOARD_HANDLER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_KEYBOARD_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 events related to keyboard input. The
|
||||
/// functions of this structure will be called on the UI thread.
|
||||
///
|
||||
typedef struct _cef_keyboard_handler_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Called before a keyboard event is sent to the renderer. |event| contains
|
||||
/// information about the keyboard event. |os_event| is the operating system
|
||||
/// event message, if any. Return true (1) if the event was handled or false
|
||||
/// (0) otherwise. If the event will be handled in on_key_event() as a
|
||||
/// keyboard shortcut set |is_keyboard_shortcut| to true (1) and return false
|
||||
/// (0).
|
||||
///
|
||||
int(CEF_CALLBACK* on_pre_key_event)(struct _cef_keyboard_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_key_event_t* event,
|
||||
cef_event_handle_t os_event,
|
||||
int* is_keyboard_shortcut);
|
||||
|
||||
///
|
||||
/// Called after the renderer and JavaScript in the page has had a chance to
|
||||
/// handle the event. |event| contains information about the keyboard event.
|
||||
/// |os_event| is the operating system event message, if any. Return true (1)
|
||||
/// if the keyboard event was handled or false (0) otherwise.
|
||||
///
|
||||
int(CEF_CALLBACK* on_key_event)(struct _cef_keyboard_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_key_event_t* event,
|
||||
cef_event_handle_t os_event);
|
||||
} cef_keyboard_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_KEYBOARD_HANDLER_CAPI_H_
|
||||
|
|
@ -1,253 +0,0 @@
|
|||
// Copyright (c) 2024 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=54edf9e9c2a12acdc4cab55079a4a5cb8e2a1e43$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_LIFE_SPAN_HANDLER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_LIFE_SPAN_HANDLER_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_browser_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _cef_client_t;
|
||||
|
||||
///
|
||||
/// Implement this structure to handle events related to browser life span. The
|
||||
/// functions of this structure will be called on the UI thread unless otherwise
|
||||
/// indicated.
|
||||
///
|
||||
typedef struct _cef_life_span_handler_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Called on the UI thread before a new popup browser is created. The
|
||||
/// |browser| and |frame| values represent the source of the popup request.
|
||||
/// The |target_url| and |target_frame_name| values indicate where the popup
|
||||
/// browser should navigate and may be NULL if not specified with the request.
|
||||
/// The |target_disposition| value indicates where the user intended to open
|
||||
/// the popup (e.g. current tab, new tab, etc). The |user_gesture| value will
|
||||
/// be true (1) if the popup was opened via explicit user gesture (e.g.
|
||||
/// clicking a link) or false (0) if the popup opened automatically (e.g. via
|
||||
/// the DomContentLoaded event). The |popupFeatures| structure contains
|
||||
/// additional information about the requested popup window. To allow creation
|
||||
/// of the popup browser optionally modify |windowInfo|, |client|, |settings|
|
||||
/// and |no_javascript_access| and return false (0). To cancel creation of the
|
||||
/// popup browser return true (1). The |client| and |settings| values will
|
||||
/// default to the source browser's values. If the |no_javascript_access|
|
||||
/// value is set to false (0) the new browser will not be scriptable and may
|
||||
/// not be hosted in the same renderer process as the source browser. Any
|
||||
/// modifications to |windowInfo| will be ignored if the parent browser is
|
||||
/// wrapped in a cef_browser_view_t. Popup browser creation will be canceled
|
||||
/// if the parent browser is destroyed before the popup browser creation
|
||||
/// completes (indicated by a call to OnAfterCreated for the popup browser).
|
||||
/// The |extra_info| parameter provides an opportunity to specify extra
|
||||
/// information specific to the created popup browser that will be passed to
|
||||
/// cef_render_process_handler_t::on_browser_created() in the render process.
|
||||
///
|
||||
int(CEF_CALLBACK* on_before_popup)(
|
||||
struct _cef_life_span_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
const cef_string_t* target_url,
|
||||
const cef_string_t* target_frame_name,
|
||||
cef_window_open_disposition_t target_disposition,
|
||||
int user_gesture,
|
||||
const cef_popup_features_t* popupFeatures,
|
||||
struct _cef_window_info_t* windowInfo,
|
||||
struct _cef_client_t** client,
|
||||
struct _cef_browser_settings_t* settings,
|
||||
struct _cef_dictionary_value_t** extra_info,
|
||||
int* no_javascript_access);
|
||||
|
||||
///
|
||||
/// Called on the UI thread before a new DevTools popup browser is created.
|
||||
/// The |browser| value represents the source of the popup request. Optionally
|
||||
/// modify |windowInfo|, |client|, |settings| and |extra_info| values. The
|
||||
/// |client|, |settings| and |extra_info| values will default to the source
|
||||
/// browser's values. Any modifications to |windowInfo| will be ignored if the
|
||||
/// parent browser is Views-hosted (wrapped in a cef_browser_view_t).
|
||||
///
|
||||
/// The |extra_info| parameter provides an opportunity to specify extra
|
||||
/// information specific to the created popup browser that will be passed to
|
||||
/// cef_render_process_handler_t::on_browser_created() in the render process.
|
||||
/// The existing |extra_info| object, if any, will be read-only but may be
|
||||
/// replaced with a new object.
|
||||
///
|
||||
/// Views-hosted source browsers will create Views-hosted DevTools popups
|
||||
/// unless |use_default_window| is set to to true (1). DevTools popups can be
|
||||
/// blocked by returning true (1) from cef_command_handler_t::OnChromeCommand
|
||||
/// for IDC_DEV_TOOLS. Only used with the Chrome runtime.
|
||||
///
|
||||
void(CEF_CALLBACK* on_before_dev_tools_popup)(
|
||||
struct _cef_life_span_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_window_info_t* windowInfo,
|
||||
struct _cef_client_t** client,
|
||||
struct _cef_browser_settings_t* settings,
|
||||
struct _cef_dictionary_value_t** extra_info,
|
||||
int* use_default_window);
|
||||
|
||||
///
|
||||
/// Called after a new browser is created. It is now safe to begin performing
|
||||
/// actions with |browser|. cef_frame_handler_t callbacks related to initial
|
||||
/// main frame creation will arrive before this callback. See
|
||||
/// cef_frame_handler_t documentation for additional usage information.
|
||||
///
|
||||
void(CEF_CALLBACK* on_after_created)(struct _cef_life_span_handler_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
|
||||
///
|
||||
/// Called when a browser has received a request to close. This may result
|
||||
/// directly from a call to cef_browser_host_t::*close_browser() or indirectly
|
||||
/// if the browser is parented to a top-level window created by CEF and the
|
||||
/// user attempts to close that window (by clicking the 'X', for example). The
|
||||
/// do_close() function will be called after the JavaScript 'onunload' event
|
||||
/// has been fired.
|
||||
///
|
||||
/// An application should handle top-level owner window close notifications by
|
||||
/// calling cef_browser_host_t::try_close_browser() or
|
||||
/// cef_browser_host_t::CloseBrowser(false (0)) instead of allowing the window
|
||||
/// to close immediately (see the examples below). This gives CEF an
|
||||
/// opportunity to process the 'onbeforeunload' event and optionally cancel
|
||||
/// the close before do_close() is called.
|
||||
///
|
||||
/// When windowed rendering is enabled CEF will internally create a window or
|
||||
/// view to host the browser. In that case returning false (0) from do_close()
|
||||
/// will send the standard close notification to the browser's top-level owner
|
||||
/// window (e.g. WM_CLOSE on Windows, performClose: on OS X, "delete_event" on
|
||||
/// Linux or cef_window_delegate_t::can_close() callback from Views). If the
|
||||
/// browser's host window/view has already been destroyed (via view hierarchy
|
||||
/// tear-down, for example) then do_close() will not be called for that
|
||||
/// browser since is no longer possible to cancel the close.
|
||||
///
|
||||
/// When windowed rendering is disabled returning false (0) from do_close()
|
||||
/// will cause the browser object to be destroyed immediately.
|
||||
///
|
||||
/// If the browser's top-level owner window requires a non-standard close
|
||||
/// notification then send that notification from do_close() and return true
|
||||
/// (1).
|
||||
///
|
||||
/// The cef_life_span_handler_t::on_before_close() function will be called
|
||||
/// after do_close() (if do_close() is called) and immediately before the
|
||||
/// browser object is destroyed. The application should only exit after
|
||||
/// on_before_close() has been called for all existing browsers.
|
||||
///
|
||||
/// The below examples describe what should happen during window close when
|
||||
/// the browser is parented to an application-provided top-level window.
|
||||
///
|
||||
/// Example 1: Using cef_browser_host_t::try_close_browser(). This is
|
||||
/// recommended for clients using standard close handling and windows created
|
||||
/// on the browser process UI thread. 1. User clicks the window close button
|
||||
/// which sends a close notification
|
||||
/// to the application's top-level window.
|
||||
/// 2. Application's top-level window receives the close notification and
|
||||
/// calls TryCloseBrowser() (which internally calls CloseBrowser(false)).
|
||||
/// TryCloseBrowser() returns false so the client cancels the window
|
||||
/// close.
|
||||
/// 3. JavaScript 'onbeforeunload' handler executes and shows the close
|
||||
/// confirmation dialog (which can be overridden via
|
||||
/// CefJSDialogHandler::OnBeforeUnloadDialog()).
|
||||
/// 4. User approves the close. 5. JavaScript 'onunload' handler executes.
|
||||
/// 6. CEF sends a close notification to the application's top-level window
|
||||
/// (because DoClose() returned false by default).
|
||||
/// 7. Application's top-level window receives the close notification and
|
||||
/// calls TryCloseBrowser(). TryCloseBrowser() returns true so the client
|
||||
/// allows the window close.
|
||||
/// 8. Application's top-level window is destroyed. 9. Application's
|
||||
/// on_before_close() handler is called and the browser object
|
||||
/// is destroyed.
|
||||
/// 10. Application exits by calling cef_quit_message_loop() if no other
|
||||
/// browsers
|
||||
/// exist.
|
||||
///
|
||||
/// Example 2: Using cef_browser_host_t::CloseBrowser(false (0)) and
|
||||
/// implementing the do_close() callback. This is recommended for clients
|
||||
/// using non-standard close handling or windows that were not created on the
|
||||
/// browser process UI thread. 1. User clicks the window close button which
|
||||
/// sends a close notification
|
||||
/// to the application's top-level window.
|
||||
/// 2. Application's top-level window receives the close notification and:
|
||||
/// A. Calls CefBrowserHost::CloseBrowser(false).
|
||||
/// B. Cancels the window close.
|
||||
/// 3. JavaScript 'onbeforeunload' handler executes and shows the close
|
||||
/// confirmation dialog (which can be overridden via
|
||||
/// CefJSDialogHandler::OnBeforeUnloadDialog()).
|
||||
/// 4. User approves the close. 5. JavaScript 'onunload' handler executes.
|
||||
/// 6. Application's do_close() handler is called. Application will:
|
||||
/// A. Set a flag to indicate that the next close attempt will be allowed.
|
||||
/// B. Return false.
|
||||
/// 7. CEF sends an close notification to the application's top-level window.
|
||||
/// 8. Application's top-level window receives the close notification and
|
||||
/// allows the window to close based on the flag from #6B.
|
||||
/// 9. Application's top-level window is destroyed. 10. Application's
|
||||
/// on_before_close() handler is called and the browser object
|
||||
/// is destroyed.
|
||||
/// 11. Application exits by calling cef_quit_message_loop() if no other
|
||||
/// browsers
|
||||
/// exist.
|
||||
///
|
||||
int(CEF_CALLBACK* do_close)(struct _cef_life_span_handler_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
|
||||
///
|
||||
/// Called just before a browser is destroyed. Release all references to the
|
||||
/// browser object and do not attempt to execute any functions on the browser
|
||||
/// object (other than IsValid, GetIdentifier or IsSame) after this callback
|
||||
/// returns. cef_frame_handler_t callbacks related to final main frame
|
||||
/// destruction will arrive after this callback and cef_browser_t::IsValid
|
||||
/// will return false (0) at that time. Any in-progress network requests
|
||||
/// associated with |browser| will be aborted when the browser is destroyed,
|
||||
/// and cef_resource_request_handler_t callbacks related to those requests may
|
||||
/// still arrive on the IO thread after this callback. See cef_frame_handler_t
|
||||
/// and do_close() documentation for additional usage information.
|
||||
///
|
||||
void(CEF_CALLBACK* on_before_close)(struct _cef_life_span_handler_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
} cef_life_span_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_LIFE_SPAN_HANDLER_CAPI_H_
|
||||
|
|
@ -1,126 +0,0 @@
|
|||
// Copyright (c) 2024 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=eb842e65cd2e7c4a8a6baa2813b57ac0d3977261$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_LOAD_HANDLER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_LOAD_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 load status.
|
||||
/// The functions of this structure will be called on the browser process UI
|
||||
/// thread or render process main thread (TID_RENDERER).
|
||||
///
|
||||
typedef struct _cef_load_handler_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Called when the loading state has changed. This callback will be executed
|
||||
/// twice -- once when loading is initiated either programmatically or by user
|
||||
/// action, and once when loading is terminated due to completion,
|
||||
/// cancellation of failure. It will be called before any calls to OnLoadStart
|
||||
/// and after all calls to OnLoadError and/or OnLoadEnd.
|
||||
///
|
||||
void(CEF_CALLBACK* on_loading_state_change)(struct _cef_load_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
int isLoading,
|
||||
int canGoBack,
|
||||
int canGoForward);
|
||||
|
||||
///
|
||||
/// Called after a navigation has been committed and before the browser begins
|
||||
/// loading contents in the frame. The |frame| value will never be NULL --
|
||||
/// call the is_main() function to check if this frame is the main frame.
|
||||
/// |transition_type| provides information about the source of the navigation
|
||||
/// and an accurate value is only available in the browser process. Multiple
|
||||
/// frames may be loading at the same time. Sub-frames may start or continue
|
||||
/// loading after the main frame load has ended. This function will not be
|
||||
/// called for same page navigations (fragments, history state, etc.) or for
|
||||
/// navigations that fail or are canceled before commit. For notification of
|
||||
/// overall browser load status use OnLoadingStateChange instead.
|
||||
///
|
||||
void(CEF_CALLBACK* on_load_start)(struct _cef_load_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
cef_transition_type_t transition_type);
|
||||
|
||||
///
|
||||
/// Called when the browser is done loading a frame. The |frame| value will
|
||||
/// never be NULL -- call the is_main() function to check if this frame is the
|
||||
/// main frame. Multiple frames may be loading at the same time. Sub-frames
|
||||
/// may start or continue loading after the main frame load has ended. This
|
||||
/// function will not be called for same page navigations (fragments, history
|
||||
/// state, etc.) or for navigations that fail or are canceled before commit.
|
||||
/// For notification of overall browser load status use OnLoadingStateChange
|
||||
/// instead.
|
||||
///
|
||||
void(CEF_CALLBACK* on_load_end)(struct _cef_load_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
int httpStatusCode);
|
||||
|
||||
///
|
||||
/// Called when a navigation fails or is canceled. This function may be called
|
||||
/// by itself if before commit or in combination with OnLoadStart/OnLoadEnd if
|
||||
/// after commit. |errorCode| is the error code number, |errorText| is the
|
||||
/// error text and |failedUrl| is the URL that failed to load. See
|
||||
/// net\base\net_error_list.h for complete descriptions of the error codes.
|
||||
///
|
||||
void(CEF_CALLBACK* on_load_error)(struct _cef_load_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
cef_errorcode_t errorCode,
|
||||
const cef_string_t* errorText,
|
||||
const cef_string_t* failedUrl);
|
||||
} cef_load_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_LOAD_HANDLER_CAPI_H_
|
||||
|
|
@ -1,342 +0,0 @@
|
|||
// Copyright (c) 2024 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=8eec1100e8470cbe3ebc54d5962416d2fa4d57fb$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_MEDIA_ROUTER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_MEDIA_ROUTER_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_callback_capi.h"
|
||||
#include "include/capi/cef_registration_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _cef_media_observer_t;
|
||||
struct _cef_media_route_create_callback_t;
|
||||
struct _cef_media_route_t;
|
||||
struct _cef_media_sink_device_info_callback_t;
|
||||
struct _cef_media_sink_t;
|
||||
struct _cef_media_source_t;
|
||||
|
||||
///
|
||||
/// Supports discovery of and communication with media devices on the local
|
||||
/// network via the Cast and DIAL protocols. The functions of this structure may
|
||||
/// be called on any browser process thread unless otherwise indicated.
|
||||
///
|
||||
typedef struct _cef_media_router_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Add an observer for MediaRouter events. The observer will remain
|
||||
/// registered until the returned Registration object is destroyed.
|
||||
///
|
||||
struct _cef_registration_t*(CEF_CALLBACK* add_observer)(
|
||||
struct _cef_media_router_t* self,
|
||||
struct _cef_media_observer_t* observer);
|
||||
|
||||
///
|
||||
/// Returns a MediaSource object for the specified media source URN. Supported
|
||||
/// URN schemes include "cast:" and "dial:", and will be already known by the
|
||||
/// client application (e.g. "cast:<appId>?clientId=<clientId>").
|
||||
///
|
||||
struct _cef_media_source_t*(CEF_CALLBACK* get_source)(
|
||||
struct _cef_media_router_t* self,
|
||||
const cef_string_t* urn);
|
||||
|
||||
///
|
||||
/// Trigger an asynchronous call to cef_media_observer_t::OnSinks on all
|
||||
/// registered observers.
|
||||
///
|
||||
void(CEF_CALLBACK* notify_current_sinks)(struct _cef_media_router_t* self);
|
||||
|
||||
///
|
||||
/// Create a new route between |source| and |sink|. Source and sink must be
|
||||
/// valid, compatible (as reported by cef_media_sink_t::IsCompatibleWith), and
|
||||
/// a route between them must not already exist. |callback| will be executed
|
||||
/// on success or failure. If route creation succeeds it will also trigger an
|
||||
/// asynchronous call to cef_media_observer_t::OnRoutes on all registered
|
||||
/// observers.
|
||||
///
|
||||
void(CEF_CALLBACK* create_route)(
|
||||
struct _cef_media_router_t* self,
|
||||
struct _cef_media_source_t* source,
|
||||
struct _cef_media_sink_t* sink,
|
||||
struct _cef_media_route_create_callback_t* callback);
|
||||
|
||||
///
|
||||
/// Trigger an asynchronous call to cef_media_observer_t::OnRoutes on all
|
||||
/// registered observers.
|
||||
///
|
||||
void(CEF_CALLBACK* notify_current_routes)(struct _cef_media_router_t* self);
|
||||
} cef_media_router_t;
|
||||
|
||||
///
|
||||
/// Returns the MediaRouter object associated with the global request context.
|
||||
/// If |callback| is non-NULL it will be executed asnychronously on the UI
|
||||
/// thread after the manager's storage has been initialized. Equivalent to
|
||||
/// calling cef_request_context_t::cef_request_context_get_global_context()-
|
||||
/// >get_media_router().
|
||||
///
|
||||
CEF_EXPORT cef_media_router_t* cef_media_router_get_global(
|
||||
struct _cef_completion_callback_t* callback);
|
||||
|
||||
///
|
||||
/// Implemented by the client to observe MediaRouter events and registered via
|
||||
/// cef_media_router_t::AddObserver. The functions of this structure will be
|
||||
/// called on the browser process UI thread.
|
||||
///
|
||||
typedef struct _cef_media_observer_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// The list of available media sinks has changed or
|
||||
/// cef_media_router_t::NotifyCurrentSinks was called.
|
||||
///
|
||||
void(CEF_CALLBACK* on_sinks)(struct _cef_media_observer_t* self,
|
||||
size_t sinksCount,
|
||||
struct _cef_media_sink_t* const* sinks);
|
||||
|
||||
///
|
||||
/// The list of available media routes has changed or
|
||||
/// cef_media_router_t::NotifyCurrentRoutes was called.
|
||||
///
|
||||
void(CEF_CALLBACK* on_routes)(struct _cef_media_observer_t* self,
|
||||
size_t routesCount,
|
||||
struct _cef_media_route_t* const* routes);
|
||||
|
||||
///
|
||||
/// The connection state of |route| has changed.
|
||||
///
|
||||
void(CEF_CALLBACK* on_route_state_changed)(
|
||||
struct _cef_media_observer_t* self,
|
||||
struct _cef_media_route_t* route,
|
||||
cef_media_route_connection_state_t state);
|
||||
|
||||
///
|
||||
/// A message was received over |route|. |message| is only valid for the scope
|
||||
/// of this callback and should be copied if necessary.
|
||||
///
|
||||
void(CEF_CALLBACK* on_route_message_received)(
|
||||
struct _cef_media_observer_t* self,
|
||||
struct _cef_media_route_t* route,
|
||||
const void* message,
|
||||
size_t message_size);
|
||||
} cef_media_observer_t;
|
||||
|
||||
///
|
||||
/// Represents the route between a media source and sink. Instances of this
|
||||
/// object are created via cef_media_router_t::CreateRoute and retrieved via
|
||||
/// cef_media_observer_t::OnRoutes. Contains the status and metadata of a
|
||||
/// routing operation. The functions of this structure may be called on any
|
||||
/// browser process thread unless otherwise indicated.
|
||||
///
|
||||
typedef struct _cef_media_route_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Returns the ID for this route.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_id)(struct _cef_media_route_t* self);
|
||||
|
||||
///
|
||||
/// Returns the source associated with this route.
|
||||
///
|
||||
struct _cef_media_source_t*(CEF_CALLBACK* get_source)(
|
||||
struct _cef_media_route_t* self);
|
||||
|
||||
///
|
||||
/// Returns the sink associated with this route.
|
||||
///
|
||||
struct _cef_media_sink_t*(CEF_CALLBACK* get_sink)(
|
||||
struct _cef_media_route_t* self);
|
||||
|
||||
///
|
||||
/// Send a message over this route. |message| will be copied if necessary.
|
||||
///
|
||||
void(CEF_CALLBACK* send_route_message)(struct _cef_media_route_t* self,
|
||||
const void* message,
|
||||
size_t message_size);
|
||||
|
||||
///
|
||||
/// Terminate this route. Will result in an asynchronous call to
|
||||
/// cef_media_observer_t::OnRoutes on all registered observers.
|
||||
///
|
||||
void(CEF_CALLBACK* terminate)(struct _cef_media_route_t* self);
|
||||
} cef_media_route_t;
|
||||
|
||||
///
|
||||
/// Callback structure for cef_media_router_t::CreateRoute. The functions of
|
||||
/// this structure will be called on the browser process UI thread.
|
||||
///
|
||||
typedef struct _cef_media_route_create_callback_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Method that will be executed when the route creation has finished.
|
||||
/// |result| will be CEF_MRCR_OK if the route creation succeeded. |error| will
|
||||
/// be a description of the error if the route creation failed. |route| is the
|
||||
/// resulting route, or NULL if the route creation failed.
|
||||
///
|
||||
void(CEF_CALLBACK* on_media_route_create_finished)(
|
||||
struct _cef_media_route_create_callback_t* self,
|
||||
cef_media_route_create_result_t result,
|
||||
const cef_string_t* error,
|
||||
struct _cef_media_route_t* route);
|
||||
} cef_media_route_create_callback_t;
|
||||
|
||||
///
|
||||
/// Represents a sink to which media can be routed. Instances of this object are
|
||||
/// retrieved via cef_media_observer_t::OnSinks. The functions of this structure
|
||||
/// may be called on any browser process thread unless otherwise indicated.
|
||||
///
|
||||
typedef struct _cef_media_sink_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Returns the ID for this sink.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_id)(struct _cef_media_sink_t* self);
|
||||
|
||||
///
|
||||
/// Returns the name of this sink.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_name)(struct _cef_media_sink_t* self);
|
||||
|
||||
///
|
||||
/// Returns the icon type for this sink.
|
||||
///
|
||||
cef_media_sink_icon_type_t(CEF_CALLBACK* get_icon_type)(
|
||||
struct _cef_media_sink_t* self);
|
||||
|
||||
///
|
||||
/// Asynchronously retrieves device info.
|
||||
///
|
||||
void(CEF_CALLBACK* get_device_info)(
|
||||
struct _cef_media_sink_t* self,
|
||||
struct _cef_media_sink_device_info_callback_t* callback);
|
||||
|
||||
///
|
||||
/// Returns true (1) if this sink accepts content via Cast.
|
||||
///
|
||||
int(CEF_CALLBACK* is_cast_sink)(struct _cef_media_sink_t* self);
|
||||
|
||||
///
|
||||
/// Returns true (1) if this sink accepts content via DIAL.
|
||||
///
|
||||
int(CEF_CALLBACK* is_dial_sink)(struct _cef_media_sink_t* self);
|
||||
|
||||
///
|
||||
/// Returns true (1) if this sink is compatible with |source|.
|
||||
///
|
||||
int(CEF_CALLBACK* is_compatible_with)(struct _cef_media_sink_t* self,
|
||||
struct _cef_media_source_t* source);
|
||||
} cef_media_sink_t;
|
||||
|
||||
///
|
||||
/// Callback structure for cef_media_sink_t::GetDeviceInfo. The functions of
|
||||
/// this structure will be called on the browser process UI thread.
|
||||
///
|
||||
typedef struct _cef_media_sink_device_info_callback_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Method that will be executed asyncronously once device information has
|
||||
/// been retrieved.
|
||||
///
|
||||
void(CEF_CALLBACK* on_media_sink_device_info)(
|
||||
struct _cef_media_sink_device_info_callback_t* self,
|
||||
const struct _cef_media_sink_device_info_t* device_info);
|
||||
} cef_media_sink_device_info_callback_t;
|
||||
|
||||
///
|
||||
/// Represents a source from which media can be routed. Instances of this object
|
||||
/// are retrieved via cef_media_router_t::GetSource. The functions of this
|
||||
/// structure may be called on any browser process thread unless otherwise
|
||||
/// indicated.
|
||||
///
|
||||
typedef struct _cef_media_source_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Returns the ID (media source URN or URL) for this source.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_id)(struct _cef_media_source_t* self);
|
||||
|
||||
///
|
||||
/// Returns true (1) if this source outputs its content via Cast.
|
||||
///
|
||||
int(CEF_CALLBACK* is_cast_source)(struct _cef_media_source_t* self);
|
||||
|
||||
///
|
||||
/// Returns true (1) if this source outputs its content via DIAL.
|
||||
///
|
||||
int(CEF_CALLBACK* is_dial_source)(struct _cef_media_source_t* self);
|
||||
} cef_media_source_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_MEDIA_ROUTER_CAPI_H_
|
||||
|
|
@ -1,517 +0,0 @@
|
|||
// Copyright (c) 2024 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=5dae0b1a1271e79a5fd9b2c6e71e7a719a450161$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_MENU_MODEL_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_MENU_MODEL_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_menu_model_delegate_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Supports creation and modification of menus. 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. The functions of
|
||||
/// this structure can only be accessed on the browser process the UI thread.
|
||||
///
|
||||
typedef struct _cef_menu_model_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Returns true (1) if this menu is a submenu.
|
||||
///
|
||||
int(CEF_CALLBACK* is_sub_menu)(struct _cef_menu_model_t* self);
|
||||
|
||||
///
|
||||
/// Clears the menu. Returns true (1) on success.
|
||||
///
|
||||
int(CEF_CALLBACK* clear)(struct _cef_menu_model_t* self);
|
||||
|
||||
///
|
||||
/// Returns the number of items in this menu.
|
||||
///
|
||||
size_t(CEF_CALLBACK* get_count)(struct _cef_menu_model_t* self);
|
||||
|
||||
///
|
||||
/// Add a separator to the menu. Returns true (1) on success.
|
||||
///
|
||||
int(CEF_CALLBACK* add_separator)(struct _cef_menu_model_t* self);
|
||||
|
||||
///
|
||||
/// Add an item to the menu. Returns true (1) on success.
|
||||
///
|
||||
int(CEF_CALLBACK* add_item)(struct _cef_menu_model_t* self,
|
||||
int command_id,
|
||||
const cef_string_t* label);
|
||||
|
||||
///
|
||||
/// Add a check item to the menu. Returns true (1) on success.
|
||||
///
|
||||
int(CEF_CALLBACK* add_check_item)(struct _cef_menu_model_t* self,
|
||||
int command_id,
|
||||
const cef_string_t* label);
|
||||
|
||||
///
|
||||
/// Add a radio item to the menu. Only a single item with the specified
|
||||
/// |group_id| can be checked at a time. Returns true (1) on success.
|
||||
///
|
||||
int(CEF_CALLBACK* add_radio_item)(struct _cef_menu_model_t* self,
|
||||
int command_id,
|
||||
const cef_string_t* label,
|
||||
int group_id);
|
||||
|
||||
///
|
||||
/// Add a sub-menu to the menu. The new sub-menu is returned.
|
||||
///
|
||||
struct _cef_menu_model_t*(CEF_CALLBACK* add_sub_menu)(
|
||||
struct _cef_menu_model_t* self,
|
||||
int command_id,
|
||||
const cef_string_t* label);
|
||||
|
||||
///
|
||||
/// Insert a separator in the menu at the specified |index|. Returns true (1)
|
||||
/// on success.
|
||||
///
|
||||
int(CEF_CALLBACK* insert_separator_at)(struct _cef_menu_model_t* self,
|
||||
size_t index);
|
||||
|
||||
///
|
||||
/// Insert an item in the menu at the specified |index|. Returns true (1) on
|
||||
/// success.
|
||||
///
|
||||
int(CEF_CALLBACK* insert_item_at)(struct _cef_menu_model_t* self,
|
||||
size_t index,
|
||||
int command_id,
|
||||
const cef_string_t* label);
|
||||
|
||||
///
|
||||
/// Insert a check item in the menu at the specified |index|. Returns true (1)
|
||||
/// on success.
|
||||
///
|
||||
int(CEF_CALLBACK* insert_check_item_at)(struct _cef_menu_model_t* self,
|
||||
size_t index,
|
||||
int command_id,
|
||||
const cef_string_t* label);
|
||||
|
||||
///
|
||||
/// Insert a radio item in the menu at the specified |index|. Only a single
|
||||
/// item with the specified |group_id| can be checked at a time. Returns true
|
||||
/// (1) on success.
|
||||
///
|
||||
int(CEF_CALLBACK* insert_radio_item_at)(struct _cef_menu_model_t* self,
|
||||
size_t index,
|
||||
int command_id,
|
||||
const cef_string_t* label,
|
||||
int group_id);
|
||||
|
||||
///
|
||||
/// Insert a sub-menu in the menu at the specified |index|. The new sub-menu
|
||||
/// is returned.
|
||||
///
|
||||
struct _cef_menu_model_t*(CEF_CALLBACK* insert_sub_menu_at)(
|
||||
struct _cef_menu_model_t* self,
|
||||
size_t index,
|
||||
int command_id,
|
||||
const cef_string_t* label);
|
||||
|
||||
///
|
||||
/// Removes the item with the specified |command_id|. Returns true (1) on
|
||||
/// success.
|
||||
///
|
||||
int(CEF_CALLBACK* remove)(struct _cef_menu_model_t* self, int command_id);
|
||||
|
||||
///
|
||||
/// Removes the item at the specified |index|. Returns true (1) on success.
|
||||
///
|
||||
int(CEF_CALLBACK* remove_at)(struct _cef_menu_model_t* self, size_t index);
|
||||
|
||||
///
|
||||
/// Returns the index associated with the specified |command_id| or -1 if not
|
||||
/// found due to the command id not existing in the menu.
|
||||
///
|
||||
int(CEF_CALLBACK* get_index_of)(struct _cef_menu_model_t* self,
|
||||
int command_id);
|
||||
|
||||
///
|
||||
/// Returns the command id at the specified |index| or -1 if not found due to
|
||||
/// invalid range or the index being a separator.
|
||||
///
|
||||
int(CEF_CALLBACK* get_command_id_at)(struct _cef_menu_model_t* self,
|
||||
size_t index);
|
||||
|
||||
///
|
||||
/// Sets the command id at the specified |index|. Returns true (1) on success.
|
||||
///
|
||||
int(CEF_CALLBACK* set_command_id_at)(struct _cef_menu_model_t* self,
|
||||
size_t index,
|
||||
int command_id);
|
||||
|
||||
///
|
||||
/// Returns the label for the specified |command_id| or NULL if not found.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_label)(struct _cef_menu_model_t* self,
|
||||
int command_id);
|
||||
|
||||
///
|
||||
/// Returns the label at the specified |index| or NULL if not found due to
|
||||
/// invalid range or the index being a separator.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(
|
||||
CEF_CALLBACK* get_label_at)(struct _cef_menu_model_t* self, size_t index);
|
||||
|
||||
///
|
||||
/// Sets the label for the specified |command_id|. Returns true (1) on
|
||||
/// success.
|
||||
///
|
||||
int(CEF_CALLBACK* set_label)(struct _cef_menu_model_t* self,
|
||||
int command_id,
|
||||
const cef_string_t* label);
|
||||
|
||||
///
|
||||
/// Set the label at the specified |index|. Returns true (1) on success.
|
||||
///
|
||||
int(CEF_CALLBACK* set_label_at)(struct _cef_menu_model_t* self,
|
||||
size_t index,
|
||||
const cef_string_t* label);
|
||||
|
||||
///
|
||||
/// Returns the item type for the specified |command_id|.
|
||||
///
|
||||
cef_menu_item_type_t(CEF_CALLBACK* get_type)(struct _cef_menu_model_t* self,
|
||||
int command_id);
|
||||
|
||||
///
|
||||
/// Returns the item type at the specified |index|.
|
||||
///
|
||||
cef_menu_item_type_t(
|
||||
CEF_CALLBACK* get_type_at)(struct _cef_menu_model_t* self, size_t index);
|
||||
|
||||
///
|
||||
/// Returns the group id for the specified |command_id| or -1 if invalid.
|
||||
///
|
||||
int(CEF_CALLBACK* get_group_id)(struct _cef_menu_model_t* self,
|
||||
int command_id);
|
||||
|
||||
///
|
||||
/// Returns the group id at the specified |index| or -1 if invalid.
|
||||
///
|
||||
int(CEF_CALLBACK* get_group_id_at)(struct _cef_menu_model_t* self,
|
||||
size_t index);
|
||||
|
||||
///
|
||||
/// Sets the group id for the specified |command_id|. Returns true (1) on
|
||||
/// success.
|
||||
///
|
||||
int(CEF_CALLBACK* set_group_id)(struct _cef_menu_model_t* self,
|
||||
int command_id,
|
||||
int group_id);
|
||||
|
||||
///
|
||||
/// Sets the group id at the specified |index|. Returns true (1) on success.
|
||||
///
|
||||
int(CEF_CALLBACK* set_group_id_at)(struct _cef_menu_model_t* self,
|
||||
size_t index,
|
||||
int group_id);
|
||||
|
||||
///
|
||||
/// Returns the submenu for the specified |command_id| or NULL if invalid.
|
||||
///
|
||||
struct _cef_menu_model_t*(CEF_CALLBACK* get_sub_menu)(
|
||||
struct _cef_menu_model_t* self,
|
||||
int command_id);
|
||||
|
||||
///
|
||||
/// Returns the submenu at the specified |index| or NULL if invalid.
|
||||
///
|
||||
struct _cef_menu_model_t*(CEF_CALLBACK* get_sub_menu_at)(
|
||||
struct _cef_menu_model_t* self,
|
||||
size_t index);
|
||||
|
||||
///
|
||||
/// Returns true (1) if the specified |command_id| is visible.
|
||||
///
|
||||
int(CEF_CALLBACK* is_visible)(struct _cef_menu_model_t* self, int command_id);
|
||||
|
||||
///
|
||||
/// Returns true (1) if the specified |index| is visible.
|
||||
///
|
||||
int(CEF_CALLBACK* is_visible_at)(struct _cef_menu_model_t* self,
|
||||
size_t index);
|
||||
|
||||
///
|
||||
/// Change the visibility of the specified |command_id|. Returns true (1) on
|
||||
/// success.
|
||||
///
|
||||
int(CEF_CALLBACK* set_visible)(struct _cef_menu_model_t* self,
|
||||
int command_id,
|
||||
int visible);
|
||||
|
||||
///
|
||||
/// Change the visibility at the specified |index|. Returns true (1) on
|
||||
/// success.
|
||||
///
|
||||
int(CEF_CALLBACK* set_visible_at)(struct _cef_menu_model_t* self,
|
||||
size_t index,
|
||||
int visible);
|
||||
|
||||
///
|
||||
/// Returns true (1) if the specified |command_id| is enabled.
|
||||
///
|
||||
int(CEF_CALLBACK* is_enabled)(struct _cef_menu_model_t* self, int command_id);
|
||||
|
||||
///
|
||||
/// Returns true (1) if the specified |index| is enabled.
|
||||
///
|
||||
int(CEF_CALLBACK* is_enabled_at)(struct _cef_menu_model_t* self,
|
||||
size_t index);
|
||||
|
||||
///
|
||||
/// Change the enabled status of the specified |command_id|. Returns true (1)
|
||||
/// on success.
|
||||
///
|
||||
int(CEF_CALLBACK* set_enabled)(struct _cef_menu_model_t* self,
|
||||
int command_id,
|
||||
int enabled);
|
||||
|
||||
///
|
||||
/// Change the enabled status at the specified |index|. Returns true (1) on
|
||||
/// success.
|
||||
///
|
||||
int(CEF_CALLBACK* set_enabled_at)(struct _cef_menu_model_t* self,
|
||||
size_t index,
|
||||
int enabled);
|
||||
|
||||
///
|
||||
/// Returns true (1) if the specified |command_id| is checked. Only applies to
|
||||
/// check and radio items.
|
||||
///
|
||||
int(CEF_CALLBACK* is_checked)(struct _cef_menu_model_t* self, int command_id);
|
||||
|
||||
///
|
||||
/// Returns true (1) if the specified |index| is checked. Only applies to
|
||||
/// check and radio items.
|
||||
///
|
||||
int(CEF_CALLBACK* is_checked_at)(struct _cef_menu_model_t* self,
|
||||
size_t index);
|
||||
|
||||
///
|
||||
/// Check the specified |command_id|. Only applies to check and radio items.
|
||||
/// Returns true (1) on success.
|
||||
///
|
||||
int(CEF_CALLBACK* set_checked)(struct _cef_menu_model_t* self,
|
||||
int command_id,
|
||||
int checked);
|
||||
|
||||
///
|
||||
/// Check the specified |index|. Only applies to check and radio items.
|
||||
/// Returns true (1) on success.
|
||||
///
|
||||
int(CEF_CALLBACK* set_checked_at)(struct _cef_menu_model_t* self,
|
||||
size_t index,
|
||||
int checked);
|
||||
|
||||
///
|
||||
/// Returns true (1) if the specified |command_id| has a keyboard accelerator
|
||||
/// assigned.
|
||||
///
|
||||
int(CEF_CALLBACK* has_accelerator)(struct _cef_menu_model_t* self,
|
||||
int command_id);
|
||||
|
||||
///
|
||||
/// Returns true (1) if the specified |index| has a keyboard accelerator
|
||||
/// assigned.
|
||||
///
|
||||
int(CEF_CALLBACK* has_accelerator_at)(struct _cef_menu_model_t* self,
|
||||
size_t index);
|
||||
|
||||
///
|
||||
/// Set the keyboard accelerator for the specified |command_id|. |key_code|
|
||||
/// can be any virtual key or character value. Returns true (1) on success.
|
||||
///
|
||||
int(CEF_CALLBACK* set_accelerator)(struct _cef_menu_model_t* self,
|
||||
int command_id,
|
||||
int key_code,
|
||||
int shift_pressed,
|
||||
int ctrl_pressed,
|
||||
int alt_pressed);
|
||||
|
||||
///
|
||||
/// Set the keyboard accelerator at the specified |index|. |key_code| can be
|
||||
/// any virtual key or character value. Returns true (1) on success.
|
||||
///
|
||||
int(CEF_CALLBACK* set_accelerator_at)(struct _cef_menu_model_t* self,
|
||||
size_t index,
|
||||
int key_code,
|
||||
int shift_pressed,
|
||||
int ctrl_pressed,
|
||||
int alt_pressed);
|
||||
|
||||
///
|
||||
/// Remove the keyboard accelerator for the specified |command_id|. Returns
|
||||
/// true (1) on success.
|
||||
///
|
||||
int(CEF_CALLBACK* remove_accelerator)(struct _cef_menu_model_t* self,
|
||||
int command_id);
|
||||
|
||||
///
|
||||
/// Remove the keyboard accelerator at the specified |index|. Returns true (1)
|
||||
/// on success.
|
||||
///
|
||||
int(CEF_CALLBACK* remove_accelerator_at)(struct _cef_menu_model_t* self,
|
||||
size_t index);
|
||||
|
||||
///
|
||||
/// Retrieves the keyboard accelerator for the specified |command_id|. Returns
|
||||
/// true (1) on success.
|
||||
///
|
||||
int(CEF_CALLBACK* get_accelerator)(struct _cef_menu_model_t* self,
|
||||
int command_id,
|
||||
int* key_code,
|
||||
int* shift_pressed,
|
||||
int* ctrl_pressed,
|
||||
int* alt_pressed);
|
||||
|
||||
///
|
||||
/// Retrieves the keyboard accelerator for the specified |index|. Returns true
|
||||
/// (1) on success.
|
||||
///
|
||||
int(CEF_CALLBACK* get_accelerator_at)(struct _cef_menu_model_t* self,
|
||||
size_t index,
|
||||
int* key_code,
|
||||
int* shift_pressed,
|
||||
int* ctrl_pressed,
|
||||
int* alt_pressed);
|
||||
|
||||
///
|
||||
/// Set the explicit color for |command_id| and |color_type| to |color|.
|
||||
/// Specify a |color| value of 0 to remove the explicit color. If no explicit
|
||||
/// color or default color is set for |color_type| then the system color will
|
||||
/// be used. Returns true (1) on success.
|
||||
///
|
||||
int(CEF_CALLBACK* set_color)(struct _cef_menu_model_t* self,
|
||||
int command_id,
|
||||
cef_menu_color_type_t color_type,
|
||||
cef_color_t color);
|
||||
|
||||
///
|
||||
/// Set the explicit color for |command_id| and |index| to |color|. Specify a
|
||||
/// |color| value of 0 to remove the explicit color. Specify an |index| value
|
||||
/// of -1 to set the default color for items that do not have an explicit
|
||||
/// color set. If no explicit color or default color is set for |color_type|
|
||||
/// then the system color will be used. Returns true (1) on success.
|
||||
///
|
||||
int(CEF_CALLBACK* set_color_at)(struct _cef_menu_model_t* self,
|
||||
int index,
|
||||
cef_menu_color_type_t color_type,
|
||||
cef_color_t color);
|
||||
|
||||
///
|
||||
/// Returns in |color| the color that was explicitly set for |command_id| and
|
||||
/// |color_type|. If a color was not set then 0 will be returned in |color|.
|
||||
/// Returns true (1) on success.
|
||||
///
|
||||
int(CEF_CALLBACK* get_color)(struct _cef_menu_model_t* self,
|
||||
int command_id,
|
||||
cef_menu_color_type_t color_type,
|
||||
cef_color_t* color);
|
||||
|
||||
///
|
||||
/// Returns in |color| the color that was explicitly set for |command_id| and
|
||||
/// |color_type|. Specify an |index| value of -1 to return the default color
|
||||
/// in |color|. If a color was not set then 0 will be returned in |color|.
|
||||
/// Returns true (1) on success.
|
||||
///
|
||||
int(CEF_CALLBACK* get_color_at)(struct _cef_menu_model_t* self,
|
||||
int index,
|
||||
cef_menu_color_type_t color_type,
|
||||
cef_color_t* color);
|
||||
|
||||
///
|
||||
/// Sets the font list for the specified |command_id|. If |font_list| is NULL
|
||||
/// the system font will be used. Returns true (1) on success. The format is
|
||||
/// "<FONT_FAMILY_LIST>,[STYLES] <SIZE>", where:
|
||||
/// - FONT_FAMILY_LIST is a comma-separated list of font family names,
|
||||
/// - STYLES is an optional space-separated list of style names (case-
|
||||
/// sensitive "Bold" and "Italic" are supported), and
|
||||
/// - SIZE is an integer font size in pixels with the suffix "px".
|
||||
///
|
||||
/// Here are examples of valid font description strings:
|
||||
/// - "Arial, Helvetica, Bold Italic 14px"
|
||||
/// - "Arial, 14px"
|
||||
///
|
||||
int(CEF_CALLBACK* set_font_list)(struct _cef_menu_model_t* self,
|
||||
int command_id,
|
||||
const cef_string_t* font_list);
|
||||
|
||||
///
|
||||
/// Sets the font list for the specified |index|. Specify an |index| value of
|
||||
/// - 1 to set the default font. If |font_list| is NULL the system font will
|
||||
/// - FONT_FAMILY_LIST is a comma-separated list of font family names,
|
||||
/// - STYLES is an optional space-separated list of style names (case-
|
||||
/// sensitive "Bold" and "Italic" are supported), and
|
||||
/// - SIZE is an integer font size in pixels with the suffix "px".
|
||||
///
|
||||
/// Here are examples of valid font description strings:
|
||||
/// - "Arial, Helvetica, Bold Italic 14px"
|
||||
/// - "Arial, 14px"
|
||||
///
|
||||
int(CEF_CALLBACK* set_font_list_at)(struct _cef_menu_model_t* self,
|
||||
int index,
|
||||
const cef_string_t* font_list);
|
||||
} cef_menu_model_t;
|
||||
|
||||
///
|
||||
/// Create a new MenuModel with the specified |delegate|.
|
||||
///
|
||||
CEF_EXPORT cef_menu_model_t* cef_menu_model_create(
|
||||
struct _cef_menu_model_delegate_t* delegate);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_MENU_MODEL_CAPI_H_
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
// Copyright (c) 2024 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=01bdeaf96ea01591689b52b0955504644d6614b8$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_MENU_MODEL_DELEGATE_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_MENU_MODEL_DELEGATE_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _cef_menu_model_t;
|
||||
|
||||
///
|
||||
/// Implement this structure to handle menu model events. The functions of this
|
||||
/// structure will be called on the browser process UI thread unless otherwise
|
||||
/// indicated.
|
||||
///
|
||||
typedef struct _cef_menu_model_delegate_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Perform the action associated with the specified |command_id| and optional
|
||||
/// |event_flags|.
|
||||
///
|
||||
void(CEF_CALLBACK* execute_command)(struct _cef_menu_model_delegate_t* self,
|
||||
struct _cef_menu_model_t* menu_model,
|
||||
int command_id,
|
||||
cef_event_flags_t event_flags);
|
||||
|
||||
///
|
||||
/// Called when the user moves the mouse outside the menu and over the owning
|
||||
/// window.
|
||||
///
|
||||
void(CEF_CALLBACK* mouse_outside_menu)(
|
||||
struct _cef_menu_model_delegate_t* self,
|
||||
struct _cef_menu_model_t* menu_model,
|
||||
const cef_point_t* screen_point);
|
||||
|
||||
///
|
||||
/// Called on unhandled open submenu keyboard commands. |is_rtl| will be true
|
||||
/// (1) if the menu is displaying a right-to-left language.
|
||||
///
|
||||
void(CEF_CALLBACK* unhandled_open_submenu)(
|
||||
struct _cef_menu_model_delegate_t* self,
|
||||
struct _cef_menu_model_t* menu_model,
|
||||
int is_rtl);
|
||||
|
||||
///
|
||||
/// Called on unhandled close submenu keyboard commands. |is_rtl| will be true
|
||||
/// (1) if the menu is displaying a right-to-left language.
|
||||
///
|
||||
void(CEF_CALLBACK* unhandled_close_submenu)(
|
||||
struct _cef_menu_model_delegate_t* self,
|
||||
struct _cef_menu_model_t* menu_model,
|
||||
int is_rtl);
|
||||
|
||||
///
|
||||
/// The menu is about to show.
|
||||
///
|
||||
void(CEF_CALLBACK* menu_will_show)(struct _cef_menu_model_delegate_t* self,
|
||||
struct _cef_menu_model_t* menu_model);
|
||||
|
||||
///
|
||||
/// The menu has closed.
|
||||
///
|
||||
void(CEF_CALLBACK* menu_closed)(struct _cef_menu_model_delegate_t* self,
|
||||
struct _cef_menu_model_t* menu_model);
|
||||
|
||||
///
|
||||
/// Optionally modify a menu item label. Return true (1) if |label| was
|
||||
/// modified.
|
||||
///
|
||||
int(CEF_CALLBACK* format_label)(struct _cef_menu_model_delegate_t* self,
|
||||
struct _cef_menu_model_t* menu_model,
|
||||
cef_string_t* label);
|
||||
} cef_menu_model_delegate_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_MENU_MODEL_DELEGATE_CAPI_H_
|
||||
|
|
@ -1,133 +0,0 @@
|
|||
// Copyright (c) 2024 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=dbdac05f2ebd8e8a357eacfe5095676a5bd5b1ac$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_NAVIGATION_ENTRY_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_NAVIGATION_ENTRY_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_ssl_status_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Structure used to represent an entry in navigation history.
|
||||
///
|
||||
typedef struct _cef_navigation_entry_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_navigation_entry_t* self);
|
||||
|
||||
///
|
||||
/// Returns the actual URL of the page. For some pages this may be data: URL
|
||||
/// or similar. Use get_display_url() to return a display-friendly version.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_url)(
|
||||
struct _cef_navigation_entry_t* self);
|
||||
|
||||
///
|
||||
/// Returns a display-friendly version of the URL.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_display_url)(
|
||||
struct _cef_navigation_entry_t* self);
|
||||
|
||||
///
|
||||
/// Returns the original URL that was entered by the user before any
|
||||
/// redirects.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_original_url)(
|
||||
struct _cef_navigation_entry_t* self);
|
||||
|
||||
///
|
||||
/// Returns the title set by the page. This value may be NULL.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_title)(
|
||||
struct _cef_navigation_entry_t* self);
|
||||
|
||||
///
|
||||
/// Returns the transition type which indicates what the user did to move to
|
||||
/// this page from the previous page.
|
||||
///
|
||||
cef_transition_type_t(CEF_CALLBACK* get_transition_type)(
|
||||
struct _cef_navigation_entry_t* self);
|
||||
|
||||
///
|
||||
/// Returns true (1) if this navigation includes post data.
|
||||
///
|
||||
int(CEF_CALLBACK* has_post_data)(struct _cef_navigation_entry_t* self);
|
||||
|
||||
///
|
||||
/// Returns the time for the last known successful navigation completion. A
|
||||
/// navigation may be completed more than once if the page is reloaded. May be
|
||||
/// 0 if the navigation has not yet completed.
|
||||
///
|
||||
cef_basetime_t(CEF_CALLBACK* get_completion_time)(
|
||||
struct _cef_navigation_entry_t* self);
|
||||
|
||||
///
|
||||
/// Returns the HTTP status code for the last known successful navigation
|
||||
/// response. May be 0 if the response has not yet been received or if the
|
||||
/// navigation has not yet completed.
|
||||
///
|
||||
int(CEF_CALLBACK* get_http_status_code)(struct _cef_navigation_entry_t* self);
|
||||
|
||||
///
|
||||
/// Returns the SSL information for this navigation entry.
|
||||
///
|
||||
struct _cef_sslstatus_t*(CEF_CALLBACK* get_sslstatus)(
|
||||
struct _cef_navigation_entry_t* self);
|
||||
} cef_navigation_entry_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_NAVIGATION_ENTRY_CAPI_H_
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
// Copyright (c) 2024 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=f146fd9172033e77e90994841df9fa55ff71aa4b$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_ORIGIN_WHITELIST_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_ORIGIN_WHITELIST_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Add an entry to the cross-origin access whitelist.
|
||||
///
|
||||
/// The same-origin policy restricts how scripts hosted from different origins
|
||||
/// (scheme + domain + port) can communicate. By default, scripts can only
|
||||
/// access resources with the same origin. Scripts hosted on the HTTP and HTTPS
|
||||
/// schemes (but no other schemes) can use the "Access-Control-Allow-Origin"
|
||||
/// header to allow cross-origin requests. For example,
|
||||
/// https://source.example.com can make XMLHttpRequest requests on
|
||||
/// http://target.example.com if the http://target.example.com request returns
|
||||
/// an "Access-Control-Allow-Origin: https://source.example.com" response
|
||||
/// header.
|
||||
///
|
||||
/// Scripts in separate frames or iframes and hosted from the same protocol and
|
||||
/// domain suffix can execute cross-origin JavaScript if both pages set the
|
||||
/// document.domain value to the same domain suffix. For example,
|
||||
/// scheme://foo.example.com and scheme://bar.example.com can communicate using
|
||||
/// JavaScript if both domains set document.domain="example.com".
|
||||
///
|
||||
/// This function is used to allow access to origins that would otherwise
|
||||
/// violate the same-origin policy. Scripts hosted underneath the fully
|
||||
/// qualified |source_origin| URL (like http://www.example.com) will be allowed
|
||||
/// access to all resources hosted on the specified |target_protocol| and
|
||||
/// |target_domain|. If |target_domain| is non-NULL and
|
||||
/// |allow_target_subdomains| is false (0) only exact domain matches will be
|
||||
/// allowed. If |target_domain| contains a top- level domain component (like
|
||||
/// "example.com") and |allow_target_subdomains| is true (1) sub-domain matches
|
||||
/// will be allowed. If |target_domain| is NULL and |allow_target_subdomains| if
|
||||
/// true (1) all domains and IP addresses will be allowed.
|
||||
///
|
||||
/// This function cannot be used to bypass the restrictions on local or display
|
||||
/// isolated schemes. See the comments on CefRegisterCustomScheme for more
|
||||
/// information.
|
||||
///
|
||||
/// This function may be called on any thread. Returns false (0) if
|
||||
/// |source_origin| is invalid or the whitelist cannot be accessed.
|
||||
///
|
||||
CEF_EXPORT int cef_add_cross_origin_whitelist_entry(
|
||||
const cef_string_t* source_origin,
|
||||
const cef_string_t* target_protocol,
|
||||
const cef_string_t* target_domain,
|
||||
int allow_target_subdomains);
|
||||
|
||||
///
|
||||
/// Remove an entry from the cross-origin access whitelist. Returns false (0) if
|
||||
/// |source_origin| is invalid or the whitelist cannot be accessed.
|
||||
///
|
||||
CEF_EXPORT int cef_remove_cross_origin_whitelist_entry(
|
||||
const cef_string_t* source_origin,
|
||||
const cef_string_t* target_protocol,
|
||||
const cef_string_t* target_domain,
|
||||
int allow_target_subdomains);
|
||||
|
||||
///
|
||||
/// Remove all entries from the cross-origin access whitelist. Returns false (0)
|
||||
/// if the whitelist cannot be accessed.
|
||||
///
|
||||
CEF_EXPORT int cef_clear_cross_origin_whitelist(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_ORIGIN_WHITELIST_CAPI_H_
|
||||
|
|
@ -1,184 +0,0 @@
|
|||
// Copyright (c) 2024 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=8accded29b97df1549e86e58d8976fe0f800359a$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_PARSER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_PARSER_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Combines specified |base_url| and |relative_url| into |resolved_url|.
|
||||
/// Returns false (0) if one of the URLs is NULL or invalid.
|
||||
///
|
||||
CEF_EXPORT int cef_resolve_url(const cef_string_t* base_url,
|
||||
const cef_string_t* relative_url,
|
||||
cef_string_t* resolved_url);
|
||||
|
||||
///
|
||||
/// Parse the specified |url| into its component parts. Returns false (0) if the
|
||||
/// URL is NULL or invalid.
|
||||
///
|
||||
CEF_EXPORT int cef_parse_url(const cef_string_t* url,
|
||||
struct _cef_urlparts_t* parts);
|
||||
|
||||
///
|
||||
/// Creates a URL from the specified |parts|, which must contain a non-NULL spec
|
||||
/// or a non-NULL host and path (at a minimum), but not both. Returns false (0)
|
||||
/// if |parts| isn't initialized as described.
|
||||
///
|
||||
CEF_EXPORT int cef_create_url(const struct _cef_urlparts_t* parts,
|
||||
cef_string_t* url);
|
||||
|
||||
///
|
||||
/// This is a convenience function for formatting a URL in a concise and human-
|
||||
/// friendly way to help users make security-related decisions (or in other
|
||||
/// circumstances when people need to distinguish sites, origins, or otherwise-
|
||||
/// simplified URLs from each other). Internationalized domain names (IDN) may
|
||||
/// be presented in Unicode if the conversion is considered safe. The returned
|
||||
/// value will (a) omit the path for standard schemes, excepting file and
|
||||
/// filesystem, and (b) omit the port if it is the default for the scheme. Do
|
||||
/// not use this for URLs which will be parsed or sent to other applications.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
CEF_EXPORT cef_string_userfree_t
|
||||
cef_format_url_for_security_display(const cef_string_t* origin_url);
|
||||
|
||||
///
|
||||
/// Returns the mime type for the specified file extension or an NULL string if
|
||||
/// unknown.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
CEF_EXPORT cef_string_userfree_t
|
||||
cef_get_mime_type(const cef_string_t* extension);
|
||||
|
||||
///
|
||||
/// Get the extensions associated with the given mime type. This should be
|
||||
/// passed in lower case. There could be multiple extensions for a given mime
|
||||
/// type, like "html,htm" for "text/html", or "txt,text,html,..." for "text/*".
|
||||
/// Any existing elements in the provided vector will not be erased.
|
||||
///
|
||||
CEF_EXPORT void cef_get_extensions_for_mime_type(const cef_string_t* mime_type,
|
||||
cef_string_list_t extensions);
|
||||
|
||||
///
|
||||
/// Encodes |data| as a base64 string.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
CEF_EXPORT cef_string_userfree_t cef_base64encode(const void* data,
|
||||
size_t data_size);
|
||||
|
||||
///
|
||||
/// Decodes the base64 encoded string |data|. The returned value will be NULL if
|
||||
/// the decoding fails.
|
||||
///
|
||||
CEF_EXPORT struct _cef_binary_value_t* cef_base64decode(
|
||||
const cef_string_t* data);
|
||||
|
||||
///
|
||||
/// Escapes characters in |text| which are unsuitable for use as a query
|
||||
/// parameter value. Everything except alphanumerics and -_.!~*'() will be
|
||||
/// converted to "%XX". If |use_plus| is true (1) spaces will change to "+". The
|
||||
/// result is basically the same as encodeURIComponent in Javacript.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
CEF_EXPORT cef_string_userfree_t cef_uriencode(const cef_string_t* text,
|
||||
int use_plus);
|
||||
|
||||
///
|
||||
/// Unescapes |text| and returns the result. Unescaping consists of looking for
|
||||
/// the exact pattern "%XX" where each X is a hex digit and converting to the
|
||||
/// character with the numerical value of those digits (e.g. "i%20=%203%3b"
|
||||
/// unescapes to "i = 3;"). If |convert_to_utf8| is true (1) this function will
|
||||
/// attempt to interpret the initial decoded result as UTF-8. If the result is
|
||||
/// convertable into UTF-8 it will be returned as converted. Otherwise the
|
||||
/// initial decoded result will be returned. The |unescape_rule| parameter
|
||||
/// supports further customization the decoding process.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
CEF_EXPORT cef_string_userfree_t
|
||||
cef_uridecode(const cef_string_t* text,
|
||||
int convert_to_utf8,
|
||||
cef_uri_unescape_rule_t unescape_rule);
|
||||
|
||||
///
|
||||
/// Parses the specified |json_string| and returns a dictionary or list
|
||||
/// representation. If JSON parsing fails this function returns NULL.
|
||||
///
|
||||
CEF_EXPORT struct _cef_value_t* cef_parse_json(
|
||||
const cef_string_t* json_string,
|
||||
cef_json_parser_options_t options);
|
||||
|
||||
///
|
||||
/// Parses the specified UTF8-encoded |json| buffer of size |json_size| and
|
||||
/// returns a dictionary or list representation. If JSON parsing fails this
|
||||
/// function returns NULL.
|
||||
///
|
||||
CEF_EXPORT struct _cef_value_t* cef_parse_json_buffer(
|
||||
const void* json,
|
||||
size_t json_size,
|
||||
cef_json_parser_options_t options);
|
||||
|
||||
///
|
||||
/// Parses the specified |json_string| and returns a dictionary or list
|
||||
/// representation. If JSON parsing fails this function returns NULL and
|
||||
/// populates |error_msg_out| with a formatted error message.
|
||||
///
|
||||
CEF_EXPORT struct _cef_value_t* cef_parse_jsonand_return_error(
|
||||
const cef_string_t* json_string,
|
||||
cef_json_parser_options_t options,
|
||||
cef_string_t* error_msg_out);
|
||||
|
||||
///
|
||||
/// Generates a JSON string from the specified root |node| which should be a
|
||||
/// dictionary or list value. Returns an NULL string on failure. This function
|
||||
/// requires exclusive access to |node| including any underlying data.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
CEF_EXPORT cef_string_userfree_t
|
||||
cef_write_json(struct _cef_value_t* node, cef_json_writer_options_t options);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_PARSER_CAPI_H_
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
// Copyright (c) 2024 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=ee0c50b4e1f51fb2286da24bb9244ae74f3b0c6f$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_PATH_UTIL_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_PATH_UTIL_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Retrieve the path associated with the specified |key|. Returns true (1) on
|
||||
/// success. Can be called on any thread in the browser process.
|
||||
///
|
||||
CEF_EXPORT int cef_get_path(cef_path_key_t key, cef_string_t* path);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_PATH_UTIL_CAPI_H_
|
||||
|
|
@ -1,164 +0,0 @@
|
|||
// Copyright (c) 2024 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=c9b3913701581cd6a1077fa3a39d197f338a2507$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_PERMISSION_HANDLER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_PERMISSION_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 used for asynchronous continuation of media access
|
||||
/// permission requests.
|
||||
///
|
||||
typedef struct _cef_media_access_callback_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Call to allow or deny media access. If this callback was initiated in
|
||||
/// response to a getUserMedia (indicated by
|
||||
/// CEF_MEDIA_PERMISSION_DEVICE_AUDIO_CAPTURE and/or
|
||||
/// CEF_MEDIA_PERMISSION_DEVICE_VIDEO_CAPTURE being set) then
|
||||
/// |allowed_permissions| must match |required_permissions| passed to
|
||||
/// OnRequestMediaAccessPermission.
|
||||
///
|
||||
void(CEF_CALLBACK* cont)(struct _cef_media_access_callback_t* self,
|
||||
uint32_t allowed_permissions);
|
||||
|
||||
///
|
||||
/// Cancel the media access request.
|
||||
///
|
||||
void(CEF_CALLBACK* cancel)(struct _cef_media_access_callback_t* self);
|
||||
} cef_media_access_callback_t;
|
||||
|
||||
///
|
||||
/// Callback structure used for asynchronous continuation of permission prompts.
|
||||
///
|
||||
typedef struct _cef_permission_prompt_callback_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Complete the permissions request with the specified |result|.
|
||||
///
|
||||
void(CEF_CALLBACK* cont)(struct _cef_permission_prompt_callback_t* self,
|
||||
cef_permission_request_result_t result);
|
||||
} cef_permission_prompt_callback_t;
|
||||
|
||||
///
|
||||
/// Implement this structure to handle events related to permission requests.
|
||||
/// The functions of this structure will be called on the browser process UI
|
||||
/// thread.
|
||||
///
|
||||
typedef struct _cef_permission_handler_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Called when a page requests permission to access media.
|
||||
/// |requesting_origin| is the URL origin requesting permission.
|
||||
/// |requested_permissions| is a combination of values from
|
||||
/// cef_media_access_permission_types_t that represent the requested
|
||||
/// permissions. Return true (1) and call cef_media_access_callback_t
|
||||
/// functions either in this function or at a later time to continue or cancel
|
||||
/// the request. Return false (0) to proceed with default handling. With the
|
||||
/// Chrome runtime, default handling will display the permission request UI.
|
||||
/// With the Alloy runtime, default handling will deny the request. This
|
||||
/// function will not be called if the "--enable-media-stream" command-line
|
||||
/// switch is used to grant all permissions.
|
||||
///
|
||||
int(CEF_CALLBACK* on_request_media_access_permission)(
|
||||
struct _cef_permission_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
const cef_string_t* requesting_origin,
|
||||
uint32_t requested_permissions,
|
||||
struct _cef_media_access_callback_t* callback);
|
||||
|
||||
///
|
||||
/// Called when a page should show a permission prompt. |prompt_id| uniquely
|
||||
/// identifies the prompt. |requesting_origin| is the URL origin requesting
|
||||
/// permission. |requested_permissions| is a combination of values from
|
||||
/// cef_permission_request_types_t that represent the requested permissions.
|
||||
/// Return true (1) and call cef_permission_prompt_callback_t::Continue either
|
||||
/// in this function or at a later time to continue or cancel the request.
|
||||
/// Return false (0) to proceed with default handling. With the Chrome
|
||||
/// runtime, default handling will display the permission prompt UI. With the
|
||||
/// Alloy runtime, default handling is CEF_PERMISSION_RESULT_IGNORE.
|
||||
///
|
||||
int(CEF_CALLBACK* on_show_permission_prompt)(
|
||||
struct _cef_permission_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
uint64_t prompt_id,
|
||||
const cef_string_t* requesting_origin,
|
||||
uint32_t requested_permissions,
|
||||
struct _cef_permission_prompt_callback_t* callback);
|
||||
|
||||
///
|
||||
/// Called when a permission prompt handled via OnShowPermissionPrompt is
|
||||
/// dismissed. |prompt_id| will match the value that was passed to
|
||||
/// OnShowPermissionPrompt. |result| will be the value passed to
|
||||
/// cef_permission_prompt_callback_t::Continue or CEF_PERMISSION_RESULT_IGNORE
|
||||
/// if the dialog was dismissed for other reasons such as navigation, browser
|
||||
/// closure, etc. This function will not be called if OnShowPermissionPrompt
|
||||
/// returned false (0) for |prompt_id|.
|
||||
///
|
||||
void(CEF_CALLBACK* on_dismiss_permission_prompt)(
|
||||
struct _cef_permission_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
uint64_t prompt_id,
|
||||
cef_permission_request_result_t result);
|
||||
} cef_permission_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_PERMISSION_HANDLER_CAPI_H_
|
||||
|
|
@ -1,148 +0,0 @@
|
|||
// Copyright (c) 2024 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=1c0e469a283538945834404bcd5934b9bb9a0756$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_PREFERENCE_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_PREFERENCE_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_values_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Structure that manages custom preference registrations.
|
||||
///
|
||||
typedef struct _cef_preference_registrar_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_scoped_t base;
|
||||
|
||||
///
|
||||
/// Register a preference with the specified |name| and |default_value|. To
|
||||
/// avoid conflicts with built-in preferences the |name| value should contain
|
||||
/// an application-specific prefix followed by a period (e.g. "myapp.value").
|
||||
/// The contents of |default_value| will be copied. The data type for the
|
||||
/// preference will be inferred from |default_value|'s type and cannot be
|
||||
/// changed after registration. Returns true (1) on success. Returns false (0)
|
||||
/// if |name| is already registered or if |default_value| has an invalid type.
|
||||
/// This function must be called from within the scope of the
|
||||
/// cef_browser_process_handler_t::OnRegisterCustomPreferences callback.
|
||||
///
|
||||
int(CEF_CALLBACK* add_preference)(struct _cef_preference_registrar_t* self,
|
||||
const cef_string_t* name,
|
||||
struct _cef_value_t* default_value);
|
||||
} cef_preference_registrar_t;
|
||||
|
||||
///
|
||||
/// Manage access to preferences. Many built-in preferences are registered by
|
||||
/// Chromium. Custom preferences can be registered in
|
||||
/// cef_browser_process_handler_t::OnRegisterCustomPreferences.
|
||||
///
|
||||
typedef struct _cef_preference_manager_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Returns true (1) if a preference with the specified |name| exists. This
|
||||
/// function must be called on the browser process UI thread.
|
||||
///
|
||||
int(CEF_CALLBACK* has_preference)(struct _cef_preference_manager_t* self,
|
||||
const cef_string_t* name);
|
||||
|
||||
///
|
||||
/// Returns the value for the preference with the specified |name|. Returns
|
||||
/// NULL if the preference does not exist. The returned object contains a copy
|
||||
/// of the underlying preference value and modifications to the returned
|
||||
/// object will not modify the underlying preference value. This function must
|
||||
/// be called on the browser process UI thread.
|
||||
///
|
||||
struct _cef_value_t*(CEF_CALLBACK* get_preference)(
|
||||
struct _cef_preference_manager_t* self,
|
||||
const cef_string_t* name);
|
||||
|
||||
///
|
||||
/// Returns all preferences as a dictionary. If |include_defaults| is true (1)
|
||||
/// then preferences currently at their default value will be included. The
|
||||
/// returned object contains a copy of the underlying preference values and
|
||||
/// modifications to the returned object will not modify the underlying
|
||||
/// preference values. This function must be called on the browser process UI
|
||||
/// thread.
|
||||
///
|
||||
struct _cef_dictionary_value_t*(CEF_CALLBACK* get_all_preferences)(
|
||||
struct _cef_preference_manager_t* self,
|
||||
int include_defaults);
|
||||
|
||||
///
|
||||
/// Returns true (1) if the preference with the specified |name| can be
|
||||
/// modified using SetPreference. As one example preferences set via the
|
||||
/// command-line usually cannot be modified. This function must be called on
|
||||
/// the browser process UI thread.
|
||||
///
|
||||
int(CEF_CALLBACK* can_set_preference)(struct _cef_preference_manager_t* self,
|
||||
const cef_string_t* name);
|
||||
|
||||
///
|
||||
/// Set the |value| associated with preference |name|. Returns true (1) if the
|
||||
/// value is set successfully and false (0) otherwise. If |value| is NULL the
|
||||
/// preference will be restored to its default value. If setting the
|
||||
/// preference fails then |error| will be populated with a detailed
|
||||
/// description of the problem. This function must be called on the browser
|
||||
/// process UI thread.
|
||||
///
|
||||
int(CEF_CALLBACK* set_preference)(struct _cef_preference_manager_t* self,
|
||||
const cef_string_t* name,
|
||||
struct _cef_value_t* value,
|
||||
cef_string_t* error);
|
||||
} cef_preference_manager_t;
|
||||
|
||||
///
|
||||
/// Returns the global preference manager object.
|
||||
///
|
||||
CEF_EXPORT cef_preference_manager_t* cef_preference_manager_get_global(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_PREFERENCE_CAPI_H_
|
||||
|
|
@ -1,160 +0,0 @@
|
|||
// Copyright (c) 2024 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=96d5b6c0dc8f2575e686fb79684c63787cdfe876$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_PRINT_HANDLER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_PRINT_HANDLER_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_browser_capi.h"
|
||||
#include "include/capi/cef_print_settings_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Callback structure for asynchronous continuation of print dialog requests.
|
||||
///
|
||||
typedef struct _cef_print_dialog_callback_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Continue printing with the specified |settings|.
|
||||
///
|
||||
void(CEF_CALLBACK* cont)(struct _cef_print_dialog_callback_t* self,
|
||||
struct _cef_print_settings_t* settings);
|
||||
|
||||
///
|
||||
/// Cancel the printing.
|
||||
///
|
||||
void(CEF_CALLBACK* cancel)(struct _cef_print_dialog_callback_t* self);
|
||||
} cef_print_dialog_callback_t;
|
||||
|
||||
///
|
||||
/// Callback structure for asynchronous continuation of print job requests.
|
||||
///
|
||||
typedef struct _cef_print_job_callback_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Indicate completion of the print job.
|
||||
///
|
||||
void(CEF_CALLBACK* cont)(struct _cef_print_job_callback_t* self);
|
||||
} cef_print_job_callback_t;
|
||||
|
||||
///
|
||||
/// Implement this structure to handle printing on Linux. Each browser will have
|
||||
/// only one print job in progress at a time. The functions of this structure
|
||||
/// will be called on the browser process UI thread.
|
||||
///
|
||||
typedef struct _cef_print_handler_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Called when printing has started for the specified |browser|. This
|
||||
/// function will be called before the other OnPrint*() functions and
|
||||
/// irrespective of how printing was initiated (e.g.
|
||||
/// cef_browser_host_t::print(), JavaScript window.print() or PDF extension
|
||||
/// print button).
|
||||
///
|
||||
void(CEF_CALLBACK* on_print_start)(struct _cef_print_handler_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
|
||||
///
|
||||
/// Synchronize |settings| with client state. If |get_defaults| is true (1)
|
||||
/// then populate |settings| with the default print settings. Do not keep a
|
||||
/// reference to |settings| outside of this callback.
|
||||
///
|
||||
void(CEF_CALLBACK* on_print_settings)(struct _cef_print_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_print_settings_t* settings,
|
||||
int get_defaults);
|
||||
|
||||
///
|
||||
/// Show the print dialog. Execute |callback| once the dialog is dismissed.
|
||||
/// Return true (1) if the dialog will be displayed or false (0) to cancel the
|
||||
/// printing immediately.
|
||||
///
|
||||
int(CEF_CALLBACK* on_print_dialog)(
|
||||
struct _cef_print_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
int has_selection,
|
||||
struct _cef_print_dialog_callback_t* callback);
|
||||
|
||||
///
|
||||
/// Send the print job to the printer. Execute |callback| once the job is
|
||||
/// completed. Return true (1) if the job will proceed or false (0) to cancel
|
||||
/// the job immediately.
|
||||
///
|
||||
int(CEF_CALLBACK* on_print_job)(struct _cef_print_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_string_t* document_name,
|
||||
const cef_string_t* pdf_file_path,
|
||||
struct _cef_print_job_callback_t* callback);
|
||||
|
||||
///
|
||||
/// Reset client state related to printing.
|
||||
///
|
||||
void(CEF_CALLBACK* on_print_reset)(struct _cef_print_handler_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
|
||||
///
|
||||
/// Return the PDF paper size in device units. Used in combination with
|
||||
/// cef_browser_host_t::print_to_pdf().
|
||||
///
|
||||
cef_size_t(CEF_CALLBACK* get_pdf_paper_size)(
|
||||
struct _cef_print_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
int device_units_per_inch);
|
||||
} cef_print_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_PRINT_HANDLER_CAPI_H_
|
||||
|
|
@ -1,202 +0,0 @@
|
|||
// Copyright (c) 2024 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=63977fcbe4567db202914f69539f49b254352053$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_PRINT_SETTINGS_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_PRINT_SETTINGS_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Structure representing print settings.
|
||||
///
|
||||
typedef struct _cef_print_settings_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_print_settings_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_print_settings_t* self);
|
||||
|
||||
///
|
||||
/// Set the page orientation.
|
||||
///
|
||||
void(CEF_CALLBACK* set_orientation)(struct _cef_print_settings_t* self,
|
||||
int landscape);
|
||||
|
||||
///
|
||||
/// Returns true (1) if the orientation is landscape.
|
||||
///
|
||||
int(CEF_CALLBACK* is_landscape)(struct _cef_print_settings_t* self);
|
||||
|
||||
///
|
||||
/// Set the printer printable area in device units. Some platforms already
|
||||
/// provide flipped area. Set |landscape_needs_flip| to false (0) on those
|
||||
/// platforms to avoid double flipping.
|
||||
///
|
||||
void(CEF_CALLBACK* set_printer_printable_area)(
|
||||
struct _cef_print_settings_t* self,
|
||||
const cef_size_t* physical_size_device_units,
|
||||
const cef_rect_t* printable_area_device_units,
|
||||
int landscape_needs_flip);
|
||||
|
||||
///
|
||||
/// Set the device name.
|
||||
///
|
||||
void(CEF_CALLBACK* set_device_name)(struct _cef_print_settings_t* self,
|
||||
const cef_string_t* name);
|
||||
|
||||
///
|
||||
/// Get the device name.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_device_name)(
|
||||
struct _cef_print_settings_t* self);
|
||||
|
||||
///
|
||||
/// Set the DPI (dots per inch).
|
||||
///
|
||||
void(CEF_CALLBACK* set_dpi)(struct _cef_print_settings_t* self, int dpi);
|
||||
|
||||
///
|
||||
/// Get the DPI (dots per inch).
|
||||
///
|
||||
int(CEF_CALLBACK* get_dpi)(struct _cef_print_settings_t* self);
|
||||
|
||||
///
|
||||
/// Set the page ranges.
|
||||
///
|
||||
void(CEF_CALLBACK* set_page_ranges)(struct _cef_print_settings_t* self,
|
||||
size_t rangesCount,
|
||||
cef_range_t const* ranges);
|
||||
|
||||
///
|
||||
/// Returns the number of page ranges that currently exist.
|
||||
///
|
||||
size_t(CEF_CALLBACK* get_page_ranges_count)(
|
||||
struct _cef_print_settings_t* self);
|
||||
|
||||
///
|
||||
/// Retrieve the page ranges.
|
||||
///
|
||||
void(CEF_CALLBACK* get_page_ranges)(struct _cef_print_settings_t* self,
|
||||
size_t* rangesCount,
|
||||
cef_range_t* ranges);
|
||||
|
||||
///
|
||||
/// Set whether only the selection will be printed.
|
||||
///
|
||||
void(CEF_CALLBACK* set_selection_only)(struct _cef_print_settings_t* self,
|
||||
int selection_only);
|
||||
|
||||
///
|
||||
/// Returns true (1) if only the selection will be printed.
|
||||
///
|
||||
int(CEF_CALLBACK* is_selection_only)(struct _cef_print_settings_t* self);
|
||||
|
||||
///
|
||||
/// Set whether pages will be collated.
|
||||
///
|
||||
void(CEF_CALLBACK* set_collate)(struct _cef_print_settings_t* self,
|
||||
int collate);
|
||||
|
||||
///
|
||||
/// Returns true (1) if pages will be collated.
|
||||
///
|
||||
int(CEF_CALLBACK* will_collate)(struct _cef_print_settings_t* self);
|
||||
|
||||
///
|
||||
/// Set the color model.
|
||||
///
|
||||
void(CEF_CALLBACK* set_color_model)(struct _cef_print_settings_t* self,
|
||||
cef_color_model_t model);
|
||||
|
||||
///
|
||||
/// Get the color model.
|
||||
///
|
||||
cef_color_model_t(CEF_CALLBACK* get_color_model)(
|
||||
struct _cef_print_settings_t* self);
|
||||
|
||||
///
|
||||
/// Set the number of copies.
|
||||
///
|
||||
void(CEF_CALLBACK* set_copies)(struct _cef_print_settings_t* self,
|
||||
int copies);
|
||||
|
||||
///
|
||||
/// Get the number of copies.
|
||||
///
|
||||
int(CEF_CALLBACK* get_copies)(struct _cef_print_settings_t* self);
|
||||
|
||||
///
|
||||
/// Set the duplex mode.
|
||||
///
|
||||
void(CEF_CALLBACK* set_duplex_mode)(struct _cef_print_settings_t* self,
|
||||
cef_duplex_mode_t mode);
|
||||
|
||||
///
|
||||
/// Get the duplex mode.
|
||||
///
|
||||
cef_duplex_mode_t(CEF_CALLBACK* get_duplex_mode)(
|
||||
struct _cef_print_settings_t* self);
|
||||
} cef_print_settings_t;
|
||||
|
||||
///
|
||||
/// Create a new cef_print_settings_t object.
|
||||
///
|
||||
CEF_EXPORT cef_print_settings_t* cef_print_settings_create(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_PRINT_SETTINGS_CAPI_H_
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
// Copyright (c) 2024 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=89c569df7e5e4a6035d4527218ce4dc1d68e20f0$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_PROCESS_MESSAGE_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_PROCESS_MESSAGE_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_shared_memory_region_capi.h"
|
||||
#include "include/capi/cef_values_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Structure representing a message. Can be used on any process and thread.
|
||||
///
|
||||
typedef struct _cef_process_message_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_process_message_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_process_message_t* self);
|
||||
|
||||
///
|
||||
/// Returns a writable copy of this object. Returns nullptr when message
|
||||
/// contains a shared memory region.
|
||||
///
|
||||
struct _cef_process_message_t*(CEF_CALLBACK* copy)(
|
||||
struct _cef_process_message_t* self);
|
||||
|
||||
///
|
||||
/// Returns the message name.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_name)(
|
||||
struct _cef_process_message_t* self);
|
||||
|
||||
///
|
||||
/// Returns the list of arguments. Returns nullptr when message contains a
|
||||
/// shared memory region.
|
||||
///
|
||||
struct _cef_list_value_t*(CEF_CALLBACK* get_argument_list)(
|
||||
struct _cef_process_message_t* self);
|
||||
|
||||
///
|
||||
/// Returns the shared memory region. Returns nullptr when message contains an
|
||||
/// argument list.
|
||||
///
|
||||
struct _cef_shared_memory_region_t*(CEF_CALLBACK* get_shared_memory_region)(
|
||||
struct _cef_process_message_t* self);
|
||||
} cef_process_message_t;
|
||||
|
||||
///
|
||||
/// Create a new cef_process_message_t object with the specified name.
|
||||
///
|
||||
CEF_EXPORT cef_process_message_t* cef_process_message_create(
|
||||
const cef_string_t* name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_PROCESS_MESSAGE_CAPI_H_
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
// Copyright (c) 2024 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=a61a639c7e53ecd9481eae363bac557055f0442e$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_PROCESS_UTIL_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_PROCESS_UTIL_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Launches the process specified via |command_line|. Returns true (1) upon
|
||||
/// success. Must be called on the browser process TID_PROCESS_LAUNCHER thread.
|
||||
///
|
||||
/// Unix-specific notes:
|
||||
/// - All file descriptors open in the parent process will be closed in the
|
||||
/// child process except for stdin, stdout, and stderr.
|
||||
/// - If the first argument on the command line does not contain a slash, PATH
|
||||
/// will be searched. (See man execvp.)
|
||||
///
|
||||
CEF_EXPORT int cef_launch_process(struct _cef_command_line_t* command_line);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_PROCESS_UTIL_CAPI_H_
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
// Copyright (c) 2024 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=c53a67bbf1497a51766bf03040714b5edb2117d5$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REGISTRATION_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_REGISTRATION_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Generic callback structure used for managing the lifespan of a registration.
|
||||
///
|
||||
typedef struct _cef_registration_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
} cef_registration_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_REGISTRATION_CAPI_H_
|
||||
|
|
@ -1,261 +0,0 @@
|
|||
// Copyright (c) 2024 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=5309b2f6da62526ed92c928c0918bc27898cf03b$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_accessibility_handler_capi.h"
|
||||
#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 when window rendering is disabled.
|
||||
/// The functions of this structure will be called on the UI thread.
|
||||
///
|
||||
typedef struct _cef_render_handler_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Return the handler for accessibility notifications. If no handler is
|
||||
/// provided the default implementation will be used.
|
||||
///
|
||||
struct _cef_accessibility_handler_t*(CEF_CALLBACK* get_accessibility_handler)(
|
||||
struct _cef_render_handler_t* self);
|
||||
|
||||
///
|
||||
/// Called to retrieve the root window rectangle in screen DIP coordinates.
|
||||
/// Return true (1) if the rectangle was provided. If this function returns
|
||||
/// false (0) the rectangle from GetViewRect will be used.
|
||||
///
|
||||
int(CEF_CALLBACK* get_root_screen_rect)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_rect_t* rect);
|
||||
|
||||
///
|
||||
/// Called to retrieve the view rectangle in screen DIP coordinates. This
|
||||
/// function must always provide a non-NULL rectangle.
|
||||
///
|
||||
void(CEF_CALLBACK* get_view_rect)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_rect_t* rect);
|
||||
|
||||
///
|
||||
/// Called to retrieve the translation from view DIP coordinates to screen
|
||||
/// coordinates. Windows/Linux should provide screen device (pixel)
|
||||
/// coordinates and MacOS should provide screen DIP coordinates. Return true
|
||||
/// (1) if the requested coordinates were provided.
|
||||
///
|
||||
int(CEF_CALLBACK* get_screen_point)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
int viewX,
|
||||
int viewY,
|
||||
int* screenX,
|
||||
int* screenY);
|
||||
|
||||
///
|
||||
/// Called to allow the client to fill in the CefScreenInfo object with
|
||||
/// appropriate values. Return true (1) if the |screen_info| structure has
|
||||
/// been modified.
|
||||
///
|
||||
/// If the screen info rectangle is left NULL the rectangle from GetViewRect
|
||||
/// will be used. If the rectangle is still NULL or invalid popups may not be
|
||||
/// drawn correctly.
|
||||
///
|
||||
int(CEF_CALLBACK* get_screen_info)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_screen_info_t* screen_info);
|
||||
|
||||
///
|
||||
/// Called when the browser wants to show or hide the popup widget. The popup
|
||||
/// should be shown if |show| is true (1) and hidden if |show| is false (0).
|
||||
///
|
||||
void(CEF_CALLBACK* on_popup_show)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
int show);
|
||||
|
||||
///
|
||||
/// Called when the browser wants to move or resize the popup widget. |rect|
|
||||
/// contains the new location and size in view coordinates.
|
||||
///
|
||||
void(CEF_CALLBACK* on_popup_size)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_rect_t* rect);
|
||||
|
||||
///
|
||||
/// Called when an element should be painted. Pixel values passed to this
|
||||
/// function are scaled relative to view coordinates based on the value of
|
||||
/// CefScreenInfo.device_scale_factor returned from GetScreenInfo. |type|
|
||||
/// indicates whether the element is the view or the popup widget. |buffer|
|
||||
/// contains the pixel data for the whole image. |dirtyRects| contains the set
|
||||
/// of rectangles in pixel coordinates that need to be repainted. |buffer|
|
||||
/// will be |width|*|height|*4 bytes in size and represents a BGRA image with
|
||||
/// an upper-left origin. This function is only called when
|
||||
/// cef_window_tInfo::shared_texture_enabled is set to false (0).
|
||||
///
|
||||
void(CEF_CALLBACK* on_paint)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_paint_element_type_t type,
|
||||
size_t dirtyRectsCount,
|
||||
cef_rect_t const* dirtyRects,
|
||||
const void* buffer,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
///
|
||||
/// Called when an element has been rendered to the shared texture handle.
|
||||
/// |type| indicates whether the element is the view or the popup widget.
|
||||
/// |dirtyRects| contains the set of rectangles in pixel coordinates that need
|
||||
/// to be repainted. |shared_handle| is the handle for a D3D11 Texture2D that
|
||||
/// can be accessed via ID3D11Device using the OpenSharedResource function.
|
||||
/// This function is only called when cef_window_tInfo::shared_texture_enabled
|
||||
/// is set to true (1), and is currently only supported on Windows.
|
||||
///
|
||||
void(CEF_CALLBACK* on_accelerated_paint)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_paint_element_type_t type,
|
||||
size_t dirtyRectsCount,
|
||||
cef_rect_t const* dirtyRects,
|
||||
void* shared_handle);
|
||||
|
||||
///
|
||||
/// Called to retrieve the size of the touch handle for the specified
|
||||
/// |orientation|.
|
||||
///
|
||||
void(CEF_CALLBACK* get_touch_handle_size)(
|
||||
struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_horizontal_alignment_t orientation,
|
||||
cef_size_t* size);
|
||||
|
||||
///
|
||||
/// Called when touch handle state is updated. The client is responsible for
|
||||
/// rendering the touch handles.
|
||||
///
|
||||
void(CEF_CALLBACK* on_touch_handle_state_changed)(
|
||||
struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_touch_handle_state_t* state);
|
||||
|
||||
///
|
||||
/// Called when the user starts dragging content in the web view. Contextual
|
||||
/// information about the dragged content is supplied by |drag_data|. (|x|,
|
||||
/// |y|) is the drag start location in screen coordinates. OS APIs that run a
|
||||
/// system message loop may be used within the StartDragging call.
|
||||
///
|
||||
/// Return false (0) to abort the drag operation. Don't call any of
|
||||
/// cef_browser_host_t::DragSource*Ended* functions after returning false (0).
|
||||
///
|
||||
/// Return true (1) to handle the drag operation. Call
|
||||
/// cef_browser_host_t::DragSourceEndedAt and DragSourceSystemDragEnded either
|
||||
/// synchronously or asynchronously to inform the web view that the drag
|
||||
/// operation has ended.
|
||||
///
|
||||
int(CEF_CALLBACK* start_dragging)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_drag_data_t* drag_data,
|
||||
cef_drag_operations_mask_t allowed_ops,
|
||||
int x,
|
||||
int y);
|
||||
|
||||
///
|
||||
/// Called when the web view wants to update the mouse cursor during a drag &
|
||||
/// drop operation. |operation| describes the allowed operation (none, move,
|
||||
/// copy, link).
|
||||
///
|
||||
void(CEF_CALLBACK* update_drag_cursor)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_drag_operations_mask_t operation);
|
||||
|
||||
///
|
||||
/// Called when the scroll offset has changed.
|
||||
///
|
||||
void(CEF_CALLBACK* on_scroll_offset_changed)(
|
||||
struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
double x,
|
||||
double y);
|
||||
|
||||
///
|
||||
/// Called when the IME composition range has changed. |selected_range| is the
|
||||
/// range of characters that have been selected. |character_bounds| is the
|
||||
/// bounds of each character in view coordinates.
|
||||
///
|
||||
void(CEF_CALLBACK* on_ime_composition_range_changed)(
|
||||
struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_range_t* selected_range,
|
||||
size_t character_boundsCount,
|
||||
cef_rect_t const* character_bounds);
|
||||
|
||||
///
|
||||
/// Called when text selection has changed for the specified |browser|.
|
||||
/// |selected_text| is the currently selected text and |selected_range| is the
|
||||
/// character range.
|
||||
///
|
||||
void(CEF_CALLBACK* on_text_selection_changed)(
|
||||
struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_string_t* selected_text,
|
||||
const cef_range_t* selected_range);
|
||||
|
||||
///
|
||||
/// Called when an on-screen keyboard should be shown or hidden for the
|
||||
/// specified |browser|. |input_mode| specifies what kind of keyboard should
|
||||
/// be opened. If |input_mode| is CEF_TEXT_INPUT_MODE_NONE, any existing
|
||||
/// keyboard for this browser should be hidden.
|
||||
///
|
||||
void(CEF_CALLBACK* on_virtual_keyboard_requested)(
|
||||
struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_text_input_mode_t input_mode);
|
||||
} cef_render_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_
|
||||
|
|
@ -1,168 +0,0 @@
|
|||
// Copyright (c) 2024 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=6e2fccb5a8e49918d723f6c5223062cf98b0f9de$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_RENDER_PROCESS_HANDLER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_RENDER_PROCESS_HANDLER_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_browser_capi.h"
|
||||
#include "include/capi/cef_dom_capi.h"
|
||||
#include "include/capi/cef_frame_capi.h"
|
||||
#include "include/capi/cef_load_handler_capi.h"
|
||||
#include "include/capi/cef_process_message_capi.h"
|
||||
#include "include/capi/cef_v8_capi.h"
|
||||
#include "include/capi/cef_values_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Structure used to implement render process callbacks. The functions of this
|
||||
/// structure will be called on the render process main thread (TID_RENDERER)
|
||||
/// unless otherwise indicated.
|
||||
///
|
||||
typedef struct _cef_render_process_handler_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Called after WebKit has been initialized.
|
||||
///
|
||||
void(CEF_CALLBACK* on_web_kit_initialized)(
|
||||
struct _cef_render_process_handler_t* self);
|
||||
|
||||
///
|
||||
/// Called after a browser has been created. When browsing cross-origin a new
|
||||
/// browser will be created before the old browser with the same identifier is
|
||||
/// destroyed. |extra_info| is an optional read-only value originating from
|
||||
/// cef_browser_host_t::cef_browser_host_create_browser(),
|
||||
/// cef_browser_host_t::cef_browser_host_create_browser_sync(),
|
||||
/// cef_life_span_handler_t::on_before_popup() or
|
||||
/// cef_browser_view_t::cef_browser_view_create().
|
||||
///
|
||||
void(CEF_CALLBACK* on_browser_created)(
|
||||
struct _cef_render_process_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_dictionary_value_t* extra_info);
|
||||
|
||||
///
|
||||
/// Called before a browser is destroyed.
|
||||
///
|
||||
void(CEF_CALLBACK* on_browser_destroyed)(
|
||||
struct _cef_render_process_handler_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
|
||||
///
|
||||
/// Return the handler for browser load status events.
|
||||
///
|
||||
struct _cef_load_handler_t*(CEF_CALLBACK* get_load_handler)(
|
||||
struct _cef_render_process_handler_t* self);
|
||||
|
||||
///
|
||||
/// Called immediately after the V8 context for a frame has been created. To
|
||||
/// retrieve the JavaScript 'window' object use the
|
||||
/// cef_v8context_t::get_global() function. V8 handles can only be accessed
|
||||
/// from the thread on which they are created. A task runner for posting tasks
|
||||
/// on the associated thread can be retrieved via the
|
||||
/// cef_v8context_t::get_task_runner() function.
|
||||
///
|
||||
void(CEF_CALLBACK* on_context_created)(
|
||||
struct _cef_render_process_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_v8context_t* context);
|
||||
|
||||
///
|
||||
/// Called immediately before the V8 context for a frame is released. No
|
||||
/// references to the context should be kept after this function is called.
|
||||
///
|
||||
void(CEF_CALLBACK* on_context_released)(
|
||||
struct _cef_render_process_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_v8context_t* context);
|
||||
|
||||
///
|
||||
/// Called for global uncaught exceptions in a frame. Execution of this
|
||||
/// callback is disabled by default. To enable set
|
||||
/// cef_settings_t.uncaught_exception_stack_size > 0.
|
||||
///
|
||||
void(CEF_CALLBACK* on_uncaught_exception)(
|
||||
struct _cef_render_process_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_v8context_t* context,
|
||||
struct _cef_v8exception_t* exception,
|
||||
struct _cef_v8stack_trace_t* stackTrace);
|
||||
|
||||
///
|
||||
/// Called when a new node in the the browser gets focus. The |node| value may
|
||||
/// be NULL if no specific node has gained focus. The node 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* on_focused_node_changed)(
|
||||
struct _cef_render_process_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_domnode_t* node);
|
||||
|
||||
///
|
||||
/// Called when a new message is received from a different process. Return
|
||||
/// true (1) if the message was handled or false (0) otherwise. It is safe to
|
||||
/// keep a reference to |message| outside of this callback.
|
||||
///
|
||||
int(CEF_CALLBACK* on_process_message_received)(
|
||||
struct _cef_render_process_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
cef_process_id_t source_process,
|
||||
struct _cef_process_message_t* message);
|
||||
} cef_render_process_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_RENDER_PROCESS_HANDLER_CAPI_H_
|
||||
|
|
@ -1,355 +0,0 @@
|
|||
// Copyright (c) 2024 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=14ce483864835eca476d08d39ed4236fbd1a874c$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_REQUEST_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _cef_post_data_element_t;
|
||||
struct _cef_post_data_t;
|
||||
|
||||
///
|
||||
/// Structure used to represent a web request. The functions of this structure
|
||||
/// may be called on any thread.
|
||||
///
|
||||
typedef struct _cef_request_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Returns true (1) if this object is read-only.
|
||||
///
|
||||
int(CEF_CALLBACK* is_read_only)(struct _cef_request_t* self);
|
||||
|
||||
///
|
||||
/// Get the fully qualified URL.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_url)(struct _cef_request_t* self);
|
||||
|
||||
///
|
||||
/// Set the fully qualified URL.
|
||||
///
|
||||
void(CEF_CALLBACK* set_url)(struct _cef_request_t* self,
|
||||
const cef_string_t* url);
|
||||
|
||||
///
|
||||
/// Get the request function type. The value will default to POST if post data
|
||||
/// is provided and GET otherwise.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_method)(struct _cef_request_t* self);
|
||||
|
||||
///
|
||||
/// Set the request function type.
|
||||
///
|
||||
void(CEF_CALLBACK* set_method)(struct _cef_request_t* self,
|
||||
const cef_string_t* method);
|
||||
|
||||
///
|
||||
/// Set the referrer URL and policy. If non-NULL the referrer URL must be
|
||||
/// fully qualified with an HTTP or HTTPS scheme component. Any username,
|
||||
/// password or ref component will be removed.
|
||||
///
|
||||
void(CEF_CALLBACK* set_referrer)(struct _cef_request_t* self,
|
||||
const cef_string_t* referrer_url,
|
||||
cef_referrer_policy_t policy);
|
||||
|
||||
///
|
||||
/// Get the referrer URL.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_referrer_url)(
|
||||
struct _cef_request_t* self);
|
||||
|
||||
///
|
||||
/// Get the referrer policy.
|
||||
///
|
||||
cef_referrer_policy_t(CEF_CALLBACK* get_referrer_policy)(
|
||||
struct _cef_request_t* self);
|
||||
|
||||
///
|
||||
/// Get the post data.
|
||||
///
|
||||
struct _cef_post_data_t*(CEF_CALLBACK* get_post_data)(
|
||||
struct _cef_request_t* self);
|
||||
|
||||
///
|
||||
/// Set the post data.
|
||||
///
|
||||
void(CEF_CALLBACK* set_post_data)(struct _cef_request_t* self,
|
||||
struct _cef_post_data_t* postData);
|
||||
|
||||
///
|
||||
/// Get the header values. Will not include the Referer value if any.
|
||||
///
|
||||
void(CEF_CALLBACK* get_header_map)(struct _cef_request_t* self,
|
||||
cef_string_multimap_t headerMap);
|
||||
|
||||
///
|
||||
/// Set the header values. If a Referer value exists in the header map it will
|
||||
/// be removed and ignored.
|
||||
///
|
||||
void(CEF_CALLBACK* set_header_map)(struct _cef_request_t* self,
|
||||
cef_string_multimap_t headerMap);
|
||||
|
||||
///
|
||||
/// Returns the first header value for |name| or an NULL string if not found.
|
||||
/// Will not return the Referer value if any. Use GetHeaderMap instead if
|
||||
/// |name| might have multiple values.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_header_by_name)(
|
||||
struct _cef_request_t* self,
|
||||
const cef_string_t* name);
|
||||
|
||||
///
|
||||
/// Set the header |name| to |value|. If |overwrite| is true (1) any existing
|
||||
/// values will be replaced with the new value. If |overwrite| is false (0)
|
||||
/// any existing values will not be overwritten. The Referer value cannot be
|
||||
/// set using this function.
|
||||
///
|
||||
void(CEF_CALLBACK* set_header_by_name)(struct _cef_request_t* self,
|
||||
const cef_string_t* name,
|
||||
const cef_string_t* value,
|
||||
int overwrite);
|
||||
|
||||
///
|
||||
/// Set all values at one time.
|
||||
///
|
||||
void(CEF_CALLBACK* set)(struct _cef_request_t* self,
|
||||
const cef_string_t* url,
|
||||
const cef_string_t* method,
|
||||
struct _cef_post_data_t* postData,
|
||||
cef_string_multimap_t headerMap);
|
||||
|
||||
///
|
||||
/// Get the flags used in combination with cef_urlrequest_t. See
|
||||
/// cef_urlrequest_flags_t for supported values.
|
||||
///
|
||||
int(CEF_CALLBACK* get_flags)(struct _cef_request_t* self);
|
||||
|
||||
///
|
||||
/// Set the flags used in combination with cef_urlrequest_t. See
|
||||
/// cef_urlrequest_flags_t for supported values.
|
||||
///
|
||||
void(CEF_CALLBACK* set_flags)(struct _cef_request_t* self, int flags);
|
||||
|
||||
///
|
||||
/// Get the URL to the first party for cookies used in combination with
|
||||
/// cef_urlrequest_t.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_first_party_for_cookies)(
|
||||
struct _cef_request_t* self);
|
||||
|
||||
///
|
||||
/// Set the URL to the first party for cookies used in combination with
|
||||
/// cef_urlrequest_t.
|
||||
///
|
||||
void(CEF_CALLBACK* set_first_party_for_cookies)(struct _cef_request_t* self,
|
||||
const cef_string_t* url);
|
||||
|
||||
///
|
||||
/// Get the resource type for this request. Only available in the browser
|
||||
/// process.
|
||||
///
|
||||
cef_resource_type_t(CEF_CALLBACK* get_resource_type)(
|
||||
struct _cef_request_t* self);
|
||||
|
||||
///
|
||||
/// Get the transition type for this request. Only available in the browser
|
||||
/// process and only applies to requests that represent a main frame or sub-
|
||||
/// frame navigation.
|
||||
///
|
||||
cef_transition_type_t(CEF_CALLBACK* get_transition_type)(
|
||||
struct _cef_request_t* self);
|
||||
|
||||
///
|
||||
/// Returns the globally unique identifier for this request or 0 if not
|
||||
/// specified. Can be used by cef_resource_request_handler_t implementations
|
||||
/// in the browser process to track a single request across multiple
|
||||
/// callbacks.
|
||||
///
|
||||
uint64_t(CEF_CALLBACK* get_identifier)(struct _cef_request_t* self);
|
||||
} cef_request_t;
|
||||
|
||||
///
|
||||
/// Create a new cef_request_t object.
|
||||
///
|
||||
CEF_EXPORT cef_request_t* cef_request_create(void);
|
||||
|
||||
///
|
||||
/// Structure used to represent post data for a web request. The functions of
|
||||
/// this structure may be called on any thread.
|
||||
///
|
||||
typedef struct _cef_post_data_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Returns true (1) if this object is read-only.
|
||||
///
|
||||
int(CEF_CALLBACK* is_read_only)(struct _cef_post_data_t* self);
|
||||
|
||||
///
|
||||
/// Returns true (1) if the underlying POST data includes elements that are
|
||||
/// not represented by this cef_post_data_t object (for example, multi-part
|
||||
/// file upload data). Modifying cef_post_data_t objects with excluded
|
||||
/// elements may result in the request failing.
|
||||
///
|
||||
int(CEF_CALLBACK* has_excluded_elements)(struct _cef_post_data_t* self);
|
||||
|
||||
///
|
||||
/// Returns the number of existing post data elements.
|
||||
///
|
||||
size_t(CEF_CALLBACK* get_element_count)(struct _cef_post_data_t* self);
|
||||
|
||||
///
|
||||
/// Retrieve the post data elements.
|
||||
///
|
||||
void(CEF_CALLBACK* get_elements)(struct _cef_post_data_t* self,
|
||||
size_t* elementsCount,
|
||||
struct _cef_post_data_element_t** elements);
|
||||
|
||||
///
|
||||
/// Remove the specified post data element. Returns true (1) if the removal
|
||||
/// succeeds.
|
||||
///
|
||||
int(CEF_CALLBACK* remove_element)(struct _cef_post_data_t* self,
|
||||
struct _cef_post_data_element_t* element);
|
||||
|
||||
///
|
||||
/// Add the specified post data element. Returns true (1) if the add
|
||||
/// succeeds.
|
||||
///
|
||||
int(CEF_CALLBACK* add_element)(struct _cef_post_data_t* self,
|
||||
struct _cef_post_data_element_t* element);
|
||||
|
||||
///
|
||||
/// Remove all existing post data elements.
|
||||
///
|
||||
void(CEF_CALLBACK* remove_elements)(struct _cef_post_data_t* self);
|
||||
} cef_post_data_t;
|
||||
|
||||
///
|
||||
/// Create a new cef_post_data_t object.
|
||||
///
|
||||
CEF_EXPORT cef_post_data_t* cef_post_data_create(void);
|
||||
|
||||
///
|
||||
/// Structure used to represent a single element in the request post data. The
|
||||
/// functions of this structure may be called on any thread.
|
||||
///
|
||||
typedef struct _cef_post_data_element_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Returns true (1) if this object is read-only.
|
||||
///
|
||||
int(CEF_CALLBACK* is_read_only)(struct _cef_post_data_element_t* self);
|
||||
|
||||
///
|
||||
/// Remove all contents from the post data element.
|
||||
///
|
||||
void(CEF_CALLBACK* set_to_empty)(struct _cef_post_data_element_t* self);
|
||||
|
||||
///
|
||||
/// The post data element will represent a file.
|
||||
///
|
||||
void(CEF_CALLBACK* set_to_file)(struct _cef_post_data_element_t* self,
|
||||
const cef_string_t* fileName);
|
||||
|
||||
///
|
||||
/// The post data element will represent bytes. The bytes passed in will be
|
||||
/// copied.
|
||||
///
|
||||
void(CEF_CALLBACK* set_to_bytes)(struct _cef_post_data_element_t* self,
|
||||
size_t size,
|
||||
const void* bytes);
|
||||
|
||||
///
|
||||
/// Return the type of this post data element.
|
||||
///
|
||||
cef_postdataelement_type_t(CEF_CALLBACK* get_type)(
|
||||
struct _cef_post_data_element_t* self);
|
||||
|
||||
///
|
||||
/// Return the file name.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_file)(
|
||||
struct _cef_post_data_element_t* self);
|
||||
|
||||
///
|
||||
/// Return the number of bytes.
|
||||
///
|
||||
size_t(CEF_CALLBACK* get_bytes_count)(struct _cef_post_data_element_t* self);
|
||||
|
||||
///
|
||||
/// Read up to |size| bytes into |bytes| and return the number of bytes
|
||||
/// actually read.
|
||||
///
|
||||
size_t(CEF_CALLBACK* get_bytes)(struct _cef_post_data_element_t* self,
|
||||
size_t size,
|
||||
void* bytes);
|
||||
} cef_post_data_element_t;
|
||||
|
||||
///
|
||||
/// Create a new cef_post_data_element_t object.
|
||||
///
|
||||
CEF_EXPORT cef_post_data_element_t* cef_post_data_element_create(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_REQUEST_CAPI_H_
|
||||
|
|
@ -1,398 +0,0 @@
|
|||
// Copyright (c) 2024 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=23302ef6e4458aa3e7065aeaca3421a6f0b58361$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_callback_capi.h"
|
||||
#include "include/capi/cef_cookie_capi.h"
|
||||
#include "include/capi/cef_extension_capi.h"
|
||||
#include "include/capi/cef_extension_handler_capi.h"
|
||||
#include "include/capi/cef_media_router_capi.h"
|
||||
#include "include/capi/cef_preference_capi.h"
|
||||
#include "include/capi/cef_values_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _cef_request_context_handler_t;
|
||||
struct _cef_scheme_handler_factory_t;
|
||||
|
||||
///
|
||||
/// Callback structure for cef_request_context_t::ResolveHost.
|
||||
///
|
||||
typedef struct _cef_resolve_callback_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Called on the UI thread after the ResolveHost request has completed.
|
||||
/// |result| will be the result code. |resolved_ips| will be the list of
|
||||
/// resolved IP addresses or NULL if the resolution failed.
|
||||
///
|
||||
void(CEF_CALLBACK* on_resolve_completed)(struct _cef_resolve_callback_t* self,
|
||||
cef_errorcode_t result,
|
||||
cef_string_list_t resolved_ips);
|
||||
} cef_resolve_callback_t;
|
||||
|
||||
///
|
||||
/// A request context provides request handling for a set of related browser or
|
||||
/// URL request objects. A request context can be specified when creating a new
|
||||
/// browser via the cef_browser_host_t static factory functions or when creating
|
||||
/// a new URL request via the cef_urlrequest_t static factory functions. Browser
|
||||
/// objects with different request contexts will never be hosted in the same
|
||||
/// render process. Browser objects with the same request context may or may not
|
||||
/// be hosted in the same render process depending on the process model. Browser
|
||||
/// objects created indirectly via the JavaScript window.open function or
|
||||
/// targeted links will share the same render process and the same request
|
||||
/// context as the source browser. When running in single-process mode there is
|
||||
/// only a single render process (the main process) and so all browsers created
|
||||
/// in single-process mode will share the same request context. This will be the
|
||||
/// first request context passed into a cef_browser_host_t static factory
|
||||
/// function and all other request context objects will be ignored.
|
||||
///
|
||||
typedef struct _cef_request_context_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_preference_manager_t base;
|
||||
|
||||
///
|
||||
/// Returns true (1) if this object is pointing to the same context as |that|
|
||||
/// object.
|
||||
///
|
||||
int(CEF_CALLBACK* is_same)(struct _cef_request_context_t* self,
|
||||
struct _cef_request_context_t* other);
|
||||
|
||||
///
|
||||
/// Returns true (1) if this object is sharing the same storage as |that|
|
||||
/// object.
|
||||
///
|
||||
int(CEF_CALLBACK* is_sharing_with)(struct _cef_request_context_t* self,
|
||||
struct _cef_request_context_t* other);
|
||||
|
||||
///
|
||||
/// Returns true (1) if this object is the global context. The global context
|
||||
/// is used by default when creating a browser or URL request with a NULL
|
||||
/// context argument.
|
||||
///
|
||||
int(CEF_CALLBACK* is_global)(struct _cef_request_context_t* self);
|
||||
|
||||
///
|
||||
/// Returns the handler for this context if any.
|
||||
///
|
||||
struct _cef_request_context_handler_t*(CEF_CALLBACK* get_handler)(
|
||||
struct _cef_request_context_t* self);
|
||||
|
||||
///
|
||||
/// Returns the cache path for this object. If NULL an "incognito mode" in-
|
||||
/// memory cache is being used.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_cache_path)(
|
||||
struct _cef_request_context_t* self);
|
||||
|
||||
///
|
||||
/// Returns the cookie manager for this object. If |callback| is non-NULL it
|
||||
/// will be executed asnychronously on the UI thread after the manager's
|
||||
/// storage has been initialized.
|
||||
///
|
||||
struct _cef_cookie_manager_t*(CEF_CALLBACK* get_cookie_manager)(
|
||||
struct _cef_request_context_t* self,
|
||||
struct _cef_completion_callback_t* callback);
|
||||
|
||||
///
|
||||
/// Register a scheme handler factory for the specified |scheme_name| and
|
||||
/// optional |domain_name|. An NULL |domain_name| value for a standard scheme
|
||||
/// will cause the factory to match all domain names. The |domain_name| value
|
||||
/// will be ignored for non-standard schemes. If |scheme_name| is a built-in
|
||||
/// scheme and no handler is returned by |factory| then the built-in scheme
|
||||
/// handler factory will be called. If |scheme_name| is a custom scheme then
|
||||
/// you must also implement the cef_app_t::on_register_custom_schemes()
|
||||
/// function in all processes. This function may be called multiple times to
|
||||
/// change or remove the factory that matches the specified |scheme_name| and
|
||||
/// optional |domain_name|. Returns false (0) if an error occurs. This
|
||||
/// function may be called on any thread in the browser process.
|
||||
///
|
||||
int(CEF_CALLBACK* register_scheme_handler_factory)(
|
||||
struct _cef_request_context_t* self,
|
||||
const cef_string_t* scheme_name,
|
||||
const cef_string_t* domain_name,
|
||||
struct _cef_scheme_handler_factory_t* factory);
|
||||
|
||||
///
|
||||
/// Clear all registered scheme handler factories. Returns false (0) on error.
|
||||
/// This function may be called on any thread in the browser process.
|
||||
///
|
||||
int(CEF_CALLBACK* clear_scheme_handler_factories)(
|
||||
struct _cef_request_context_t* self);
|
||||
|
||||
///
|
||||
/// Clears all certificate exceptions that were added as part of handling
|
||||
/// cef_request_handler_t::on_certificate_error(). If you call this it is
|
||||
/// recommended that you also call close_all_connections() or you risk not
|
||||
/// being prompted again for server certificates if you reconnect quickly. If
|
||||
/// |callback| is non-NULL it will be executed on the UI thread after
|
||||
/// completion.
|
||||
///
|
||||
void(CEF_CALLBACK* clear_certificate_exceptions)(
|
||||
struct _cef_request_context_t* self,
|
||||
struct _cef_completion_callback_t* callback);
|
||||
|
||||
///
|
||||
/// Clears all HTTP authentication credentials that were added as part of
|
||||
/// handling GetAuthCredentials. If |callback| is non-NULL it will be executed
|
||||
/// on the UI thread after completion.
|
||||
///
|
||||
void(CEF_CALLBACK* clear_http_auth_credentials)(
|
||||
struct _cef_request_context_t* self,
|
||||
struct _cef_completion_callback_t* callback);
|
||||
|
||||
///
|
||||
/// Clears all active and idle connections that Chromium currently has. This
|
||||
/// is only recommended if you have released all other CEF objects but don't
|
||||
/// yet want to call cef_shutdown(). If |callback| is non-NULL it will be
|
||||
/// executed on the UI thread after completion.
|
||||
///
|
||||
void(CEF_CALLBACK* close_all_connections)(
|
||||
struct _cef_request_context_t* self,
|
||||
struct _cef_completion_callback_t* callback);
|
||||
|
||||
///
|
||||
/// Attempts to resolve |origin| to a list of associated IP addresses.
|
||||
/// |callback| will be executed on the UI thread after completion.
|
||||
///
|
||||
void(CEF_CALLBACK* resolve_host)(struct _cef_request_context_t* self,
|
||||
const cef_string_t* origin,
|
||||
struct _cef_resolve_callback_t* callback);
|
||||
|
||||
///
|
||||
/// Load an extension.
|
||||
///
|
||||
/// If extension resources will be read from disk using the default load
|
||||
/// implementation then |root_directory| should be the absolute path to the
|
||||
/// extension resources directory and |manifest| should be NULL. If extension
|
||||
/// resources will be provided by the client (e.g. via cef_request_handler_t
|
||||
/// and/or cef_extension_handler_t) then |root_directory| should be a path
|
||||
/// component unique to the extension (if not absolute this will be internally
|
||||
/// prefixed with the PK_DIR_RESOURCES path) and |manifest| should contain the
|
||||
/// contents that would otherwise be read from the "manifest.json" file on
|
||||
/// disk.
|
||||
///
|
||||
/// The loaded extension will be accessible in all contexts sharing the same
|
||||
/// storage (HasExtension returns true (1)). However, only the context on
|
||||
/// which this function was called is considered the loader (DidLoadExtension
|
||||
/// returns true (1)) and only the loader will receive
|
||||
/// cef_request_context_handler_t callbacks for the extension.
|
||||
///
|
||||
/// cef_extension_handler_t::OnExtensionLoaded will be called on load success
|
||||
/// or cef_extension_handler_t::OnExtensionLoadFailed will be called on load
|
||||
/// failure.
|
||||
///
|
||||
/// If the extension specifies a background script via the "background"
|
||||
/// manifest key then cef_extension_handler_t::OnBeforeBackgroundBrowser will
|
||||
/// be called to create the background browser. See that function for
|
||||
/// additional information about background scripts.
|
||||
///
|
||||
/// For visible extension views the client application should evaluate the
|
||||
/// manifest to determine the correct extension URL to load and then pass that
|
||||
/// URL to the cef_browser_host_t::CreateBrowser* function after the extension
|
||||
/// has loaded. For example, the client can look for the "browser_action"
|
||||
/// manifest key as documented at
|
||||
/// https://developer.chrome.com/extensions/browserAction. Extension URLs take
|
||||
/// the form "chrome-extension://<extension_id>/<path>".
|
||||
///
|
||||
/// Browsers that host extensions differ from normal browsers as follows:
|
||||
/// - Can access chrome.* JavaScript APIs if allowed by the manifest. Visit
|
||||
/// chrome://extensions-support for the list of extension APIs currently
|
||||
/// supported by CEF.
|
||||
/// - Main frame navigation to non-extension content is blocked.
|
||||
/// - Pinch-zooming is disabled.
|
||||
/// - CefBrowserHost::GetExtension returns the hosted extension.
|
||||
/// - CefBrowserHost::IsBackgroundHost returns true for background hosts.
|
||||
///
|
||||
/// See https://developer.chrome.com/extensions for extension implementation
|
||||
/// and usage documentation.
|
||||
///
|
||||
void(CEF_CALLBACK* load_extension)(struct _cef_request_context_t* self,
|
||||
const cef_string_t* root_directory,
|
||||
struct _cef_dictionary_value_t* manifest,
|
||||
struct _cef_extension_handler_t* handler);
|
||||
|
||||
///
|
||||
/// Returns true (1) if this context was used to load the extension identified
|
||||
/// by |extension_id|. Other contexts sharing the same storage will also have
|
||||
/// access to the extension (see HasExtension). This function must be called
|
||||
/// on the browser process UI thread.
|
||||
///
|
||||
int(CEF_CALLBACK* did_load_extension)(struct _cef_request_context_t* self,
|
||||
const cef_string_t* extension_id);
|
||||
|
||||
///
|
||||
/// Returns true (1) if this context has access to the extension identified by
|
||||
/// |extension_id|. This may not be the context that was used to load the
|
||||
/// extension (see DidLoadExtension). This function must be called on the
|
||||
/// browser process UI thread.
|
||||
///
|
||||
int(CEF_CALLBACK* has_extension)(struct _cef_request_context_t* self,
|
||||
const cef_string_t* extension_id);
|
||||
|
||||
///
|
||||
/// Retrieve the list of all extensions that this context has access to (see
|
||||
/// HasExtension). |extension_ids| will be populated with the list of
|
||||
/// extension ID values. Returns true (1) on success. This function must be
|
||||
/// called on the browser process UI thread.
|
||||
///
|
||||
int(CEF_CALLBACK* get_extensions)(struct _cef_request_context_t* self,
|
||||
cef_string_list_t extension_ids);
|
||||
|
||||
///
|
||||
/// Returns the extension matching |extension_id| or NULL if no matching
|
||||
/// extension is accessible in this context (see HasExtension). This function
|
||||
/// must be called on the browser process UI thread.
|
||||
///
|
||||
struct _cef_extension_t*(CEF_CALLBACK* get_extension)(
|
||||
struct _cef_request_context_t* self,
|
||||
const cef_string_t* extension_id);
|
||||
|
||||
///
|
||||
/// Returns the MediaRouter object associated with this context. If
|
||||
/// |callback| is non-NULL it will be executed asnychronously on the UI thread
|
||||
/// after the manager's context has been initialized.
|
||||
///
|
||||
struct _cef_media_router_t*(CEF_CALLBACK* get_media_router)(
|
||||
struct _cef_request_context_t* self,
|
||||
struct _cef_completion_callback_t* callback);
|
||||
|
||||
///
|
||||
/// Returns the current value for |content_type| that applies for the
|
||||
/// specified URLs. If both URLs are NULL the default value will be returned.
|
||||
/// Returns nullptr if no value is configured. Must be called on the browser
|
||||
/// process UI thread.
|
||||
///
|
||||
struct _cef_value_t*(CEF_CALLBACK* get_website_setting)(
|
||||
struct _cef_request_context_t* self,
|
||||
const cef_string_t* requesting_url,
|
||||
const cef_string_t* top_level_url,
|
||||
cef_content_setting_types_t content_type);
|
||||
|
||||
///
|
||||
/// Sets the current value for |content_type| for the specified URLs in the
|
||||
/// default scope. If both URLs are NULL, and the context is not incognito,
|
||||
/// the default value will be set. Pass nullptr for |value| to remove the
|
||||
/// default value for this content type.
|
||||
///
|
||||
/// WARNING: Incorrect usage of this function may cause instability or
|
||||
/// security issues in Chromium. Make sure that you first understand the
|
||||
/// potential impact of any changes to |content_type| by reviewing the related
|
||||
/// source code in Chromium. For example, if you plan to modify
|
||||
/// CEF_CONTENT_SETTING_TYPE_POPUPS, first review and understand the usage of
|
||||
/// ContentSettingsType::POPUPS in Chromium:
|
||||
/// https://source.chromium.org/search?q=ContentSettingsType::POPUPS
|
||||
///
|
||||
void(CEF_CALLBACK* set_website_setting)(
|
||||
struct _cef_request_context_t* self,
|
||||
const cef_string_t* requesting_url,
|
||||
const cef_string_t* top_level_url,
|
||||
cef_content_setting_types_t content_type,
|
||||
struct _cef_value_t* value);
|
||||
|
||||
///
|
||||
/// Returns the current value for |content_type| that applies for the
|
||||
/// specified URLs. If both URLs are NULL the default value will be returned.
|
||||
/// Returns CEF_CONTENT_SETTING_VALUE_DEFAULT if no value is configured. Must
|
||||
/// be called on the browser process UI thread.
|
||||
///
|
||||
cef_content_setting_values_t(CEF_CALLBACK* get_content_setting)(
|
||||
struct _cef_request_context_t* self,
|
||||
const cef_string_t* requesting_url,
|
||||
const cef_string_t* top_level_url,
|
||||
cef_content_setting_types_t content_type);
|
||||
|
||||
///
|
||||
/// Sets the current value for |content_type| for the specified URLs in the
|
||||
/// default scope. If both URLs are NULL, and the context is not incognito,
|
||||
/// the default value will be set. Pass CEF_CONTENT_SETTING_VALUE_DEFAULT for
|
||||
/// |value| to use the default value for this content type.
|
||||
///
|
||||
/// WARNING: Incorrect usage of this function may cause instability or
|
||||
/// security issues in Chromium. Make sure that you first understand the
|
||||
/// potential impact of any changes to |content_type| by reviewing the related
|
||||
/// source code in Chromium. For example, if you plan to modify
|
||||
/// CEF_CONTENT_SETTING_TYPE_POPUPS, first review and understand the usage of
|
||||
/// ContentSettingsType::POPUPS in Chromium:
|
||||
/// https://source.chromium.org/search?q=ContentSettingsType::POPUPS
|
||||
///
|
||||
void(CEF_CALLBACK* set_content_setting)(
|
||||
struct _cef_request_context_t* self,
|
||||
const cef_string_t* requesting_url,
|
||||
const cef_string_t* top_level_url,
|
||||
cef_content_setting_types_t content_type,
|
||||
cef_content_setting_values_t value);
|
||||
} cef_request_context_t;
|
||||
|
||||
///
|
||||
/// Returns the global context object.
|
||||
///
|
||||
CEF_EXPORT cef_request_context_t* cef_request_context_get_global_context(void);
|
||||
|
||||
///
|
||||
/// Creates a new context object with the specified |settings| and optional
|
||||
/// |handler|.
|
||||
///
|
||||
CEF_EXPORT cef_request_context_t* cef_request_context_create_context(
|
||||
const struct _cef_request_context_settings_t* settings,
|
||||
struct _cef_request_context_handler_t* handler);
|
||||
|
||||
///
|
||||
/// Creates a new context object that shares storage with |other| and uses an
|
||||
/// optional |handler|.
|
||||
///
|
||||
CEF_EXPORT cef_request_context_t* cef_create_context_shared(
|
||||
cef_request_context_t* other,
|
||||
struct _cef_request_context_handler_t* handler);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_CAPI_H_
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
// Copyright (c) 2024 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=d90d816565429ad304f43490b0619af5ffa70274$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_HANDLER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_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_preference_capi.h"
|
||||
#include "include/capi/cef_request_capi.h"
|
||||
#include "include/capi/cef_resource_request_handler_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Implement this structure to provide handler implementations. The handler
|
||||
/// instance will not be released until all objects related to the context have
|
||||
/// been destroyed.
|
||||
///
|
||||
typedef struct _cef_request_context_handler_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Called on the browser process UI thread immediately after the request
|
||||
/// context has been initialized.
|
||||
///
|
||||
void(CEF_CALLBACK* on_request_context_initialized)(
|
||||
struct _cef_request_context_handler_t* self,
|
||||
struct _cef_request_context_t* request_context);
|
||||
|
||||
///
|
||||
/// Called on the browser process IO thread before a resource request is
|
||||
/// initiated. The |browser| and |frame| values represent the source of the
|
||||
/// request, and may be NULL for requests originating from service workers or
|
||||
/// cef_urlrequest_t. |request| represents the request contents and cannot be
|
||||
/// modified in this callback. |is_navigation| will be true (1) if the
|
||||
/// resource request is a navigation. |is_download| will be true (1) if the
|
||||
/// resource request is a download. |request_initiator| is the origin (scheme
|
||||
/// + domain) of the page that initiated the request. Set
|
||||
/// |disable_default_handling| to true (1) to disable default handling of the
|
||||
/// request, in which case it will need to be handled via
|
||||
/// cef_resource_request_handler_t::GetResourceHandler or it will be canceled.
|
||||
/// To allow the resource load to proceed with default handling return NULL.
|
||||
/// To specify a handler for the resource return a
|
||||
/// cef_resource_request_handler_t object. This function will not be called if
|
||||
/// the client associated with |browser| returns a non-NULL value from
|
||||
/// cef_request_handler_t::GetResourceRequestHandler for the same request
|
||||
/// (identified by cef_request_t::GetIdentifier).
|
||||
///
|
||||
struct _cef_resource_request_handler_t*(
|
||||
CEF_CALLBACK* get_resource_request_handler)(
|
||||
struct _cef_request_context_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request,
|
||||
int is_navigation,
|
||||
int is_download,
|
||||
const cef_string_t* request_initiator,
|
||||
int* disable_default_handling);
|
||||
} cef_request_context_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_HANDLER_CAPI_H_
|
||||
|
|
@ -1,247 +0,0 @@
|
|||
// Copyright (c) 2024 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=3b59c0bc014d773dedc24649071141ee2dd2125c$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_auth_callback_capi.h"
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_browser_capi.h"
|
||||
#include "include/capi/cef_callback_capi.h"
|
||||
#include "include/capi/cef_frame_capi.h"
|
||||
#include "include/capi/cef_request_capi.h"
|
||||
#include "include/capi/cef_resource_request_handler_capi.h"
|
||||
#include "include/capi/cef_ssl_info_capi.h"
|
||||
#include "include/capi/cef_x509_certificate_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Callback structure used to select a client certificate for authentication.
|
||||
///
|
||||
typedef struct _cef_select_client_certificate_callback_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Chooses the specified certificate for client certificate authentication.
|
||||
/// NULL value means that no client certificate should be used.
|
||||
///
|
||||
void(CEF_CALLBACK* select)(
|
||||
struct _cef_select_client_certificate_callback_t* self,
|
||||
struct _cef_x509certificate_t* cert);
|
||||
} cef_select_client_certificate_callback_t;
|
||||
|
||||
///
|
||||
/// Implement this structure to handle events related to browser requests. The
|
||||
/// functions of this structure will be called on the thread indicated.
|
||||
///
|
||||
typedef struct _cef_request_handler_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Called on the UI thread before browser navigation. Return true (1) to
|
||||
/// cancel the navigation or false (0) to allow the navigation to proceed. The
|
||||
/// |request| object cannot be modified in this callback.
|
||||
/// cef_load_handler_t::OnLoadingStateChange will be called twice in all
|
||||
/// cases. If the navigation is allowed cef_load_handler_t::OnLoadStart and
|
||||
/// cef_load_handler_t::OnLoadEnd will be called. If the navigation is
|
||||
/// canceled cef_load_handler_t::OnLoadError will be called with an
|
||||
/// |errorCode| value of ERR_ABORTED. The |user_gesture| value will be true
|
||||
/// (1) if the browser navigated via explicit user gesture (e.g. clicking a
|
||||
/// link) or false (0) if it navigated automatically (e.g. via the
|
||||
/// DomContentLoaded event).
|
||||
///
|
||||
int(CEF_CALLBACK* on_before_browse)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request,
|
||||
int user_gesture,
|
||||
int is_redirect);
|
||||
|
||||
///
|
||||
/// Called on the UI thread before OnBeforeBrowse in certain limited cases
|
||||
/// where navigating a new or different browser might be desirable. This
|
||||
/// includes user-initiated navigation that might open in a special way (e.g.
|
||||
/// links clicked via middle-click or ctrl + left-click) and certain types of
|
||||
/// cross-origin navigation initiated from the renderer process (e.g.
|
||||
/// navigating the top-level frame to/from a file URL). The |browser| and
|
||||
/// |frame| values represent the source of the navigation. The
|
||||
/// |target_disposition| value indicates where the user intended to navigate
|
||||
/// the browser based on standard Chromium behaviors (e.g. current tab, new
|
||||
/// tab, etc). The |user_gesture| value will be true (1) if the browser
|
||||
/// navigated via explicit user gesture (e.g. clicking a link) or false (0) if
|
||||
/// it navigated automatically (e.g. via the DomContentLoaded event). Return
|
||||
/// true (1) to cancel the navigation or false (0) to allow the navigation to
|
||||
/// proceed in the source browser's top-level frame.
|
||||
///
|
||||
int(CEF_CALLBACK* on_open_urlfrom_tab)(
|
||||
struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
const cef_string_t* target_url,
|
||||
cef_window_open_disposition_t target_disposition,
|
||||
int user_gesture);
|
||||
|
||||
///
|
||||
/// Called on the browser process IO thread before a resource request is
|
||||
/// initiated. The |browser| and |frame| values represent the source of the
|
||||
/// request. |request| represents the request contents and cannot be modified
|
||||
/// in this callback. |is_navigation| will be true (1) if the resource request
|
||||
/// is a navigation. |is_download| will be true (1) if the resource request is
|
||||
/// a download. |request_initiator| is the origin (scheme + domain) of the
|
||||
/// page that initiated the request. Set |disable_default_handling| to true
|
||||
/// (1) to disable default handling of the request, in which case it will need
|
||||
/// to be handled via cef_resource_request_handler_t::GetResourceHandler or it
|
||||
/// will be canceled. To allow the resource load to proceed with default
|
||||
/// handling return NULL. To specify a handler for the resource return a
|
||||
/// cef_resource_request_handler_t object. If this callback returns NULL the
|
||||
/// same function will be called on the associated
|
||||
/// cef_request_context_handler_t, if any.
|
||||
///
|
||||
struct _cef_resource_request_handler_t*(
|
||||
CEF_CALLBACK* get_resource_request_handler)(
|
||||
struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request,
|
||||
int is_navigation,
|
||||
int is_download,
|
||||
const cef_string_t* request_initiator,
|
||||
int* disable_default_handling);
|
||||
|
||||
///
|
||||
/// Called on the IO thread when the browser needs credentials from the user.
|
||||
/// |origin_url| is the origin making this authentication request. |isProxy|
|
||||
/// indicates whether the host is a proxy server. |host| contains the hostname
|
||||
/// and |port| contains the port number. |realm| is the realm of the challenge
|
||||
/// and may be NULL. |scheme| is the authentication scheme used, such as
|
||||
/// "basic" or "digest", and will be NULL if the source of the request is an
|
||||
/// FTP server. Return true (1) to continue the request and call
|
||||
/// cef_auth_callback_t::cont() either in this function or at a later time
|
||||
/// when the authentication information is available. Return false (0) to
|
||||
/// cancel the request immediately.
|
||||
///
|
||||
int(CEF_CALLBACK* get_auth_credentials)(
|
||||
struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_string_t* origin_url,
|
||||
int isProxy,
|
||||
const cef_string_t* host,
|
||||
int port,
|
||||
const cef_string_t* realm,
|
||||
const cef_string_t* scheme,
|
||||
struct _cef_auth_callback_t* callback);
|
||||
|
||||
///
|
||||
/// Called on the UI thread to handle requests for URLs with an invalid SSL
|
||||
/// certificate. Return true (1) and call cef_callback_t functions either in
|
||||
/// this function or at a later time to continue or cancel the request. Return
|
||||
/// false (0) to cancel the request immediately. If
|
||||
/// cef_settings_t.ignore_certificate_errors is set all invalid certificates
|
||||
/// will be accepted without calling this function.
|
||||
///
|
||||
int(CEF_CALLBACK* on_certificate_error)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_errorcode_t cert_error,
|
||||
const cef_string_t* request_url,
|
||||
struct _cef_sslinfo_t* ssl_info,
|
||||
struct _cef_callback_t* callback);
|
||||
|
||||
///
|
||||
/// Called on the UI thread when a client certificate is being requested for
|
||||
/// authentication. Return false (0) to use the default behavior and
|
||||
/// automatically select the first certificate available. Return true (1) and
|
||||
/// call cef_select_client_certificate_callback_t::Select either in this
|
||||
/// function or at a later time to select a certificate. Do not call Select or
|
||||
/// call it with NULL to continue without using any certificate. |isProxy|
|
||||
/// indicates whether the host is an HTTPS proxy or the origin server. |host|
|
||||
/// and |port| contains the hostname and port of the SSL server.
|
||||
/// |certificates| is the list of certificates to choose from; this list has
|
||||
/// already been pruned by Chromium so that it only contains certificates from
|
||||
/// issuers that the server trusts.
|
||||
///
|
||||
int(CEF_CALLBACK* on_select_client_certificate)(
|
||||
struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
int isProxy,
|
||||
const cef_string_t* host,
|
||||
int port,
|
||||
size_t certificatesCount,
|
||||
struct _cef_x509certificate_t* const* certificates,
|
||||
struct _cef_select_client_certificate_callback_t* callback);
|
||||
|
||||
///
|
||||
/// Called on the browser process UI thread when the render view associated
|
||||
/// with |browser| is ready to receive/handle IPC messages in the render
|
||||
/// process.
|
||||
///
|
||||
void(CEF_CALLBACK* on_render_view_ready)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
|
||||
///
|
||||
/// Called on the browser process UI thread when the render process terminates
|
||||
/// unexpectedly. |status| indicates how the process terminated.
|
||||
///
|
||||
void(CEF_CALLBACK* on_render_process_terminated)(
|
||||
struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_termination_status_t status);
|
||||
|
||||
///
|
||||
/// Called on the browser process UI thread when the window.document object of
|
||||
/// the main frame has been created.
|
||||
///
|
||||
void(CEF_CALLBACK* on_document_available_in_main_frame)(
|
||||
struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
} cef_request_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
// Copyright (c) 2024 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=d97d3ca6c8d610627538c58f3b4ba3869f3d9ac7$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_RESOURCE_BUNDLE_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_RESOURCE_BUNDLE_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_values_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Structure used for retrieving resources from the resource bundle (*.pak)
|
||||
/// files loaded by CEF during startup or via the cef_resource_bundle_handler_t
|
||||
/// returned from cef_app_t::GetResourceBundleHandler. See CefSettings for
|
||||
/// additional options related to resource bundle loading. The functions of this
|
||||
/// structure may be called on any thread unless otherwise indicated.
|
||||
///
|
||||
typedef struct _cef_resource_bundle_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Returns the localized string for the specified |string_id| or an NULL
|
||||
/// string if the value is not found. Include cef_pack_strings.h for a listing
|
||||
/// of valid string ID values.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_localized_string)(
|
||||
struct _cef_resource_bundle_t* self,
|
||||
int string_id);
|
||||
|
||||
///
|
||||
/// Returns a cef_binary_value_t containing the decompressed contents of the
|
||||
/// specified scale independent |resource_id| or NULL if not found. Include
|
||||
/// cef_pack_resources.h for a listing of valid resource ID values.
|
||||
///
|
||||
struct _cef_binary_value_t*(CEF_CALLBACK* get_data_resource)(
|
||||
struct _cef_resource_bundle_t* self,
|
||||
int resource_id);
|
||||
|
||||
///
|
||||
/// Returns a cef_binary_value_t containing the decompressed contents of the
|
||||
/// specified |resource_id| nearest the scale factor |scale_factor| or NULL if
|
||||
/// not found. Use a |scale_factor| value of SCALE_FACTOR_NONE for scale
|
||||
/// independent resources or call GetDataResource instead.Include
|
||||
/// cef_pack_resources.h for a listing of valid resource ID values.
|
||||
///
|
||||
struct _cef_binary_value_t*(CEF_CALLBACK* get_data_resource_for_scale)(
|
||||
struct _cef_resource_bundle_t* self,
|
||||
int resource_id,
|
||||
cef_scale_factor_t scale_factor);
|
||||
} cef_resource_bundle_t;
|
||||
|
||||
///
|
||||
/// Returns the global resource bundle instance.
|
||||
///
|
||||
CEF_EXPORT cef_resource_bundle_t* cef_resource_bundle_get_global(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_RESOURCE_BUNDLE_CAPI_H_
|
||||
|
|
@ -1,105 +0,0 @@
|
|||
// Copyright (c) 2024 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=b25f3131d67980e493da4d7e484676d000334995$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_RESOURCE_BUNDLE_HANDLER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_RESOURCE_BUNDLE_HANDLER_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Structure used to implement a custom resource bundle structure. See
|
||||
/// CefSettings for additional options related to resource bundle loading. The
|
||||
/// functions of this structure may be called on multiple threads.
|
||||
///
|
||||
typedef struct _cef_resource_bundle_handler_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Called to retrieve a localized translation for the specified |string_id|.
|
||||
/// To provide the translation set |string| to the translation string and
|
||||
/// return true (1). To use the default translation return false (0). Include
|
||||
/// cef_pack_strings.h for a listing of valid string ID values.
|
||||
///
|
||||
int(CEF_CALLBACK* get_localized_string)(
|
||||
struct _cef_resource_bundle_handler_t* self,
|
||||
int string_id,
|
||||
cef_string_t* string);
|
||||
|
||||
///
|
||||
/// Called to retrieve data for the specified scale independent |resource_id|.
|
||||
/// To provide the resource data set |data| and |data_size| to the data
|
||||
/// pointer and size respectively and return true (1). To use the default
|
||||
/// resource data return false (0). The resource data will not be copied and
|
||||
/// must remain resident in memory. Include cef_pack_resources.h for a listing
|
||||
/// of valid resource ID values.
|
||||
///
|
||||
int(CEF_CALLBACK* get_data_resource)(
|
||||
struct _cef_resource_bundle_handler_t* self,
|
||||
int resource_id,
|
||||
void** data,
|
||||
size_t* data_size);
|
||||
|
||||
///
|
||||
/// Called to retrieve data for the specified |resource_id| nearest the scale
|
||||
/// factor |scale_factor|. To provide the resource data set |data| and
|
||||
/// |data_size| to the data pointer and size respectively and return true (1).
|
||||
/// To use the default resource data return false (0). The resource data will
|
||||
/// not be copied and must remain resident in memory. Include
|
||||
/// cef_pack_resources.h for a listing of valid resource ID values.
|
||||
///
|
||||
int(CEF_CALLBACK* get_data_resource_for_scale)(
|
||||
struct _cef_resource_bundle_handler_t* self,
|
||||
int resource_id,
|
||||
cef_scale_factor_t scale_factor,
|
||||
void** data,
|
||||
size_t* data_size);
|
||||
} cef_resource_bundle_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_RESOURCE_BUNDLE_HANDLER_CAPI_H_
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue