mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
24 Commits
5bafd32ee1
...
5938
Author | SHA1 | Date | |
---|---|---|---|
|
da4c36ad01 | ||
|
5053a958e1 | ||
|
946dde2e17 | ||
|
e80c977855 | ||
|
dca8a93dda | ||
|
885c92cd15 | ||
|
475b91e0ed | ||
|
f1b94ea90e | ||
|
a26f38b1bd | ||
|
197744e165 | ||
|
d3947ca03c | ||
|
a5b2677409 | ||
|
a287baf2ef | ||
|
641496065f | ||
|
fb73900826 | ||
|
e313dea9b6 | ||
|
21a4dca86e | ||
|
0726eefbe0 | ||
|
5f8d100619 | ||
|
53a890ff2c | ||
|
0cae6e9bbe | ||
|
e5339214b0 | ||
|
fb3a2c62ab | ||
|
debec4c0da |
@@ -7,5 +7,6 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'refs/tags/117.0.5938.0'
|
||||
'chromium_checkout': 'refs/tags/117.0.5938.152',
|
||||
'depot_tools_checkout': 'd9011c559b'
|
||||
}
|
||||
|
@@ -1,2 +1,2 @@
|
||||
@echo off
|
||||
python.bat tools\gclient_hook.py
|
||||
python3.bat tools\gclient_hook.py
|
||||
|
@@ -23,7 +23,6 @@
|
||||
'include/base/cef_ptr_util.h',
|
||||
'include/base/cef_ref_counted.h',
|
||||
'include/base/cef_scoped_refptr.h',
|
||||
'include/base/cef_template_util.h',
|
||||
'include/base/cef_thread_checker.h',
|
||||
'include/base/cef_trace_event.h',
|
||||
'include/base/cef_tuple.h',
|
||||
|
@@ -84,7 +84,6 @@
|
||||
|
||||
#include "include/base/cef_build.h"
|
||||
#include "include/base/cef_compiler_specific.h"
|
||||
#include "include/base/cef_template_util.h"
|
||||
#include "include/base/internal/cef_bind_internal.h"
|
||||
|
||||
#if defined(OS_APPLE) && !HAS_FEATURE(objc_arc)
|
||||
@@ -105,7 +104,7 @@ BindOnce(Functor&& functor, Args&&... args) {
|
||||
"BindOnce requires non-const rvalue for OnceCallback binding."
|
||||
" I.e.: base::BindOnce(std::move(callback)).");
|
||||
static_assert(
|
||||
conjunction<cef_internal::AssertBindArgIsNotBasePassed<
|
||||
std::conjunction<cef_internal::AssertBindArgIsNotBasePassed<
|
||||
std::decay_t<Args>>...>::value,
|
||||
"Use std::move() instead of base::Passed() with base::BindOnce()");
|
||||
|
||||
|
@@ -50,7 +50,6 @@
|
||||
#include "include/base/cef_compiler_specific.h"
|
||||
#include "include/base/cef_logging.h"
|
||||
#include "include/base/cef_scoped_refptr.h"
|
||||
#include "include/base/cef_template_util.h"
|
||||
#include "include/base/cef_thread_checker.h"
|
||||
|
||||
namespace base {
|
||||
@@ -485,7 +484,7 @@ class RefCountedData
|
||||
RefCountedData(const T& in_value) : data(in_value) {}
|
||||
RefCountedData(T&& in_value) : data(std::move(in_value)) {}
|
||||
template <typename... Args>
|
||||
explicit RefCountedData(in_place_t, Args&&... args)
|
||||
explicit RefCountedData(std::in_place_t, Args&&... args)
|
||||
: data(std::forward<Args>(args)...) {}
|
||||
|
||||
T data;
|
||||
|
@@ -1,417 +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_TEMPLATE_UTIL_H_
|
||||
#define CEF_INCLUDE_BASE_CEF_TEMPLATE_UTIL_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/template_util.h"
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include <stddef.h>
|
||||
#include <iosfwd>
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "include/base/cef_build.h"
|
||||
|
||||
// Some versions of libstdc++ have partial support for type_traits, but misses
|
||||
// a smaller subset while removing some of the older non-standard stuff. Assume
|
||||
// that all versions below 5.0 fall in this category, along with one 5.0
|
||||
// experimental release. Test for this by consulting compiler major version,
|
||||
// the only reliable option available, so theoretically this could fail should
|
||||
// you attempt to mix an earlier version of libstdc++ with >= GCC5. But
|
||||
// that's unlikely to work out, especially as GCC5 changed ABI.
|
||||
#define CR_GLIBCXX_5_0_0 20150123
|
||||
#if (defined(__GNUC__) && __GNUC__ < 5) || \
|
||||
(defined(__GLIBCXX__) && __GLIBCXX__ == CR_GLIBCXX_5_0_0)
|
||||
#define CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX
|
||||
#endif
|
||||
|
||||
// This hacks around using gcc with libc++ which has some incompatibilies.
|
||||
// - is_trivially_* doesn't work: https://llvm.org/bugs/show_bug.cgi?id=27538
|
||||
// TODO(danakj): Remove this when android builders are all using a newer version
|
||||
// of gcc, or the android ndk is updated to a newer libc++ that works with older
|
||||
// gcc versions.
|
||||
#if !defined(__clang__) && defined(_LIBCPP_VERSION)
|
||||
#define CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX
|
||||
#endif
|
||||
|
||||
namespace base {
|
||||
|
||||
template <class T>
|
||||
struct is_non_const_reference : std::false_type {};
|
||||
template <class T>
|
||||
struct is_non_const_reference<T&> : std::true_type {};
|
||||
template <class T>
|
||||
struct is_non_const_reference<const T&> : std::false_type {};
|
||||
|
||||
namespace internal {
|
||||
|
||||
// Implementation detail of base::void_t below.
|
||||
template <typename...>
|
||||
struct make_void {
|
||||
using type = void;
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
||||
// base::void_t is an implementation of std::void_t from C++17.
|
||||
//
|
||||
// We use |base::internal::make_void| as a helper struct to avoid a C++14
|
||||
// defect:
|
||||
// http://en.cppreference.com/w/cpp/types/void_t
|
||||
// http://open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#1558
|
||||
template <typename... Ts>
|
||||
using void_t = typename ::base::internal::make_void<Ts...>::type;
|
||||
|
||||
namespace internal {
|
||||
|
||||
// Uses expression SFINAE to detect whether using operator<< would work.
|
||||
template <typename T, typename = void>
|
||||
struct SupportsOstreamOperator : std::false_type {};
|
||||
template <typename T>
|
||||
struct SupportsOstreamOperator<T,
|
||||
decltype(void(std::declval<std::ostream&>()
|
||||
<< std::declval<T>()))>
|
||||
: std::true_type {};
|
||||
|
||||
template <typename T, typename = void>
|
||||
struct SupportsToString : std::false_type {};
|
||||
template <typename T>
|
||||
struct SupportsToString<T, decltype(void(std::declval<T>().ToString()))>
|
||||
: std::true_type {};
|
||||
|
||||
// Used to detect whether the given type is an iterator. This is normally used
|
||||
// with std::enable_if to provide disambiguation for functions that take
|
||||
// templatzed iterators as input.
|
||||
template <typename T, typename = void>
|
||||
struct is_iterator : std::false_type {};
|
||||
|
||||
template <typename T>
|
||||
struct is_iterator<T,
|
||||
void_t<typename std::iterator_traits<T>::iterator_category>>
|
||||
: std::true_type {};
|
||||
|
||||
// Helper to express preferences in an overload set. If more than one overload
|
||||
// are available for a given set of parameters the overload with the higher
|
||||
// priority will be chosen.
|
||||
template <size_t I>
|
||||
struct priority_tag : priority_tag<I - 1> {};
|
||||
|
||||
template <>
|
||||
struct priority_tag<0> {};
|
||||
|
||||
} // namespace internal
|
||||
|
||||
// is_trivially_copyable is especially hard to get right.
|
||||
// - Older versions of libstdc++ will fail to have it like they do for other
|
||||
// type traits. This has become a subset of the second point, but used to be
|
||||
// handled independently.
|
||||
// - An experimental release of gcc includes most of type_traits but misses
|
||||
// is_trivially_copyable, so we still have to avoid using libstdc++ in this
|
||||
// case, which is covered by CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX.
|
||||
// - When compiling libc++ from before r239653, with a gcc compiler, the
|
||||
// std::is_trivially_copyable can fail. So we need to work around that by not
|
||||
// using the one in libc++ in this case. This is covered by the
|
||||
// CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX define, and is discussed in
|
||||
// https://llvm.org/bugs/show_bug.cgi?id=27538#c1 where they point out that
|
||||
// in libc++'s commit r239653 this is fixed by libc++ checking for gcc 5.1.
|
||||
// - In both of the above cases we are using the gcc compiler. When defining
|
||||
// this ourselves on compiler intrinsics, the __is_trivially_copyable()
|
||||
// intrinsic is not available on gcc before version 5.1 (see the discussion in
|
||||
// https://llvm.org/bugs/show_bug.cgi?id=27538#c1 again), so we must check for
|
||||
// that version.
|
||||
// - When __is_trivially_copyable() is not available because we are on gcc older
|
||||
// than 5.1, we need to fall back to something, so we use __has_trivial_copy()
|
||||
// instead based on what was done one-off in bit_cast() previously.
|
||||
|
||||
// TODO(crbug.com/554293): Remove this when all platforms have this in the std
|
||||
// namespace and it works with gcc as needed.
|
||||
#if defined(CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX) || \
|
||||
defined(CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX)
|
||||
template <typename T>
|
||||
struct is_trivially_copyable {
|
||||
// TODO(danakj): Remove this when android builders are all using a newer version
|
||||
// of gcc, or the android ndk is updated to a newer libc++ that does this for
|
||||
// us.
|
||||
#if _GNUC_VER >= 501
|
||||
static constexpr bool value = __is_trivially_copyable(T);
|
||||
#else
|
||||
static constexpr bool value =
|
||||
__has_trivial_copy(T) && __has_trivial_destructor(T);
|
||||
#endif
|
||||
};
|
||||
#else
|
||||
template <class T>
|
||||
using is_trivially_copyable = std::is_trivially_copyable<T>;
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ <= 7
|
||||
// Workaround for g++7 and earlier family.
|
||||
// Due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80654, without this
|
||||
// Optional<std::vector<T>> where T is non-copyable causes a compile error.
|
||||
// As we know it is not trivially copy constructible, explicitly declare so.
|
||||
template <typename T>
|
||||
struct is_trivially_copy_constructible
|
||||
: std::is_trivially_copy_constructible<T> {};
|
||||
|
||||
template <typename... T>
|
||||
struct is_trivially_copy_constructible<std::vector<T...>> : std::false_type {};
|
||||
#else
|
||||
// Otherwise use std::is_trivially_copy_constructible as is.
|
||||
template <typename T>
|
||||
using is_trivially_copy_constructible = std::is_trivially_copy_constructible<T>;
|
||||
#endif
|
||||
|
||||
// base::in_place_t is an implementation of std::in_place_t from
|
||||
// C++17. A tag type used to request in-place construction in template vararg
|
||||
// constructors.
|
||||
|
||||
// Specification:
|
||||
// https://en.cppreference.com/w/cpp/utility/in_place
|
||||
struct in_place_t {};
|
||||
constexpr in_place_t in_place = {};
|
||||
|
||||
// base::in_place_type_t is an implementation of std::in_place_type_t from
|
||||
// C++17. A tag type used for in-place construction when the type to construct
|
||||
// needs to be specified, such as with base::unique_any, designed to be a
|
||||
// drop-in replacement.
|
||||
|
||||
// Specification:
|
||||
// http://en.cppreference.com/w/cpp/utility/in_place
|
||||
template <typename T>
|
||||
struct in_place_type_t {};
|
||||
|
||||
template <typename T>
|
||||
struct is_in_place_type_t {
|
||||
static constexpr bool value = false;
|
||||
};
|
||||
|
||||
template <typename... Ts>
|
||||
struct is_in_place_type_t<in_place_type_t<Ts...>> {
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
// C++14 implementation of C++17's std::bool_constant.
|
||||
//
|
||||
// Reference: https://en.cppreference.com/w/cpp/types/integral_constant
|
||||
// Specification: https://wg21.link/meta.type.synop
|
||||
template <bool B>
|
||||
using bool_constant = std::integral_constant<bool, B>;
|
||||
|
||||
// C++14 implementation of C++17's std::conjunction.
|
||||
//
|
||||
// Reference: https://en.cppreference.com/w/cpp/types/conjunction
|
||||
// Specification: https://wg21.link/meta.logical#1.itemdecl:1
|
||||
template <typename...>
|
||||
struct conjunction : std::true_type {};
|
||||
|
||||
template <typename B1>
|
||||
struct conjunction<B1> : B1 {};
|
||||
|
||||
template <typename B1, typename... Bn>
|
||||
struct conjunction<B1, Bn...>
|
||||
: std::conditional_t<static_cast<bool>(B1::value), conjunction<Bn...>, B1> {
|
||||
};
|
||||
|
||||
// C++14 implementation of C++17's std::disjunction.
|
||||
//
|
||||
// Reference: https://en.cppreference.com/w/cpp/types/disjunction
|
||||
// Specification: https://wg21.link/meta.logical#itemdecl:2
|
||||
template <typename...>
|
||||
struct disjunction : std::false_type {};
|
||||
|
||||
template <typename B1>
|
||||
struct disjunction<B1> : B1 {};
|
||||
|
||||
template <typename B1, typename... Bn>
|
||||
struct disjunction<B1, Bn...>
|
||||
: std::conditional_t<static_cast<bool>(B1::value), B1, disjunction<Bn...>> {
|
||||
};
|
||||
|
||||
// C++14 implementation of C++17's std::negation.
|
||||
//
|
||||
// Reference: https://en.cppreference.com/w/cpp/types/negation
|
||||
// Specification: https://wg21.link/meta.logical#itemdecl:3
|
||||
template <typename B>
|
||||
struct negation : bool_constant<!static_cast<bool>(B::value)> {};
|
||||
|
||||
// Implementation of C++17's invoke_result.
|
||||
//
|
||||
// This implementation adds references to `Functor` and `Args` to work around
|
||||
// some quirks of std::result_of. See the #Notes section of [1] for details.
|
||||
//
|
||||
// References:
|
||||
// [1] https://en.cppreference.com/w/cpp/types/result_of
|
||||
// [2] https://wg21.link/meta.trans.other#lib:invoke_result
|
||||
#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
|
||||
template <typename Functor, typename... Args>
|
||||
using invoke_result = std::invoke_result<Functor, Args...>;
|
||||
#else
|
||||
template <typename Functor, typename... Args>
|
||||
using invoke_result = std::result_of<Functor && (Args && ...)>;
|
||||
#endif
|
||||
|
||||
// Implementation of C++17's std::invoke_result_t.
|
||||
//
|
||||
// Reference: https://wg21.link/meta.type.synop#lib:invoke_result_t
|
||||
template <typename Functor, typename... Args>
|
||||
using invoke_result_t = typename invoke_result<Functor, Args...>::type;
|
||||
|
||||
namespace internal {
|
||||
|
||||
// Base case, `InvokeResult` does not have a nested type member. This means `F`
|
||||
// could not be invoked with `Args...` and thus is not invocable.
|
||||
template <typename InvokeResult, typename R, typename = void>
|
||||
struct IsInvocableImpl : std::false_type {};
|
||||
|
||||
// Happy case, `InvokeResult` does have a nested type member. Now check whether
|
||||
// `InvokeResult::type` is convertible to `R`. Short circuit in case
|
||||
// `std::is_void<R>`.
|
||||
template <typename InvokeResult, typename R>
|
||||
struct IsInvocableImpl<InvokeResult, R, void_t<typename InvokeResult::type>>
|
||||
: disjunction<std::is_void<R>,
|
||||
std::is_convertible<typename InvokeResult::type, R>> {};
|
||||
|
||||
} // namespace internal
|
||||
|
||||
// Implementation of C++17's std::is_invocable_r.
|
||||
//
|
||||
// Returns whether `F` can be invoked with `Args...` and the result is
|
||||
// convertible to `R`.
|
||||
//
|
||||
// Reference: https://wg21.link/meta.rel#lib:is_invocable_r
|
||||
template <typename R, typename F, typename... Args>
|
||||
struct is_invocable_r
|
||||
: internal::IsInvocableImpl<invoke_result<F, Args...>, R> {};
|
||||
|
||||
// Implementation of C++17's std::is_invocable.
|
||||
//
|
||||
// Returns whether `F` can be invoked with `Args...`.
|
||||
//
|
||||
// Reference: https://wg21.link/meta.rel#lib:is_invocable
|
||||
template <typename F, typename... Args>
|
||||
struct is_invocable : is_invocable_r<void, F, Args...> {};
|
||||
|
||||
namespace internal {
|
||||
|
||||
// The indirection with std::is_enum<T> is required, because instantiating
|
||||
// std::underlying_type_t<T> when T is not an enum is UB prior to C++20.
|
||||
template <typename T, bool = std::is_enum<T>::value>
|
||||
struct IsScopedEnumImpl : std::false_type {};
|
||||
|
||||
template <typename T>
|
||||
struct IsScopedEnumImpl<T, /*std::is_enum<T>::value=*/true>
|
||||
: negation<std::is_convertible<T, std::underlying_type_t<T>>> {};
|
||||
|
||||
} // namespace internal
|
||||
|
||||
// Implementation of C++23's std::is_scoped_enum
|
||||
//
|
||||
// Reference: https://en.cppreference.com/w/cpp/types/is_scoped_enum
|
||||
template <typename T>
|
||||
struct is_scoped_enum : internal::IsScopedEnumImpl<T> {};
|
||||
|
||||
// Implementation of C++20's std::remove_cvref.
|
||||
//
|
||||
// References:
|
||||
// - https://en.cppreference.com/w/cpp/types/remove_cvref
|
||||
// - https://wg21.link/meta.trans.other#lib:remove_cvref
|
||||
template <typename T>
|
||||
struct remove_cvref {
|
||||
using type = std::remove_cv_t<std::remove_reference_t<T>>;
|
||||
};
|
||||
|
||||
// Implementation of C++20's std::remove_cvref_t.
|
||||
//
|
||||
// References:
|
||||
// - https://en.cppreference.com/w/cpp/types/remove_cvref
|
||||
// - https://wg21.link/meta.type.synop#lib:remove_cvref_t
|
||||
template <typename T>
|
||||
using remove_cvref_t = typename remove_cvref<T>::type;
|
||||
|
||||
// Simplified implementation of C++20's std::iter_value_t.
|
||||
// As opposed to std::iter_value_t, this implementation does not restrict
|
||||
// the type of `Iter` and does not consider specializations of
|
||||
// `indirectly_readable_traits`.
|
||||
//
|
||||
// Reference: https://wg21.link/readable.traits#2
|
||||
template <typename Iter>
|
||||
using iter_value_t =
|
||||
typename std::iterator_traits<remove_cvref_t<Iter>>::value_type;
|
||||
|
||||
// Simplified implementation of C++20's std::iter_reference_t.
|
||||
// As opposed to std::iter_reference_t, this implementation does not restrict
|
||||
// the type of `Iter`.
|
||||
//
|
||||
// Reference: https://wg21.link/iterator.synopsis#:~:text=iter_reference_t
|
||||
template <typename Iter>
|
||||
using iter_reference_t = decltype(*std::declval<Iter&>());
|
||||
|
||||
// Simplified implementation of C++20's std::indirect_result_t. As opposed to
|
||||
// std::indirect_result_t, this implementation does not restrict the type of
|
||||
// `Func` and `Iters`.
|
||||
//
|
||||
// Reference: https://wg21.link/iterator.synopsis#:~:text=indirect_result_t
|
||||
template <typename Func, typename... Iters>
|
||||
using indirect_result_t = invoke_result_t<Func, iter_reference_t<Iters>...>;
|
||||
|
||||
// Simplified implementation of C++20's std::projected. As opposed to
|
||||
// std::projected, this implementation does not explicitly restrict the type of
|
||||
// `Iter` and `Proj`, but rather does so implicitly by requiring
|
||||
// `indirect_result_t<Proj, Iter>` is a valid type. This is required for SFINAE
|
||||
// friendliness.
|
||||
//
|
||||
// Reference: https://wg21.link/projected
|
||||
template <typename Iter,
|
||||
typename Proj,
|
||||
typename IndirectResultT = indirect_result_t<Proj, Iter>>
|
||||
struct projected {
|
||||
using value_type = remove_cvref_t<IndirectResultT>;
|
||||
|
||||
IndirectResultT operator*() const; // not defined
|
||||
};
|
||||
|
||||
} // namespace base
|
||||
|
||||
#undef CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX
|
||||
#undef CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_TEMPLATE_UTIL_H_
|
@@ -68,7 +68,6 @@
|
||||
#include "include/base/cef_build.h"
|
||||
#include "include/base/cef_compiler_specific.h"
|
||||
#include "include/base/cef_logging.h"
|
||||
#include "include/base/cef_template_util.h"
|
||||
#include "include/base/cef_weak_ptr.h"
|
||||
#include "include/base/internal/cef_callback_internal.h"
|
||||
#include "include/base/internal/cef_raw_scoped_refptr_mismatch_checker.h"
|
||||
@@ -356,14 +355,14 @@ template <typename Functor, typename SFINAE = void>
|
||||
struct IsCallableObject : std::false_type {};
|
||||
|
||||
template <typename Callable>
|
||||
struct IsCallableObject<Callable, void_t<decltype(&Callable::operator())>>
|
||||
struct IsCallableObject<Callable, std::void_t<decltype(&Callable::operator())>>
|
||||
: std::true_type {};
|
||||
|
||||
// HasRefCountedTypeAsRawPtr inherits from true_type when any of the |Args| is a
|
||||
// raw pointer to a RefCounted type.
|
||||
template <typename... Ts>
|
||||
struct HasRefCountedTypeAsRawPtr
|
||||
: disjunction<NeedsScopedRefptrButGetsRawPtr<Ts>...> {};
|
||||
: std::disjunction<NeedsScopedRefptrButGetsRawPtr<Ts>...> {};
|
||||
|
||||
// ForceVoidReturn<>
|
||||
//
|
||||
@@ -878,7 +877,7 @@ BanUnconstructedRefCountedReceiver(const Receiver& receiver, Unused&&...) {
|
||||
// This stores all the state passed into Bind().
|
||||
template <typename Functor, typename... BoundArgs>
|
||||
struct BindState final : BindStateBase {
|
||||
using IsCancellable = bool_constant<
|
||||
using IsCancellable = std::bool_constant<
|
||||
CallbackCancellationTraits<Functor,
|
||||
std::tuple<BoundArgs...>>::is_cancellable>;
|
||||
template <typename ForwardFunctor, typename... ForwardBoundArgs>
|
||||
@@ -1252,7 +1251,7 @@ decltype(auto) BindImpl(Functor&& functor, Args&&... args) {
|
||||
// PolymorphicInvoke, to which CallbackType will cast back.
|
||||
using PolymorphicInvoke = typename CallbackType::PolymorphicInvoke;
|
||||
PolymorphicInvoke invoke_func =
|
||||
GetInvokeFunc<Invoker>(bool_constant<kIsOnce>());
|
||||
GetInvokeFunc<Invoker>(std::bool_constant<kIsOnce>());
|
||||
|
||||
using InvokeFuncStorage = BindStateBase::InvokeFuncStorage;
|
||||
return CallbackType(BindState::Create(
|
||||
|
@@ -34,8 +34,6 @@
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include "include/base/cef_template_util.h"
|
||||
|
||||
// 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
|
||||
@@ -54,16 +52,16 @@ struct IsRefCountedType : std::false_type {};
|
||||
|
||||
template <typename T>
|
||||
struct IsRefCountedType<T,
|
||||
void_t<decltype(std::declval<T*>()->AddRef()),
|
||||
decltype(std::declval<T*>()->Release())>>
|
||||
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
|
||||
: conjunction<std::is_pointer<T>,
|
||||
IsRefCountedType<std::remove_pointer_t<T>>> {
|
||||
: std::conjunction<std::is_pointer<T>,
|
||||
IsRefCountedType<std::remove_pointer_t<T>>> {
|
||||
static_assert(!std::is_reference<T>::value,
|
||||
"NeedsScopedRefptrButGetsRawPtr requires non-reference type.");
|
||||
};
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=1de3354bd0a042cc28199f1f56753b1df9e279a2$
|
||||
// $hash=5374127458a7cac3ee9b4d2b4ad8a6f5ca81ec52$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_DISPLAY_HANDLER_CAPI_H_
|
||||
@@ -84,8 +84,13 @@ typedef struct _cef_display_handler_t {
|
||||
/// Called when web content in the page has toggled fullscreen mode. If
|
||||
/// |fullscreen| is true (1) the content will automatically be sized to fill
|
||||
/// the browser content area. If |fullscreen| is false (0) the content will
|
||||
/// automatically return to its original size and position. The client is
|
||||
/// responsible for resizing the browser if desired.
|
||||
/// 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,
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=94e93810316b74e54eb315d97c6fc6f1cc0c9cc5$
|
||||
// $hash=9e8dd2187d592f7556cbee0db3ceab851f9aae13$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_BROWSER_VIEW_DELEGATE_CAPI_H_
|
||||
@@ -119,14 +119,23 @@ typedef struct _cef_browser_view_delegate_t {
|
||||
/// documentation.
|
||||
///
|
||||
cef_chrome_toolbar_type_t(CEF_CALLBACK* get_chrome_toolbar_type)(
|
||||
struct _cef_browser_view_delegate_t* self);
|
||||
struct _cef_browser_view_delegate_t* self,
|
||||
struct _cef_browser_view_t* browser_view);
|
||||
|
||||
///
|
||||
/// Return true (1) to create frameless windows for Document picture-in-
|
||||
/// picture popups. Content in frameless windows should specify draggable
|
||||
/// regions using "-webkit-app-region: drag" CSS.
|
||||
///
|
||||
int(CEF_CALLBACK* use_frameless_window_for_picture_in_picture)(
|
||||
struct _cef_browser_view_delegate_t* self,
|
||||
struct _cef_browser_view_t* browser_view);
|
||||
|
||||
///
|
||||
/// Called when |browser_view| receives a gesture command. Return true (1) to
|
||||
/// handle (or disable) a |gesture_command| or false (0) to propagate the
|
||||
/// gesture to the browser for default handling. This function will only be
|
||||
/// called with the Alloy runtime. To handle these commands with the Chrome
|
||||
/// runtime implement cef_command_handler_t::OnChromeCommand instead.
|
||||
/// gesture to the browser for default handling. With the Chrome runtime these
|
||||
/// commands can also be handled via cef_command_handler_t::OnChromeCommand.
|
||||
///
|
||||
int(CEF_CALLBACK* on_gesture_command)(
|
||||
struct _cef_browser_view_delegate_t* self,
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=d53c4a0a7e731a56a0edcb9d705c76b0a2770155$
|
||||
// $hash=4b43fe0b493d860e8b28d7a6d892db49d1135b34$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_CAPI_H_
|
||||
@@ -155,7 +155,9 @@ typedef struct _cef_window_t {
|
||||
void(CEF_CALLBACK* restore)(struct _cef_window_t* self);
|
||||
|
||||
///
|
||||
/// Set fullscreen Window state.
|
||||
/// Set fullscreen Window state. The
|
||||
/// cef_window_delegate_t::OnWindowFullscreenTransition function will be
|
||||
/// called during the fullscreen transition for notification purposes.
|
||||
///
|
||||
void(CEF_CALLBACK* set_fullscreen)(struct _cef_window_t* self,
|
||||
int fullscreen);
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=61099a1ba8b16a5e46f5a80d326d1f9bfc99317d$
|
||||
// $hash=456f00f7afbac910cf36feecd38399a2fb16960d$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_DELEGATE_CAPI_H_
|
||||
@@ -96,6 +96,20 @@ typedef struct _cef_window_delegate_t {
|
||||
struct _cef_window_t* window,
|
||||
const cef_rect_t* new_bounds);
|
||||
|
||||
///
|
||||
/// Called when |window| is transitioning to or from fullscreen mode. On MacOS
|
||||
/// the transition occurs asynchronously with |is_competed| set to false (0)
|
||||
/// when the transition starts and true (1) after the transition completes. On
|
||||
/// other platforms the transition occurs synchronously with |is_completed|
|
||||
/// set to true (1) after the transition completes. With the Alloy runtime you
|
||||
/// must also implement cef_display_handler_t::OnFullscreenModeChange to
|
||||
/// handle fullscreen transitions initiated by browser content.
|
||||
///
|
||||
void(CEF_CALLBACK* on_window_fullscreen_transition)(
|
||||
struct _cef_window_delegate_t* self,
|
||||
struct _cef_window_t* window,
|
||||
int is_completed);
|
||||
|
||||
///
|
||||
/// Return the parent for |window| or NULL if the |window| does not have a
|
||||
/// parent. Windows with parents will not get a taskbar button. Set |is_menu|
|
||||
@@ -210,17 +224,6 @@ typedef struct _cef_window_delegate_t {
|
||||
int(CEF_CALLBACK* on_key_event)(struct _cef_window_delegate_t* self,
|
||||
struct _cef_window_t* window,
|
||||
const cef_key_event_t* event);
|
||||
|
||||
///
|
||||
/// Called when the |window| is transitioning to or from fullscreen mode. The
|
||||
/// transition occurs in two stages, with |is_competed| set to false (0) when
|
||||
/// the transition starts and true (1) when the transition completes. This
|
||||
/// function is only supported on macOS.
|
||||
///
|
||||
void(CEF_CALLBACK* on_window_fullscreen_transition)(
|
||||
struct _cef_window_delegate_t* self,
|
||||
struct _cef_window_t* window,
|
||||
int is_completed);
|
||||
} cef_window_delegate_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -42,13 +42,13 @@
|
||||
// way that may cause binary incompatibility with other builds. The universal
|
||||
// hash value will change if any platform is affected whereas the platform hash
|
||||
// values will change only if that particular platform is affected.
|
||||
#define CEF_API_HASH_UNIVERSAL "a86f6076488c08805e6d0038c8935604fd32507c"
|
||||
#define CEF_API_HASH_UNIVERSAL "133bd59744d82162591d93434cb6ff146717a3f7"
|
||||
#if defined(OS_WIN)
|
||||
#define CEF_API_HASH_PLATFORM "bf9b8fe7fee80a5ec3b46427e8b3a4b29afca1ce"
|
||||
#define CEF_API_HASH_PLATFORM "a39ec0ef3643f91abe7dc529def454336016478d"
|
||||
#elif defined(OS_MAC)
|
||||
#define CEF_API_HASH_PLATFORM "e57a71ffed7a2ef3b8b5725dec90799057a017e9"
|
||||
#define CEF_API_HASH_PLATFORM "35b5f3657fe9f203a7852235b85b5f2a7501d59e"
|
||||
#elif defined(OS_LINUX)
|
||||
#define CEF_API_HASH_PLATFORM "bb78503cd459091d26ac7876599c975e8f718705"
|
||||
#define CEF_API_HASH_PLATFORM "5623b2222e7b39b014c821d941c280e29b8693d3"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -75,8 +75,12 @@ class CefDisplayHandler : public virtual CefBaseRefCounted {
|
||||
/// Called when web content in the page has toggled fullscreen mode. If
|
||||
/// |fullscreen| is true the content will automatically be sized to fill the
|
||||
/// browser content area. If |fullscreen| is false the content will
|
||||
/// automatically return to its original size and position. The client is
|
||||
/// responsible for resizing the browser if desired.
|
||||
/// 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 CefWindow::SetFullscreen when using Views). With
|
||||
/// the Chrome runtime the fullscreen transition will be triggered
|
||||
/// automatically. The CefWindowDelegate::OnWindowFullscreenTransition method
|
||||
/// will be called during the fullscreen transition for notification purposes.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnFullscreenModeChange(CefRefPtr<CefBrowser> browser,
|
||||
|
@@ -113,14 +113,27 @@ class CefBrowserViewDelegate : public CefViewDelegate {
|
||||
/// documentation.
|
||||
///
|
||||
/*--cef(default_retval=CEF_CTT_NONE)--*/
|
||||
virtual ChromeToolbarType GetChromeToolbarType() { return CEF_CTT_NONE; }
|
||||
virtual ChromeToolbarType GetChromeToolbarType(
|
||||
CefRefPtr<CefBrowserView> browser_view) {
|
||||
return CEF_CTT_NONE;
|
||||
}
|
||||
|
||||
///
|
||||
/// Return true to create frameless windows for Document picture-in-picture
|
||||
/// popups. Content in frameless windows should specify draggable regions
|
||||
/// using "-webkit-app-region: drag" CSS.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool UseFramelessWindowForPictureInPicture(
|
||||
CefRefPtr<CefBrowserView> browser_view) {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
/// Called when |browser_view| receives a gesture command. Return true to
|
||||
/// handle (or disable) a |gesture_command| or false to propagate the gesture
|
||||
/// to the browser for default handling. This method will only be called with
|
||||
/// the Alloy runtime. To handle these commands with the Chrome runtime
|
||||
/// implement CefCommandHandler::OnChromeCommand instead.
|
||||
/// to the browser for default handling. With the Chrome runtime these
|
||||
/// commands can also be handled via CefCommandHandler::OnChromeCommand.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool OnGestureCommand(CefRefPtr<CefBrowserView> browser_view,
|
||||
|
@@ -165,7 +165,9 @@ class CefWindow : public CefPanel {
|
||||
virtual void Restore() = 0;
|
||||
|
||||
///
|
||||
/// Set fullscreen Window state.
|
||||
/// Set fullscreen Window state. The
|
||||
/// CefWindowDelegate::OnWindowFullscreenTransition method will be called
|
||||
/// during the fullscreen transition for notification purposes.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SetFullscreen(bool fullscreen) = 0;
|
||||
|
@@ -84,6 +84,19 @@ class CefWindowDelegate : public CefPanelDelegate {
|
||||
virtual void OnWindowBoundsChanged(CefRefPtr<CefWindow> window,
|
||||
const CefRect& new_bounds) {}
|
||||
|
||||
///
|
||||
/// Called when |window| is transitioning to or from fullscreen mode. On MacOS
|
||||
/// the transition occurs asynchronously with |is_competed| set to false when
|
||||
/// the transition starts and true after the transition completes. On other
|
||||
/// platforms the transition occurs synchronously with |is_completed| set to
|
||||
/// true after the transition completes. With the Alloy runtime you must also
|
||||
/// implement CefDisplayHandler::OnFullscreenModeChange to handle fullscreen
|
||||
/// transitions initiated by browser content.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnWindowFullscreenTransition(CefRefPtr<CefWindow> window,
|
||||
bool is_completed) {}
|
||||
|
||||
///
|
||||
/// Return the parent for |window| or NULL if the |window| does not have a
|
||||
/// parent. Windows with parents will not get a taskbar button. Set |is_menu|
|
||||
@@ -209,16 +222,6 @@ class CefWindowDelegate : public CefPanelDelegate {
|
||||
const CefKeyEvent& event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
/// Called when the |window| is transitioning to or from fullscreen mode. The
|
||||
/// transition occurs in two stages, with |is_competed| set to false when the
|
||||
/// transition starts and true when the transition completes.
|
||||
/// This method is only supported on macOS.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnWindowFullscreenTransition(CefRefPtr<CefWindow> window,
|
||||
bool is_completed) {}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_VIEWS_CEF_WINDOW_DELEGATE_H_
|
||||
|
@@ -11,6 +11,8 @@
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "chrome/browser/ui/page_action/page_action_icon_type.h"
|
||||
#include "content/public/browser/web_contents_delegate.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "third_party/skia/include/core/SkRegion.h"
|
||||
#include "ui/base/window_open_disposition.h"
|
||||
|
||||
class Browser;
|
||||
@@ -33,7 +35,8 @@ class BrowserDelegate : public content::WebContentsDelegate {
|
||||
// Called from the Browser constructor to create a new delegate.
|
||||
static std::unique_ptr<BrowserDelegate> Create(
|
||||
Browser* browser,
|
||||
scoped_refptr<CreateParams> cef_params);
|
||||
scoped_refptr<CreateParams> cef_params,
|
||||
const Browser* opener);
|
||||
|
||||
~BrowserDelegate() override {}
|
||||
|
||||
@@ -103,6 +106,29 @@ class BrowserDelegate : public content::WebContentsDelegate {
|
||||
content::MediaResponseCallback callback) {
|
||||
return callback;
|
||||
}
|
||||
|
||||
// Optionally override support for the specified window feature of type
|
||||
// Browser::WindowFeature.
|
||||
virtual absl::optional<bool> SupportsWindowFeature(int feature) const {
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
// Returns true if draggable regions are supported.
|
||||
virtual bool SupportsDraggableRegion() const { return false; }
|
||||
|
||||
// Returns the draggable region, if any, relative to the web contents.
|
||||
// Called from PictureInPictureBrowserFrameView::NonClientHitTest and
|
||||
// BrowserView::ShouldDescendIntoChildForEventHandling.
|
||||
virtual const absl::optional<SkRegion> GetDraggableRegion() const {
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
// Set the draggable region relative to web contents.
|
||||
// Called from DraggableRegionsHostImpl::UpdateDraggableRegions.
|
||||
virtual void UpdateDraggableRegion(const SkRegion& region) {}
|
||||
|
||||
// Called at the end of a fullscreen transition.
|
||||
virtual void WindowFullscreenStateChanged() {}
|
||||
};
|
||||
|
||||
} // namespace cef
|
||||
|
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "libcef/browser/chrome/chrome_browser_context.h"
|
||||
|
||||
#include "libcef/browser/prefs/browser_prefs.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
@@ -167,6 +168,8 @@ void ChromeBrowserContext::ProfileCreated(Profile::CreateStatus status,
|
||||
: SessionStartupPref::kPrefValueNewTab);
|
||||
}
|
||||
|
||||
browser_prefs::SetInitialProfilePrefs(profile_);
|
||||
|
||||
if (!init_callbacks_.empty()) {
|
||||
for (auto& callback : init_callbacks_) {
|
||||
std::move(callback).Run();
|
||||
|
@@ -11,8 +11,11 @@
|
||||
#include "libcef/browser/browser_info_manager.h"
|
||||
#include "libcef/browser/browser_platform_delegate.h"
|
||||
#include "libcef/browser/chrome/chrome_browser_host_impl.h"
|
||||
#include "libcef/browser/chrome/views/chrome_browser_view.h"
|
||||
#include "libcef/browser/media_access_query.h"
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
#include "libcef/browser/views/browser_view_impl.h"
|
||||
#include "libcef/browser/views/window_impl.h"
|
||||
#include "libcef/common/app_manager.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
|
||||
@@ -27,9 +30,19 @@ using content::KeyboardEventProcessingResult;
|
||||
|
||||
ChromeBrowserDelegate::ChromeBrowserDelegate(
|
||||
Browser* browser,
|
||||
const CefBrowserCreateParams& create_params)
|
||||
const CefBrowserCreateParams& create_params,
|
||||
const Browser* opener)
|
||||
: browser_(browser), create_params_(create_params) {
|
||||
DCHECK(browser_);
|
||||
|
||||
if (opener) {
|
||||
DCHECK(browser->is_type_picture_in_picture());
|
||||
auto opener_host = ChromeBrowserHostImpl::GetBrowserForBrowser(opener);
|
||||
DCHECK(opener_host);
|
||||
if (opener_host) {
|
||||
opener_host_ = opener_host->GetWeakPtr();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ChromeBrowserDelegate::~ChromeBrowserDelegate() = default;
|
||||
@@ -195,6 +208,73 @@ ChromeBrowserDelegate::RequestMediaAccessPermissionEx(
|
||||
return callback;
|
||||
}
|
||||
|
||||
bool ChromeBrowserDelegate::SupportsFramelessPictureInPicture() const {
|
||||
if (!browser_->is_type_picture_in_picture()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (frameless_pip_.has_value()) {
|
||||
return *frameless_pip_;
|
||||
}
|
||||
|
||||
frameless_pip_ = false;
|
||||
|
||||
if (opener_host_) {
|
||||
if (auto chrome_browser_view = opener_host_->chrome_browser_view()) {
|
||||
if (auto cef_delegate = chrome_browser_view->cef_delegate()) {
|
||||
frameless_pip_ = cef_delegate->UseFramelessWindowForPictureInPicture(
|
||||
chrome_browser_view->cef_browser_view());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return *frameless_pip_;
|
||||
}
|
||||
|
||||
absl::optional<bool> ChromeBrowserDelegate::SupportsWindowFeature(
|
||||
int feature) const {
|
||||
// Override the default value from
|
||||
// Browser::PictureInPictureBrowserSupportsWindowFeature.
|
||||
if (feature == Browser::FEATURE_TITLEBAR &&
|
||||
browser_->is_type_picture_in_picture()) {
|
||||
// Return false to hide titlebar and enable draggable regions.
|
||||
return !SupportsFramelessPictureInPicture();
|
||||
}
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
bool ChromeBrowserDelegate::SupportsDraggableRegion() const {
|
||||
return SupportsFramelessPictureInPicture();
|
||||
}
|
||||
|
||||
const absl::optional<SkRegion> ChromeBrowserDelegate::GetDraggableRegion()
|
||||
const {
|
||||
DCHECK(SupportsDraggableRegion());
|
||||
return draggable_region_;
|
||||
}
|
||||
|
||||
void ChromeBrowserDelegate::UpdateDraggableRegion(const SkRegion& region) {
|
||||
DCHECK(SupportsDraggableRegion());
|
||||
draggable_region_ = region;
|
||||
}
|
||||
|
||||
void ChromeBrowserDelegate::WindowFullscreenStateChanged() {
|
||||
// Use a synchronous callback for notification on Windows/Linux. MacOS gets
|
||||
// notified asynchronously via CefNativeWidgetMac callbacks.
|
||||
#if !BUILDFLAG(IS_MAC)
|
||||
if (auto browser = ChromeBrowserHostImpl::GetBrowserForBrowser(browser_)) {
|
||||
if (auto chrome_browser_view = browser->chrome_browser_view()) {
|
||||
auto* cef_window = chrome_browser_view->cef_browser_view()->cef_window();
|
||||
if (auto* delegate = cef_window->delegate()) {
|
||||
// Give the CefWindowDelegate a chance to handle the event.
|
||||
delegate->OnWindowFullscreenTransition(cef_window,
|
||||
/*is_completed=*/true);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ChromeBrowserDelegate::WebContentsCreated(
|
||||
content::WebContents* source_contents,
|
||||
int opener_render_process_id,
|
||||
@@ -397,7 +477,12 @@ namespace cef {
|
||||
// static
|
||||
std::unique_ptr<BrowserDelegate> BrowserDelegate::Create(
|
||||
Browser* browser,
|
||||
scoped_refptr<CreateParams> cef_params) {
|
||||
scoped_refptr<CreateParams> cef_params,
|
||||
const Browser* opener) {
|
||||
if (!cef::IsChromeRuntimeEnabled()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CefBrowserCreateParams create_params;
|
||||
|
||||
// Parameters from ChromeBrowserHostImpl::Create, or nullptr if the Browser
|
||||
@@ -412,7 +497,8 @@ std::unique_ptr<BrowserDelegate> BrowserDelegate::Create(
|
||||
params->create_params_.browser_view = nullptr;
|
||||
}
|
||||
|
||||
return std::make_unique<ChromeBrowserDelegate>(browser, create_params);
|
||||
return std::make_unique<ChromeBrowserDelegate>(browser, create_params,
|
||||
opener);
|
||||
}
|
||||
|
||||
} // namespace cef
|
||||
|
@@ -40,7 +40,8 @@ class ChromeBrowserHostImpl;
|
||||
class ChromeBrowserDelegate : public cef::BrowserDelegate {
|
||||
public:
|
||||
ChromeBrowserDelegate(Browser* browser,
|
||||
const CefBrowserCreateParams& create_params);
|
||||
const CefBrowserCreateParams& create_params,
|
||||
const Browser* opener);
|
||||
|
||||
ChromeBrowserDelegate(const ChromeBrowserDelegate&) = delete;
|
||||
ChromeBrowserDelegate& operator=(const ChromeBrowserDelegate&) = delete;
|
||||
@@ -65,6 +66,11 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
|
||||
content::WebContents* web_contents,
|
||||
const content::MediaStreamRequest& request,
|
||||
content::MediaResponseCallback callback) override;
|
||||
absl::optional<bool> SupportsWindowFeature(int feature) const override;
|
||||
bool SupportsDraggableRegion() const override;
|
||||
const absl::optional<SkRegion> GetDraggableRegion() const override;
|
||||
void UpdateDraggableRegion(const SkRegion& region) override;
|
||||
void WindowFullscreenStateChanged() override;
|
||||
|
||||
// WebContentsDelegate methods:
|
||||
void WebContentsCreated(content::WebContents* source_contents,
|
||||
@@ -113,12 +119,17 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
|
||||
CefBrowserContentsDelegate* GetDelegateForWebContents(
|
||||
content::WebContents* web_contents);
|
||||
|
||||
bool SupportsFramelessPictureInPicture() const;
|
||||
|
||||
Browser* const browser_;
|
||||
base::WeakPtr<ChromeBrowserHostImpl> opener_host_;
|
||||
|
||||
// Used when creating a new browser host.
|
||||
const CefBrowserCreateParams create_params_;
|
||||
|
||||
absl::optional<bool> show_status_bubble_;
|
||||
absl::optional<SkRegion> draggable_region_;
|
||||
mutable absl::optional<bool> frameless_pip_;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_BROWSER_DELEGATE_H_
|
||||
|
@@ -332,6 +332,13 @@ bool ChromeBrowserHostImpl::IsBackgroundHost() {
|
||||
return false;
|
||||
}
|
||||
|
||||
ChromeBrowserView* ChromeBrowserHostImpl::chrome_browser_view() const {
|
||||
if (browser_ && is_views_hosted_) {
|
||||
return static_cast<ChromeBrowserView*>(browser_->window());
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool ChromeBrowserHostImpl::Navigate(const content::OpenURLParams& params) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (GetCurrentTabIndex() == TabStripModel::kNoTab) {
|
||||
@@ -413,8 +420,7 @@ Browser* ChromeBrowserHostImpl::CreateBrowser(
|
||||
auto view_impl =
|
||||
static_cast<CefBrowserViewImpl*>(params.browser_view.get());
|
||||
|
||||
chrome_browser_view =
|
||||
static_cast<ChromeBrowserView*>(view_impl->root_view());
|
||||
chrome_browser_view = view_impl->chrome_browser_view();
|
||||
chrome_params.window = chrome_browser_view;
|
||||
|
||||
auto chrome_widget =
|
||||
@@ -433,8 +439,7 @@ Browser* ChromeBrowserHostImpl::CreateBrowser(
|
||||
if (chrome_browser_view) {
|
||||
// Initialize the BrowserFrame and BrowserView and create the controls that
|
||||
// require access to the Browser.
|
||||
chrome_browser_view->InitBrowser(base::WrapUnique(browser),
|
||||
params.browser_view);
|
||||
chrome_browser_view->InitBrowser(base::WrapUnique(browser));
|
||||
|
||||
// Don't set theme colors in ContentsWebView::UpdateBackgroundColor.
|
||||
chrome_browser_view->contents_web_view()->SetBackgroundVisible(false);
|
||||
@@ -514,10 +519,8 @@ void ChromeBrowserHostImpl::SetBrowser(Browser* browser) {
|
||||
|
||||
void ChromeBrowserHostImpl::WindowDestroyed() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (browser_ && is_views_hosted_) {
|
||||
auto chrome_browser_view =
|
||||
static_cast<ChromeBrowserView*>(browser_->window());
|
||||
chrome_browser_view->Destroyed();
|
||||
if (auto view = chrome_browser_view()) {
|
||||
view->Destroyed();
|
||||
}
|
||||
|
||||
platform_delegate_->CloseHostWindow();
|
||||
@@ -532,6 +535,7 @@ bool ChromeBrowserHostImpl::WillBeDestroyed() const {
|
||||
void ChromeBrowserHostImpl::DestroyBrowser() {
|
||||
CEF_REQUIRE_UIT();
|
||||
browser_ = nullptr;
|
||||
weak_ptr_factory_.InvalidateWeakPtrs();
|
||||
|
||||
OnBeforeClose();
|
||||
OnBrowserDestroyed();
|
||||
|
@@ -11,8 +11,11 @@
|
||||
#include "libcef/browser/browser_host_base.h"
|
||||
#include "libcef/browser/chrome/browser_delegate.h"
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
|
||||
class Browser;
|
||||
class ChromeBrowserDelegate;
|
||||
class ChromeBrowserView;
|
||||
|
||||
// CefBrowser implementation for the chrome runtime. Method calls are delegated
|
||||
// to the chrome Browser object or the WebContents as appropriate. See the
|
||||
@@ -114,6 +117,15 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
|
||||
CefRefPtr<CefExtension> GetExtension() override;
|
||||
bool IsBackgroundHost() override;
|
||||
|
||||
Browser* browser() const { return browser_; }
|
||||
|
||||
// Return the CEF specialization of BrowserView.
|
||||
ChromeBrowserView* chrome_browser_view() const;
|
||||
|
||||
base::WeakPtr<ChromeBrowserHostImpl> GetWeakPtr() {
|
||||
return weak_ptr_factory_.GetWeakPtr();
|
||||
}
|
||||
|
||||
protected:
|
||||
bool Navigate(const content::OpenURLParams& params) override;
|
||||
|
||||
@@ -157,6 +169,8 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
|
||||
|
||||
Browser* browser_ = nullptr;
|
||||
CefWindowHandle host_window_handle_ = kNullWindowHandle;
|
||||
|
||||
base::WeakPtrFactory<ChromeBrowserHostImpl> weak_ptr_factory_{this};
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_BROWSER_HOST_IMPL_H_
|
||||
|
@@ -411,17 +411,6 @@ bool ChromeContentBrowserClientCef::ConfigureNetworkContextParams(
|
||||
cef_context ? cef_context->GetCookieableSchemes()
|
||||
: CefBrowserContext::GetGlobalCookieableSchemes();
|
||||
|
||||
// Prefer the CEF settings configuration, if specified, instead of the
|
||||
// kAcceptLanguages preference which is controlled by the
|
||||
// chrome://settings/languages configuration.
|
||||
const std::string& accept_language_list =
|
||||
browser_prefs::GetAcceptLanguageList(cef_context, /*browser=*/nullptr,
|
||||
/*expand=*/true);
|
||||
if (!accept_language_list.empty() &&
|
||||
accept_language_list != network_context_params->accept_language) {
|
||||
network_context_params->accept_language = accept_language_list;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "chrome/browser/themes/theme_service.h"
|
||||
#include "chrome/browser/ui/browser.h"
|
||||
#include "chrome/browser/ui/browser_commands.h"
|
||||
#include "chrome/browser/ui/views/frame/browser_view.h"
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
@@ -17,10 +18,10 @@
|
||||
void ChromeBrowserFrame::Init(BrowserView* browser_view,
|
||||
std::unique_ptr<Browser> browser) {
|
||||
DCHECK(browser_view);
|
||||
DCHECK(browser);
|
||||
|
||||
DCHECK(!browser_);
|
||||
browser_ = browser.get();
|
||||
DCHECK(browser_);
|
||||
DCHECK(!browser_view_);
|
||||
browser_view_ = browser_view;
|
||||
|
||||
// Initialize BrowserFrame state.
|
||||
InitBrowserView(browser_view);
|
||||
@@ -42,6 +43,10 @@ void ChromeBrowserFrame::Init(BrowserView* browser_view,
|
||||
#endif // BUILDFLAG(IS_MAC)
|
||||
}
|
||||
|
||||
void ChromeBrowserFrame::ToggleFullscreenMode() {
|
||||
chrome::ToggleFullscreenMode(browser_view_->browser());
|
||||
}
|
||||
|
||||
views::internal::RootView* ChromeBrowserFrame::CreateRootView() {
|
||||
// Bypass the BrowserFrame implementation.
|
||||
return views::Widget::CreateRootView();
|
||||
|
@@ -97,13 +97,17 @@ class ChromeBrowserFrame : public BrowserFrame {
|
||||
|
||||
void Init(BrowserView* browser_view, std::unique_ptr<Browser> browser);
|
||||
|
||||
void ToggleFullscreenMode();
|
||||
|
||||
// views::Widget methods:
|
||||
views::internal::RootView* CreateRootView() override;
|
||||
std::unique_ptr<views::NonClientFrameView> CreateNonClientFrameView()
|
||||
override;
|
||||
|
||||
BrowserView* browser_view() const { return browser_view_; }
|
||||
|
||||
private:
|
||||
Browser* browser_ = nullptr;
|
||||
BrowserView* browser_view_ = nullptr;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_BROWSER_FRAME_H_
|
||||
|
@@ -7,27 +7,19 @@
|
||||
#include "libcef/browser/chrome/views/chrome_browser_frame.h"
|
||||
#include "libcef/browser/views/browser_view_impl.h"
|
||||
|
||||
ChromeBrowserView::ChromeBrowserView(CefBrowserViewDelegate* cef_delegate,
|
||||
Delegate* browser_view_delegate)
|
||||
: ParentClass(cef_delegate), browser_view_delegate_(browser_view_delegate) {
|
||||
DCHECK(browser_view_delegate_);
|
||||
}
|
||||
ChromeBrowserView::ChromeBrowserView(CefBrowserViewImpl* cef_browser_view)
|
||||
: ParentClass(cef_browser_view->delegate()),
|
||||
cef_browser_view_(cef_browser_view) {}
|
||||
|
||||
void ChromeBrowserView::InitBrowser(std::unique_ptr<Browser> browser,
|
||||
CefRefPtr<CefBrowserView> browser_view) {
|
||||
DCHECK(!browser_);
|
||||
void ChromeBrowserView::InitBrowser(std::unique_ptr<Browser> browser) {
|
||||
DCHECK(!web_view_);
|
||||
|
||||
browser_ = browser.get();
|
||||
DCHECK(browser_);
|
||||
|
||||
// Initialize the BrowserFrame and BrowserView.
|
||||
auto chrome_widget = static_cast<ChromeBrowserFrame*>(GetWidget());
|
||||
chrome_widget->Init(this, std::move(browser));
|
||||
|
||||
// Retrieve the views::WebView that was created by the above initializations.
|
||||
auto view_impl = static_cast<CefBrowserViewImpl*>(browser_view.get());
|
||||
web_view_ = view_impl->web_view();
|
||||
web_view_ = cef_browser_view_->web_view();
|
||||
DCHECK(web_view_);
|
||||
|
||||
ParentClass::AddedToWidget();
|
||||
@@ -36,7 +28,6 @@ void ChromeBrowserView::InitBrowser(std::unique_ptr<Browser> browser,
|
||||
void ChromeBrowserView::Destroyed() {
|
||||
DCHECK(!destroyed_);
|
||||
destroyed_ = true;
|
||||
browser_ = nullptr;
|
||||
web_view_ = nullptr;
|
||||
}
|
||||
|
||||
@@ -62,19 +53,24 @@ void ChromeBrowserView::ViewHierarchyChanged(
|
||||
|
||||
void ChromeBrowserView::AddedToWidget() {
|
||||
// Results in a call to InitBrowser which calls ParentClass::AddedToWidget.
|
||||
browser_view_delegate_->OnBrowserViewAdded();
|
||||
cef_browser_view_->OnBrowserViewAdded();
|
||||
}
|
||||
|
||||
void ChromeBrowserView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
|
||||
ParentClass::OnBoundsChanged(previous_bounds);
|
||||
browser_view_delegate_->OnBoundsChanged();
|
||||
cef_browser_view_->OnBoundsChanged();
|
||||
}
|
||||
|
||||
ToolbarView* ChromeBrowserView::OverrideCreateToolbar(
|
||||
Browser* browser,
|
||||
BrowserView* browser_view) {
|
||||
void ChromeBrowserView::OnGestureEvent(ui::GestureEvent* event) {
|
||||
if (cef_browser_view_->OnGestureEvent(event)) {
|
||||
return;
|
||||
}
|
||||
ParentClass::OnGestureEvent(event);
|
||||
}
|
||||
|
||||
ToolbarView* ChromeBrowserView::OverrideCreateToolbar() {
|
||||
if (cef_delegate()) {
|
||||
auto toolbar_type = cef_delegate()->GetChromeToolbarType();
|
||||
auto toolbar_type = cef_delegate()->GetChromeToolbarType(cef_browser_view_);
|
||||
absl::optional<ToolbarView::DisplayMode> display_mode;
|
||||
switch (toolbar_type) {
|
||||
case CEF_CTT_NORMAL:
|
||||
@@ -87,8 +83,8 @@ ToolbarView* ChromeBrowserView::OverrideCreateToolbar(
|
||||
break;
|
||||
}
|
||||
if (display_mode) {
|
||||
cef_toolbar_ = CefToolbarViewImpl::Create(nullptr, browser, browser_view,
|
||||
display_mode);
|
||||
cef_toolbar_ =
|
||||
CefToolbarViewImpl::Create(nullptr, browser(), this, display_mode);
|
||||
// Ownership will be taken by BrowserView.
|
||||
view_util::PassOwnership(cef_toolbar_).release();
|
||||
return cef_toolbar_->root_view();
|
||||
|
@@ -19,25 +19,23 @@ namespace views {
|
||||
class WebView;
|
||||
} // namespace views
|
||||
|
||||
class CefBrowserViewImpl;
|
||||
|
||||
// A variant of CefBrowserViewView that extends BrowserView instead of
|
||||
// views::WebView. See chrome_browser_frame.h for related documentation.
|
||||
class ChromeBrowserView
|
||||
: public CefViewView<BrowserView, CefBrowserViewDelegate> {
|
||||
public:
|
||||
using ParentClass = CefViewView<BrowserView, CefBrowserViewDelegate>;
|
||||
using Delegate = CefBrowserViewView::Delegate;
|
||||
|
||||
// |cef_delegate| may be nullptr.
|
||||
// |browser_view_delegate| must be non-nullptr.
|
||||
ChromeBrowserView(CefBrowserViewDelegate* cef_delegate,
|
||||
Delegate* browser_view_delegate);
|
||||
// |cef_browser_view| is non-nullptr and will outlive this object.
|
||||
explicit ChromeBrowserView(CefBrowserViewImpl* cef_browser_view);
|
||||
|
||||
ChromeBrowserView(const ChromeBrowserView&) = delete;
|
||||
ChromeBrowserView& operator=(const ChromeBrowserView&) = delete;
|
||||
|
||||
// Called by ChromeBrowserHostImpl.
|
||||
void InitBrowser(std::unique_ptr<Browser> browser,
|
||||
CefRefPtr<CefBrowserView> browser_view);
|
||||
void InitBrowser(std::unique_ptr<Browser> browser);
|
||||
void Destroyed();
|
||||
|
||||
// View methods:
|
||||
@@ -45,18 +43,17 @@ class ChromeBrowserView
|
||||
const views::ViewHierarchyChangedDetails& details) override;
|
||||
void AddedToWidget() override;
|
||||
void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
|
||||
void OnGestureEvent(ui::GestureEvent* event) override;
|
||||
|
||||
// BrowserView methods:
|
||||
ToolbarView* OverrideCreateToolbar(Browser* browser,
|
||||
BrowserView* browser_view) override;
|
||||
ToolbarView* OverrideCreateToolbar() override;
|
||||
|
||||
CefRefPtr<CefToolbarViewImpl> cef_toolbar() const { return cef_toolbar_; }
|
||||
CefBrowserViewImpl* cef_browser_view() const { return cef_browser_view_; }
|
||||
|
||||
private:
|
||||
// Not owned by this object.
|
||||
Delegate* browser_view_delegate_;
|
||||
CefBrowserViewImpl* const cef_browser_view_;
|
||||
|
||||
Browser* browser_ = nullptr;
|
||||
views::WebView* web_view_ = nullptr;
|
||||
|
||||
bool destroyed_ = false;
|
||||
|
@@ -118,8 +118,8 @@ bool CefExtensionsBrowserClient::AreExtensionsDisabled(
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CefExtensionsBrowserClient::IsValidContext(BrowserContext* context) {
|
||||
return GetOriginalContext(context) != nullptr;
|
||||
bool CefExtensionsBrowserClient::IsValidContext(void* context) {
|
||||
return GetOriginalContext(static_cast<BrowserContext*>(context)) != nullptr;
|
||||
}
|
||||
|
||||
bool CefExtensionsBrowserClient::IsSameContext(BrowserContext* first,
|
||||
|
@@ -31,7 +31,7 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
|
||||
bool IsShuttingDown() override;
|
||||
bool AreExtensionsDisabled(const base::CommandLine& command_line,
|
||||
content::BrowserContext* context) override;
|
||||
bool IsValidContext(content::BrowserContext* context) override;
|
||||
bool IsValidContext(void* context) override;
|
||||
bool IsSameContext(content::BrowserContext* first,
|
||||
content::BrowserContext* second) override;
|
||||
bool HasOffTheRecordContext(content::BrowserContext* context) override;
|
||||
|
@@ -275,7 +275,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
|
||||
// Default values for standard headers.
|
||||
accept_language_ = browser_prefs::GetAcceptLanguageList(
|
||||
cef_browser_context, browser.get(), /*expand=*/true);
|
||||
cef_browser_context, browser.get());
|
||||
DCHECK(!accept_language_.empty());
|
||||
user_agent_ =
|
||||
CefAppManager::Get()->GetContentClient()->browser()->GetUserAgent();
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include "base/values.h"
|
||||
#include "chrome/browser/accessibility/accessibility_ui.h"
|
||||
#include "chrome/browser/download/download_prefs.h"
|
||||
#include "chrome/browser/media/router/discovery/access_code/access_code_cast_feature.h"
|
||||
#include "chrome/browser/media/router/media_router_feature.h"
|
||||
#include "chrome/browser/media/webrtc/permission_bubble_media_access_handler.h"
|
||||
#include "chrome/browser/net/profile_network_context_service.h"
|
||||
@@ -268,6 +269,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
extensions::ExtensionPrefs::RegisterProfilePrefs(registry.get());
|
||||
HostContentSettingsMap::RegisterProfilePrefs(registry.get());
|
||||
language::LanguagePrefs::RegisterProfilePrefs(registry.get());
|
||||
media_router::RegisterAccessCodeProfilePrefs(registry.get());
|
||||
media_router::RegisterProfilePrefs(registry.get());
|
||||
media_device_salt::MediaDeviceIDSalt::RegisterProfilePrefs(registry.get());
|
||||
PermissionBubbleMediaAccessHandler::RegisterProfilePrefs(registry.get());
|
||||
@@ -363,8 +365,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
}
|
||||
|
||||
std::string GetAcceptLanguageList(CefBrowserContext* browser_context,
|
||||
CefBrowserHostBase* browser,
|
||||
bool expand) {
|
||||
CefBrowserHostBase* browser) {
|
||||
// Always prefer to the CEF settings configuration, if specified.
|
||||
std::string accept_language_list =
|
||||
GetAcceptLanguageListSetting(browser_context, browser);
|
||||
@@ -378,10 +379,29 @@ std::string GetAcceptLanguageList(CefBrowserContext* browser_context,
|
||||
accept_language_list = prefs->GetString(language::prefs::kAcceptLanguages);
|
||||
}
|
||||
|
||||
if (!accept_language_list.empty() && expand) {
|
||||
if (!accept_language_list.empty()) {
|
||||
return ComputeAcceptLanguageFromPref(accept_language_list);
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
|
||||
void SetInitialProfilePrefs(Profile* profile) {
|
||||
auto* prefs = profile->GetPrefs();
|
||||
|
||||
// Language preferences.
|
||||
const std::string& accept_language_list = GetAcceptLanguageListSetting(
|
||||
CefBrowserContext::FromProfile(profile), /*browser=*/nullptr);
|
||||
if (!accept_language_list.empty()) {
|
||||
// Used by ProfileNetworkContextService and InterceptedRequestHandlerWrapper
|
||||
// (via GetAcceptLanguageList) for request headers, and
|
||||
// renderer_preferences_util::UpdateFromSystemSettings() for
|
||||
// `navigator.language`.
|
||||
prefs->SetString(language::prefs::kAcceptLanguages, accept_language_list);
|
||||
|
||||
// Necessary to avoid a reset of the kAcceptLanguages value in
|
||||
// LanguagePrefs::UpdateAcceptLanguagesPref().
|
||||
prefs->SetString(language::prefs::kSelectedLanguages, accept_language_list);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace browser_prefs
|
||||
|
@@ -37,8 +37,10 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
// |browser_context| and/or |browser| may be nullptr. If |expand| is true then
|
||||
// base languages and Q values may be added.
|
||||
std::string GetAcceptLanguageList(CefBrowserContext* browser_context,
|
||||
CefBrowserHostBase* browser,
|
||||
bool expand);
|
||||
CefBrowserHostBase* browser);
|
||||
|
||||
// Set preferences for a newly initialized Profile.
|
||||
void SetInitialProfilePrefs(Profile* profile);
|
||||
|
||||
} // namespace browser_prefs
|
||||
|
||||
|
@@ -13,8 +13,27 @@
|
||||
#include "libcef/browser/views/window_impl.h"
|
||||
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "ui/content_accelerators/accelerator_util.h"
|
||||
|
||||
namespace {
|
||||
|
||||
absl::optional<cef_gesture_command_t> GetGestureCommand(
|
||||
ui::GestureEvent* event) {
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
if (event->details().type() == ui::ET_GESTURE_SWIPE) {
|
||||
if (event->details().swipe_left()) {
|
||||
return CEF_GESTURE_COMMAND_BACK;
|
||||
} else if (event->details().swipe_right()) {
|
||||
return CEF_GESTURE_COMMAND_FORWARD;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// static
|
||||
CefRefPtr<CefBrowserView> CefBrowserView::CreateBrowserView(
|
||||
CefRefPtr<CefClient> client,
|
||||
@@ -122,10 +141,7 @@ bool CefBrowserViewImpl::HandleKeyboardEvent(
|
||||
}
|
||||
|
||||
// Give the CefWindowDelegate a chance to handle the event.
|
||||
CefRefPtr<CefWindow> window =
|
||||
view_util::GetWindowFor(root_view()->GetWidget());
|
||||
CefWindowImpl* window_impl = static_cast<CefWindowImpl*>(window.get());
|
||||
if (window_impl) {
|
||||
if (auto* window_impl = cef_window()) {
|
||||
CefKeyEvent cef_event;
|
||||
if (browser_util::GetCefKeyEvent(event, cef_event) &&
|
||||
window_impl->OnKeyEvent(cef_event)) {
|
||||
@@ -146,7 +162,7 @@ CefRefPtr<CefBrowser> CefBrowserViewImpl::GetBrowser() {
|
||||
CefRefPtr<CefView> CefBrowserViewImpl::GetChromeToolbar() {
|
||||
CEF_REQUIRE_VALID_RETURN(nullptr);
|
||||
if (cef::IsChromeRuntimeEnabled()) {
|
||||
return static_cast<ChromeBrowserView*>(root_view())->cef_toolbar();
|
||||
return chrome_browser_view()->cef_toolbar();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
@@ -218,21 +234,27 @@ void CefBrowserViewImpl::OnBoundsChanged() {
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserViewImpl::OnGestureCommand(cef_gesture_command_t command) {
|
||||
if (delegate()->OnGestureCommand(this, command)) {
|
||||
return;
|
||||
}
|
||||
bool CefBrowserViewImpl::OnGestureEvent(ui::GestureEvent* event) {
|
||||
if (auto command = GetGestureCommand(event)) {
|
||||
if (delegate() && delegate()->OnGestureCommand(this, *command)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (browser_) {
|
||||
switch (command) {
|
||||
case CEF_GESTURE_COMMAND_BACK:
|
||||
browser_->GoBack();
|
||||
break;
|
||||
case CEF_GESTURE_COMMAND_FORWARD:
|
||||
browser_->GoForward();
|
||||
break;
|
||||
if (!cef::IsChromeRuntimeEnabled() && browser_) {
|
||||
// Default handling for the Alloy runtime.
|
||||
switch (*command) {
|
||||
case CEF_GESTURE_COMMAND_BACK:
|
||||
browser_->GoBack();
|
||||
break;
|
||||
case CEF_GESTURE_COMMAND_FORWARD:
|
||||
browser_->GoForward();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
CefBrowserViewImpl::CefBrowserViewImpl(
|
||||
@@ -263,7 +285,7 @@ void CefBrowserViewImpl::SetDefaults(const CefBrowserSettings& settings) {
|
||||
|
||||
views::View* CefBrowserViewImpl::CreateRootView() {
|
||||
if (cef::IsChromeRuntimeEnabled()) {
|
||||
return new ChromeBrowserView(delegate(), this);
|
||||
return new ChromeBrowserView(this);
|
||||
}
|
||||
|
||||
return new CefBrowserViewView(delegate(), this);
|
||||
@@ -271,7 +293,7 @@ views::View* CefBrowserViewImpl::CreateRootView() {
|
||||
|
||||
void CefBrowserViewImpl::InitializeRootView() {
|
||||
if (cef::IsChromeRuntimeEnabled()) {
|
||||
static_cast<ChromeBrowserView*>(root_view())->Initialize();
|
||||
chrome_browser_view()->Initialize();
|
||||
} else {
|
||||
static_cast<CefBrowserViewView*>(root_view())->Initialize();
|
||||
}
|
||||
@@ -283,12 +305,23 @@ views::WebView* CefBrowserViewImpl::web_view() const {
|
||||
}
|
||||
|
||||
if (cef::IsChromeRuntimeEnabled()) {
|
||||
return static_cast<ChromeBrowserView*>(root_view())->contents_web_view();
|
||||
return chrome_browser_view()->contents_web_view();
|
||||
}
|
||||
|
||||
return static_cast<CefBrowserViewView*>(root_view());
|
||||
}
|
||||
|
||||
ChromeBrowserView* CefBrowserViewImpl::chrome_browser_view() const {
|
||||
CHECK(cef::IsChromeRuntimeEnabled());
|
||||
return static_cast<ChromeBrowserView*>(root_view());
|
||||
}
|
||||
|
||||
CefWindowImpl* CefBrowserViewImpl::cef_window() const {
|
||||
CefRefPtr<CefWindow> window =
|
||||
view_util::GetWindowFor(root_view()->GetWidget());
|
||||
return static_cast<CefWindowImpl*>(window.get());
|
||||
}
|
||||
|
||||
bool CefBrowserViewImpl::HandleAccelerator(
|
||||
const content::NativeWebKeyboardEvent& event,
|
||||
views::FocusManager* focus_manager) {
|
||||
|
@@ -18,6 +18,8 @@
|
||||
#include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
|
||||
|
||||
class CefBrowserHostBase;
|
||||
class CefWindowImpl;
|
||||
class ChromeBrowserView;
|
||||
|
||||
class CefBrowserViewImpl
|
||||
: public CefViewImpl<views::View, CefBrowserView, CefBrowserViewDelegate>,
|
||||
@@ -74,11 +76,17 @@ class CefBrowserViewImpl
|
||||
// CefBrowserViewView::Delegate methods:
|
||||
void OnBrowserViewAdded() override;
|
||||
void OnBoundsChanged() override;
|
||||
void OnGestureCommand(cef_gesture_command_t command) override;
|
||||
bool OnGestureEvent(ui::GestureEvent* event) override;
|
||||
|
||||
// Return the WebView representation of this object.
|
||||
views::WebView* web_view() const;
|
||||
|
||||
// Return the CEF specialization of BrowserView.
|
||||
ChromeBrowserView* chrome_browser_view() const;
|
||||
|
||||
// Return the CefWindowImpl hosting this object.
|
||||
CefWindowImpl* cef_window() const;
|
||||
|
||||
private:
|
||||
// Create a new implementation object.
|
||||
// Always call Initialize() after creation.
|
||||
|
@@ -4,28 +4,8 @@
|
||||
|
||||
#include "libcef/browser/views/browser_view_view.h"
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "libcef/browser/views/browser_view_impl.h"
|
||||
|
||||
namespace {
|
||||
|
||||
std::optional<cef_gesture_command_t> GetGestureCommand(
|
||||
ui::GestureEvent* event) {
|
||||
#if defined(OS_MAC)
|
||||
if (event->details().type() == ui::ET_GESTURE_SWIPE) {
|
||||
if (event->details().swipe_left()) {
|
||||
return cef_gesture_command_t::CEF_GESTURE_COMMAND_BACK;
|
||||
} else if (event->details().swipe_right()) {
|
||||
return cef_gesture_command_t::CEF_GESTURE_COMMAND_FORWARD;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefBrowserViewView::CefBrowserViewView(CefBrowserViewDelegate* cef_delegate,
|
||||
Delegate* browser_view_delegate)
|
||||
: ParentClass(cef_delegate), browser_view_delegate_(browser_view_delegate) {
|
||||
@@ -60,7 +40,8 @@ void CefBrowserViewView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
|
||||
}
|
||||
|
||||
void CefBrowserViewView::OnGestureEvent(ui::GestureEvent* event) {
|
||||
if (auto command = GetGestureCommand(event)) {
|
||||
browser_view_delegate_->OnGestureCommand(*command);
|
||||
if (browser_view_delegate_->OnGestureEvent(event)) {
|
||||
return;
|
||||
}
|
||||
ParentClass::OnGestureEvent(event);
|
||||
}
|
||||
|
@@ -41,8 +41,9 @@ class CefBrowserViewView
|
||||
// Called when the BrowserView bounds have changed.
|
||||
virtual void OnBoundsChanged() = 0;
|
||||
|
||||
// Called when the BrowserView receives a gesture command.
|
||||
virtual void OnGestureCommand(cef_gesture_command_t command) = 0;
|
||||
// Called when the BrowserView receives a gesture event.
|
||||
// Returns true if the gesture was handled.
|
||||
virtual bool OnGestureEvent(ui::GestureEvent* event) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~Delegate() {}
|
||||
|
@@ -48,6 +48,9 @@ class CefNativeWidgetMac : public views::NativeWidgetMac {
|
||||
const CefRefPtr<CefWindow> window_;
|
||||
CefWindowDelegate* const window_delegate_;
|
||||
|
||||
// Returns true if the CefWindow is fully initialized.
|
||||
bool IsCefWindowInitialized() const;
|
||||
|
||||
BrowserView* browser_view_ = nullptr;
|
||||
};
|
||||
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#include "include/views/cef_window.h"
|
||||
#include "include/views/cef_window_delegate.h"
|
||||
#include "libcef/browser/views/ns_window.h"
|
||||
#include "libcef/browser/views/window_impl.h"
|
||||
|
||||
#include "chrome/browser/apps/app_shim/app_shim_host_mac.h"
|
||||
#include "chrome/browser/apps/app_shim/app_shim_manager_mac.h"
|
||||
@@ -118,12 +119,16 @@ void CefNativeWidgetMac::GetWindowFrameTitlebarHeight(
|
||||
|
||||
void CefNativeWidgetMac::OnWindowFullscreenTransitionStart() {
|
||||
views::NativeWidgetMac::OnWindowFullscreenTransitionStart();
|
||||
window_delegate_->OnWindowFullscreenTransition(window_, false);
|
||||
if (IsCefWindowInitialized()) {
|
||||
window_delegate_->OnWindowFullscreenTransition(window_, false);
|
||||
}
|
||||
}
|
||||
|
||||
void CefNativeWidgetMac::OnWindowFullscreenTransitionComplete() {
|
||||
views::NativeWidgetMac::OnWindowFullscreenTransitionComplete();
|
||||
window_delegate_->OnWindowFullscreenTransition(window_, true);
|
||||
if (IsCefWindowInitialized()) {
|
||||
window_delegate_->OnWindowFullscreenTransition(window_, true);
|
||||
}
|
||||
}
|
||||
|
||||
void CefNativeWidgetMac::OnWindowInitialized() {
|
||||
@@ -142,3 +147,7 @@ void CefNativeWidgetMac::OnWindowInitialized() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CefNativeWidgetMac::IsCefWindowInitialized() const {
|
||||
return static_cast<CefWindowImpl*>(window_.get())->initialized();
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@
|
||||
#include "libcef/browser/views/window_impl.h"
|
||||
|
||||
#include "libcef/browser/browser_util.h"
|
||||
#include "libcef/browser/chrome/views/chrome_browser_frame.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/browser/views/browser_view_impl.h"
|
||||
#include "libcef/browser/views/display_impl.h"
|
||||
@@ -12,6 +13,7 @@
|
||||
#include "libcef/browser/views/layout_util.h"
|
||||
#include "libcef/browser/views/view_util.h"
|
||||
#include "libcef/browser/views/window_view.h"
|
||||
#include "libcef/features/runtime.h"
|
||||
|
||||
#include "base/i18n/rtl.h"
|
||||
#include "components/constrained_window/constrained_window_views.h"
|
||||
@@ -116,9 +118,6 @@ CefRefPtr<CefWindowImpl> CefWindowImpl::Create(
|
||||
CefRefPtr<CefWindowImpl> window = new CefWindowImpl(delegate);
|
||||
window->Initialize();
|
||||
window->CreateWidget(parent_widget);
|
||||
if (delegate) {
|
||||
delegate->OnWindowCreated(window.get());
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -253,7 +252,29 @@ void CefWindowImpl::Restore() {
|
||||
void CefWindowImpl::SetFullscreen(bool fullscreen) {
|
||||
CEF_REQUIRE_VALID_RETURN_VOID();
|
||||
if (widget_ && fullscreen != widget_->IsFullscreen()) {
|
||||
if (cef::IsChromeRuntimeEnabled()) {
|
||||
// If a BrowserView exists, toggle fullscreen mode via the Chrome command
|
||||
// for consistent behavior.
|
||||
auto* browser_frame = static_cast<ChromeBrowserFrame*>(widget_);
|
||||
if (browser_frame->browser_view()) {
|
||||
browser_frame->ToggleFullscreenMode();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Call the Widget method directly with Alloy runtime, or Chrome runtime
|
||||
// when no BrowserView exists.
|
||||
widget_->SetFullscreen(fullscreen);
|
||||
|
||||
// Use a synchronous callback notification on Windows/Linux. Chrome runtime
|
||||
// on Windows/Linux gets notified synchronously via ChromeBrowserDelegate
|
||||
// callbacks when a BrowserView exists. MacOS (both runtimes) gets notified
|
||||
// asynchronously via CefNativeWidgetMac callbacks.
|
||||
#if !BUILDFLAG(IS_MAC)
|
||||
if (delegate()) {
|
||||
delegate()->OnWindowFullscreenTransition(this, /*is_completed=*/true);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -714,7 +735,7 @@ void CefWindowImpl::RemoveAllAccelerators() {
|
||||
}
|
||||
|
||||
CefWindowImpl::CefWindowImpl(CefRefPtr<CefWindowDelegate> delegate)
|
||||
: ParentClass(delegate), widget_(nullptr), destroyed_(false) {}
|
||||
: ParentClass(delegate) {}
|
||||
|
||||
CefWindowView* CefWindowImpl::CreateRootView() {
|
||||
return new CefWindowView(delegate(), this);
|
||||
@@ -740,4 +761,10 @@ void CefWindowImpl::CreateWidget(gfx::AcceleratedWidget parent_widget) {
|
||||
// keep an owned reference.
|
||||
std::unique_ptr<views::View> view_ptr = view_util::PassOwnership(this);
|
||||
[[maybe_unused]] views::View* view = view_ptr.release();
|
||||
|
||||
initialized_ = true;
|
||||
|
||||
if (delegate()) {
|
||||
delegate()->OnWindowCreated(this);
|
||||
}
|
||||
}
|
||||
|
@@ -132,6 +132,7 @@ class CefWindowImpl
|
||||
void MenuClosed();
|
||||
|
||||
views::Widget* widget() const { return widget_; }
|
||||
bool initialized() const { return initialized_; }
|
||||
|
||||
private:
|
||||
// Create a new implementation object.
|
||||
@@ -146,10 +147,13 @@ class CefWindowImpl
|
||||
// Initialize the Widget.
|
||||
void CreateWidget(gfx::AcceleratedWidget parent_widget);
|
||||
|
||||
views::Widget* widget_;
|
||||
views::Widget* widget_ = nullptr;
|
||||
|
||||
// True if the window has been initialized.
|
||||
bool initialized_ = false;
|
||||
|
||||
// True if the window has been destroyed.
|
||||
bool destroyed_;
|
||||
bool destroyed_ = false;
|
||||
|
||||
// The currently active menu model and runner.
|
||||
CefRefPtr<CefMenuModelImpl> menu_model_;
|
||||
|
@@ -43,6 +43,7 @@
|
||||
#include "net/base/features.h"
|
||||
#include "sandbox/policy/switches.h"
|
||||
#include "services/network/public/cpp/features.h"
|
||||
#include "third_party/blink/public/common/features.h"
|
||||
#include "third_party/blink/public/common/switches.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
#include "ui/base/ui_base_features.h"
|
||||
@@ -301,6 +302,15 @@ absl::optional<int> AlloyMainDelegate::BasicStartupComplete() {
|
||||
disable_features.push_back(features::kBackForwardCache.name);
|
||||
}
|
||||
|
||||
if (blink::features::kDocumentPictureInPictureAPI.default_state ==
|
||||
base::FEATURE_ENABLED_BY_DEFAULT) {
|
||||
// Disable DocumentPictureInPictureAPI globally so that
|
||||
// blink::RuntimeEnabledFeatures::DocumentPictureInPictureAPIEnabled
|
||||
// reports the correct value in the renderer process (see issue #3448).
|
||||
disable_features.push_back(
|
||||
blink::features::kDocumentPictureInPictureAPI.name);
|
||||
}
|
||||
|
||||
if (!disable_features.empty()) {
|
||||
DCHECK(!base::FeatureList::GetInstance());
|
||||
std::string disable_features_str =
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=4bffd98075025b4d02063698dbec87e9b9a31597$
|
||||
// $hash=f82440b30a75049733b4dd200494ab06d52c68b3$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/views/browser_view_delegate_cpptoc.h"
|
||||
@@ -166,7 +166,8 @@ int CEF_CALLBACK browser_view_delegate_on_popup_browser_view_created(
|
||||
|
||||
cef_chrome_toolbar_type_t CEF_CALLBACK
|
||||
browser_view_delegate_get_chrome_toolbar_type(
|
||||
struct _cef_browser_view_delegate_t* self) {
|
||||
struct _cef_browser_view_delegate_t* self,
|
||||
cef_browser_view_t* browser_view) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
@@ -175,15 +176,48 @@ browser_view_delegate_get_chrome_toolbar_type(
|
||||
if (!self) {
|
||||
return CEF_CTT_NONE;
|
||||
}
|
||||
// Verify param: browser_view; type: refptr_diff
|
||||
DCHECK(browser_view);
|
||||
if (!browser_view) {
|
||||
return CEF_CTT_NONE;
|
||||
}
|
||||
|
||||
// Execute
|
||||
cef_chrome_toolbar_type_t _retval =
|
||||
CefBrowserViewDelegateCppToC::Get(self)->GetChromeToolbarType();
|
||||
CefBrowserViewDelegateCppToC::Get(self)->GetChromeToolbarType(
|
||||
CefBrowserViewCToCpp::Wrap(browser_view));
|
||||
|
||||
// Return type: simple
|
||||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK
|
||||
browser_view_delegate_use_frameless_window_for_picture_in_picture(
|
||||
struct _cef_browser_view_delegate_t* self,
|
||||
cef_browser_view_t* browser_view) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self) {
|
||||
return 0;
|
||||
}
|
||||
// Verify param: browser_view; type: refptr_diff
|
||||
DCHECK(browser_view);
|
||||
if (!browser_view) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Execute
|
||||
bool _retval = CefBrowserViewDelegateCppToC::Get(self)
|
||||
->UseFramelessWindowForPictureInPicture(
|
||||
CefBrowserViewCToCpp::Wrap(browser_view));
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK browser_view_delegate_on_gesture_command(
|
||||
struct _cef_browser_view_delegate_t* self,
|
||||
cef_browser_view_t* browser_view,
|
||||
@@ -493,6 +527,8 @@ CefBrowserViewDelegateCppToC::CefBrowserViewDelegateCppToC() {
|
||||
browser_view_delegate_on_popup_browser_view_created;
|
||||
GetStruct()->get_chrome_toolbar_type =
|
||||
browser_view_delegate_get_chrome_toolbar_type;
|
||||
GetStruct()->use_frameless_window_for_picture_in_picture =
|
||||
browser_view_delegate_use_frameless_window_for_picture_in_picture;
|
||||
GetStruct()->on_gesture_command = browser_view_delegate_on_gesture_command;
|
||||
GetStruct()->base.get_preferred_size =
|
||||
browser_view_delegate_get_preferred_size;
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=10ec416d3aeba7215b08604b1a329adc1c9aaf6f$
|
||||
// $hash=61afa22f2b3401bab08c3faeb872e3de7a99ca5b$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/views/window_delegate_cpptoc.h"
|
||||
@@ -141,6 +141,29 @@ window_delegate_on_window_bounds_changed(struct _cef_window_delegate_t* self,
|
||||
CefWindowCToCpp::Wrap(window), new_boundsVal);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK window_delegate_on_window_fullscreen_transition(
|
||||
struct _cef_window_delegate_t* self,
|
||||
cef_window_t* window,
|
||||
int is_completed) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self) {
|
||||
return;
|
||||
}
|
||||
// Verify param: window; type: refptr_diff
|
||||
DCHECK(window);
|
||||
if (!window) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Execute
|
||||
CefWindowDelegateCppToC::Get(self)->OnWindowFullscreenTransition(
|
||||
CefWindowCToCpp::Wrap(window), is_completed ? true : false);
|
||||
}
|
||||
|
||||
cef_window_t* CEF_CALLBACK
|
||||
window_delegate_get_parent_window(struct _cef_window_delegate_t* self,
|
||||
cef_window_t* window,
|
||||
@@ -509,29 +532,6 @@ window_delegate_on_key_event(struct _cef_window_delegate_t* self,
|
||||
return _retval;
|
||||
}
|
||||
|
||||
void CEF_CALLBACK window_delegate_on_window_fullscreen_transition(
|
||||
struct _cef_window_delegate_t* self,
|
||||
cef_window_t* window,
|
||||
int is_completed) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self) {
|
||||
return;
|
||||
}
|
||||
// Verify param: window; type: refptr_diff
|
||||
DCHECK(window);
|
||||
if (!window) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Execute
|
||||
CefWindowDelegateCppToC::Get(self)->OnWindowFullscreenTransition(
|
||||
CefWindowCToCpp::Wrap(window), is_completed ? true : false);
|
||||
}
|
||||
|
||||
cef_size_t CEF_CALLBACK
|
||||
window_delegate_get_preferred_size(struct _cef_view_delegate_t* self,
|
||||
cef_view_t* view) {
|
||||
@@ -805,6 +805,8 @@ CefWindowDelegateCppToC::CefWindowDelegateCppToC() {
|
||||
window_delegate_on_window_activation_changed;
|
||||
GetStruct()->on_window_bounds_changed =
|
||||
window_delegate_on_window_bounds_changed;
|
||||
GetStruct()->on_window_fullscreen_transition =
|
||||
window_delegate_on_window_fullscreen_transition;
|
||||
GetStruct()->get_parent_window = window_delegate_get_parent_window;
|
||||
GetStruct()->is_window_modal_dialog = window_delegate_is_window_modal_dialog;
|
||||
GetStruct()->get_initial_bounds = window_delegate_get_initial_bounds;
|
||||
@@ -819,8 +821,6 @@ CefWindowDelegateCppToC::CefWindowDelegateCppToC() {
|
||||
GetStruct()->can_close = window_delegate_can_close;
|
||||
GetStruct()->on_accelerator = window_delegate_on_accelerator;
|
||||
GetStruct()->on_key_event = window_delegate_on_key_event;
|
||||
GetStruct()->on_window_fullscreen_transition =
|
||||
window_delegate_on_window_fullscreen_transition;
|
||||
GetStruct()->base.base.get_preferred_size =
|
||||
window_delegate_get_preferred_size;
|
||||
GetStruct()->base.base.get_minimum_size = window_delegate_get_minimum_size;
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=bff0bff161e504deec6aef910ebf5d8962bd7c85$
|
||||
// $hash=a3ab5cba4139ac15763ef0df69988b1bfc00b2bf$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/views/browser_view_delegate_ctocpp.h"
|
||||
@@ -149,7 +149,8 @@ bool CefBrowserViewDelegateCToCpp::OnPopupBrowserViewCreated(
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CefBrowserViewDelegate::ChromeToolbarType
|
||||
CefBrowserViewDelegateCToCpp::GetChromeToolbarType() {
|
||||
CefBrowserViewDelegateCToCpp::GetChromeToolbarType(
|
||||
CefRefPtr<CefBrowserView> browser_view) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_browser_view_delegate_t* _struct = GetStruct();
|
||||
@@ -159,13 +160,47 @@ CefBrowserViewDelegateCToCpp::GetChromeToolbarType() {
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser_view; type: refptr_diff
|
||||
DCHECK(browser_view.get());
|
||||
if (!browser_view.get()) {
|
||||
return CEF_CTT_NONE;
|
||||
}
|
||||
|
||||
// Execute
|
||||
cef_chrome_toolbar_type_t _retval = _struct->get_chrome_toolbar_type(_struct);
|
||||
cef_chrome_toolbar_type_t _retval = _struct->get_chrome_toolbar_type(
|
||||
_struct, CefBrowserViewCppToC::Wrap(browser_view));
|
||||
|
||||
// Return type: simple
|
||||
return _retval;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
bool CefBrowserViewDelegateCToCpp::UseFramelessWindowForPictureInPicture(
|
||||
CefRefPtr<CefBrowserView> browser_view) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_browser_view_delegate_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct,
|
||||
use_frameless_window_for_picture_in_picture)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser_view; type: refptr_diff
|
||||
DCHECK(browser_view.get());
|
||||
if (!browser_view.get()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->use_frameless_window_for_picture_in_picture(
|
||||
_struct, CefBrowserViewCppToC::Wrap(browser_view));
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
bool CefBrowserViewDelegateCToCpp::OnGestureCommand(
|
||||
CefRefPtr<CefBrowserView> browser_view,
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=15c0d7230887344fa77279c76ff377b3f2d9ee1d$
|
||||
// $hash=2157bfb760455bcd97d4e30eba9db474c7b3cabd$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_BROWSER_VIEW_DELEGATE_CTOCPP_H_
|
||||
@@ -51,7 +51,10 @@ class CefBrowserViewDelegateCToCpp
|
||||
bool OnPopupBrowserViewCreated(CefRefPtr<CefBrowserView> browser_view,
|
||||
CefRefPtr<CefBrowserView> popup_browser_view,
|
||||
bool is_devtools) override;
|
||||
ChromeToolbarType GetChromeToolbarType() override;
|
||||
ChromeToolbarType GetChromeToolbarType(
|
||||
CefRefPtr<CefBrowserView> browser_view) override;
|
||||
bool UseFramelessWindowForPictureInPicture(
|
||||
CefRefPtr<CefBrowserView> browser_view) override;
|
||||
bool OnGestureCommand(CefRefPtr<CefBrowserView> browser_view,
|
||||
cef_gesture_command_t gesture_command) override;
|
||||
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=12bd03a8fb7d680a4e2b1a6818313c29bf14f011$
|
||||
// $hash=bb69763a25cd013a50504d762a81c0a4454ce8eb$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/views/window_delegate_ctocpp.h"
|
||||
@@ -129,6 +129,30 @@ void CefWindowDelegateCToCpp::OnWindowBoundsChanged(CefRefPtr<CefWindow> window,
|
||||
&new_bounds);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefWindowDelegateCToCpp::OnWindowFullscreenTransition(
|
||||
CefRefPtr<CefWindow> window,
|
||||
bool is_completed) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_window_delegate_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_window_fullscreen_transition)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: window; type: refptr_diff
|
||||
DCHECK(window.get());
|
||||
if (!window.get()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Execute
|
||||
_struct->on_window_fullscreen_transition(
|
||||
_struct, CefWindowCppToC::Wrap(window), is_completed);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CefRefPtr<CefWindow> CefWindowDelegateCToCpp::GetParentWindow(
|
||||
CefRefPtr<CefWindow> window,
|
||||
@@ -487,30 +511,6 @@ bool CefWindowDelegateCToCpp::OnKeyEvent(CefRefPtr<CefWindow> window,
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefWindowDelegateCToCpp::OnWindowFullscreenTransition(
|
||||
CefRefPtr<CefWindow> window,
|
||||
bool is_completed) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_window_delegate_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_window_fullscreen_transition)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: window; type: refptr_diff
|
||||
DCHECK(window.get());
|
||||
if (!window.get()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Execute
|
||||
_struct->on_window_fullscreen_transition(
|
||||
_struct, CefWindowCppToC::Wrap(window), is_completed);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CefSize CefWindowDelegateCToCpp::GetPreferredSize(CefRefPtr<CefView> view) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=25487f4d82069d1e4c0c7b27c1c1fcbcebbbacea$
|
||||
// $hash=e1ed42bb378f9f140e006ec582c0e908f711e7fa$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_WINDOW_DELEGATE_CTOCPP_H_
|
||||
@@ -44,6 +44,8 @@ class CefWindowDelegateCToCpp
|
||||
bool active) override;
|
||||
void OnWindowBoundsChanged(CefRefPtr<CefWindow> window,
|
||||
const CefRect& new_bounds) override;
|
||||
void OnWindowFullscreenTransition(CefRefPtr<CefWindow> window,
|
||||
bool is_completed) override;
|
||||
CefRefPtr<CefWindow> GetParentWindow(CefRefPtr<CefWindow> window,
|
||||
bool* is_menu,
|
||||
bool* can_activate_menu) override;
|
||||
@@ -61,8 +63,6 @@ class CefWindowDelegateCToCpp
|
||||
bool OnAccelerator(CefRefPtr<CefWindow> window, int command_id) override;
|
||||
bool OnKeyEvent(CefRefPtr<CefWindow> window,
|
||||
const CefKeyEvent& event) override;
|
||||
void OnWindowFullscreenTransition(CefRefPtr<CefWindow> window,
|
||||
bool is_completed) override;
|
||||
|
||||
// CefPanelDelegate methods.
|
||||
|
||||
|
@@ -652,8 +652,15 @@ patches = [
|
||||
},
|
||||
{
|
||||
# win: Add support for "force-light-mode" command-line option.
|
||||
# mac: Add support for "force-light-mode" and "force-dark-mode".
|
||||
# https://github.com/chromiumembedded/cef/issues/3534
|
||||
# https://chromium-review.googlesource.com/c/chromium/src/+/4766248
|
||||
'name': 'win_light_mode_3534'
|
||||
'name': 'light_mode_3534'
|
||||
},
|
||||
{
|
||||
# win: Fix exiting fullscreen when windows are created fullscreen.
|
||||
# https://github.com/chromiumembedded/cef/issues/3243
|
||||
# https://chromium-review.googlesource.com/c/chromium/src/+/4778723
|
||||
'name': 'win_fullscreen_3243'
|
||||
}
|
||||
]
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git chrome/browser/BUILD.gn chrome/browser/BUILD.gn
|
||||
index d2207552c449f..1acd7fda6147d 100644
|
||||
index ff490f2ffb3f5..76b9309cd20f2 100644
|
||||
--- chrome/browser/BUILD.gn
|
||||
+++ chrome/browser/BUILD.gn
|
||||
@@ -11,6 +11,7 @@ import("//build/config/compiler/pgo/pgo.gni")
|
||||
|
@@ -13,7 +13,7 @@ index 2480282a19d12..dbd1fbf8a15b5 100644
|
||||
return false;
|
||||
}
|
||||
diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn
|
||||
index cc4fbda7ddfa8..c7278ef3d7ff7 100644
|
||||
index 8ffa857f767e8..335ed228a21f2 100644
|
||||
--- chrome/browser/ui/BUILD.gn
|
||||
+++ chrome/browser/ui/BUILD.gn
|
||||
@@ -9,6 +9,7 @@ import("//build/config/compiler/compiler.gni")
|
||||
@@ -43,7 +43,7 @@ index cc4fbda7ddfa8..c7278ef3d7ff7 100644
|
||||
"//chrome:resources",
|
||||
"//chrome:strings",
|
||||
"//chrome/app:chrome_dll_resources",
|
||||
@@ -2683,6 +2689,8 @@ static_library("ui") {
|
||||
@@ -2685,6 +2691,8 @@ static_library("ui") {
|
||||
"views/apps/app_dialog/app_block_dialog_view.h",
|
||||
"views/apps/app_dialog/app_pause_dialog_view.cc",
|
||||
"views/apps/app_dialog/app_pause_dialog_view.h",
|
||||
@@ -52,7 +52,7 @@ index cc4fbda7ddfa8..c7278ef3d7ff7 100644
|
||||
"views/apps/app_info_dialog/arc_app_info_links_panel.cc",
|
||||
"views/apps/app_info_dialog/arc_app_info_links_panel.h",
|
||||
"views/apps/chrome_app_window_client_views_chromeos.cc",
|
||||
@@ -4573,8 +4581,6 @@ static_library("ui") {
|
||||
@@ -4575,8 +4583,6 @@ static_library("ui") {
|
||||
"views/accessibility/theme_tracking_non_accessible_image_view.h",
|
||||
"views/apps/app_dialog/app_dialog_view.cc",
|
||||
"views/apps/app_dialog/app_dialog_view.h",
|
||||
@@ -61,7 +61,7 @@ index cc4fbda7ddfa8..c7278ef3d7ff7 100644
|
||||
"views/apps/app_info_dialog/app_info_dialog_container.cc",
|
||||
"views/apps/app_info_dialog/app_info_dialog_container.h",
|
||||
"views/apps/app_info_dialog/app_info_dialog_views.cc",
|
||||
@@ -6226,6 +6232,7 @@ static_library("ui") {
|
||||
@@ -6228,6 +6234,7 @@ static_library("ui") {
|
||||
if (enable_printing) {
|
||||
deps += [
|
||||
"//components/printing/browser",
|
||||
@@ -70,7 +70,7 @@ index cc4fbda7ddfa8..c7278ef3d7ff7 100644
|
||||
]
|
||||
}
|
||||
diff --git chrome/browser/ui/browser.cc chrome/browser/ui/browser.cc
|
||||
index 501783a57a06e..5a90cf466eed1 100644
|
||||
index c5aefe534dcd1..0f8bba9965a33 100644
|
||||
--- chrome/browser/ui/browser.cc
|
||||
+++ chrome/browser/ui/browser.cc
|
||||
@@ -263,6 +263,25 @@
|
||||
@@ -99,21 +99,18 @@ index 501783a57a06e..5a90cf466eed1 100644
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
#include "chrome/browser/extensions/extension_browser_window_helper.h"
|
||||
#endif
|
||||
@@ -505,6 +524,13 @@ Browser::Browser(const CreateParams& params)
|
||||
|
||||
tab_strip_model_->AddObserver(this);
|
||||
|
||||
@@ -454,6 +473,10 @@ Browser::Browser(const CreateParams& params)
|
||||
type_(params.type),
|
||||
profile_(params.profile),
|
||||
window_(nullptr),
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ if (cef::IsChromeRuntimeEnabled()) {
|
||||
+ cef_browser_delegate_ =
|
||||
+ cef::BrowserDelegate::Create(this, params.cef_params);
|
||||
+ }
|
||||
+ cef_browser_delegate_(
|
||||
+ cef::BrowserDelegate::Create(this, params.cef_params, params.opener)),
|
||||
+#endif
|
||||
+
|
||||
location_bar_model_ = std::make_unique<LocationBarModelImpl>(
|
||||
location_bar_model_delegate_.get(), content::kMaxURLDisplayChars);
|
||||
|
||||
@@ -645,6 +671,12 @@ Browser::~Browser() {
|
||||
tab_strip_model_delegate_(
|
||||
std::make_unique<chrome::BrowserTabStripModelDelegate>(this)),
|
||||
tab_strip_model_(std::make_unique<TabStripModel>(
|
||||
@@ -645,6 +668,12 @@ Browser::~Browser() {
|
||||
// away so they don't try and call back to us.
|
||||
if (select_file_dialog_.get())
|
||||
select_file_dialog_->ListenerDestroyed();
|
||||
@@ -126,7 +123,16 @@ index 501783a57a06e..5a90cf466eed1 100644
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1380,6 +1412,14 @@ content::KeyboardEventProcessingResult Browser::PreHandleKeyboardEvent(
|
||||
@@ -1040,6 +1069,8 @@ void Browser::WindowFullscreenStateChanged() {
|
||||
->WindowFullscreenStateChanged();
|
||||
command_controller_->FullscreenStateChanged();
|
||||
UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TOGGLE_FULLSCREEN);
|
||||
+
|
||||
+ CALL_CEF_DELEGATE(WindowFullscreenStateChanged);
|
||||
}
|
||||
|
||||
void Browser::FullscreenTopUIStateChanged() {
|
||||
@@ -1378,6 +1409,14 @@ content::KeyboardEventProcessingResult Browser::PreHandleKeyboardEvent(
|
||||
if (exclusive_access_manager_->HandleUserKeyEvent(event))
|
||||
return content::KeyboardEventProcessingResult::HANDLED;
|
||||
|
||||
@@ -141,7 +147,7 @@ index 501783a57a06e..5a90cf466eed1 100644
|
||||
return window()->PreHandleKeyboardEvent(event);
|
||||
}
|
||||
|
||||
@@ -1387,8 +1427,18 @@ bool Browser::HandleKeyboardEvent(content::WebContents* source,
|
||||
@@ -1385,8 +1424,18 @@ bool Browser::HandleKeyboardEvent(content::WebContents* source,
|
||||
const NativeWebKeyboardEvent& event) {
|
||||
DevToolsWindow* devtools_window =
|
||||
DevToolsWindow::GetInstanceForInspectedWebContents(source);
|
||||
@@ -162,7 +168,7 @@ index 501783a57a06e..5a90cf466eed1 100644
|
||||
}
|
||||
|
||||
bool Browser::TabsNeedBeforeUnloadFired() {
|
||||
@@ -1592,6 +1642,14 @@ WebContents* Browser::OpenURLFromTab(WebContents* source,
|
||||
@@ -1590,6 +1639,14 @@ WebContents* Browser::OpenURLFromTab(WebContents* source,
|
||||
return window->OpenURLFromTab(source, params);
|
||||
}
|
||||
|
||||
@@ -177,7 +183,7 @@ index 501783a57a06e..5a90cf466eed1 100644
|
||||
NavigateParams nav_params(this, params.url, params.transition);
|
||||
nav_params.FillNavigateParamsFromOpenURLParams(params);
|
||||
nav_params.source_contents = source;
|
||||
@@ -1749,6 +1807,8 @@ void Browser::LoadingStateChanged(WebContents* source,
|
||||
@@ -1747,6 +1804,8 @@ void Browser::LoadingStateChanged(WebContents* source,
|
||||
bool should_show_loading_ui) {
|
||||
ScheduleUIUpdate(source, content::INVALIDATE_TYPE_LOAD);
|
||||
UpdateWindowForLoadingStateChanged(source, should_show_loading_ui);
|
||||
@@ -186,7 +192,7 @@ index 501783a57a06e..5a90cf466eed1 100644
|
||||
}
|
||||
|
||||
void Browser::CloseContents(WebContents* source) {
|
||||
@@ -1777,6 +1837,8 @@ void Browser::SetContentsBounds(WebContents* source, const gfx::Rect& bounds) {
|
||||
@@ -1775,6 +1834,8 @@ void Browser::SetContentsBounds(WebContents* source, const gfx::Rect& bounds) {
|
||||
}
|
||||
|
||||
void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
|
||||
@@ -195,7 +201,7 @@ index 501783a57a06e..5a90cf466eed1 100644
|
||||
if (!GetStatusBubble())
|
||||
return;
|
||||
|
||||
@@ -1784,6 +1846,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
|
||||
@@ -1782,6 +1843,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
|
||||
GetStatusBubble()->SetURL(url);
|
||||
}
|
||||
|
||||
@@ -213,7 +219,7 @@ index 501783a57a06e..5a90cf466eed1 100644
|
||||
void Browser::ContentsMouseEvent(WebContents* source,
|
||||
bool motion,
|
||||
bool exited) {
|
||||
@@ -1808,6 +1881,19 @@ bool Browser::TakeFocus(content::WebContents* source, bool reverse) {
|
||||
@@ -1806,6 +1878,19 @@ bool Browser::TakeFocus(content::WebContents* source, bool reverse) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -233,7 +239,7 @@ index 501783a57a06e..5a90cf466eed1 100644
|
||||
void Browser::BeforeUnloadFired(WebContents* web_contents,
|
||||
bool proceed,
|
||||
bool* proceed_to_fire_unload) {
|
||||
@@ -1900,6 +1986,10 @@ void Browser::WebContentsCreated(WebContents* source_contents,
|
||||
@@ -1898,6 +1983,10 @@ void Browser::WebContentsCreated(WebContents* source_contents,
|
||||
|
||||
// Make the tab show up in the task manager.
|
||||
task_manager::WebContentsTags::CreateForTabContents(new_contents);
|
||||
@@ -244,7 +250,7 @@ index 501783a57a06e..5a90cf466eed1 100644
|
||||
}
|
||||
|
||||
void Browser::PortalWebContentsCreated(WebContents* portal_web_contents) {
|
||||
@@ -2017,11 +2107,15 @@ void Browser::EnterFullscreenModeForTab(
|
||||
@@ -2015,11 +2104,15 @@ void Browser::EnterFullscreenModeForTab(
|
||||
const blink::mojom::FullscreenOptions& options) {
|
||||
exclusive_access_manager_->fullscreen_controller()->EnterFullscreenModeForTab(
|
||||
requesting_frame, options.display_id);
|
||||
@@ -260,7 +266,7 @@ index 501783a57a06e..5a90cf466eed1 100644
|
||||
}
|
||||
|
||||
bool Browser::IsFullscreenForTabOrPending(const WebContents* web_contents) {
|
||||
@@ -2211,6 +2305,15 @@ void Browser::RequestMediaAccessPermission(
|
||||
@@ -2209,6 +2302,15 @@ void Browser::RequestMediaAccessPermission(
|
||||
content::WebContents* web_contents,
|
||||
const content::MediaStreamRequest& request,
|
||||
content::MediaResponseCallback callback) {
|
||||
@@ -276,7 +282,7 @@ index 501783a57a06e..5a90cf466eed1 100644
|
||||
const extensions::Extension* extension =
|
||||
GetExtensionForOrigin(profile_, request.security_origin);
|
||||
MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest(
|
||||
@@ -2762,13 +2865,20 @@ void Browser::RemoveScheduledUpdatesFor(WebContents* contents) {
|
||||
@@ -2760,13 +2862,20 @@ void Browser::RemoveScheduledUpdatesFor(WebContents* contents) {
|
||||
// Browser, Getters for UI (private):
|
||||
|
||||
StatusBubble* Browser::GetStatusBubble() {
|
||||
@@ -298,7 +304,7 @@ index 501783a57a06e..5a90cf466eed1 100644
|
||||
return window_ ? window_->GetStatusBubble() : nullptr;
|
||||
}
|
||||
|
||||
@@ -2902,6 +3012,8 @@ void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
|
||||
@@ -2900,6 +3009,8 @@ void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
|
||||
BookmarkTabHelper::FromWebContents(web_contents)->RemoveObserver(this);
|
||||
web_contents_collection_.StopObserving(web_contents);
|
||||
}
|
||||
@@ -307,8 +313,23 @@ index 501783a57a06e..5a90cf466eed1 100644
|
||||
}
|
||||
|
||||
void Browser::TabDetachedAtImpl(content::WebContents* contents,
|
||||
@@ -3054,6 +3165,14 @@ bool Browser::PictureInPictureBrowserSupportsWindowFeature(
|
||||
|
||||
bool Browser::SupportsWindowFeatureImpl(WindowFeature feature,
|
||||
bool check_can_support) const {
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ if (cef_delegate()) {
|
||||
+ if (auto value = cef_delegate()->SupportsWindowFeature(feature)) {
|
||||
+ return *value;
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
switch (type_) {
|
||||
case TYPE_NORMAL:
|
||||
return NormalBrowserSupportsWindowFeature(feature, check_can_support);
|
||||
diff --git chrome/browser/ui/browser.h chrome/browser/ui/browser.h
|
||||
index 9fceed57deff5..bc0058f0b1db2 100644
|
||||
index 9fceed57deff5..a1a962cf014fa 100644
|
||||
--- chrome/browser/ui/browser.h
|
||||
+++ chrome/browser/ui/browser.h
|
||||
@@ -22,6 +22,7 @@
|
||||
@@ -330,19 +351,23 @@ index 9fceed57deff5..bc0058f0b1db2 100644
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
#error This file should only be included on desktop.
|
||||
#endif
|
||||
@@ -322,6 +327,11 @@ class Browser : public TabStripModelObserver,
|
||||
@@ -322,6 +327,15 @@ class Browser : public TabStripModelObserver,
|
||||
// Document Picture in Picture options, specific to TYPE_PICTURE_IN_PICTURE.
|
||||
absl::optional<blink::mojom::PictureInPictureWindowOptions> pip_options;
|
||||
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ // Opaque CEF-specific configuration. Will be propagated to new Browsers.
|
||||
+ scoped_refptr<cef::BrowserDelegate::CreateParams> cef_params;
|
||||
+
|
||||
+ // Specify the Browser that is opening this popup.
|
||||
+ // Currently only used with TYPE_PICTURE_IN_PICTURE.
|
||||
+ raw_ptr<Browser, DanglingUntriaged> opener = nullptr;
|
||||
+#endif
|
||||
+
|
||||
private:
|
||||
friend class Browser;
|
||||
friend class WindowSizerChromeOSTest;
|
||||
@@ -403,6 +413,13 @@ class Browser : public TabStripModelObserver,
|
||||
@@ -403,6 +417,13 @@ class Browser : public TabStripModelObserver,
|
||||
update_ui_immediately_for_testing_ = true;
|
||||
}
|
||||
|
||||
@@ -356,7 +381,7 @@ index 9fceed57deff5..bc0058f0b1db2 100644
|
||||
// Accessors ////////////////////////////////////////////////////////////////
|
||||
|
||||
const CreateParams& create_params() const { return create_params_; }
|
||||
@@ -476,6 +493,12 @@ class Browser : public TabStripModelObserver,
|
||||
@@ -476,6 +497,12 @@ class Browser : public TabStripModelObserver,
|
||||
|
||||
base::WeakPtr<Browser> AsWeakPtr();
|
||||
|
||||
@@ -369,7 +394,7 @@ index 9fceed57deff5..bc0058f0b1db2 100644
|
||||
// Get the FindBarController for this browser, creating it if it does not
|
||||
// yet exist.
|
||||
FindBarController* GetFindBarController();
|
||||
@@ -869,11 +892,19 @@ class Browser : public TabStripModelObserver,
|
||||
@@ -869,11 +896,19 @@ class Browser : public TabStripModelObserver,
|
||||
void SetContentsBounds(content::WebContents* source,
|
||||
const gfx::Rect& bounds) override;
|
||||
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
|
||||
@@ -389,7 +414,18 @@ index 9fceed57deff5..bc0058f0b1db2 100644
|
||||
void BeforeUnloadFired(content::WebContents* source,
|
||||
bool proceed,
|
||||
bool* proceed_to_fire_unload) override;
|
||||
@@ -1281,6 +1312,8 @@ class Browser : public TabStripModelObserver,
|
||||
@@ -1212,6 +1247,10 @@ class Browser : public TabStripModelObserver,
|
||||
// This Browser's window.
|
||||
raw_ptr<BrowserWindow, DanglingUntriaged> window_;
|
||||
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ std::unique_ptr<cef::BrowserDelegate> cef_browser_delegate_;
|
||||
+#endif
|
||||
+
|
||||
std::unique_ptr<TabStripModelDelegate> const tab_strip_model_delegate_;
|
||||
std::unique_ptr<TabStripModel> const tab_strip_model_;
|
||||
|
||||
@@ -1281,6 +1320,8 @@ class Browser : public TabStripModelObserver,
|
||||
const std::string initial_workspace_;
|
||||
bool initial_visible_on_all_workspaces_state_;
|
||||
|
||||
@@ -398,22 +434,22 @@ index 9fceed57deff5..bc0058f0b1db2 100644
|
||||
CreationSource creation_source_ = CreationSource::kUnknown;
|
||||
|
||||
UnloadController unload_controller_;
|
||||
@@ -1348,6 +1381,10 @@ class Browser : public TabStripModelObserver,
|
||||
extension_browser_window_helper_;
|
||||
#endif
|
||||
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ std::unique_ptr<cef::BrowserDelegate> cef_browser_delegate_;
|
||||
+#endif
|
||||
+
|
||||
const base::ElapsedTimer creation_timer_;
|
||||
|
||||
// The opener browser of the document picture-in-picture browser. Null if the
|
||||
diff --git chrome/browser/ui/browser_navigator.cc chrome/browser/ui/browser_navigator.cc
|
||||
index 88edd87bcb2d0..26f9d74bd4ed9 100644
|
||||
index 88edd87bcb2d0..03fc4f4ccd95f 100644
|
||||
--- chrome/browser/ui/browser_navigator.cc
|
||||
+++ chrome/browser/ui/browser_navigator.cc
|
||||
@@ -556,6 +556,13 @@ std::unique_ptr<content::WebContents> CreateTargetContents(
|
||||
@@ -293,6 +293,10 @@ std::pair<Browser*, int> GetBrowserAndTabForDisposition(
|
||||
: 1.0;
|
||||
browser_params.pip_options = pip_options;
|
||||
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ browser_params.opener = params.browser;
|
||||
+#endif
|
||||
+
|
||||
const BrowserWindow* const browser_window = params.browser->window();
|
||||
const gfx::NativeWindow native_window =
|
||||
browser_window ? browser_window->GetNativeWindow()
|
||||
@@ -556,6 +560,13 @@ std::unique_ptr<content::WebContents> CreateTargetContents(
|
||||
std::unique_ptr<WebContents> target_contents =
|
||||
WebContents::Create(create_params);
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git chrome/browser/renderer_context_menu/render_view_context_menu.cc chrome/browser/renderer_context_menu/render_view_context_menu.cc
|
||||
index 6083c04105cf9..a77ebeff46a70 100644
|
||||
index b3e367b9ea823..932a1563c1b05 100644
|
||||
--- chrome/browser/renderer_context_menu/render_view_context_menu.cc
|
||||
+++ chrome/browser/renderer_context_menu/render_view_context_menu.cc
|
||||
@@ -341,6 +341,13 @@ base::OnceCallback<void(RenderViewContextMenu*)>* GetMenuShownCallback() {
|
||||
@@ -55,7 +55,7 @@ index 6083c04105cf9..a77ebeff46a70 100644
|
||||
}
|
||||
|
||||
Profile* RenderViewContextMenu::GetProfile() const {
|
||||
@@ -3320,6 +3345,12 @@ void RenderViewContextMenu::RegisterExecutePluginActionCallbackForTesting(
|
||||
@@ -3325,6 +3350,12 @@ void RenderViewContextMenu::RegisterExecutePluginActionCallbackForTesting(
|
||||
execute_plugin_action_callback_ = std::move(cb);
|
||||
}
|
||||
|
||||
|
@@ -44,7 +44,7 @@ index 16107572d4d0d..409e9ea870482 100644
|
||||
base::FeatureList::IsEnabled(
|
||||
features::kPeriodicSyncPermissionForDefaultSearchEngine) &&
|
||||
diff --git chrome/browser/permissions/chrome_permissions_client.cc chrome/browser/permissions/chrome_permissions_client.cc
|
||||
index 18e2eec8f64ff..d36b3206aeb63 100644
|
||||
index 4d895c857260c..4dbfba9b15cae 100644
|
||||
--- chrome/browser/permissions/chrome_permissions_client.cc
|
||||
+++ chrome/browser/permissions/chrome_permissions_client.cc
|
||||
@@ -14,6 +14,7 @@
|
||||
@@ -67,7 +67,7 @@ index 18e2eec8f64ff..d36b3206aeb63 100644
|
||||
->GetScore(origin);
|
||||
@@ -338,8 +342,10 @@ ChromePermissionsClient::CreatePermissionUiSelectors(
|
||||
std::make_unique<ContextualNotificationPermissionUiSelector>());
|
||||
selectors.emplace_back(std::make_unique<PrefNotificationPermissionUiSelector>(
|
||||
selectors.emplace_back(std::make_unique<PrefBasedQuietPermissionUiSelector>(
|
||||
Profile::FromBrowserContext(browser_context)));
|
||||
+ if (!cef::IsAlloyRuntimeEnabled()) {
|
||||
selectors.emplace_back(std::make_unique<PredictionBasedPermissionUiSelector>(
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git chrome/browser/safe_browsing/BUILD.gn chrome/browser/safe_browsing/BUILD.gn
|
||||
index 2731d7c8912a9..91206a1aaca39 100644
|
||||
index 32a8fcc0633d5..5c661dca845b9 100644
|
||||
--- chrome/browser/safe_browsing/BUILD.gn
|
||||
+++ chrome/browser/safe_browsing/BUILD.gn
|
||||
@@ -32,6 +32,7 @@ static_library("safe_browsing") {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git chrome/browser/themes/theme_service.cc chrome/browser/themes/theme_service.cc
|
||||
index 31dff947be598..14138f1030822 100644
|
||||
index c9d21e2861e0e..baa94ae75a77a 100644
|
||||
--- chrome/browser/themes/theme_service.cc
|
||||
+++ chrome/browser/themes/theme_service.cc
|
||||
@@ -30,6 +30,7 @@
|
||||
@@ -21,7 +21,7 @@ index 31dff947be598..14138f1030822 100644
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
#include "base/scoped_observation.h"
|
||||
#include "extensions/browser/extension_registry_observer.h"
|
||||
@@ -272,11 +277,19 @@ void ThemeService::Init() {
|
||||
@@ -273,11 +278,19 @@ void ThemeService::Init() {
|
||||
// OnExtensionServiceReady. Otherwise, the ThemeObserver won't be
|
||||
// constructed in time to observe the corresponding events.
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
@@ -42,7 +42,7 @@ index 31dff947be598..14138f1030822 100644
|
||||
theme_syncable_service_ =
|
||||
std::make_unique<ThemeSyncableService>(profile_, this);
|
||||
diff --git chrome/browser/themes/theme_service_factory.cc chrome/browser/themes/theme_service_factory.cc
|
||||
index 783fd6aa20dac..8c4e51b577c5d 100644
|
||||
index 879bbeef4037b..e6cc36f388197 100644
|
||||
--- chrome/browser/themes/theme_service_factory.cc
|
||||
+++ chrome/browser/themes/theme_service_factory.cc
|
||||
@@ -9,6 +9,7 @@
|
||||
|
@@ -233,7 +233,7 @@ index c09da3b85e58f..36d0c1a52a44b 100644
|
||||
+#endif
|
||||
}
|
||||
diff --git chrome/browser/chrome_content_browser_client.cc chrome/browser/chrome_content_browser_client.cc
|
||||
index 974e3c37047e1..ce3f7084e6458 100644
|
||||
index da2cf79ceae39..be27a3d9ac81c 100644
|
||||
--- chrome/browser/chrome_content_browser_client.cc
|
||||
+++ chrome/browser/chrome_content_browser_client.cc
|
||||
@@ -42,6 +42,7 @@
|
||||
@@ -244,7 +244,7 @@ index 974e3c37047e1..ce3f7084e6458 100644
|
||||
#include "chrome/browser/accessibility/accessibility_labels_service.h"
|
||||
#include "chrome/browser/accessibility/accessibility_labels_service_factory.h"
|
||||
#include "chrome/browser/after_startup_task_utils.h"
|
||||
@@ -1542,6 +1543,8 @@ ChromeContentBrowserClient::GetPopupNavigationDelegateFactoryForTesting() {
|
||||
@@ -1543,6 +1544,8 @@ ChromeContentBrowserClient::GetPopupNavigationDelegateFactoryForTesting() {
|
||||
}
|
||||
|
||||
ChromeContentBrowserClient::ChromeContentBrowserClient() {
|
||||
@@ -253,7 +253,7 @@ index 974e3c37047e1..ce3f7084e6458 100644
|
||||
#if BUILDFLAG(ENABLE_PLUGINS)
|
||||
extra_parts_.push_back(
|
||||
std::make_unique<ChromeContentBrowserClientPluginsPart>());
|
||||
@@ -1574,6 +1577,11 @@ ChromeContentBrowserClient::~ChromeContentBrowserClient() {
|
||||
@@ -1575,6 +1578,11 @@ ChromeContentBrowserClient::~ChromeContentBrowserClient() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ index 974e3c37047e1..ce3f7084e6458 100644
|
||||
// static
|
||||
void ChromeContentBrowserClient::RegisterLocalStatePrefs(
|
||||
PrefRegistrySimple* registry) {
|
||||
@@ -4409,9 +4417,11 @@ void ChromeContentBrowserClient::BrowserURLHandlerCreated(
|
||||
@@ -4410,9 +4418,11 @@ void ChromeContentBrowserClient::BrowserURLHandlerCreated(
|
||||
&search::HandleNewTabURLReverseRewrite);
|
||||
#endif // BUILDFLAG(IS_ANDROID)
|
||||
|
||||
@@ -277,7 +277,7 @@ index 974e3c37047e1..ce3f7084e6458 100644
|
||||
}
|
||||
|
||||
base::FilePath ChromeContentBrowserClient::GetDefaultDownloadDirectory() {
|
||||
@@ -6450,7 +6460,7 @@ void ChromeContentBrowserClient::OnNetworkServiceCreated(
|
||||
@@ -6451,7 +6461,7 @@ void ChromeContentBrowserClient::OnNetworkServiceCreated(
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ index 974e3c37047e1..ce3f7084e6458 100644
|
||||
content::BrowserContext* context,
|
||||
bool in_memory,
|
||||
const base::FilePath& relative_partition_path,
|
||||
@@ -6468,6 +6478,8 @@ void ChromeContentBrowserClient::ConfigureNetworkContextParams(
|
||||
@@ -6469,6 +6479,8 @@ void ChromeContentBrowserClient::ConfigureNetworkContextParams(
|
||||
network_context_params->user_agent = GetUserAgentBasedOnPolicy(context);
|
||||
network_context_params->accept_language = GetApplicationLocale();
|
||||
}
|
||||
@@ -295,7 +295,7 @@ index 974e3c37047e1..ce3f7084e6458 100644
|
||||
}
|
||||
|
||||
std::vector<base::FilePath>
|
||||
@@ -7497,10 +7509,10 @@ void ChromeContentBrowserClient::OnKeepaliveRequestStarted(
|
||||
@@ -7498,10 +7510,10 @@ void ChromeContentBrowserClient::OnKeepaliveRequestStarted(
|
||||
const auto now = base::TimeTicks::Now();
|
||||
const auto timeout = GetKeepaliveTimerTimeout(context);
|
||||
keepalive_deadline_ = std::max(keepalive_deadline_, now + timeout);
|
||||
@@ -308,7 +308,7 @@ index 974e3c37047e1..ce3f7084e6458 100644
|
||||
FROM_HERE, keepalive_deadline_ - now,
|
||||
base::BindOnce(
|
||||
&ChromeContentBrowserClient::OnKeepaliveTimerFired,
|
||||
@@ -7519,7 +7531,8 @@ void ChromeContentBrowserClient::OnKeepaliveRequestFinished() {
|
||||
@@ -7520,7 +7532,8 @@ void ChromeContentBrowserClient::OnKeepaliveRequestFinished() {
|
||||
--num_keepalive_requests_;
|
||||
if (num_keepalive_requests_ == 0) {
|
||||
DVLOG(1) << "Stopping the keepalive timer";
|
||||
@@ -318,7 +318,7 @@ index 974e3c37047e1..ce3f7084e6458 100644
|
||||
// This deletes the keep alive handle attached to the timer function and
|
||||
// unblock the shutdown sequence.
|
||||
}
|
||||
@@ -7661,7 +7674,7 @@ void ChromeContentBrowserClient::OnKeepaliveTimerFired(
|
||||
@@ -7662,7 +7675,7 @@ void ChromeContentBrowserClient::OnKeepaliveTimerFired(
|
||||
const auto now = base::TimeTicks::Now();
|
||||
const auto then = keepalive_deadline_;
|
||||
if (now < then) {
|
||||
|
@@ -231,7 +231,7 @@ index 59024587ef6b7..0c30aa71768cf 100644
|
||||
|
||||
void FindBarHost::RegisterAccelerators() {
|
||||
diff --git chrome/browser/ui/views/frame/browser_frame.cc chrome/browser/ui/views/frame/browser_frame.cc
|
||||
index dad33e7ccfaa8..d1a644672d8e2 100644
|
||||
index 40fc0ef6a91bb..c5f4b4e3b363d 100644
|
||||
--- chrome/browser/ui/views/frame/browser_frame.cc
|
||||
+++ chrome/browser/ui/views/frame/browser_frame.cc
|
||||
@@ -91,15 +91,23 @@ ui::ColorProviderKey::SchemeVariant GetSchemeVariant(
|
||||
@@ -331,7 +331,7 @@ index dad33e7ccfaa8..d1a644672d8e2 100644
|
||||
|
||||
key.app_controller = browser_view_->browser()->app_controller();
|
||||
|
||||
@@ -584,5 +614,8 @@ bool BrowserFrame::RegenerateFrameOnThemeChange(
|
||||
@@ -597,5 +627,8 @@ bool BrowserFrame::RegenerateFrameOnThemeChange(
|
||||
}
|
||||
|
||||
bool BrowserFrame::IsIncognitoBrowser() const {
|
||||
@@ -355,7 +355,7 @@ index 77ca1dbf118f9..c60711991d093 100644
|
||||
BrowserFrame(const BrowserFrame&) = delete;
|
||||
BrowserFrame& operator=(const BrowserFrame&) = delete;
|
||||
diff --git chrome/browser/ui/views/frame/browser_view.cc chrome/browser/ui/views/frame/browser_view.cc
|
||||
index 261dfb8562dbd..650a2847fb6c8 100644
|
||||
index 261dfb8562dbd..64bb1900483c8 100644
|
||||
--- chrome/browser/ui/views/frame/browser_view.cc
|
||||
+++ chrome/browser/ui/views/frame/browser_view.cc
|
||||
@@ -336,11 +336,10 @@ using content::NativeWebKeyboardEvent;
|
||||
@@ -411,7 +411,7 @@ index 261dfb8562dbd..650a2847fb6c8 100644
|
||||
|
||||
- toolbar_ = top_container_->AddChildView(
|
||||
- std::make_unique<ToolbarView>(browser_.get(), this));
|
||||
+ toolbar_ = OverrideCreateToolbar(browser_.get(), this);
|
||||
+ toolbar_ = OverrideCreateToolbar();
|
||||
+ if (!toolbar_) {
|
||||
+ toolbar_ = new ToolbarView(browser_.get(), this, absl::nullopt);
|
||||
+ } else {
|
||||
@@ -469,7 +469,57 @@ index 261dfb8562dbd..650a2847fb6c8 100644
|
||||
top_container()->DestroyLayer();
|
||||
AddChildViewAt(top_container(), 0);
|
||||
EnsureFocusOrder();
|
||||
@@ -3994,8 +4016,10 @@ void BrowserView::Layout() {
|
||||
@@ -3873,11 +3895,38 @@ void BrowserView::GetAccessiblePanes(std::vector<views::View*>* panes) {
|
||||
bool BrowserView::ShouldDescendIntoChildForEventHandling(
|
||||
gfx::NativeView child,
|
||||
const gfx::Point& location) {
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ const bool frameless_pip =
|
||||
+ GetIsPictureInPictureType() &&
|
||||
+ !browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR);
|
||||
+ if (frameless_pip) {
|
||||
+ if (auto frame_view = frame()->GetFrameView()) {
|
||||
+ int result = frame_view->NonClientHitTest(location);
|
||||
+ if (result == HTTOP || result == HTTOPLEFT || result == HTTOPRIGHT) {
|
||||
+ // Allow resize from the top of a frameless window.
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ absl::optional<SkRegion> draggable_region;
|
||||
+
|
||||
// Window for PWAs with window-controls-overlay display override should claim
|
||||
// mouse events that fall within the draggable region.
|
||||
web_app::AppBrowserController* controller = browser()->app_controller();
|
||||
- if (AreDraggableRegionsEnabled() && controller &&
|
||||
- controller->draggable_region().has_value()) {
|
||||
+ if (AreDraggableRegionsEnabled() && controller) {
|
||||
+ draggable_region = controller->draggable_region();
|
||||
+ }
|
||||
+
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ // Match logic in PictureInPictureBrowserFrameView::NonClientHitTest.
|
||||
+ if (!draggable_region.has_value() && frameless_pip) {
|
||||
+ draggable_region = browser_->cef_delegate()->GetDraggableRegion();
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ if (draggable_region.has_value()) {
|
||||
// Draggable regions are defined relative to the web contents.
|
||||
gfx::Point point_in_contents_web_view_coords(location);
|
||||
views::View::ConvertPointToTarget(GetWidget()->GetRootView(),
|
||||
@@ -3886,7 +3935,7 @@ bool BrowserView::ShouldDescendIntoChildForEventHandling(
|
||||
|
||||
// Draggable regions should be ignored for clicks into any browser view's
|
||||
// owned widgets, for example alerts, permission prompts or find bar.
|
||||
- return !controller->draggable_region()->contains(
|
||||
+ return !draggable_region->contains(
|
||||
point_in_contents_web_view_coords.x(),
|
||||
point_in_contents_web_view_coords.y()) ||
|
||||
WidgetOwnedByAnchorContainsPoint(point_in_contents_web_view_coords);
|
||||
@@ -3994,8 +4043,10 @@ void BrowserView::Layout() {
|
||||
|
||||
// TODO(jamescook): Why was this in the middle of layout code?
|
||||
toolbar_->location_bar()->omnibox_view()->SetFocusBehavior(
|
||||
@@ -482,7 +532,7 @@ index 261dfb8562dbd..650a2847fb6c8 100644
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
// In chromeOS ash we round the bottom two corners of the browser frame by
|
||||
@@ -4073,6 +4097,11 @@ void BrowserView::AddedToWidget() {
|
||||
@@ -4073,6 +4124,11 @@ void BrowserView::AddedToWidget() {
|
||||
SetThemeProfileForWindow(GetNativeWindow(), browser_->profile());
|
||||
#endif
|
||||
|
||||
@@ -494,7 +544,7 @@ index 261dfb8562dbd..650a2847fb6c8 100644
|
||||
toolbar_->Init();
|
||||
|
||||
// TODO(pbos): Investigate whether the side panels should be creatable when
|
||||
@@ -4120,13 +4149,9 @@ void BrowserView::AddedToWidget() {
|
||||
@@ -4120,13 +4176,9 @@ void BrowserView::AddedToWidget() {
|
||||
|
||||
EnsureFocusOrder();
|
||||
|
||||
@@ -510,7 +560,7 @@ index 261dfb8562dbd..650a2847fb6c8 100644
|
||||
using_native_frame_ = frame_->ShouldUseNativeFrame();
|
||||
|
||||
MaybeInitializeWebUITabStrip();
|
||||
@@ -4544,7 +4569,8 @@ void BrowserView::ProcessFullscreen(bool fullscreen,
|
||||
@@ -4544,7 +4596,8 @@ void BrowserView::ProcessFullscreen(bool fullscreen,
|
||||
// Undo our anti-jankiness hacks and force a re-layout.
|
||||
in_process_fullscreen_ = false;
|
||||
ToolbarSizeChanged(false);
|
||||
@@ -520,7 +570,7 @@ index 261dfb8562dbd..650a2847fb6c8 100644
|
||||
}
|
||||
|
||||
bool BrowserView::ShouldUseImmersiveFullscreenForUrl(const GURL& url) const {
|
||||
@@ -4915,6 +4941,8 @@ Profile* BrowserView::GetProfile() {
|
||||
@@ -4915,6 +4968,8 @@ Profile* BrowserView::GetProfile() {
|
||||
}
|
||||
|
||||
void BrowserView::UpdateUIForTabFullscreen() {
|
||||
@@ -529,7 +579,7 @@ index 261dfb8562dbd..650a2847fb6c8 100644
|
||||
frame()->GetFrameView()->UpdateFullscreenTopUI();
|
||||
}
|
||||
|
||||
@@ -4937,6 +4965,8 @@ void BrowserView::HideDownloadShelf() {
|
||||
@@ -4937,6 +4992,8 @@ void BrowserView::HideDownloadShelf() {
|
||||
}
|
||||
|
||||
bool BrowserView::CanUserExitFullscreen() const {
|
||||
@@ -539,7 +589,7 @@ index 261dfb8562dbd..650a2847fb6c8 100644
|
||||
}
|
||||
|
||||
diff --git chrome/browser/ui/views/frame/browser_view.h chrome/browser/ui/views/frame/browser_view.h
|
||||
index 58f128d2217a0..c8dd2a4a5a940 100644
|
||||
index 58f128d2217a0..2d5115f2a568e 100644
|
||||
--- chrome/browser/ui/views/frame/browser_view.h
|
||||
+++ chrome/browser/ui/views/frame/browser_view.h
|
||||
@@ -136,11 +136,16 @@ class BrowserView : public BrowserWindow,
|
||||
@@ -559,15 +609,12 @@ index 58f128d2217a0..c8dd2a4a5a940 100644
|
||||
void set_frame(BrowserFrame* frame) {
|
||||
frame_ = frame;
|
||||
paint_as_active_subscription_ =
|
||||
@@ -810,6 +815,12 @@ class BrowserView : public BrowserWindow,
|
||||
@@ -810,6 +815,9 @@ class BrowserView : public BrowserWindow,
|
||||
return web_app_frame_toolbar();
|
||||
}
|
||||
|
||||
+ protected:
|
||||
+ virtual ToolbarView* OverrideCreateToolbar(Browser* browser,
|
||||
+ BrowserView* browser_view) {
|
||||
+ return nullptr;
|
||||
+ }
|
||||
+ virtual ToolbarView* OverrideCreateToolbar() { return nullptr; }
|
||||
+
|
||||
private:
|
||||
// Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate
|
||||
@@ -617,6 +664,100 @@ index 8267a265a8e10..ee08f18e96a34 100644
|
||||
}
|
||||
|
||||
ContentsWebView::~ContentsWebView() {
|
||||
diff --git chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.cc chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.cc
|
||||
index c586392c83bb6..131d6b0b2526b 100644
|
||||
--- chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.cc
|
||||
+++ chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.cc
|
||||
@@ -414,6 +414,11 @@ PictureInPictureBrowserFrameView::PictureInPictureBrowserFrameView(
|
||||
frame->GetNativeWindow()->SetEventTargeter(
|
||||
std::make_unique<chromeos::InteriorResizeHandleTargeter>());
|
||||
#endif
|
||||
+
|
||||
+ if (!browser_view->browser()->SupportsWindowFeature(
|
||||
+ Browser::FEATURE_TITLEBAR)) {
|
||||
+ top_bar_container_view_->SetVisible(false);
|
||||
+ }
|
||||
}
|
||||
|
||||
PictureInPictureBrowserFrameView::~PictureInPictureBrowserFrameView() {
|
||||
@@ -513,17 +518,20 @@ gfx::Rect PictureInPictureBrowserFrameView::GetWindowBoundsForClientBounds(
|
||||
|
||||
int PictureInPictureBrowserFrameView::NonClientHitTest(
|
||||
const gfx::Point& point) {
|
||||
- // Allow interacting with the buttons.
|
||||
- if (GetLocationIconViewBounds().Contains(point) ||
|
||||
- GetBackToTabControlsBounds().Contains(point) ||
|
||||
- GetCloseControlsBounds().Contains(point)) {
|
||||
- return HTCLIENT;
|
||||
- }
|
||||
-
|
||||
- for (size_t i = 0; i < content_setting_views_.size(); i++) {
|
||||
- if (GetContentSettingViewBounds(i).Contains(point)) {
|
||||
+ const bool frameless = !top_bar_container_view_->GetVisible();
|
||||
+ if (!frameless) {
|
||||
+ // Allow interacting with the buttons.
|
||||
+ if (GetLocationIconViewBounds().Contains(point) ||
|
||||
+ GetBackToTabControlsBounds().Contains(point) ||
|
||||
+ GetCloseControlsBounds().Contains(point)) {
|
||||
return HTCLIENT;
|
||||
}
|
||||
+
|
||||
+ for (size_t i = 0; i < content_setting_views_.size(); i++) {
|
||||
+ if (GetContentSettingViewBounds(i).Contains(point)) {
|
||||
+ return HTCLIENT;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
// Allow dragging and resizing the window.
|
||||
@@ -533,6 +541,27 @@ int PictureInPictureBrowserFrameView::NonClientHitTest(
|
||||
if (window_component != HTNOWHERE)
|
||||
return window_component;
|
||||
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ if (frameless) {
|
||||
+ // Match logic in BrowserView::ShouldDescendIntoChildForEventHandling.
|
||||
+ const auto draggable_region =
|
||||
+ browser_view()->browser()->cef_delegate()->GetDraggableRegion();
|
||||
+ if (draggable_region.has_value()) {
|
||||
+ // Draggable regions are defined relative to the web contents.
|
||||
+ gfx::Point point_in_contents_web_view_coords(point);
|
||||
+ views::View::ConvertPointToTarget(GetWidget()->GetRootView(),
|
||||
+ browser_view()->contents_web_view(),
|
||||
+ &point_in_contents_web_view_coords);
|
||||
+
|
||||
+ if (draggable_region->contains(
|
||||
+ point_in_contents_web_view_coords.x(),
|
||||
+ point_in_contents_web_view_coords.y())) {
|
||||
+ return HTCAPTION;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+#endif // BUILDFLAG(ENABLE_CEF)
|
||||
+
|
||||
// Allow interacting with the web contents.
|
||||
int frame_component = frame()->client_view()->NonClientHitTest(point);
|
||||
if (frame_component != HTNOWHERE)
|
||||
@@ -591,7 +620,8 @@ void PictureInPictureBrowserFrameView::Layout() {
|
||||
gfx::Rect content_area = GetLocalBounds();
|
||||
content_area.Inset(FrameBorderInsets());
|
||||
gfx::Rect top_bar = content_area;
|
||||
- top_bar.set_height(kTopControlsHeight);
|
||||
+ top_bar.set_height(
|
||||
+ top_bar_container_view_->GetVisible() ? kTopControlsHeight : 0);
|
||||
top_bar_container_view_->SetBoundsRect(top_bar);
|
||||
#if !BUILDFLAG(IS_ANDROID)
|
||||
if (auto_pip_setting_overlay_) {
|
||||
@@ -1029,7 +1059,8 @@ gfx::Insets PictureInPictureBrowserFrameView::ResizeBorderInsets() const {
|
||||
}
|
||||
|
||||
int PictureInPictureBrowserFrameView::GetTopAreaHeight() const {
|
||||
- return FrameBorderInsets().top() + kTopControlsHeight;
|
||||
+ return FrameBorderInsets().top() +
|
||||
+ (top_bar_container_view_->GetVisible() ? kTopControlsHeight : 0);
|
||||
}
|
||||
|
||||
gfx::Size PictureInPictureBrowserFrameView::GetNonClientViewAreaSize() const {
|
||||
diff --git chrome/browser/ui/views/page_action/page_action_icon_controller.cc chrome/browser/ui/views/page_action/page_action_icon_controller.cc
|
||||
index 723a2840bd988..975152c988917 100644
|
||||
--- chrome/browser/ui/views/page_action/page_action_icon_controller.cc
|
||||
@@ -681,10 +822,10 @@ index dc792bea0ab88..e02cdd3214b1d 100644
|
||||
}
|
||||
|
||||
diff --git chrome/browser/ui/views/toolbar/toolbar_view.cc chrome/browser/ui/views/toolbar/toolbar_view.cc
|
||||
index 55c2762426eaa..d2a6f69ad70aa 100644
|
||||
index 619f741f15097..79356428c64bf 100644
|
||||
--- chrome/browser/ui/views/toolbar/toolbar_view.cc
|
||||
+++ chrome/browser/ui/views/toolbar/toolbar_view.cc
|
||||
@@ -182,7 +182,7 @@ class TabstripLikeBackground : public views::Background {
|
||||
@@ -190,7 +190,7 @@ class TabstripLikeBackground : public views::Background {
|
||||
void Paint(gfx::Canvas* canvas, views::View* view) const override {
|
||||
bool painted = TopContainerBackground::PaintThemeCustomImage(
|
||||
canvas, view, browser_view_, /*translate_view_coordinates=*/false);
|
||||
@@ -693,7 +834,7 @@ index 55c2762426eaa..d2a6f69ad70aa 100644
|
||||
SkColor frame_color =
|
||||
browser_view_->frame()->GetFrameView()->GetFrameColor(
|
||||
BrowserFrameActiveState::kUseCurrent);
|
||||
@@ -208,12 +208,13 @@ class ToolbarView::ContainerView : public views::View {
|
||||
@@ -226,12 +226,13 @@ class ToolbarView::ContainerView : public views::View {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ToolbarView, public:
|
||||
|
||||
@@ -709,7 +850,7 @@ index 55c2762426eaa..d2a6f69ad70aa 100644
|
||||
SetID(VIEW_ID_TOOLBAR);
|
||||
|
||||
container_view_ = AddChildView(std::make_unique<ContainerView>());
|
||||
@@ -238,6 +239,19 @@ ToolbarView::~ToolbarView() {
|
||||
@@ -256,6 +257,19 @@ ToolbarView::~ToolbarView() {
|
||||
}
|
||||
|
||||
void ToolbarView::Init() {
|
||||
@@ -729,7 +870,7 @@ index 55c2762426eaa..d2a6f69ad70aa 100644
|
||||
#if defined(USE_AURA)
|
||||
// Avoid generating too many occlusion tracking calculation events before this
|
||||
// function returns. The occlusion status will be computed only once once this
|
||||
@@ -262,12 +276,13 @@ void ToolbarView::Init() {
|
||||
@@ -280,12 +294,13 @@ void ToolbarView::Init() {
|
||||
|
||||
auto location_bar = std::make_unique<LocationBarView>(
|
||||
browser_, browser_->profile(), browser_->command_controller(), this,
|
||||
@@ -745,7 +886,7 @@ index 55c2762426eaa..d2a6f69ad70aa 100644
|
||||
download_button =
|
||||
std::make_unique<DownloadToolbarButtonView>(browser_view_);
|
||||
}
|
||||
@@ -349,8 +364,10 @@ void ToolbarView::Init() {
|
||||
@@ -367,8 +382,10 @@ void ToolbarView::Init() {
|
||||
}
|
||||
}
|
||||
std::unique_ptr<media_router::CastToolbarButton> cast;
|
||||
@@ -757,7 +898,7 @@ index 55c2762426eaa..d2a6f69ad70aa 100644
|
||||
|
||||
std::unique_ptr<MediaToolbarButtonView> media_button;
|
||||
if (base::FeatureList::IsEnabled(media::kGlobalMediaControls)) {
|
||||
@@ -360,7 +377,8 @@ void ToolbarView::Init() {
|
||||
@@ -378,7 +395,8 @@ void ToolbarView::Init() {
|
||||
|
||||
std::unique_ptr<send_tab_to_self::SendTabToSelfToolbarIconView>
|
||||
send_tab_to_self_button;
|
||||
@@ -767,7 +908,7 @@ index 55c2762426eaa..d2a6f69ad70aa 100644
|
||||
send_tab_to_self_button =
|
||||
std::make_unique<send_tab_to_self::SendTabToSelfToolbarIconView>(
|
||||
browser_view_);
|
||||
@@ -368,7 +386,7 @@ void ToolbarView::Init() {
|
||||
@@ -386,7 +404,7 @@ void ToolbarView::Init() {
|
||||
|
||||
std::unique_ptr<SidePanelToolbarButton> side_panel_button;
|
||||
std::unique_ptr<SidePanelToolbarContainer> side_panel_toolbar_container;
|
||||
@@ -790,3 +931,64 @@ index be3bd96444563..96669547e3ccf 100644
|
||||
ToolbarView(const ToolbarView&) = delete;
|
||||
ToolbarView& operator=(const ToolbarView&) = delete;
|
||||
~ToolbarView() override;
|
||||
diff --git chrome/browser/ui/web_applications/draggable_region_host_impl.cc chrome/browser/ui/web_applications/draggable_region_host_impl.cc
|
||||
index 460a2b08f964b..cb1b67d8b1213 100644
|
||||
--- chrome/browser/ui/web_applications/draggable_region_host_impl.cc
|
||||
+++ chrome/browser/ui/web_applications/draggable_region_host_impl.cc
|
||||
@@ -11,6 +11,24 @@
|
||||
#include "chrome/common/chrome_features.h"
|
||||
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
|
||||
|
||||
+namespace {
|
||||
+
|
||||
+bool IsSupported(Browser* browser) {
|
||||
+ if (web_app::AppBrowserController::IsWebApp(browser))
|
||||
+ return true;
|
||||
+
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ if (browser->cef_delegate() &&
|
||||
+ browser->cef_delegate()->SupportsDraggableRegion()) {
|
||||
+ return true;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+} // namespace
|
||||
+
|
||||
DraggableRegionsHostImpl::DraggableRegionsHostImpl(
|
||||
content::RenderFrameHost& render_frame_host,
|
||||
mojo::PendingReceiver<chrome::mojom::DraggableRegions> receiver)
|
||||
@@ -28,7 +46,7 @@ void DraggableRegionsHostImpl::CreateIfAllowed(
|
||||
auto* browser = chrome::FindBrowserWithWebContents(web_contents);
|
||||
|
||||
// We only want to bind the receiver for PWAs.
|
||||
- if (!web_app::AppBrowserController::IsWebApp(browser))
|
||||
+ if (!IsSupported(browser))
|
||||
return;
|
||||
|
||||
// The object is bound to the lifetime of |render_frame_host| and the mojo
|
||||
@@ -43,7 +61,7 @@ void DraggableRegionsHostImpl::UpdateDraggableRegions(
|
||||
auto* browser = chrome::FindBrowserWithWebContents(web_contents);
|
||||
// When a WebApp browser's WebContents is reparented to a tabbed browser, a
|
||||
// draggable regions update may race with the reparenting logic.
|
||||
- if (!web_app::AppBrowserController::IsWebApp(browser))
|
||||
+ if (!IsSupported(browser))
|
||||
return;
|
||||
|
||||
SkRegion sk_region;
|
||||
@@ -56,5 +74,12 @@ void DraggableRegionsHostImpl::UpdateDraggableRegions(
|
||||
}
|
||||
|
||||
auto* app_browser_controller = browser->app_controller();
|
||||
- app_browser_controller->UpdateDraggableRegion(sk_region);
|
||||
+ if (app_browser_controller) {
|
||||
+ app_browser_controller->UpdateDraggableRegion(sk_region);
|
||||
+ }
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ else {
|
||||
+ browser->cef_delegate()->UpdateDraggableRegion(sk_region);
|
||||
+ }
|
||||
+#endif
|
||||
}
|
||||
|
@@ -198,7 +198,7 @@ index c3197eb4790fa..1e7ae767b0582 100644
|
||||
}
|
||||
|
||||
diff --git extensions/browser/extensions_browser_client.h extensions/browser/extensions_browser_client.h
|
||||
index c8b79578252a9..fbfac71f6a861 100644
|
||||
index 058367b7ab78d..99a9e901566ce 100644
|
||||
--- extensions/browser/extensions_browser_client.h
|
||||
+++ extensions/browser/extensions_browser_client.h
|
||||
@@ -32,6 +32,7 @@
|
||||
@@ -217,7 +217,7 @@ index c8b79578252a9..fbfac71f6a861 100644
|
||||
class ExtensionHostDelegate;
|
||||
class ExtensionSet;
|
||||
class ExtensionSystem;
|
||||
@@ -263,6 +265,14 @@ class ExtensionsBrowserClient {
|
||||
@@ -265,6 +267,14 @@ class ExtensionsBrowserClient {
|
||||
virtual std::unique_ptr<ExtensionHostDelegate>
|
||||
CreateExtensionHostDelegate() = 0;
|
||||
|
||||
|
117
patch/patches/light_mode_3534.patch
Normal file
117
patch/patches/light_mode_3534.patch
Normal file
@@ -0,0 +1,117 @@
|
||||
diff --git base/win/dark_mode_support.cc base/win/dark_mode_support.cc
|
||||
index 325bc70b6ba97..d4117dbb1d4d8 100644
|
||||
--- base/win/dark_mode_support.cc
|
||||
+++ base/win/dark_mode_support.cc
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
+#include "base/command_line.h"
|
||||
#include "base/native_library.h"
|
||||
#include "base/win/windows_version.h"
|
||||
|
||||
@@ -85,11 +86,20 @@ const DarkModeSupport& GetDarkModeSupport() {
|
||||
return dark_mode_support;
|
||||
}
|
||||
|
||||
+bool IsForcedLightMode() {
|
||||
+ static bool kIsForcedLightMode =
|
||||
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
+ "force-light-mode");
|
||||
+ return kIsForcedLightMode;
|
||||
+}
|
||||
+
|
||||
} // namespace
|
||||
|
||||
namespace base::win {
|
||||
|
||||
bool IsDarkModeAvailable() {
|
||||
+ if (IsForcedLightMode())
|
||||
+ return false;
|
||||
auto& dark_mode_support = GetDarkModeSupport();
|
||||
return (dark_mode_support.allow_dark_mode_for_app ||
|
||||
dark_mode_support.set_preferred_app_mode) &&
|
||||
diff --git ui/native_theme/native_theme_mac.mm ui/native_theme/native_theme_mac.mm
|
||||
index 604ef6b4771e3..0011a095f8a66 100644
|
||||
--- ui/native_theme/native_theme_mac.mm
|
||||
+++ ui/native_theme/native_theme_mac.mm
|
||||
@@ -45,6 +45,14 @@ bool PrefersReducedTransparency() {
|
||||
bool IsHighContrast() {
|
||||
return NSWorkspace.sharedWorkspace.accessibilityDisplayShouldIncreaseContrast;
|
||||
}
|
||||
+
|
||||
+bool IsForcedLightMode() {
|
||||
+ static bool kIsForcedLightMode =
|
||||
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
+ "force-light-mode");
|
||||
+ return kIsForcedLightMode;
|
||||
+}
|
||||
+
|
||||
} // namespace
|
||||
|
||||
// Helper object to respond to light mode/dark mode changeovers.
|
||||
@@ -567,11 +575,15 @@ void NativeThemeMac::PaintSelectedMenuItem(
|
||||
|
||||
void NativeThemeMac::InitializeDarkModeStateAndObserver() {
|
||||
__block auto theme = this;
|
||||
- set_use_dark_colors(IsDarkMode());
|
||||
+ if (!IsForcedLightMode()) {
|
||||
+ set_use_dark_colors(IsForcedDarkMode() || IsDarkMode());
|
||||
+ }
|
||||
set_preferred_color_scheme(CalculatePreferredColorScheme());
|
||||
appearance_observer_ =
|
||||
[[NativeThemeEffectiveAppearanceObserver alloc] initWithHandler:^{
|
||||
- theme->set_use_dark_colors(IsDarkMode());
|
||||
+ if (!IsForcedLightMode()) {
|
||||
+ theme->set_use_dark_colors(IsForcedDarkMode() || IsDarkMode());
|
||||
+ }
|
||||
theme->set_preferred_color_scheme(CalculatePreferredColorScheme());
|
||||
theme->NotifyOnNativeThemeUpdated();
|
||||
}];
|
||||
@@ -580,7 +592,9 @@ void NativeThemeMac::InitializeDarkModeStateAndObserver() {
|
||||
void NativeThemeMac::ConfigureWebInstance() {
|
||||
// NativeThemeAura is used as web instance so we need to initialize its state.
|
||||
NativeTheme* web_instance = NativeTheme::GetInstanceForWeb();
|
||||
- web_instance->set_use_dark_colors(IsDarkMode());
|
||||
+ if (!IsForcedLightMode()) {
|
||||
+ web_instance->set_use_dark_colors(IsForcedDarkMode() || IsDarkMode());
|
||||
+ }
|
||||
web_instance->set_preferred_color_scheme(CalculatePreferredColorScheme());
|
||||
web_instance->SetPreferredContrast(CalculatePreferredContrast());
|
||||
web_instance->set_prefers_reduced_transparency(PrefersReducedTransparency());
|
||||
diff --git ui/native_theme/native_theme_win.cc ui/native_theme/native_theme_win.cc
|
||||
index d3f9fcbed28f9..32ab3dc997027 100644
|
||||
--- ui/native_theme/native_theme_win.cc
|
||||
+++ ui/native_theme/native_theme_win.cc
|
||||
@@ -630,14 +630,17 @@ bool NativeThemeWin::ShouldUseDarkColors() const {
|
||||
// Windows high contrast modes are entirely different themes,
|
||||
// so let them take priority over dark mode.
|
||||
// ...unless --force-dark-mode was specified in which case caveat emptor.
|
||||
- if (InForcedColorsMode() && !IsForcedDarkMode())
|
||||
+ if (supports_windows_dark_mode_ && IsForcedDarkMode()) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ if (InForcedColorsMode())
|
||||
return false;
|
||||
return NativeTheme::ShouldUseDarkColors();
|
||||
}
|
||||
|
||||
NativeTheme::PreferredColorScheme
|
||||
NativeThemeWin::CalculatePreferredColorScheme() const {
|
||||
- if (!InForcedColorsMode())
|
||||
+ if (!InForcedColorsMode() || !supports_windows_dark_mode_)
|
||||
return NativeTheme::CalculatePreferredColorScheme();
|
||||
|
||||
// According to the spec, the preferred color scheme for web content is 'dark'
|
||||
@@ -1590,8 +1593,9 @@ void NativeThemeWin::RegisterThemeRegkeyObserver() {
|
||||
}
|
||||
|
||||
void NativeThemeWin::UpdateDarkModeStatus() {
|
||||
- bool dark_mode_enabled = false;
|
||||
- if (hkcu_themes_regkey_.Valid()) {
|
||||
+ bool dark_mode_enabled = ShouldUseDarkColors();
|
||||
+ if (supports_windows_dark_mode_ && !IsForcedDarkMode() &&
|
||||
+ hkcu_themes_regkey_.Valid()) {
|
||||
DWORD apps_use_light_theme = 1;
|
||||
hkcu_themes_regkey_.ReadValueDW(L"AppsUseLightTheme",
|
||||
&apps_use_light_theme);
|
@@ -10,10 +10,10 @@ index 4fc3870bcfbc8..24c6d32d4a8d8 100644
|
||||
+// This load will not send any cookies. For CEF usage.
|
||||
+LOAD_FLAG(DO_NOT_SEND_COOKIES, 1 << 19)
|
||||
diff --git net/url_request/url_request_http_job.cc net/url_request/url_request_http_job.cc
|
||||
index d748009dece6f..b88a28c870f8a 100644
|
||||
index 43e03be287f2a..e969f58ed80a2 100644
|
||||
--- net/url_request/url_request_http_job.cc
|
||||
+++ net/url_request/url_request_http_job.cc
|
||||
@@ -1761,7 +1761,8 @@ bool URLRequestHttpJob::ShouldAddCookieHeader() const {
|
||||
@@ -1768,7 +1768,8 @@ bool URLRequestHttpJob::ShouldAddCookieHeader() const {
|
||||
// Read cookies whenever allow_credentials() is true, even if the PrivacyMode
|
||||
// is being overridden by NetworkDelegate and will eventually block them, as
|
||||
// blocked cookies still need to be logged in that case.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git base/trace_event/builtin_categories.h base/trace_event/builtin_categories.h
|
||||
index 1ddaeafd2779a..4feee8b931fd4 100644
|
||||
index 5d1c694fba219..f0fa55370ab13 100644
|
||||
--- base/trace_event/builtin_categories.h
|
||||
+++ base/trace_event/builtin_categories.h
|
||||
@@ -64,6 +64,8 @@
|
||||
|
@@ -240,7 +240,7 @@ index 711dc633bffc2..0fa2626150de2 100644
|
||||
std::unique_ptr<SelectionController> selection_controller_;
|
||||
|
||||
diff --git ui/views/controls/menu/menu_controller.cc ui/views/controls/menu/menu_controller.cc
|
||||
index 3f81597c41a3e..b281eb2e7ac65 100644
|
||||
index b3207f7f32500..05018a895dbaf 100644
|
||||
--- ui/views/controls/menu/menu_controller.cc
|
||||
+++ ui/views/controls/menu/menu_controller.cc
|
||||
@@ -564,7 +564,8 @@ void MenuController::Run(Widget* parent,
|
||||
@@ -269,7 +269,7 @@ index 3f81597c41a3e..b281eb2e7ac65 100644
|
||||
if (item->GetParentMenuItem()) {
|
||||
params.context = item->GetWidget();
|
||||
// (crbug.com/1414232) The item to be open is a submenu. Make sure
|
||||
@@ -2936,8 +2939,13 @@ MenuItemView* MenuController::FindInitialSelectableMenuItem(
|
||||
@@ -2927,8 +2930,13 @@ MenuItemView* MenuController::FindInitialSelectableMenuItem(
|
||||
|
||||
void MenuController::OpenSubmenuChangeSelectionIfCan() {
|
||||
MenuItemView* item = pending_state_.item;
|
||||
@@ -284,7 +284,7 @@ index 3f81597c41a3e..b281eb2e7ac65 100644
|
||||
|
||||
// Show the sub-menu.
|
||||
SetSelection(item, SELECTION_OPEN_SUBMENU | SELECTION_UPDATE_IMMEDIATELY);
|
||||
@@ -2957,8 +2965,10 @@ void MenuController::OpenSubmenuChangeSelectionIfCan() {
|
||||
@@ -2948,8 +2956,10 @@ void MenuController::OpenSubmenuChangeSelectionIfCan() {
|
||||
void MenuController::CloseSubmenu() {
|
||||
MenuItemView* item = state_.item;
|
||||
DCHECK(item);
|
||||
@@ -676,7 +676,7 @@ index cf696fbcf0714..5c48fd7410b88 100644
|
||||
|
||||
// Hides and cancels the menu.
|
||||
diff --git ui/views/controls/menu/menu_scroll_view_container.cc ui/views/controls/menu/menu_scroll_view_container.cc
|
||||
index a80ff0b70cab9..b37fed46d6cbd 100644
|
||||
index af45e941c3ee9..9f32d109cc44b 100644
|
||||
--- ui/views/controls/menu/menu_scroll_view_container.cc
|
||||
+++ ui/views/controls/menu/menu_scroll_view_container.cc
|
||||
@@ -246,6 +246,11 @@ MenuScrollViewContainer::MenuScrollViewContainer(SubmenuView* content_view)
|
||||
|
@@ -1,8 +1,8 @@
|
||||
diff --git content/browser/web_contents/web_contents_impl.cc content/browser/web_contents/web_contents_impl.cc
|
||||
index 1caf3d1f032c4..d561f8aad9386 100644
|
||||
index b5bb5e16086d4..3e86382c3ce93 100644
|
||||
--- content/browser/web_contents/web_contents_impl.cc
|
||||
+++ content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -3323,6 +3323,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
|
||||
@@ -3322,6 +3322,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
|
||||
params.main_frame_name, GetOpener(), primary_main_frame_policy,
|
||||
base::UnguessableToken::Create());
|
||||
|
||||
@@ -15,7 +15,7 @@ index 1caf3d1f032c4..d561f8aad9386 100644
|
||||
std::unique_ptr<WebContentsViewDelegate> delegate =
|
||||
GetContentClient()->browser()->GetWebContentsViewDelegate(this);
|
||||
|
||||
@@ -3333,6 +3339,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
|
||||
@@ -3332,6 +3338,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
|
||||
view_ = CreateWebContentsView(this, std::move(delegate),
|
||||
&render_view_host_delegate_view_);
|
||||
}
|
||||
@@ -23,7 +23,7 @@ index 1caf3d1f032c4..d561f8aad9386 100644
|
||||
CHECK(render_view_host_delegate_view_);
|
||||
CHECK(view_.get());
|
||||
|
||||
@@ -3522,6 +3529,9 @@ void WebContentsImpl::RenderWidgetCreated(
|
||||
@@ -3521,6 +3528,9 @@ void WebContentsImpl::RenderWidgetCreated(
|
||||
OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::RenderWidgetCreated",
|
||||
"render_widget_host", render_widget_host);
|
||||
created_widgets_.insert(render_widget_host);
|
||||
@@ -33,7 +33,7 @@ index 1caf3d1f032c4..d561f8aad9386 100644
|
||||
}
|
||||
|
||||
void WebContentsImpl::RenderWidgetDeleted(
|
||||
@@ -4274,6 +4284,15 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
@@ -4273,6 +4283,15 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
create_params.picture_in_picture_options = *(params.pip_options);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ index 1caf3d1f032c4..d561f8aad9386 100644
|
||||
// Check whether there is an available prerendered page for this navigation if
|
||||
// this is not for guest. If it exists, take WebContents pre-created for
|
||||
// hosting the prerendered page instead of creating new WebContents.
|
||||
@@ -8231,6 +8250,9 @@ void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node,
|
||||
@@ -8230,6 +8249,9 @@ void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node,
|
||||
// frames).
|
||||
SetFocusedFrameTree(&node->frame_tree());
|
||||
}
|
||||
|
13
patch/patches/win_fullscreen_3243.patch
Normal file
13
patch/patches/win_fullscreen_3243.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git ui/views/win/fullscreen_handler.cc ui/views/win/fullscreen_handler.cc
|
||||
index bf14eb24f08b1..1d3ce1e151849 100644
|
||||
--- ui/views/win/fullscreen_handler.cc
|
||||
+++ ui/views/win/fullscreen_handler.cc
|
||||
@@ -109,7 +109,7 @@ void FullscreenHandler::ProcessFullscreen(bool fullscreen,
|
||||
// Restore the window style and bounds saved prior to entering fullscreen.
|
||||
// Making multiple window adjustments here is ugly, but if SetWindowPos()
|
||||
// doesn't redraw, the taskbar won't be repainted.
|
||||
- SetWindowLong(hwnd_, GWL_STYLE, saved_window_info_.style);
|
||||
+ SetWindowLong(hwnd_, GWL_STYLE, saved_window_info_.style | WS_VISIBLE);
|
||||
SetWindowLong(hwnd_, GWL_EXSTYLE, saved_window_info_.ex_style);
|
||||
|
||||
gfx::Rect window_rect(saved_window_info_.rect);
|
@@ -1,55 +0,0 @@
|
||||
diff --git base/win/dark_mode_support.cc base/win/dark_mode_support.cc
|
||||
index 325bc70b6ba97..6ba7f2f2becf6 100644
|
||||
--- base/win/dark_mode_support.cc
|
||||
+++ base/win/dark_mode_support.cc
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
+#include "base/command_line.h"
|
||||
#include "base/native_library.h"
|
||||
#include "base/win/windows_version.h"
|
||||
|
||||
@@ -85,11 +86,20 @@ const DarkModeSupport& GetDarkModeSupport() {
|
||||
return dark_mode_support;
|
||||
}
|
||||
|
||||
+bool IsForcedLightMode() {
|
||||
+ static bool kIsForcedDarkMode =
|
||||
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
+ "force-light-mode");
|
||||
+ return kIsForcedDarkMode;
|
||||
+}
|
||||
+
|
||||
} // namespace
|
||||
|
||||
namespace base::win {
|
||||
|
||||
bool IsDarkModeAvailable() {
|
||||
+ if (IsForcedLightMode())
|
||||
+ return false;
|
||||
auto& dark_mode_support = GetDarkModeSupport();
|
||||
return (dark_mode_support.allow_dark_mode_for_app ||
|
||||
dark_mode_support.set_preferred_app_mode) &&
|
||||
diff --git ui/native_theme/native_theme_win.cc ui/native_theme/native_theme_win.cc
|
||||
index d3f9fcbed28f9..94673728a3e11 100644
|
||||
--- ui/native_theme/native_theme_win.cc
|
||||
+++ ui/native_theme/native_theme_win.cc
|
||||
@@ -637,7 +637,7 @@ bool NativeThemeWin::ShouldUseDarkColors() const {
|
||||
|
||||
NativeTheme::PreferredColorScheme
|
||||
NativeThemeWin::CalculatePreferredColorScheme() const {
|
||||
- if (!InForcedColorsMode())
|
||||
+ if (!InForcedColorsMode() || !supports_windows_dark_mode_)
|
||||
return NativeTheme::CalculatePreferredColorScheme();
|
||||
|
||||
// According to the spec, the preferred color scheme for web content is 'dark'
|
||||
@@ -1591,7 +1591,7 @@ void NativeThemeWin::RegisterThemeRegkeyObserver() {
|
||||
|
||||
void NativeThemeWin::UpdateDarkModeStatus() {
|
||||
bool dark_mode_enabled = false;
|
||||
- if (hkcu_themes_regkey_.Valid()) {
|
||||
+ if (supports_windows_dark_mode_ && hkcu_themes_regkey_.Valid()) {
|
||||
DWORD apps_use_light_theme = 1;
|
||||
hkcu_themes_regkey_.ReadValueDW(L"AppsUseLightTheme",
|
||||
&apps_use_light_theme);
|
@@ -7,6 +7,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "include/cef_parser.h"
|
||||
#include "tests/cefclient/browser/test_runner.h"
|
||||
#include "tests/shared/browser/client_app_browser.h"
|
||||
#include "tests/shared/common/client_switches.h"
|
||||
#include "tests/shared/common/string_util.h"
|
||||
@@ -128,13 +129,16 @@ MainContextImpl::MainContextImpl(CefRefPtr<CefCommandLine> command_line,
|
||||
if (use_views_ && command_line->HasSwitch(switches::kHideFrame) &&
|
||||
!command_line_->HasSwitch(switches::kUrl)) {
|
||||
// Use the draggable regions test as the default URL for frameless windows.
|
||||
main_url_ = "http://tests/draggable";
|
||||
main_url_ = test_runner::GetTestURL("draggable");
|
||||
}
|
||||
|
||||
if (command_line_->HasSwitch(switches::kBackgroundColor)) {
|
||||
// Parse the background color value.
|
||||
background_color_ =
|
||||
ParseColor(command_line_->GetSwitchValue(switches::kBackgroundColor));
|
||||
} else if (command_line_->HasSwitch("force-dark-mode")) {
|
||||
// Use black background color by default with dark mode.
|
||||
background_color_ = ParseColor("black");
|
||||
}
|
||||
|
||||
if (background_color_ == 0 && !use_views_) {
|
||||
|
@@ -31,9 +31,6 @@ const char kPortKey[] = "port";
|
||||
const char kStatusKey[] = "status";
|
||||
const char kMessageKey[] = "message";
|
||||
|
||||
// Required URL for cefQuery execution.
|
||||
const char kTestUrl[] = "http://tests/server";
|
||||
|
||||
// Server default values.
|
||||
const char kServerAddress[] = "127.0.0.1";
|
||||
const int kServerPortDefault = 8099;
|
||||
@@ -234,7 +231,7 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
||||
|
||||
// Only handle messages from the test URL.
|
||||
const std::string& url = frame->GetURL();
|
||||
if (url.find(kTestUrl) != 0) {
|
||||
if (url.find(test_runner::GetTestURL("server")) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -39,7 +39,7 @@ namespace {
|
||||
|
||||
const char kTestHost[] = "tests";
|
||||
const char kLocalHost[] = "localhost";
|
||||
const char kTestOrigin[] = "http://tests/";
|
||||
const char kTestOrigin[] = "https://tests/";
|
||||
|
||||
// Pages handled via StringResourceProvider.
|
||||
const char kTestGetSourcePage[] = "get_source.html";
|
||||
@@ -102,18 +102,18 @@ void RunRequestTest(CefRefPtr<CefBrowser> browser) {
|
||||
// Create a new request
|
||||
CefRefPtr<CefRequest> request(CefRequest::Create());
|
||||
|
||||
if (browser->GetMainFrame()->GetURL().ToString().find("http://tests/") != 0) {
|
||||
if (browser->GetMainFrame()->GetURL().ToString().find(kTestOrigin) != 0) {
|
||||
// The LoadRequest method 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).
|
||||
Alert(browser,
|
||||
"Please first navigate to a http://tests/ URL. "
|
||||
"For example, first load Tests > Other Tests.");
|
||||
Alert(browser, "Please first navigate to a " + std::string(kTestOrigin) +
|
||||
" URL. "
|
||||
"For example, first load Tests > Other Tests.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the request URL
|
||||
request->SetURL("http://tests/request");
|
||||
request->SetURL(GetTestURL("request"));
|
||||
|
||||
// Add post data to the request. The correct method and content-
|
||||
// type headers will be set by CEF.
|
||||
@@ -419,7 +419,7 @@ void MuteAudio(CefRefPtr<CefBrowser> browser, bool mute) {
|
||||
}
|
||||
|
||||
void RunOtherTests(CefRefPtr<CefBrowser> browser) {
|
||||
browser->GetMainFrame()->LoadURL("http://tests/other_tests");
|
||||
browser->GetMainFrame()->LoadURL(GetTestURL("other_tests"));
|
||||
}
|
||||
|
||||
// Provider that dumps the request contents.
|
||||
@@ -679,7 +679,7 @@ CefRefPtr<CefStreamReader> GetDumpResponse(
|
||||
}
|
||||
|
||||
if (!origin.empty() &&
|
||||
(origin.find("http://" + std::string(kTestHost)) == 0 ||
|
||||
(origin.find("https://" + std::string(kTestHost)) == 0 ||
|
||||
origin.find("http://" + std::string(kLocalHost)) == 0)) {
|
||||
// Allow cross-origin XMLHttpRequests from test origins.
|
||||
response_headers.insert(
|
||||
@@ -832,6 +832,10 @@ void Alert(CefRefPtr<CefBrowser> browser, const std::string& message) {
|
||||
frame->ExecuteJavaScript("alert('" + msg + "');", frame->GetURL(), 0);
|
||||
}
|
||||
|
||||
std::string GetTestURL(const std::string& path) {
|
||||
return kTestOrigin + path;
|
||||
}
|
||||
|
||||
bool IsTestURL(const std::string& url, const std::string& path) {
|
||||
CefURLParts parts;
|
||||
CefParseURL(url, parts);
|
||||
|
@@ -44,8 +44,11 @@ void SetupResourceManager(CefRefPtr<CefResourceManager> resource_manager,
|
||||
// Show a JS alert message.
|
||||
void Alert(CefRefPtr<CefBrowser> browser, const std::string& message);
|
||||
|
||||
// Returns "https://tests/<path>".
|
||||
std::string GetTestURL(const std::string& path);
|
||||
|
||||
// Returns true if |url| is a test URL with the specified |path|. This matches
|
||||
// both http://tests/<path> and http://localhost:xxxx/<path>.
|
||||
// both "https://tests/<path>" and "http://localhost:xxxx/<path>".
|
||||
bool IsTestURL(const std::string& url, const std::string& path);
|
||||
|
||||
// Create all CefMessageRouterBrowserSide::Handler objects. They will be
|
||||
|
@@ -277,12 +277,18 @@ void ViewsWindow::SetFavicon(CefRefPtr<CefImage> image) {
|
||||
|
||||
void ViewsWindow::SetFullscreen(bool fullscreen) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
if (window_) {
|
||||
// Hide the top controls while in full-screen mode.
|
||||
if (with_controls_) {
|
||||
ShowTopControls(!fullscreen);
|
||||
}
|
||||
|
||||
// For Chrome runtime we ignore this notification from
|
||||
// ClientHandler::OnFullscreenModeChange(). Chrome runtime will trigger
|
||||
// the fullscreen change internally and then call
|
||||
// OnWindowFullscreenTransition().
|
||||
if (MainContext::Get()->UseChromeRuntime()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// For Alloy runtime we need to explicitly trigger the fullscreen change.
|
||||
if (window_) {
|
||||
// Results in a call to OnWindowFullscreenTransition().
|
||||
window_->SetFullscreen(fullscreen);
|
||||
}
|
||||
}
|
||||
@@ -404,10 +410,12 @@ bool ViewsWindow::GetWindowRestorePreferences(
|
||||
show_state = CEF_SHOW_STATE_NORMAL;
|
||||
if (window_->IsMinimized()) {
|
||||
show_state = CEF_SHOW_STATE_MINIMIZED;
|
||||
} else if (window_->IsFullscreen()) {
|
||||
// On MacOS, IsMaximized() will also return true for fullscreen, so check
|
||||
// IsFullscreen() first.
|
||||
show_state = CEF_SHOW_STATE_FULLSCREEN;
|
||||
} else if (window_->IsMaximized()) {
|
||||
show_state = CEF_SHOW_STATE_MAXIMIZED;
|
||||
} else if (window_->IsFullscreen()) {
|
||||
show_state = CEF_SHOW_STATE_FULLSCREEN;
|
||||
}
|
||||
|
||||
if (show_state == CEF_SHOW_STATE_NORMAL) {
|
||||
@@ -485,10 +493,16 @@ bool ViewsWindow::OnPopupBrowserViewCreated(
|
||||
return true;
|
||||
}
|
||||
|
||||
CefBrowserViewDelegate::ChromeToolbarType ViewsWindow::GetChromeToolbarType() {
|
||||
CefBrowserViewDelegate::ChromeToolbarType ViewsWindow::GetChromeToolbarType(
|
||||
CefRefPtr<CefBrowserView> browser_view) {
|
||||
return chrome_toolbar_type_;
|
||||
}
|
||||
|
||||
bool ViewsWindow::UseFramelessWindowForPictureInPicture(
|
||||
CefRefPtr<CefBrowserView> browser_view) {
|
||||
return hide_pip_frame_;
|
||||
}
|
||||
|
||||
void ViewsWindow::OnButtonPressed(CefRefPtr<CefButton> button) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
DCHECK(with_controls_);
|
||||
@@ -620,6 +634,25 @@ bool ViewsWindow::OnKeyEvent(CefRefPtr<CefTextfield> textfield,
|
||||
return false;
|
||||
}
|
||||
|
||||
void ViewsWindow::OnWindowFullscreenTransition(CefRefPtr<CefWindow> window,
|
||||
bool is_completed) {
|
||||
#if defined(OS_MAC)
|
||||
// On MacOS we get two asynchronous callbacks, and we want to change the UI on
|
||||
// |is_completed=false| (e.g. when the fullscreen transition begins).
|
||||
const bool should_change = !is_completed;
|
||||
#else
|
||||
// On other platforms we only get a single synchronous callback with
|
||||
// |is_completed=true|.
|
||||
DCHECK(is_completed);
|
||||
const bool should_change = true;
|
||||
#endif
|
||||
|
||||
// Hide the top controls while in fullscreen mode.
|
||||
if (should_change && with_controls_) {
|
||||
ShowTopControls(!window->IsFullscreen());
|
||||
}
|
||||
}
|
||||
|
||||
void ViewsWindow::OnWindowCreated(CefRefPtr<CefWindow> window) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
DCHECK(browser_view_);
|
||||
@@ -1038,6 +1071,7 @@ ViewsWindow::ViewsWindow(WindowType type,
|
||||
|
||||
use_window_modal_dialog_ =
|
||||
command_line->HasSwitch(switches::kUseWindowModalDialog);
|
||||
hide_pip_frame_ = command_line->HasSwitch(switches::kHidePipFrame);
|
||||
}
|
||||
|
||||
void ViewsWindow::SetBrowserView(CefRefPtr<CefBrowserView> browser_view) {
|
||||
|
@@ -140,7 +140,10 @@ class ViewsWindow : public CefBrowserViewDelegate,
|
||||
bool OnPopupBrowserViewCreated(CefRefPtr<CefBrowserView> browser_view,
|
||||
CefRefPtr<CefBrowserView> popup_browser_view,
|
||||
bool is_devtools) override;
|
||||
ChromeToolbarType GetChromeToolbarType() override;
|
||||
ChromeToolbarType GetChromeToolbarType(
|
||||
CefRefPtr<CefBrowserView> browser_view) override;
|
||||
bool UseFramelessWindowForPictureInPicture(
|
||||
CefRefPtr<CefBrowserView> browser_view) override;
|
||||
|
||||
// CefButtonDelegate methods:
|
||||
void OnButtonPressed(CefRefPtr<CefButton> button) override;
|
||||
@@ -185,6 +188,8 @@ class ViewsWindow : public CefBrowserViewDelegate,
|
||||
bool OnAccelerator(CefRefPtr<CefWindow> window, int command_id) override;
|
||||
bool OnKeyEvent(CefRefPtr<CefWindow> window,
|
||||
const CefKeyEvent& event) override;
|
||||
void OnWindowFullscreenTransition(CefRefPtr<CefWindow> window,
|
||||
bool is_completed) override;
|
||||
|
||||
// CefViewDelegate methods:
|
||||
CefSize GetPreferredSize(CefRefPtr<CefView> view) override;
|
||||
@@ -254,6 +259,7 @@ class ViewsWindow : public CefBrowserViewDelegate,
|
||||
ChromeToolbarType chrome_toolbar_type_;
|
||||
bool use_window_modal_dialog_;
|
||||
bool use_bottom_controls_;
|
||||
bool hide_pip_frame_;
|
||||
CefRefPtr<CefWindow> window_;
|
||||
|
||||
CefRefPtr<CefMenuModel> button_menu_model_;
|
||||
|
@@ -35,6 +35,7 @@ const char kMessagePositionName[] = "WindowTest.Position";
|
||||
const char kMessageMinimizeName[] = "WindowTest.Minimize";
|
||||
const char kMessageMaximizeName[] = "WindowTest.Maximize";
|
||||
const char kMessageRestoreName[] = "WindowTest.Restore";
|
||||
const char kMessageFullscreenName[] = "WindowTest.Fullscreen";
|
||||
const char kMessageTitlebarHeightName[] = "WindowTest.TitlebarHeight";
|
||||
|
||||
// Create the appropriate platform test runner object.
|
||||
@@ -109,6 +110,8 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
||||
runner_->Maximize(browser);
|
||||
} else if (message_name == kMessageRestoreName) {
|
||||
runner_->Restore(browser);
|
||||
} else if (message_name == kMessageFullscreenName) {
|
||||
runner_->Fullscreen(browser);
|
||||
} else if (message_name.find(kMessageTitlebarHeightName) == 0) {
|
||||
const auto height = ParseHeight(message_name);
|
||||
runner_->SetTitleBarHeight(browser, height);
|
||||
|
@@ -36,6 +36,10 @@ void WindowTestRunner::ModifyBounds(const CefRect& display, CefRect& window) {
|
||||
}
|
||||
}
|
||||
|
||||
void WindowTestRunner::Fullscreen(CefRefPtr<CefBrowser> browser) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
void WindowTestRunner::SetTitleBarHeight(CefRefPtr<CefBrowser> browser,
|
||||
const std::optional<float>& height) {
|
||||
NOTIMPLEMENTED();
|
||||
|
@@ -27,6 +27,7 @@ class WindowTestRunner {
|
||||
virtual void Minimize(CefRefPtr<CefBrowser> browser) = 0;
|
||||
virtual void Maximize(CefRefPtr<CefBrowser> browser) = 0;
|
||||
virtual void Restore(CefRefPtr<CefBrowser> browser) = 0;
|
||||
virtual void Fullscreen(CefRefPtr<CefBrowser> browser);
|
||||
|
||||
// Fit |window| inside |display|. Coordinates are relative to the upper-left
|
||||
// corner of the display.
|
||||
|
@@ -69,6 +69,17 @@ void WindowTestRunnerViews::Restore(CefRefPtr<CefBrowser> browser) {
|
||||
GetWindow(browser)->Restore();
|
||||
}
|
||||
|
||||
void WindowTestRunnerViews::Fullscreen(CefRefPtr<CefBrowser> browser) {
|
||||
auto window = GetWindow(browser);
|
||||
|
||||
// Results in a call to ViewsWindow::OnWindowFullscreenTransition().
|
||||
if (window->IsFullscreen()) {
|
||||
window->SetFullscreen(false);
|
||||
} else {
|
||||
window->SetFullscreen(true);
|
||||
}
|
||||
}
|
||||
|
||||
void WindowTestRunnerViews::SetTitleBarHeight(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
const std::optional<float>& height) {
|
||||
|
@@ -24,6 +24,7 @@ class WindowTestRunnerViews : public WindowTestRunner {
|
||||
void Minimize(CefRefPtr<CefBrowser> browser) override;
|
||||
void Maximize(CefRefPtr<CefBrowser> browser) override;
|
||||
void Restore(CefRefPtr<CefBrowser> browser) override;
|
||||
void Fullscreen(CefRefPtr<CefBrowser> browser) override;
|
||||
void SetTitleBarHeight(CefRefPtr<CefBrowser> browser,
|
||||
const std::optional<float>& height) override;
|
||||
};
|
||||
|
@@ -24,7 +24,7 @@ function setButtonState(start_enabled, stop_enabled) {
|
||||
}
|
||||
|
||||
function setup() {
|
||||
if (location.origin != 'http://tests') {
|
||||
if (location.origin != 'https://tests') {
|
||||
document.getElementById('warning').style.display = 'block';
|
||||
return;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ function openServer() {
|
||||
</head>
|
||||
<body bgcolor="white" onload="setup()">
|
||||
<div id="warning" style="display:none;color:red;font-weight:bold;">
|
||||
This page can only be run from the http://tests origin.
|
||||
This page can only be run from the https://tests origin.
|
||||
</div>
|
||||
<p>
|
||||
This page starts an HTTP/WebSocket server on localhost with the specified port number.
|
||||
|
@@ -87,7 +87,7 @@ function doSend() {
|
||||
<body bgcolor="white" onload="setup()">
|
||||
<div id="warning" style="display:none;color:red;font-weight:bold;">
|
||||
This page is most useful when loaded from localhost.
|
||||
You should first create a server using the <a href="http://tests/server">HTTP/WebSocket Server test</a>.
|
||||
You should first create a server using the <a href="https://tests/server">HTTP/WebSocket Server test</a>.
|
||||
</div>
|
||||
<p>
|
||||
This page tests a WebSocket connection.
|
||||
|
@@ -38,6 +38,10 @@ function restore() {
|
||||
setTimeout(function() { send_message('Restore'); }, 1000);
|
||||
}
|
||||
|
||||
function fullscreen() {
|
||||
send_message('Fullscreen');
|
||||
}
|
||||
|
||||
function position() {
|
||||
var x = parseInt(document.getElementById('x').value);
|
||||
var y = parseInt(document.getElementById('y').value);
|
||||
@@ -64,6 +68,7 @@ Click a button to perform the associated window action.
|
||||
<br/><input type="button" onclick="minimize();" value="Minimize">
|
||||
<br/><input type="button" onclick="maximize();" value="Maximize">
|
||||
<br/><input type="button" onclick="restore();" value="Restore"> (minimizes and then restores the window as topmost)
|
||||
<br/><input type="button" onclick="fullscreen();" value="Toggle Fullscreen"> (works with Views)
|
||||
<br/><input type="button" onclick="position();" value="Set Position">
|
||||
X: <input type="text" size="4" id="x" value="200">
|
||||
Y: <input type="text" size="4" id="y" value="100">
|
||||
|
@@ -30,7 +30,7 @@ function execXMLHttpRequest()
|
||||
}
|
||||
</script>
|
||||
<form>
|
||||
URL: <input type="text" id="url" value="http://tests/request">
|
||||
URL: <input type="text" id="url" value="https://tests/request">
|
||||
<br/><input type="button" onclick="execXMLHttpRequest();" value="Execute XMLHttpRequest">
|
||||
<br/><textarea rows="10" cols="40" id="ta"></textarea>
|
||||
</form>
|
||||
|
@@ -23,6 +23,11 @@ namespace {
|
||||
// Test timeout in MS.
|
||||
const int kTestTimeout = 5000;
|
||||
|
||||
#if defined(OS_MAC)
|
||||
// Match the value in view_util_mac.mm.
|
||||
constexpr float kDefaultTitleBarHeight = 30;
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
// static
|
||||
@@ -33,8 +38,8 @@ void TestWindowDelegate::RunTest(CefRefPtr<CefWaitableEvent> event,
|
||||
std::unique_ptr<Config> config) {
|
||||
CefSize window_size{config->window_size, config->window_size};
|
||||
|
||||
#if defined(OS_WIN)
|
||||
if (!config->frameless) {
|
||||
#if defined(OS_WIN)
|
||||
// Expand the client area size to full window size based on the default
|
||||
// frame window style. AdjustWindowRect expects pixel coordinates, so
|
||||
// perform the necessary conversions.
|
||||
@@ -53,8 +58,11 @@ void TestWindowDelegate::RunTest(CefRefPtr<CefWaitableEvent> event,
|
||||
{rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top},
|
||||
scale_factor);
|
||||
window_size = {scaled_rect.width, scaled_rect.height};
|
||||
#elif defined(OS_MAC)
|
||||
// Expand client area size to include the default titlebar height.
|
||||
window_size.height += kDefaultTitleBarHeight;
|
||||
#endif
|
||||
}
|
||||
#endif // defined(OS_WIN)
|
||||
|
||||
CefWindow::CreateTopLevelWindow(
|
||||
new TestWindowDelegate(event, std::move(config), window_size));
|
||||
@@ -67,14 +75,8 @@ void TestWindowDelegate::OnWindowCreated(CefRefPtr<CefWindow> window) {
|
||||
EXPECT_TRUE(window->IsValid());
|
||||
EXPECT_FALSE(window->IsClosed());
|
||||
|
||||
EXPECT_FALSE(window->IsVisible());
|
||||
EXPECT_FALSE(window->IsDrawn());
|
||||
|
||||
EXPECT_FALSE(window->IsActive());
|
||||
EXPECT_FALSE(window->IsAlwaysOnTop());
|
||||
EXPECT_FALSE(window->IsMaximized());
|
||||
EXPECT_FALSE(window->IsMinimized());
|
||||
EXPECT_FALSE(window->IsFullscreen());
|
||||
|
||||
const char* title = "ViewsTest";
|
||||
window->SetTitle(title);
|
||||
@@ -95,26 +97,36 @@ void TestWindowDelegate::OnWindowCreated(CefRefPtr<CefWindow> window) {
|
||||
EXPECT_FALSE(got_get_preferred_size_);
|
||||
}
|
||||
|
||||
CefRect client_bounds = window->GetBounds();
|
||||
if (!config_->window_origin.IsEmpty()) {
|
||||
EXPECT_EQ(config_->window_origin.x, client_bounds.x);
|
||||
EXPECT_EQ(config_->window_origin.y, client_bounds.y);
|
||||
} else {
|
||||
// Default origin is the upper-left corner of the display's work area.
|
||||
auto work_area = display->GetWorkArea();
|
||||
EXPECT_NEAR(work_area.x, client_bounds.x, 1);
|
||||
EXPECT_NEAR(work_area.y, client_bounds.y, 1);
|
||||
}
|
||||
// Expectations for the default |initial_show_state| value.
|
||||
if (config_->initial_show_state == CEF_SHOW_STATE_NORMAL) {
|
||||
EXPECT_FALSE(window->IsVisible());
|
||||
EXPECT_FALSE(window->IsDrawn());
|
||||
|
||||
if (config_->frameless) {
|
||||
EXPECT_NEAR(config_->window_size, client_bounds.width, 2);
|
||||
EXPECT_NEAR(config_->window_size, client_bounds.height, 2);
|
||||
} else {
|
||||
// Client area bounds calculation might have off-by-one errors on Windows
|
||||
// due to non-client frame size being calculated internally in pixels and
|
||||
// then converted to DIPs. See https://crbug.com/602692.
|
||||
EXPECT_NEAR(client_bounds.width, window_size_.width, 2);
|
||||
EXPECT_NEAR(client_bounds.height, window_size_.height, 2);
|
||||
EXPECT_FALSE(window->IsMaximized());
|
||||
EXPECT_FALSE(window->IsMinimized());
|
||||
EXPECT_FALSE(window->IsFullscreen());
|
||||
|
||||
CefRect client_bounds = window->GetBounds();
|
||||
if (!config_->window_origin.IsEmpty()) {
|
||||
EXPECT_EQ(config_->window_origin.x, client_bounds.x);
|
||||
EXPECT_EQ(config_->window_origin.y, client_bounds.y);
|
||||
} else {
|
||||
// Default origin is the upper-left corner of the display's work area.
|
||||
auto work_area = display->GetWorkArea();
|
||||
EXPECT_NEAR(work_area.x, client_bounds.x, 1);
|
||||
EXPECT_NEAR(work_area.y, client_bounds.y, 1);
|
||||
}
|
||||
|
||||
if (config_->frameless) {
|
||||
EXPECT_NEAR(config_->window_size, client_bounds.width, 2);
|
||||
EXPECT_NEAR(config_->window_size, client_bounds.height, 2);
|
||||
} else {
|
||||
// Client area bounds calculation might have off-by-one errors on Windows
|
||||
// due to non-client frame size being calculated internally in pixels and
|
||||
// then converted to DIPs. See https://crbug.com/602692.
|
||||
EXPECT_NEAR(client_bounds.width, window_size_.width, 2);
|
||||
EXPECT_NEAR(client_bounds.height, window_size_.height, 2);
|
||||
}
|
||||
}
|
||||
|
||||
// Run the callback.
|
||||
@@ -158,6 +170,41 @@ void TestWindowDelegate::OnWindowDestroyed(CefRefPtr<CefWindow> window) {
|
||||
weak_ptr_factory_.InvalidateWeakPtrs();
|
||||
}
|
||||
|
||||
void TestWindowDelegate::OnWindowFullscreenTransition(
|
||||
CefRefPtr<CefWindow> window,
|
||||
bool is_completed) {
|
||||
EXPECT_TRUE(window->IsSame(window_));
|
||||
|
||||
EXPECT_TRUE(window->IsValid());
|
||||
EXPECT_FALSE(window->IsClosed());
|
||||
EXPECT_TRUE(window->IsVisible());
|
||||
EXPECT_TRUE(window->IsDrawn());
|
||||
|
||||
fullscreen_transition_callback_count_++;
|
||||
|
||||
#if defined(OS_MAC)
|
||||
// Two callbacks on MacOS.
|
||||
EXPECT_EQ(is_completed ? 2U : 1U, fullscreen_transition_callback_count_);
|
||||
#else
|
||||
// Single callback on other platforms.
|
||||
EXPECT_TRUE(is_completed);
|
||||
EXPECT_EQ(1U, fullscreen_transition_callback_count_);
|
||||
#endif
|
||||
|
||||
if (is_completed) {
|
||||
fullscreen_transition_complete_count_++;
|
||||
|
||||
// Reset intermediate state.
|
||||
fullscreen_transition_callback_count_ = 0;
|
||||
|
||||
// Run the callback.
|
||||
if (!config_->on_window_fullscreen_transition_complete.is_null()) {
|
||||
config_->on_window_fullscreen_transition_complete.Run(
|
||||
window, fullscreen_transition_complete_count_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool TestWindowDelegate::IsFrameless(CefRefPtr<CefWindow> window) {
|
||||
return config_->frameless;
|
||||
}
|
||||
@@ -173,6 +220,11 @@ CefRect TestWindowDelegate::GetInitialBounds(CefRefPtr<CefWindow> window) {
|
||||
return CefRect();
|
||||
}
|
||||
|
||||
cef_show_state_t TestWindowDelegate::GetInitialShowState(
|
||||
CefRefPtr<CefWindow> window) {
|
||||
return config_->initial_show_state;
|
||||
}
|
||||
|
||||
CefSize TestWindowDelegate::GetPreferredSize(CefRefPtr<CefView> view) {
|
||||
got_get_preferred_size_ = true;
|
||||
return window_size_;
|
||||
|
@@ -20,6 +20,8 @@ class TestWindowDelegate : public CefWindowDelegate {
|
||||
base::OnceCallback<void(CefRefPtr<CefWindow>)>;
|
||||
using OnWindowDestroyedCallback =
|
||||
base::OnceCallback<void(CefRefPtr<CefWindow>)>;
|
||||
using OnWindowFullscreenTransitionCompleteCallback =
|
||||
base::RepeatingCallback<void(CefRefPtr<CefWindow>, size_t /*count*/)>;
|
||||
using OnAcceleratorCallback =
|
||||
base::RepeatingCallback<bool(CefRefPtr<CefWindow>, int)>;
|
||||
using OnKeyEventCallback =
|
||||
@@ -28,12 +30,15 @@ class TestWindowDelegate : public CefWindowDelegate {
|
||||
struct Config {
|
||||
OnWindowCreatedCallback on_window_created;
|
||||
OnWindowDestroyedCallback on_window_destroyed;
|
||||
OnWindowFullscreenTransitionCompleteCallback
|
||||
on_window_fullscreen_transition_complete;
|
||||
OnAcceleratorCallback on_accelerator;
|
||||
OnKeyEventCallback on_key_event;
|
||||
bool frameless = false;
|
||||
bool close_window = true;
|
||||
int window_size = kWSize;
|
||||
CefPoint window_origin = {};
|
||||
cef_show_state_t initial_show_state = CEF_SHOW_STATE_NORMAL;
|
||||
};
|
||||
|
||||
// Creates a Window with a new TestWindowDelegate instance and executes
|
||||
@@ -48,8 +53,11 @@ class TestWindowDelegate : public CefWindowDelegate {
|
||||
// CefWindowDelegate methods:
|
||||
void OnWindowCreated(CefRefPtr<CefWindow> window) override;
|
||||
void OnWindowDestroyed(CefRefPtr<CefWindow> window) override;
|
||||
void OnWindowFullscreenTransition(CefRefPtr<CefWindow> window,
|
||||
bool is_completed) override;
|
||||
bool IsFrameless(CefRefPtr<CefWindow> window) override;
|
||||
CefRect GetInitialBounds(CefRefPtr<CefWindow> window) override;
|
||||
cef_show_state_t GetInitialShowState(CefRefPtr<CefWindow> window) override;
|
||||
CefSize GetPreferredSize(CefRefPtr<CefView> view) override;
|
||||
bool OnAccelerator(CefRefPtr<CefWindow> window, int command_id) override;
|
||||
bool OnKeyEvent(CefRefPtr<CefWindow> window,
|
||||
@@ -73,6 +81,9 @@ class TestWindowDelegate : public CefWindowDelegate {
|
||||
bool got_get_initial_bounds_ = false;
|
||||
bool got_get_preferred_size_ = false;
|
||||
|
||||
size_t fullscreen_transition_callback_count_ = 0;
|
||||
size_t fullscreen_transition_complete_count_ = 0;
|
||||
|
||||
// Must be the last member.
|
||||
base::WeakPtrFactory<TestWindowDelegate> weak_ptr_factory_;
|
||||
|
||||
|
@@ -36,6 +36,13 @@ void ExpectCloseRects(const CefRect& expected,
|
||||
EXPECT_LE(abs(expected.height - actual.height), allowed_deviance);
|
||||
}
|
||||
|
||||
void ExpectClosePoints(const CefPoint& expected,
|
||||
const CefPoint& actual,
|
||||
int allowed_deviance) {
|
||||
EXPECT_LE(abs(expected.x - actual.x), allowed_deviance);
|
||||
EXPECT_LE(abs(expected.y - actual.y), allowed_deviance);
|
||||
}
|
||||
|
||||
void WindowCreateImpl(CefRefPtr<CefWaitableEvent> event) {
|
||||
auto config = std::make_unique<TestWindowDelegate::Config>();
|
||||
TestWindowDelegate::RunTest(event, std::move(config));
|
||||
@@ -47,23 +54,106 @@ void WindowCreateFramelessImpl(CefRefPtr<CefWaitableEvent> event) {
|
||||
TestWindowDelegate::RunTest(event, std::move(config));
|
||||
}
|
||||
|
||||
void RunWindowShow(CefRefPtr<CefWindow> window) {
|
||||
EXPECT_FALSE(window->IsVisible());
|
||||
EXPECT_FALSE(window->IsDrawn());
|
||||
window->Show();
|
||||
EXPECT_TRUE(window->IsVisible());
|
||||
EXPECT_TRUE(window->IsDrawn());
|
||||
void RunWindowShow(cef_show_state_t initial_show_state,
|
||||
CefRefPtr<CefWindow> window) {
|
||||
#if defined(OS_MAC)
|
||||
if (initial_show_state == CEF_SHOW_STATE_FULLSCREEN) {
|
||||
// On MacOS, starting in fullscreen mode also shows the window on creation.
|
||||
EXPECT_TRUE(window->IsVisible());
|
||||
EXPECT_TRUE(window->IsDrawn());
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
EXPECT_FALSE(window->IsVisible());
|
||||
EXPECT_FALSE(window->IsDrawn());
|
||||
window->Show();
|
||||
}
|
||||
|
||||
if (initial_show_state == CEF_SHOW_STATE_MINIMIZED) {
|
||||
#if !defined(OS_MAC)
|
||||
// This result is a bit unexpected, but I guess the platform considers a
|
||||
// window to be visible even when it's minimized.
|
||||
EXPECT_TRUE(window->IsVisible());
|
||||
EXPECT_TRUE(window->IsDrawn());
|
||||
#else
|
||||
EXPECT_FALSE(window->IsVisible());
|
||||
EXPECT_FALSE(window->IsDrawn());
|
||||
#endif
|
||||
} else {
|
||||
EXPECT_TRUE(window->IsVisible());
|
||||
EXPECT_TRUE(window->IsDrawn());
|
||||
}
|
||||
|
||||
switch (initial_show_state) {
|
||||
case CEF_SHOW_STATE_NORMAL:
|
||||
EXPECT_FALSE(window->IsMaximized());
|
||||
EXPECT_FALSE(window->IsMinimized());
|
||||
EXPECT_FALSE(window->IsFullscreen());
|
||||
break;
|
||||
case CEF_SHOW_STATE_MINIMIZED:
|
||||
EXPECT_FALSE(window->IsMaximized());
|
||||
#if defined(OS_WIN)
|
||||
// On MacOS, IsMinimized() state isn't reliable in this callback due to a
|
||||
// timing issue between NativeWidgetMac::Minimize requesting the minimize
|
||||
// state change (before this callback) and
|
||||
// NativeWidgetMacNSWindowHost::OnWindowMiniaturizedChanged indicating the
|
||||
// completed state change (after this callback).
|
||||
// On Linux, there's likely a similar timing issue.
|
||||
EXPECT_TRUE(window->IsMinimized());
|
||||
#endif
|
||||
EXPECT_FALSE(window->IsFullscreen());
|
||||
break;
|
||||
case CEF_SHOW_STATE_MAXIMIZED:
|
||||
#if !defined(OS_LINUX)
|
||||
// On Linux, there's likely a similar timing issue.
|
||||
EXPECT_TRUE(window->IsMaximized());
|
||||
#endif
|
||||
EXPECT_FALSE(window->IsMinimized());
|
||||
EXPECT_FALSE(window->IsFullscreen());
|
||||
break;
|
||||
case CEF_SHOW_STATE_FULLSCREEN:
|
||||
EXPECT_FALSE(window->IsMaximized());
|
||||
EXPECT_FALSE(window->IsMinimized());
|
||||
EXPECT_TRUE(window->IsFullscreen());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void WindowCreateWithOriginImpl(CefRefPtr<CefWaitableEvent> event) {
|
||||
auto config = std::make_unique<TestWindowDelegate::Config>();
|
||||
config->window_origin = {100, 200};
|
||||
config->on_window_created = base::BindOnce(RunWindowShow);
|
||||
config->on_window_created =
|
||||
base::BindOnce(RunWindowShow, config->initial_show_state);
|
||||
TestWindowDelegate::RunTest(event, std::move(config));
|
||||
}
|
||||
|
||||
void RunWindowShowHide(CefRefPtr<CefWindow> window) {
|
||||
RunWindowShow(window);
|
||||
void WindowCreateMinimizedImpl(CefRefPtr<CefWaitableEvent> event) {
|
||||
auto config = std::make_unique<TestWindowDelegate::Config>();
|
||||
config->initial_show_state = CEF_SHOW_STATE_MINIMIZED;
|
||||
config->on_window_created =
|
||||
base::BindOnce(RunWindowShow, config->initial_show_state);
|
||||
TestWindowDelegate::RunTest(event, std::move(config));
|
||||
}
|
||||
|
||||
void WindowCreateMaximizedImpl(CefRefPtr<CefWaitableEvent> event) {
|
||||
auto config = std::make_unique<TestWindowDelegate::Config>();
|
||||
config->initial_show_state = CEF_SHOW_STATE_MAXIMIZED;
|
||||
config->on_window_created =
|
||||
base::BindOnce(RunWindowShow, config->initial_show_state);
|
||||
TestWindowDelegate::RunTest(event, std::move(config));
|
||||
}
|
||||
|
||||
void WindowCreateFullscreenImpl(CefRefPtr<CefWaitableEvent> event) {
|
||||
auto config = std::make_unique<TestWindowDelegate::Config>();
|
||||
config->initial_show_state = CEF_SHOW_STATE_FULLSCREEN;
|
||||
config->on_window_created =
|
||||
base::BindOnce(RunWindowShow, config->initial_show_state);
|
||||
TestWindowDelegate::RunTest(event, std::move(config));
|
||||
}
|
||||
|
||||
void RunWindowShowHide(cef_show_state_t initial_show_state,
|
||||
CefRefPtr<CefWindow> window) {
|
||||
RunWindowShow(initial_show_state, window);
|
||||
window->Hide();
|
||||
EXPECT_FALSE(window->IsVisible());
|
||||
EXPECT_FALSE(window->IsDrawn());
|
||||
@@ -71,13 +161,15 @@ void RunWindowShowHide(CefRefPtr<CefWindow> window) {
|
||||
|
||||
void WindowShowHideImpl(CefRefPtr<CefWaitableEvent> event) {
|
||||
auto config = std::make_unique<TestWindowDelegate::Config>();
|
||||
config->on_window_created = base::BindOnce(RunWindowShowHide);
|
||||
config->on_window_created =
|
||||
base::BindOnce(RunWindowShowHide, config->initial_show_state);
|
||||
TestWindowDelegate::RunTest(event, std::move(config));
|
||||
}
|
||||
|
||||
void WindowShowHideFramelessImpl(CefRefPtr<CefWaitableEvent> event) {
|
||||
auto config = std::make_unique<TestWindowDelegate::Config>();
|
||||
config->on_window_created = base::BindOnce(RunWindowShowHide);
|
||||
config->on_window_created =
|
||||
base::BindOnce(RunWindowShowHide, config->initial_show_state);
|
||||
config->frameless = true;
|
||||
TestWindowDelegate::RunTest(event, std::move(config));
|
||||
}
|
||||
@@ -146,9 +238,9 @@ void RunWindowLayoutAndCoords(CefRefPtr<CefWindow> window) {
|
||||
point);
|
||||
point = CefPoint(0, 0);
|
||||
EXPECT_TRUE(view2->ConvertPointToScreen(point));
|
||||
EXPECT_EQ(CefPoint(client_bounds_in_screen.x,
|
||||
client_bounds_in_screen.y + kWSize / 2),
|
||||
point);
|
||||
ExpectClosePoints(CefPoint(client_bounds_in_screen.x,
|
||||
client_bounds_in_screen.y + kWSize / 2),
|
||||
point, 1);
|
||||
|
||||
// Test view from screen coordinate conversions.
|
||||
point = CefPoint(client_bounds_in_screen.x, client_bounds_in_screen.y);
|
||||
@@ -157,7 +249,7 @@ void RunWindowLayoutAndCoords(CefRefPtr<CefWindow> window) {
|
||||
point = CefPoint(client_bounds_in_screen.x,
|
||||
client_bounds_in_screen.y + kWSize / 2);
|
||||
EXPECT_TRUE(view2->ConvertPointFromScreen(point));
|
||||
EXPECT_EQ(CefPoint(0, 0), point);
|
||||
ExpectClosePoints(CefPoint(0, 0), point, 1);
|
||||
|
||||
// Test view to window coordinate conversions.
|
||||
point = CefPoint(0, 0);
|
||||
@@ -165,7 +257,7 @@ void RunWindowLayoutAndCoords(CefRefPtr<CefWindow> window) {
|
||||
EXPECT_EQ(CefPoint(0, 0), point);
|
||||
point = CefPoint(0, 0);
|
||||
EXPECT_TRUE(view2->ConvertPointToWindow(point));
|
||||
EXPECT_EQ(CefPoint(0, kWSize / 2), point);
|
||||
ExpectClosePoints(CefPoint(0, kWSize / 2), point, 1);
|
||||
|
||||
// Test view from window coordinate conversions.
|
||||
point = CefPoint(0, 0);
|
||||
@@ -173,23 +265,23 @@ void RunWindowLayoutAndCoords(CefRefPtr<CefWindow> window) {
|
||||
EXPECT_EQ(CefPoint(0, 0), point);
|
||||
point = CefPoint(0, kWSize / 2);
|
||||
EXPECT_TRUE(view2->ConvertPointFromWindow(point));
|
||||
EXPECT_EQ(CefPoint(0, 0), point);
|
||||
ExpectClosePoints(CefPoint(0, 0), point, 1);
|
||||
|
||||
// Test view to view coordinate conversions.
|
||||
point = CefPoint(0, 0);
|
||||
EXPECT_TRUE(view1->ConvertPointToView(view2, point));
|
||||
EXPECT_EQ(CefPoint(0, -kWSize / 2), point);
|
||||
ExpectClosePoints(CefPoint(0, -kWSize / 2), point, 1);
|
||||
point = CefPoint(0, 0);
|
||||
EXPECT_TRUE(view2->ConvertPointToView(view1, point));
|
||||
EXPECT_EQ(CefPoint(0, kWSize / 2), point);
|
||||
ExpectClosePoints(CefPoint(0, kWSize / 2), point, 1);
|
||||
|
||||
// Test view from view coordinate conversions.
|
||||
point = CefPoint(0, -kWSize / 2);
|
||||
EXPECT_TRUE(view1->ConvertPointFromView(view2, point));
|
||||
EXPECT_EQ(CefPoint(0, 0), point);
|
||||
ExpectClosePoints(CefPoint(0, 0), point, 1);
|
||||
point = CefPoint(0, kWSize / 2);
|
||||
EXPECT_TRUE(view2->ConvertPointFromView(view1, point));
|
||||
EXPECT_EQ(CefPoint(0, 0), point);
|
||||
ExpectClosePoints(CefPoint(0, 0), point, 1);
|
||||
|
||||
CefRefPtr<CefDisplay> display = window->GetDisplay();
|
||||
EXPECT_TRUE(display.get());
|
||||
@@ -198,8 +290,8 @@ void RunWindowLayoutAndCoords(CefRefPtr<CefWindow> window) {
|
||||
point = CefPoint(client_bounds_in_screen.x, client_bounds_in_screen.y);
|
||||
display->ConvertPointToPixels(point);
|
||||
display->ConvertPointFromPixels(point);
|
||||
EXPECT_EQ(CefPoint(client_bounds_in_screen.x, client_bounds_in_screen.y),
|
||||
point);
|
||||
ExpectClosePoints(
|
||||
CefPoint(client_bounds_in_screen.x, client_bounds_in_screen.y), point, 1);
|
||||
|
||||
// We don't know what the pixel values will be, but they should be reversable.
|
||||
point = CefPoint(client_bounds_in_screen.x, client_bounds_in_screen.y);
|
||||
@@ -278,10 +370,15 @@ void VerifyMinimize(CefRefPtr<CefWindow> window) {
|
||||
EXPECT_FALSE(window->IsMaximized());
|
||||
EXPECT_FALSE(window->IsFullscreen());
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// This result is a bit unexpected, but I guess the platform considers a
|
||||
// window to be visible even when it's minimized.
|
||||
EXPECT_TRUE(window->IsVisible());
|
||||
EXPECT_TRUE(window->IsDrawn());
|
||||
#else
|
||||
EXPECT_FALSE(window->IsVisible());
|
||||
EXPECT_FALSE(window->IsDrawn());
|
||||
#endif
|
||||
|
||||
window->Restore();
|
||||
CefPostDelayedTask(TID_UI, base::BindOnce(VerifyRestore, window),
|
||||
@@ -316,28 +413,26 @@ void WindowMinimizeFramelessImpl(CefRefPtr<CefWaitableEvent> event) {
|
||||
config->close_window = false;
|
||||
TestWindowDelegate::RunTest(event, std::move(config));
|
||||
}
|
||||
|
||||
void VerifyFullscreenExit(CefRefPtr<CefWindow> window) {
|
||||
void WindowFullscreenTransitionComplete(CefRefPtr<CefWindow> window,
|
||||
size_t count) {
|
||||
EXPECT_FALSE(window->IsMinimized());
|
||||
|
||||
#if defined(OS_MAC)
|
||||
// On MacOS, IsMaximized() returns true when IsFullscreen() returns true.
|
||||
EXPECT_EQ(window->IsFullscreen(), window->IsMaximized());
|
||||
#else
|
||||
EXPECT_FALSE(window->IsMaximized());
|
||||
EXPECT_FALSE(window->IsFullscreen());
|
||||
EXPECT_TRUE(window->IsVisible());
|
||||
EXPECT_TRUE(window->IsDrawn());
|
||||
#endif
|
||||
|
||||
// End the test by closing the Window.
|
||||
window->Close();
|
||||
}
|
||||
if (window->IsFullscreen()) {
|
||||
EXPECT_EQ(1U, count);
|
||||
window->SetFullscreen(false);
|
||||
} else {
|
||||
EXPECT_EQ(2U, count);
|
||||
|
||||
void VerifyFullscreen(CefRefPtr<CefWindow> window) {
|
||||
EXPECT_FALSE(window->IsMinimized());
|
||||
EXPECT_FALSE(window->IsMaximized());
|
||||
EXPECT_TRUE(window->IsFullscreen());
|
||||
EXPECT_TRUE(window->IsVisible());
|
||||
EXPECT_TRUE(window->IsDrawn());
|
||||
|
||||
window->SetFullscreen(false);
|
||||
CefPostDelayedTask(TID_UI, base::BindOnce(VerifyFullscreenExit, window),
|
||||
kStateDelayMS);
|
||||
// End the test by closing the Window.
|
||||
window->Close();
|
||||
}
|
||||
}
|
||||
|
||||
void RunWindowFullscreen(CefRefPtr<CefWindow> window) {
|
||||
@@ -350,13 +445,13 @@ void RunWindowFullscreen(CefRefPtr<CefWindow> window) {
|
||||
EXPECT_TRUE(window->IsDrawn());
|
||||
|
||||
window->SetFullscreen(true);
|
||||
CefPostDelayedTask(TID_UI, base::BindOnce(VerifyFullscreen, window),
|
||||
kStateDelayMS);
|
||||
}
|
||||
|
||||
void WindowFullscreenImpl(CefRefPtr<CefWaitableEvent> event) {
|
||||
auto config = std::make_unique<TestWindowDelegate::Config>();
|
||||
config->on_window_created = base::BindOnce(RunWindowFullscreen);
|
||||
config->on_window_fullscreen_transition_complete =
|
||||
base::BindRepeating(WindowFullscreenTransitionComplete);
|
||||
config->close_window = false;
|
||||
TestWindowDelegate::RunTest(event, std::move(config));
|
||||
}
|
||||
@@ -364,6 +459,8 @@ void WindowFullscreenImpl(CefRefPtr<CefWaitableEvent> event) {
|
||||
void WindowFullscreenFramelessImpl(CefRefPtr<CefWaitableEvent> event) {
|
||||
auto config = std::make_unique<TestWindowDelegate::Config>();
|
||||
config->on_window_created = base::BindOnce(RunWindowFullscreen);
|
||||
config->on_window_fullscreen_transition_complete =
|
||||
base::BindRepeating(WindowFullscreenTransitionComplete);
|
||||
config->frameless = true;
|
||||
config->close_window = false;
|
||||
TestWindowDelegate::RunTest(event, std::move(config));
|
||||
@@ -505,6 +602,9 @@ void WindowAcceleratorImpl(CefRefPtr<CefWaitableEvent> event) {
|
||||
WINDOW_TEST_ASYNC(WindowCreate)
|
||||
WINDOW_TEST_ASYNC(WindowCreateFrameless)
|
||||
WINDOW_TEST_ASYNC(WindowCreateWithOrigin)
|
||||
WINDOW_TEST_ASYNC(WindowCreateMinimized)
|
||||
WINDOW_TEST_ASYNC(WindowCreateMaximized)
|
||||
WINDOW_TEST_ASYNC(WindowCreateFullscreen)
|
||||
WINDOW_TEST_ASYNC(WindowShowHide)
|
||||
WINDOW_TEST_ASYNC(WindowShowHideFrameless)
|
||||
WINDOW_TEST_ASYNC(WindowLayoutAndCoords)
|
||||
|
@@ -56,6 +56,7 @@ const char kUseTestHttpServer[] = "use-test-http-server";
|
||||
const char kShowWindowButtons[] = "show-window-buttons";
|
||||
const char kUseWindowModalDialog[] = "use-window-modal-dialog";
|
||||
const char kUseBottomControls[] = "use-bottom-controls";
|
||||
const char kHidePipFrame[] = "hide-pip-frame";
|
||||
|
||||
} // namespace switches
|
||||
} // namespace client
|
||||
|
@@ -50,6 +50,7 @@ extern const char kUseTestHttpServer[];
|
||||
extern const char kShowWindowButtons[];
|
||||
extern const char kUseWindowModalDialog[];
|
||||
extern const char kUseBottomControls[];
|
||||
extern const char kHidePipFrame[];
|
||||
|
||||
} // namespace switches
|
||||
} // namespace client
|
||||
|
@@ -466,19 +466,18 @@ def GetConfigArgs(args, is_debug, cpu):
|
||||
"""
|
||||
add_args = {}
|
||||
|
||||
if platform == 'windows' and cpu == 'x86':
|
||||
# Disable Rust dependencies for Windows x86 builds due to
|
||||
# https://crbug.com/1465165.
|
||||
add_args['enable_rust'] = False
|
||||
if GetArgValue(args, 'is_official_build'):
|
||||
# Disable Chromium field trials in official builds.
|
||||
add_args['disable_fieldtrial_testing_config'] = True
|
||||
|
||||
# Cannot create is_official_build=true is_debug=true builds.
|
||||
# This restriction is enforced in //build/config/BUILDCONFIG.gn.
|
||||
# Instead, our "official Debug" build is a Release build with dchecks and
|
||||
# symbols. Symbols will be generated by default for official builds; see the
|
||||
# definition of 'symbol_level' in //build/config/compiler/compiler.gni.
|
||||
if is_debug and GetArgValue(args, 'is_official_build'):
|
||||
is_debug = False
|
||||
add_args['dcheck_always_on'] = True
|
||||
# Cannot create is_official_build=true is_debug=true builds.
|
||||
# This restriction is enforced in //build/config/BUILDCONFIG.gn.
|
||||
# Instead, our "official Debug" build is a Release build with dchecks and
|
||||
# symbols. Symbols will be generated by default for official builds; see the
|
||||
# definition of 'symbol_level' in //build/config/compiler/compiler.gni.
|
||||
if is_debug:
|
||||
is_debug = False
|
||||
add_args['dcheck_always_on'] = True
|
||||
|
||||
result = MergeDicts(args, add_args, {
|
||||
'is_debug': is_debug,
|
||||
|
Reference in New Issue
Block a user