mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
25 Commits
5bafd32ee1
...
3987
Author | SHA1 | Date | |
---|---|---|---|
|
1c446e7301 | ||
|
7b802c9272 | ||
|
a33bdbcdb4 | ||
|
a3e4933507 | ||
|
d12ef0f15d | ||
|
cce1b63049 | ||
|
badf1061f2 | ||
|
ec58f88052 | ||
|
e70b0c3cfe | ||
|
1802ceeb85 | ||
|
919206cd65 | ||
|
52b5cc5da4 | ||
|
892739653a | ||
|
29aedaf650 | ||
|
9d2a31ec60 | ||
|
05e96e04fa | ||
|
e6096029c7 | ||
|
f96cd1de5e | ||
|
d9fd476670 | ||
|
bc10d1ab8b | ||
|
df7fb8ec6d | ||
|
74f7b0cb38 | ||
|
b440f4c949 | ||
|
408e48bde6 | ||
|
14948082f3 |
20
BUILD.gn
20
BUILD.gn
@@ -473,6 +473,16 @@ static_library("libcef_static") {
|
||||
"libcef/browser/javascript_dialog_manager.h",
|
||||
"libcef/browser/media_capture_devices_dispatcher.cc",
|
||||
"libcef/browser/media_capture_devices_dispatcher.h",
|
||||
"libcef/browser/media_router/media_route_impl.cc",
|
||||
"libcef/browser/media_router/media_route_impl.h",
|
||||
"libcef/browser/media_router/media_router_impl.cc",
|
||||
"libcef/browser/media_router/media_router_impl.h",
|
||||
"libcef/browser/media_router/media_router_manager.cc",
|
||||
"libcef/browser/media_router/media_router_manager.h",
|
||||
"libcef/browser/media_router/media_sink_impl.cc",
|
||||
"libcef/browser/media_router/media_sink_impl.h",
|
||||
"libcef/browser/media_router/media_source_impl.cc",
|
||||
"libcef/browser/media_router/media_source_impl.h",
|
||||
"libcef/browser/menu_manager.cc",
|
||||
"libcef/browser/menu_manager.h",
|
||||
"libcef/browser/menu_model_impl.cc",
|
||||
@@ -1187,6 +1197,7 @@ source_set("cef_content_browser_overlay_manifest") {
|
||||
|
||||
deps = [
|
||||
"//base",
|
||||
"//chrome/common:mojo_bindings",
|
||||
"//extensions/buildflags",
|
||||
"//extensions/common:mojom",
|
||||
"//extensions/common/api:mojom",
|
||||
@@ -2143,13 +2154,18 @@ if (is_mac) {
|
||||
libs = [
|
||||
"comctl32.lib",
|
||||
"d3d11.lib",
|
||||
"glu32.lib",
|
||||
"imm32.lib",
|
||||
"oleacc.lib",
|
||||
"opengl32.lib",
|
||||
"rpcrt4.lib",
|
||||
"shlwapi.lib",
|
||||
]
|
||||
|
||||
if (target_cpu != "arm64") {
|
||||
libs += [
|
||||
"opengl32.lib",
|
||||
"glu32.lib"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
|
@@ -7,5 +7,6 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'refs/tags/80.0.3987.0'
|
||||
'chromium_checkout': 'refs/tags/80.0.3987.163',
|
||||
'depot_tools_checkout': 'ec2a6ce270'
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
# by hand. See the translator.README.txt file in the tools directory for
|
||||
# more information.
|
||||
#
|
||||
# $hash=98198bc4243deb46c848735f0d5499aa4891e535$
|
||||
# $hash=578c0aef11c3c7840679e480069fc9031c628e25$
|
||||
#
|
||||
|
||||
{
|
||||
@@ -43,6 +43,7 @@
|
||||
'include/cef_keyboard_handler.h',
|
||||
'include/cef_life_span_handler.h',
|
||||
'include/cef_load_handler.h',
|
||||
'include/cef_media_router.h',
|
||||
'include/cef_menu_model.h',
|
||||
'include/cef_menu_model_delegate.h',
|
||||
'include/cef_navigation_entry.h',
|
||||
@@ -53,6 +54,7 @@
|
||||
'include/cef_print_settings.h',
|
||||
'include/cef_process_message.h',
|
||||
'include/cef_process_util.h',
|
||||
'include/cef_registration.h',
|
||||
'include/cef_render_handler.h',
|
||||
'include/cef_render_process_handler.h',
|
||||
'include/cef_request.h',
|
||||
@@ -136,6 +138,7 @@
|
||||
'include/capi/cef_keyboard_handler_capi.h',
|
||||
'include/capi/cef_life_span_handler_capi.h',
|
||||
'include/capi/cef_load_handler_capi.h',
|
||||
'include/capi/cef_media_router_capi.h',
|
||||
'include/capi/cef_menu_model_capi.h',
|
||||
'include/capi/cef_menu_model_delegate_capi.h',
|
||||
'include/capi/cef_navigation_entry_capi.h',
|
||||
@@ -146,6 +149,7 @@
|
||||
'include/capi/cef_print_settings_capi.h',
|
||||
'include/capi/cef_process_message_capi.h',
|
||||
'include/capi/cef_process_util_capi.h',
|
||||
'include/capi/cef_registration_capi.h',
|
||||
'include/capi/cef_render_handler_capi.h',
|
||||
'include/capi/cef_render_process_handler_capi.h',
|
||||
'include/capi/cef_request_capi.h',
|
||||
@@ -308,6 +312,18 @@
|
||||
'libcef_dll/cpptoc/list_value_cpptoc.h',
|
||||
'libcef_dll/ctocpp/load_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/load_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/media_observer_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/media_observer_ctocpp.h',
|
||||
'libcef_dll/cpptoc/media_route_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/media_route_cpptoc.h',
|
||||
'libcef_dll/ctocpp/media_route_create_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/media_route_create_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/media_router_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/media_router_cpptoc.h',
|
||||
'libcef_dll/cpptoc/media_sink_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/media_sink_cpptoc.h',
|
||||
'libcef_dll/cpptoc/media_source_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/media_source_cpptoc.h',
|
||||
'libcef_dll/cpptoc/views/menu_button_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/menu_button_cpptoc.h',
|
||||
'libcef_dll/ctocpp/views/menu_button_delegate_ctocpp.cc',
|
||||
@@ -346,6 +362,8 @@
|
||||
'libcef_dll/ctocpp/read_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/register_cdm_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/register_cdm_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/registration_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/registration_cpptoc.h',
|
||||
'libcef_dll/ctocpp/render_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/render_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/render_process_handler_ctocpp.cc',
|
||||
@@ -598,6 +616,18 @@
|
||||
'libcef_dll/ctocpp/list_value_ctocpp.h',
|
||||
'libcef_dll/cpptoc/load_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/load_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/media_observer_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/media_observer_cpptoc.h',
|
||||
'libcef_dll/ctocpp/media_route_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/media_route_ctocpp.h',
|
||||
'libcef_dll/cpptoc/media_route_create_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/media_route_create_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/media_router_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/media_router_ctocpp.h',
|
||||
'libcef_dll/ctocpp/media_sink_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/media_sink_ctocpp.h',
|
||||
'libcef_dll/ctocpp/media_source_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/media_source_ctocpp.h',
|
||||
'libcef_dll/ctocpp/views/menu_button_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/menu_button_ctocpp.h',
|
||||
'libcef_dll/cpptoc/views/menu_button_delegate_cpptoc.cc',
|
||||
@@ -636,6 +666,8 @@
|
||||
'libcef_dll/cpptoc/read_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/register_cdm_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/register_cdm_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/registration_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/registration_ctocpp.h',
|
||||
'libcef_dll/cpptoc/render_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/render_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/render_process_handler_cpptoc.cc',
|
||||
|
@@ -238,6 +238,8 @@
|
||||
'tests/cefclient/browser/main_context.h',
|
||||
'tests/cefclient/browser/main_context_impl.cc',
|
||||
'tests/cefclient/browser/main_context_impl.h',
|
||||
'tests/cefclient/browser/media_router_test.cc',
|
||||
'tests/cefclient/browser/media_router_test.h',
|
||||
'tests/cefclient/browser/osr_dragdrop_events.h',
|
||||
'tests/cefclient/browser/osr_renderer.h',
|
||||
'tests/cefclient/browser/osr_renderer.cc',
|
||||
@@ -287,6 +289,7 @@
|
||||
'tests/cefclient/resources/drm.html',
|
||||
'tests/cefclient/resources/localstorage.html',
|
||||
'tests/cefclient/resources/logo.png',
|
||||
'tests/cefclient/resources/media_router.html',
|
||||
'tests/cefclient/resources/menu_icon.1x.png',
|
||||
'tests/cefclient/resources/menu_icon.2x.png',
|
||||
'tests/cefclient/resources/other_tests.html',
|
||||
|
@@ -178,7 +178,7 @@ Atomic64 Release_Load(volatile const Atomic64* ptr);
|
||||
// Include our platform specific implementation.
|
||||
#if defined(OS_WIN) && defined(COMPILER_MSVC) && defined(ARCH_CPU_X86_FAMILY)
|
||||
#include "include/base/internal/cef_atomicops_x86_msvc.h"
|
||||
#elif defined(OS_WIN) && defined(__ARM_ARCH_ISA_A64)
|
||||
#elif defined(OS_WIN) && (defined(__ARM_ARCH_ISA_A64) || defined(_M_ARM64))
|
||||
#include "include/base/internal/cef_atomicops_arm64_msvc.h"
|
||||
#elif defined(OS_MACOSX)
|
||||
#include "include/base/internal/cef_atomicops_mac.h"
|
||||
|
@@ -95,7 +95,7 @@
|
||||
#define ARCH_CPU_ARMEL 1
|
||||
#define ARCH_CPU_32_BITS 1
|
||||
#define ARCH_CPU_LITTLE_ENDIAN 1
|
||||
#elif defined(__aarch64__)
|
||||
#elif defined(__aarch64__) || defined(_M_ARM64)
|
||||
#define ARCH_CPU_ARM_FAMILY 1
|
||||
#define ARCH_CPU_ARM64 1
|
||||
#define ARCH_CPU_64_BITS 1
|
||||
|
322
include/capi/cef_media_router_capi.h
Normal file
322
include/capi/cef_media_router_capi.h
Normal file
@@ -0,0 +1,322 @@
|
||||
// Copyright (c) 2020 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool and should not edited
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=a7070419332ec8f6d6e4df898c8eb666b988970a$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_MEDIA_ROUTER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_MEDIA_ROUTER_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_registration_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _cef_media_observer_t;
|
||||
struct _cef_media_route_create_callback_t;
|
||||
struct _cef_media_route_t;
|
||||
struct _cef_media_sink_t;
|
||||
struct _cef_media_source_t;
|
||||
|
||||
///
|
||||
// Supports discovery of and communication with media devices on the local
|
||||
// network via the Cast and DIAL protocols. The functions of this structure may
|
||||
// be called on any browser process thread unless otherwise indicated.
|
||||
///
|
||||
typedef struct _cef_media_router_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Add an observer for MediaRouter events. The observer will remain registered
|
||||
// until the returned Registration object is destroyed.
|
||||
///
|
||||
struct _cef_registration_t*(CEF_CALLBACK* add_observer)(
|
||||
struct _cef_media_router_t* self,
|
||||
struct _cef_media_observer_t* observer);
|
||||
|
||||
///
|
||||
// Returns a MediaSource object for the specified media source URN. Supported
|
||||
// URN schemes include "cast:" and "dial:", and will be already known by the
|
||||
// client application (e.g. "cast:<appId>?clientId=<clientId>").
|
||||
///
|
||||
struct _cef_media_source_t*(CEF_CALLBACK* get_source)(
|
||||
struct _cef_media_router_t* self,
|
||||
const cef_string_t* urn);
|
||||
|
||||
///
|
||||
// Trigger an asynchronous call to cef_media_observer_t::OnSinks on all
|
||||
// registered observers.
|
||||
///
|
||||
void(CEF_CALLBACK* notify_current_sinks)(struct _cef_media_router_t* self);
|
||||
|
||||
///
|
||||
// Create a new route between |source| and |sink|. Source and sink must be
|
||||
// valid, compatible (as reported by cef_media_sink_t::IsCompatibleWith), and
|
||||
// a route between them must not already exist. |callback| will be executed on
|
||||
// success or failure. If route creation succeeds it will also trigger an
|
||||
// asynchronous call to cef_media_observer_t::OnRoutes on all registered
|
||||
// observers.
|
||||
///
|
||||
void(CEF_CALLBACK* create_route)(
|
||||
struct _cef_media_router_t* self,
|
||||
struct _cef_media_source_t* source,
|
||||
struct _cef_media_sink_t* sink,
|
||||
struct _cef_media_route_create_callback_t* callback);
|
||||
|
||||
///
|
||||
// Trigger an asynchronous call to cef_media_observer_t::OnRoutes on all
|
||||
// registered observers.
|
||||
///
|
||||
void(CEF_CALLBACK* notify_current_routes)(struct _cef_media_router_t* self);
|
||||
} cef_media_router_t;
|
||||
|
||||
///
|
||||
// Returns the MediaRouter object associated with the global request context.
|
||||
// Equivalent to calling cef_request_context_t::cef_request_context_get_global_c
|
||||
// ontext()->get_media_router().
|
||||
///
|
||||
CEF_EXPORT cef_media_router_t* cef_media_router_get_global();
|
||||
|
||||
///
|
||||
// Implemented by the client to observe MediaRouter events and registered via
|
||||
// cef_media_router_t::AddObserver. The functions of this structure will be
|
||||
// called on the browser process UI thread.
|
||||
///
|
||||
typedef struct _cef_media_observer_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// The list of available media sinks has changed or
|
||||
// cef_media_router_t::NotifyCurrentSinks was called.
|
||||
///
|
||||
void(CEF_CALLBACK* on_sinks)(struct _cef_media_observer_t* self,
|
||||
size_t sinksCount,
|
||||
struct _cef_media_sink_t* const* sinks);
|
||||
|
||||
///
|
||||
// The list of available media routes has changed or
|
||||
// cef_media_router_t::NotifyCurrentRoutes was called.
|
||||
///
|
||||
void(CEF_CALLBACK* on_routes)(struct _cef_media_observer_t* self,
|
||||
size_t routesCount,
|
||||
struct _cef_media_route_t* const* routes);
|
||||
|
||||
///
|
||||
// The connection state of |route| has changed.
|
||||
///
|
||||
void(CEF_CALLBACK* on_route_state_changed)(
|
||||
struct _cef_media_observer_t* self,
|
||||
struct _cef_media_route_t* route,
|
||||
cef_media_route_connection_state_t state);
|
||||
|
||||
///
|
||||
// A message was recieved over |route|. |message| is only valid for the scope
|
||||
// of this callback and should be copied if necessary.
|
||||
///
|
||||
void(CEF_CALLBACK* on_route_message_received)(
|
||||
struct _cef_media_observer_t* self,
|
||||
struct _cef_media_route_t* route,
|
||||
const void* message,
|
||||
size_t message_size);
|
||||
} cef_media_observer_t;
|
||||
|
||||
///
|
||||
// Represents the route between a media source and sink. Instances of this
|
||||
// object are created via cef_media_router_t::CreateRoute and retrieved via
|
||||
// cef_media_observer_t::OnRoutes. Contains the status and metadata of a routing
|
||||
// operation. The functions of this structure may be called on any browser
|
||||
// process thread unless otherwise indicated.
|
||||
///
|
||||
typedef struct _cef_media_route_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Returns the ID for this route.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_id)(struct _cef_media_route_t* self);
|
||||
|
||||
///
|
||||
// Returns the source associated with this route.
|
||||
///
|
||||
struct _cef_media_source_t*(CEF_CALLBACK* get_source)(
|
||||
struct _cef_media_route_t* self);
|
||||
|
||||
///
|
||||
// Returns the sink associated with this route.
|
||||
///
|
||||
struct _cef_media_sink_t*(CEF_CALLBACK* get_sink)(
|
||||
struct _cef_media_route_t* self);
|
||||
|
||||
///
|
||||
// Send a message over this route. |message| will be copied if necessary.
|
||||
///
|
||||
void(CEF_CALLBACK* send_route_message)(struct _cef_media_route_t* self,
|
||||
const void* message,
|
||||
size_t message_size);
|
||||
|
||||
///
|
||||
// Terminate this route. Will result in an asynchronous call to
|
||||
// cef_media_observer_t::OnRoutes on all registered observers.
|
||||
///
|
||||
void(CEF_CALLBACK* terminate)(struct _cef_media_route_t* self);
|
||||
} cef_media_route_t;
|
||||
|
||||
///
|
||||
// Callback structure for cef_media_router_t::CreateRoute. The functions of this
|
||||
// structure will be called on the browser process UI thread.
|
||||
///
|
||||
typedef struct _cef_media_route_create_callback_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Method that will be executed when the route creation has finished. |result|
|
||||
// will be CEF_MRCR_OK if the route creation succeeded. |error| will be a
|
||||
// description of the error if the route creation failed. |route| is the
|
||||
// resulting route, or NULL if the route creation failed.
|
||||
///
|
||||
void(CEF_CALLBACK* on_media_route_create_finished)(
|
||||
struct _cef_media_route_create_callback_t* self,
|
||||
cef_media_route_create_result_t result,
|
||||
const cef_string_t* error,
|
||||
struct _cef_media_route_t* route);
|
||||
} cef_media_route_create_callback_t;
|
||||
|
||||
///
|
||||
// Represents a sink to which media can be routed. Instances of this object are
|
||||
// retrieved via cef_media_observer_t::OnSinks. The functions of this structure
|
||||
// may be called on any browser process thread unless otherwise indicated.
|
||||
///
|
||||
typedef struct _cef_media_sink_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Returns the ID for this sink.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_id)(struct _cef_media_sink_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if this sink is valid.
|
||||
///
|
||||
int(CEF_CALLBACK* is_valid)(struct _cef_media_sink_t* self);
|
||||
|
||||
///
|
||||
// Returns the name of this sink.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_name)(struct _cef_media_sink_t* self);
|
||||
|
||||
///
|
||||
// Returns the description of this sink.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_description)(
|
||||
struct _cef_media_sink_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if this sink accepts content via Cast.
|
||||
///
|
||||
int(CEF_CALLBACK* is_cast_sink)(struct _cef_media_sink_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if this sink accepts content via DIAL.
|
||||
///
|
||||
int(CEF_CALLBACK* is_dial_sink)(struct _cef_media_sink_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if this sink is compatible with |source|.
|
||||
///
|
||||
int(CEF_CALLBACK* is_compatible_with)(struct _cef_media_sink_t* self,
|
||||
struct _cef_media_source_t* source);
|
||||
} cef_media_sink_t;
|
||||
|
||||
///
|
||||
// Represents a source from which media can be routed. Instances of this object
|
||||
// are retrieved via cef_media_router_t::GetSource. The functions of this
|
||||
// structure may be called on any browser process thread unless otherwise
|
||||
// indicated.
|
||||
///
|
||||
typedef struct _cef_media_source_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Returns the ID (media source URN or URL) for this source.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_id)(struct _cef_media_source_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if this source is valid.
|
||||
///
|
||||
int(CEF_CALLBACK* is_valid)(struct _cef_media_source_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if this source outputs its content via Cast.
|
||||
///
|
||||
int(CEF_CALLBACK* is_cast_source)(struct _cef_media_source_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if this source outputs its content via DIAL.
|
||||
///
|
||||
int(CEF_CALLBACK* is_dial_source)(struct _cef_media_source_t* self);
|
||||
} cef_media_source_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_MEDIA_ROUTER_CAPI_H_
|
63
include/capi/cef_registration_capi.h
Normal file
63
include/capi/cef_registration_capi.h
Normal file
@@ -0,0 +1,63 @@
|
||||
// Copyright (c) 2020 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool and should not edited
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=029e237cf80f94a25453bac5a9b1e0765bb56f37$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REGISTRATION_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_REGISTRATION_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
// Generic callback structure used for managing the lifespan of a registration.
|
||||
///
|
||||
typedef struct _cef_registration_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
} cef_registration_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_REGISTRATION_CAPI_H_
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=2b01472d9b9a8cc9d1b2e669c91c2849bdb162e9$
|
||||
// $hash=7ce0953f069204a4dd2037c4a05ac9454c5e66a6$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_CAPI_H_
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "include/capi/cef_cookie_capi.h"
|
||||
#include "include/capi/cef_extension_capi.h"
|
||||
#include "include/capi/cef_extension_handler_capi.h"
|
||||
#include "include/capi/cef_media_router_capi.h"
|
||||
#include "include/capi/cef_values_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -353,6 +354,12 @@ typedef struct _cef_request_context_t {
|
||||
struct _cef_extension_t*(CEF_CALLBACK* get_extension)(
|
||||
struct _cef_request_context_t* self,
|
||||
const cef_string_t* extension_id);
|
||||
|
||||
///
|
||||
// Returns the MediaRouter object associated with this context.
|
||||
///
|
||||
struct _cef_media_router_t*(CEF_CALLBACK* get_media_router)(
|
||||
struct _cef_request_context_t* self);
|
||||
} cef_request_context_t;
|
||||
|
||||
///
|
||||
|
@@ -34,7 +34,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=06d0c1ccfa43926a01cbeb3ec95ff2a001fd0b45$
|
||||
// $hash=789c89f59dd4f5aac704644d0d64cbf658506382$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_API_HASH_H_
|
||||
@@ -47,13 +47,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 "3ad9591f7024619a1e2fd796c7ad51ae3a34abbb"
|
||||
#define CEF_API_HASH_UNIVERSAL "5f9a1d7977affd8006aff83fe4ab7c408c3288f0"
|
||||
#if defined(OS_WIN)
|
||||
#define CEF_API_HASH_PLATFORM "3b8e38ae40c1a930227c6277c39dbc24081ccec1"
|
||||
#define CEF_API_HASH_PLATFORM "5131b8a7e8097ab4c415227c65e7385a3363b56f"
|
||||
#elif defined(OS_MACOSX)
|
||||
#define CEF_API_HASH_PLATFORM "4a77f1908fabccdb01a2d3bdbede5ca09fbaa394"
|
||||
#define CEF_API_HASH_PLATFORM "136b3df0013c4997f81de2eba43fca2e36ad603c"
|
||||
#elif defined(OS_LINUX)
|
||||
#define CEF_API_HASH_PLATFORM "434da6be7db70fd90c4265118ac47ace4073c6ae"
|
||||
#define CEF_API_HASH_PLATFORM "7353c7e128ad2e0185a93f488876e607f57f576a"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
300
include/cef_media_router.h
Normal file
300
include/cef_media_router.h
Normal file
@@ -0,0 +1,300 @@
|
||||
// Copyright (c) 2020 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// The contents of this file must follow a specific format in order to
|
||||
// support the CEF translator tool. See the translator.README.txt file in the
|
||||
// tools directory for more information.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CEF_MEDIA_ROUTER_H_
|
||||
#define CEF_INCLUDE_CEF_MEDIA_ROUTER_H_
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_registration.h"
|
||||
|
||||
class CefMediaObserver;
|
||||
class CefMediaRoute;
|
||||
class CefMediaRouteCreateCallback;
|
||||
class CefMediaSink;
|
||||
class CefMediaSource;
|
||||
|
||||
///
|
||||
// Supports discovery of and communication with media devices on the local
|
||||
// network via the Cast and DIAL protocols. The methods of this class may be
|
||||
// called on any browser process thread unless otherwise indicated.
|
||||
///
|
||||
/*--cef(source=library)--*/
|
||||
class CefMediaRouter : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Returns the MediaRouter object associated with the global request context.
|
||||
// Equivalent to calling
|
||||
// CefRequestContext::GetGlobalContext()->GetMediaRouter().
|
||||
///
|
||||
/*--cef()--*/
|
||||
static CefRefPtr<CefMediaRouter> GetGlobalMediaRouter();
|
||||
|
||||
///
|
||||
// Add an observer for MediaRouter events. The observer will remain registered
|
||||
// until the returned Registration object is destroyed.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefRegistration> AddObserver(
|
||||
CefRefPtr<CefMediaObserver> observer) = 0;
|
||||
|
||||
///
|
||||
// Returns a MediaSource object for the specified media source URN. Supported
|
||||
// URN schemes include "cast:" and "dial:", and will be already known by the
|
||||
// client application (e.g. "cast:<appId>?clientId=<clientId>").
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefMediaSource> GetSource(const CefString& urn) = 0;
|
||||
|
||||
///
|
||||
// Trigger an asynchronous call to CefMediaObserver::OnSinks on all
|
||||
// registered observers.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void NotifyCurrentSinks() = 0;
|
||||
|
||||
///
|
||||
// Create a new route between |source| and |sink|. Source and sink must be
|
||||
// valid, compatible (as reported by CefMediaSink::IsCompatibleWith), and a
|
||||
// route between them must not already exist. |callback| will be executed
|
||||
// on success or failure. If route creation succeeds it will also trigger an
|
||||
// asynchronous call to CefMediaObserver::OnRoutes on all registered
|
||||
// observers.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void CreateRoute(CefRefPtr<CefMediaSource> source,
|
||||
CefRefPtr<CefMediaSink> sink,
|
||||
CefRefPtr<CefMediaRouteCreateCallback> callback) = 0;
|
||||
|
||||
///
|
||||
// Trigger an asynchronous call to CefMediaObserver::OnRoutes on all
|
||||
// registered observers.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void NotifyCurrentRoutes() = 0;
|
||||
};
|
||||
|
||||
///
|
||||
// Implemented by the client to observe MediaRouter events and registered via
|
||||
// CefMediaRouter::AddObserver. The methods of this class will be called on the
|
||||
// browser process UI thread.
|
||||
///
|
||||
/*--cef(source=client)--*/
|
||||
class CefMediaObserver : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
typedef cef_media_route_connection_state_t ConnectionState;
|
||||
|
||||
///
|
||||
// The list of available media sinks has changed or
|
||||
// CefMediaRouter::NotifyCurrentSinks was called.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnSinks(const std::vector<CefRefPtr<CefMediaSink>>& sinks) = 0;
|
||||
|
||||
///
|
||||
// The list of available media routes has changed or
|
||||
// CefMediaRouter::NotifyCurrentRoutes was called.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnRoutes(
|
||||
const std::vector<CefRefPtr<CefMediaRoute>>& routes) = 0;
|
||||
|
||||
///
|
||||
// The connection state of |route| has changed.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnRouteStateChanged(CefRefPtr<CefMediaRoute> route,
|
||||
ConnectionState state) = 0;
|
||||
|
||||
///
|
||||
// A message was recieved over |route|. |message| is only valid for
|
||||
// the scope of this callback and should be copied if necessary.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnRouteMessageReceived(CefRefPtr<CefMediaRoute> route,
|
||||
const void* message,
|
||||
size_t message_size) = 0;
|
||||
};
|
||||
|
||||
///
|
||||
// Represents the route between a media source and sink. Instances of this
|
||||
// object are created via CefMediaRouter::CreateRoute and retrieved via
|
||||
// CefMediaObserver::OnRoutes. Contains the status and metadata of a
|
||||
// routing operation. The methods of this class may be called on any browser
|
||||
// process thread unless otherwise indicated.
|
||||
///
|
||||
/*--cef(source=library)--*/
|
||||
class CefMediaRoute : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Returns the ID for this route.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefString GetId() = 0;
|
||||
|
||||
///
|
||||
// Returns the source associated with this route.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefMediaSource> GetSource() = 0;
|
||||
|
||||
///
|
||||
// Returns the sink associated with this route.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefMediaSink> GetSink() = 0;
|
||||
|
||||
///
|
||||
// Send a message over this route. |message| will be copied if necessary.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SendRouteMessage(const void* message, size_t message_size) = 0;
|
||||
|
||||
///
|
||||
// Terminate this route. Will result in an asynchronous call to
|
||||
// CefMediaObserver::OnRoutes on all registered observers.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void Terminate() = 0;
|
||||
};
|
||||
|
||||
///
|
||||
// Callback interface for CefMediaRouter::CreateRoute. The methods of this
|
||||
// class will be called on the browser process UI thread.
|
||||
///
|
||||
/*--cef(source=client)--*/
|
||||
class CefMediaRouteCreateCallback : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
typedef cef_media_route_create_result_t RouteCreateResult;
|
||||
|
||||
///
|
||||
// Method that will be executed when the route creation has finished. |result|
|
||||
// will be CEF_MRCR_OK if the route creation succeeded. |error| will be a
|
||||
// description of the error if the route creation failed. |route| is the
|
||||
// resulting route, or empty if the route creation failed.
|
||||
///
|
||||
/*--cef(optional_param=error,optional_param=route)--*/
|
||||
virtual void OnMediaRouteCreateFinished(RouteCreateResult result,
|
||||
const CefString& error,
|
||||
CefRefPtr<CefMediaRoute> route) = 0;
|
||||
};
|
||||
|
||||
///
|
||||
// Represents a sink to which media can be routed. Instances of this object are
|
||||
// retrieved via CefMediaObserver::OnSinks. The methods of this class may
|
||||
// be called on any browser process thread unless otherwise indicated.
|
||||
///
|
||||
/*--cef(source=library)--*/
|
||||
class CefMediaSink : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Returns the ID for this sink.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefString GetId() = 0;
|
||||
|
||||
///
|
||||
// Returns true if this sink is valid.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsValid() = 0;
|
||||
|
||||
///
|
||||
// Returns the name of this sink.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefString GetName() = 0;
|
||||
|
||||
///
|
||||
// Returns the description of this sink.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefString GetDescription() = 0;
|
||||
|
||||
///
|
||||
// Returns true if this sink accepts content via Cast.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsCastSink() = 0;
|
||||
|
||||
///
|
||||
// Returns true if this sink accepts content via DIAL.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsDialSink() = 0;
|
||||
|
||||
///
|
||||
// Returns true if this sink is compatible with |source|.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsCompatibleWith(CefRefPtr<CefMediaSource> source) = 0;
|
||||
};
|
||||
|
||||
///
|
||||
// Represents a source from which media can be routed. Instances of this object
|
||||
// are retrieved via CefMediaRouter::GetSource. The methods of this class may be
|
||||
// called on any browser process thread unless otherwise indicated.
|
||||
///
|
||||
/*--cef(source=library)--*/
|
||||
class CefMediaSource : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Returns the ID (media source URN or URL) for this source.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefString GetId() = 0;
|
||||
|
||||
///
|
||||
// Returns true if this source is valid.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsValid() = 0;
|
||||
|
||||
///
|
||||
// Returns true if this source outputs its content via Cast.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsCastSource() = 0;
|
||||
|
||||
///
|
||||
// Returns true if this source outputs its content via DIAL.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsDialSource() = 0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_MEDIA_ROUTER_H_
|
49
include/cef_registration.h
Normal file
49
include/cef_registration.h
Normal file
@@ -0,0 +1,49 @@
|
||||
// Copyright (c) 2020 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// The contents of this file must follow a specific format in order to
|
||||
// support the CEF translator tool. See the translator.README.txt file in the
|
||||
// tools directory for more information.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CEF_REGISTRATION_H_
|
||||
#define CEF_INCLUDE_CEF_REGISTRATION_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
|
||||
///
|
||||
// Generic callback interface used for managing the lifespan of a registration.
|
||||
///
|
||||
/*--cef(source=library)--*/
|
||||
class CefRegistration : public virtual CefBaseRefCounted {};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_REGISTRATION_H_
|
@@ -44,6 +44,7 @@
|
||||
#include "include/cef_cookie.h"
|
||||
#include "include/cef_extension.h"
|
||||
#include "include/cef_extension_handler.h"
|
||||
#include "include/cef_media_router.h"
|
||||
#include "include/cef_values.h"
|
||||
|
||||
class CefRequestContextHandler;
|
||||
@@ -361,6 +362,12 @@ class CefRequestContext : public virtual CefBaseRefCounted {
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefExtension> GetExtension(
|
||||
const CefString& extension_id) = 0;
|
||||
|
||||
///
|
||||
// Returns the MediaRouter object associated with this context.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefMediaRouter> GetMediaRouter() = 0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_REQUEST_CONTEXT_H_
|
||||
|
@@ -1775,6 +1775,7 @@ typedef enum {
|
||||
EVENTFLAG_IS_KEY_PAD = 1 << 9,
|
||||
EVENTFLAG_IS_LEFT = 1 << 10,
|
||||
EVENTFLAG_IS_RIGHT = 1 << 11,
|
||||
EVENTFLAG_ALTGR_DOWN = 1 << 12,
|
||||
} cef_event_flags_t;
|
||||
|
||||
///
|
||||
@@ -2292,21 +2293,10 @@ typedef enum {
|
||||
///
|
||||
UU_URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS = 1 << 3,
|
||||
|
||||
///
|
||||
// Unescapes characters that can be used in spoofing attempts (such as LOCK)
|
||||
// and control characters (such as BiDi control characters and %01). This
|
||||
// INCLUDES NULLs. This is used for rare cases such as data: URL decoding
|
||||
// where the result is binary data.
|
||||
//
|
||||
// DO NOT use UU_SPOOFING_AND_CONTROL_CHARS if the URL is going to be
|
||||
// displayed in the UI for security reasons.
|
||||
///
|
||||
UU_SPOOFING_AND_CONTROL_CHARS = 1 << 4,
|
||||
|
||||
///
|
||||
// URL queries use "+" for space. This flag controls that replacement.
|
||||
///
|
||||
UU_REPLACE_PLUS_WITH_SPACE = 1 << 5,
|
||||
UU_REPLACE_PLUS_WITH_SPACE = 1 << 4,
|
||||
} cef_uri_unescape_rule_t;
|
||||
|
||||
///
|
||||
@@ -2953,6 +2943,36 @@ typedef struct _cef_composition_underline_t {
|
||||
int thick;
|
||||
} cef_composition_underline_t;
|
||||
|
||||
///
|
||||
// Result codes for CefMediaRouter::CreateRoute. These constants match
|
||||
// their equivalents in Chromium's route_request_result.h and should not be
|
||||
// renumbered.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_MRCR_UNKNOWN_ERROR = 0,
|
||||
CEF_MRCR_OK = 1,
|
||||
CEF_MRCR_TIMED_OUT = 2,
|
||||
CEF_MRCR_ROUTE_NOT_FOUND = 3,
|
||||
CEF_MRCR_SINK_NOT_FOUND = 4,
|
||||
CEF_MRCR_INVALID_ORIGIN = 5,
|
||||
CEF_MRCR_NO_SUPPORTED_PROVIDER = 7,
|
||||
CEF_MRCR_CANCELLED = 8,
|
||||
CEF_MRCR_ROUTE_ALREADY_EXISTS = 9,
|
||||
|
||||
CEF_MRCR_TOTAL_COUNT = 11 // The total number of values.
|
||||
} cef_media_route_create_result_t;
|
||||
|
||||
///
|
||||
// Connection state for a MediaRoute object.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_MRCS_UNKNOWN,
|
||||
CEF_MRCS_CONNECTING,
|
||||
CEF_MRCS_CONNECTED,
|
||||
CEF_MRCS_CLOSED,
|
||||
CEF_MRCS_TERMINATED,
|
||||
} cef_media_route_connection_state_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/download_manager_delegate.h"
|
||||
#include "libcef/browser/extensions/extension_system.h"
|
||||
#include "libcef/browser/media_router/media_router_manager.h"
|
||||
#include "libcef/browser/prefs/browser_prefs.h"
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
#include "libcef/browser/ssl_host_state_delegate.h"
|
||||
@@ -164,6 +165,11 @@ base::LazyInstance<ImplManager>::DestructorAtExit g_manager =
|
||||
base::LazyInstance<ImplManager>::Leaky g_manager = LAZY_INSTANCE_INITIALIZER;
|
||||
#endif
|
||||
|
||||
CefBrowserContext* GetSelf(base::WeakPtr<CefBrowserContext> self) {
|
||||
CEF_REQUIRE_UIT();
|
||||
return self.get();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// Creates and manages VisitedLinkEventListener objects for each
|
||||
@@ -220,8 +226,9 @@ class CefVisitedLinkListener : public visitedlink::VisitedLinkWriter::Listener {
|
||||
};
|
||||
|
||||
CefBrowserContext::CefBrowserContext(const CefRequestContextSettings& settings)
|
||||
: settings_(settings) {
|
||||
: settings_(settings), weak_ptr_factory_(this) {
|
||||
g_manager.Get().AddImpl(this);
|
||||
getter_ = base::BindRepeating(GetSelf, weak_ptr_factory_.GetWeakPtr());
|
||||
}
|
||||
|
||||
CefBrowserContext::~CefBrowserContext() {
|
||||
@@ -233,6 +240,9 @@ CefBrowserContext::~CefBrowserContext() {
|
||||
// Unregister the context first to avoid re-entrancy during shutdown.
|
||||
g_manager.Get().RemoveImpl(this, cache_path_);
|
||||
|
||||
// Destroy objects that may hold references to the MediaRouter.
|
||||
media_router_manager_.reset();
|
||||
|
||||
// Send notifications to clean up objects associated with this Profile.
|
||||
MaybeSendDestroyedNotification();
|
||||
|
||||
@@ -812,3 +822,11 @@ bool CefBrowserContext::IsPrintPreviewSupported() const {
|
||||
|
||||
return !GetPrefs()->GetBoolean(prefs::kPrintPreviewDisabled);
|
||||
}
|
||||
|
||||
CefMediaRouterManager* CefBrowserContext::GetMediaRouterManager() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!media_router_manager_) {
|
||||
media_router_manager_.reset(new CefMediaRouterManager(this));
|
||||
}
|
||||
return media_router_manager_.get();
|
||||
}
|
||||
|
@@ -13,8 +13,10 @@
|
||||
#include "libcef/browser/request_context_handler_map.h"
|
||||
#include "libcef/browser/resource_context.h"
|
||||
|
||||
#include "base/callback.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "chrome/browser/download/download_prefs.h"
|
||||
#include "chrome/common/plugin.mojom.h"
|
||||
#include "components/proxy_config/pref_proxy_config_tracker.h"
|
||||
@@ -84,6 +86,7 @@
|
||||
*/
|
||||
|
||||
class CefDownloadManagerDelegate;
|
||||
class CefMediaRouterManager;
|
||||
class CefRequestContextImpl;
|
||||
class CefSSLHostStateDelegate;
|
||||
class CefVisitedLinkListener;
|
||||
@@ -279,6 +282,13 @@ class CefBrowserContext : public ChromeProfileStub,
|
||||
// Returns true if this context supports print preview.
|
||||
bool IsPrintPreviewSupported() const;
|
||||
|
||||
CefMediaRouterManager* GetMediaRouterManager();
|
||||
|
||||
// Returns the BrowserContext, or nullptr if the BrowserContext has already
|
||||
// been destroyed.
|
||||
using Getter = base::RepeatingCallback<CefBrowserContext*()>;
|
||||
Getter getter() const { return getter_; }
|
||||
|
||||
private:
|
||||
// Allow deletion via std::unique_ptr().
|
||||
friend std::default_delete<CefBrowserContext>;
|
||||
@@ -315,6 +325,8 @@ class CefBrowserContext : public ChromeProfileStub,
|
||||
|
||||
std::unique_ptr<DownloadPrefs> download_prefs_;
|
||||
|
||||
std::unique_ptr<CefMediaRouterManager> media_router_manager_;
|
||||
|
||||
// Map IDs to CefRequestContextHandler objects.
|
||||
CefRequestContextHandlerMap handler_map_;
|
||||
|
||||
@@ -338,6 +350,9 @@ class CefBrowserContext : public ChromeProfileStub,
|
||||
typedef std::set<int> NodeIdSet;
|
||||
NodeIdSet node_id_set_;
|
||||
|
||||
Getter getter_;
|
||||
base::WeakPtrFactory<CefBrowserContext> weak_ptr_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserContext);
|
||||
};
|
||||
|
||||
|
@@ -1079,7 +1079,7 @@ void CefBrowserHostImpl::WasResized() {
|
||||
if (!web_contents() || !platform_delegate_)
|
||||
return;
|
||||
|
||||
platform_delegate_->SynchronizeVisualProperties();
|
||||
platform_delegate_->WasResized();
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::WasHidden(bool hidden) {
|
||||
|
@@ -50,6 +50,7 @@
|
||||
#include "ui/wm/core/wm_state.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "chrome/browser/chrome_browser_main_win.h"
|
||||
#include "ui/base/cursor/cursor_loader_win.h"
|
||||
#endif
|
||||
#endif // defined(USE_AURA)
|
||||
@@ -128,6 +129,12 @@ void CefBrowserMainParts::PreMainMessageLoopStart() {
|
||||
DCHECK(local_state);
|
||||
OSCrypt::Init(local_state);
|
||||
#endif
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// installer_util references strings that are normally compiled into
|
||||
// setup.exe. In Chrome, these strings are in the locale files.
|
||||
ChromeBrowserMainPartsWin::SetupInstallerUtilStrings();
|
||||
#endif // defined(OS_WIN)
|
||||
}
|
||||
|
||||
void CefBrowserMainParts::PostMainMessageLoopStart() {
|
||||
|
@@ -145,7 +145,7 @@ class CefBrowserPlatformDelegate {
|
||||
virtual bool CanUseExternalBeginFrame() const = 0;
|
||||
|
||||
// Notify the window that it was resized.
|
||||
virtual void SynchronizeVisualProperties() = 0;
|
||||
virtual void WasResized() = 0;
|
||||
|
||||
// Send input events.
|
||||
virtual void SendKeyEvent(const CefKeyEvent& event) = 0;
|
||||
|
@@ -162,8 +162,10 @@ PrefService* ChromeBrowserProcessStub::local_state() {
|
||||
base::FilePath(CefString(&settings.cache_path));
|
||||
|
||||
// Used for very early NetworkService initialization.
|
||||
// Always persist preferences for this PrefService if possible because it
|
||||
// contains the cookie encryption key on Windows.
|
||||
local_state_ = browser_prefs::CreatePrefService(
|
||||
nullptr, cache_path, !!settings.persist_user_preferences);
|
||||
nullptr /* profile */, cache_path, true /* persist_user_preferences */);
|
||||
}
|
||||
return local_state_.get();
|
||||
}
|
||||
|
@@ -392,7 +392,6 @@ bool CefContext::Initialize(const CefMainArgs& args,
|
||||
#if defined(OS_WIN)
|
||||
sandbox::SandboxInterfaceInfo sandbox_info = {0};
|
||||
if (windows_sandbox_info == nullptr) {
|
||||
content::InitializeSandboxInfo(&sandbox_info);
|
||||
windows_sandbox_info = &sandbox_info;
|
||||
settings_.no_sandbox = true;
|
||||
}
|
||||
|
@@ -58,8 +58,10 @@ content::WebContents* GetOwnerForGuestContents(content::WebContents* guest) {
|
||||
static_cast<content::WebContentsImpl*>(guest);
|
||||
content::BrowserPluginGuest* plugin_guest =
|
||||
guest_impl->GetBrowserPluginGuest();
|
||||
if (plugin_guest)
|
||||
return plugin_guest->embedder_web_contents();
|
||||
if (plugin_guest) {
|
||||
return content::WebContents::FromRenderFrameHost(
|
||||
plugin_guest->GetEmbedderFrame());
|
||||
}
|
||||
|
||||
// Maybe it's a print preview dialog.
|
||||
auto print_preview_controller =
|
||||
|
@@ -47,7 +47,7 @@ SkColor CefBrowserPlatformDelegateBackground::GetBackgroundColor() const {
|
||||
return native_delegate_->GetBackgroundColor();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateBackground::SynchronizeVisualProperties() {
|
||||
void CefBrowserPlatformDelegateBackground::WasResized() {
|
||||
// Nothing to do here.
|
||||
}
|
||||
|
||||
|
@@ -24,7 +24,7 @@ class CefBrowserPlatformDelegateBackground
|
||||
SkColor GetBackgroundColor() const override;
|
||||
bool CanUseSharedTexture() const override;
|
||||
bool CanUseExternalBeginFrame() const override;
|
||||
void SynchronizeVisualProperties() override;
|
||||
void WasResized() override;
|
||||
void SendKeyEvent(const CefKeyEvent& event) override;
|
||||
void SendMouseClickEvent(const CefMouseEvent& event,
|
||||
CefBrowserHost::MouseButtonType type,
|
||||
|
@@ -367,6 +367,11 @@ void CefFrameHostImpl::SendCommand(
|
||||
if (frame_id < CefFrameHostImpl::kMainFrameId)
|
||||
return;
|
||||
|
||||
if (!render_frame_host_ || !response_manager_) {
|
||||
// detached frame has no response_manager_
|
||||
return;
|
||||
}
|
||||
|
||||
TRACE_EVENT2("cef", "CefFrameHostImpl::SendCommand", "frame_id", frame_id,
|
||||
"needsResponse", responseHandler.get() ? 1 : 0);
|
||||
Cef_Request_Params params;
|
||||
@@ -407,6 +412,11 @@ void CefFrameHostImpl::SendCode(
|
||||
if (frame_id < CefFrameHostImpl::kMainFrameId)
|
||||
return;
|
||||
|
||||
if (!render_frame_host_ || !response_manager_) {
|
||||
// detached frame has no response_manager_
|
||||
return;
|
||||
}
|
||||
|
||||
TRACE_EVENT2("cef", "CefFrameHostImpl::SendCommand", "frame_id", frame_id,
|
||||
"needsResponse", responseHandler.get() ? 1 : 0);
|
||||
Cef_Request_Params params;
|
||||
|
86
libcef/browser/media_router/media_route_impl.cc
Normal file
86
libcef/browser/media_router/media_route_impl.cc
Normal file
@@ -0,0 +1,86 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/media_router/media_route_impl.h"
|
||||
|
||||
#include "libcef/browser/media_router/media_router_manager.h"
|
||||
#include "libcef/browser/media_router/media_sink_impl.h"
|
||||
#include "libcef/browser/media_router/media_source_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// Do not keep a reference to the object returned by this method.
|
||||
CefBrowserContext* GetBrowserContext(const CefBrowserContext::Getter& getter) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!getter.is_null());
|
||||
|
||||
// Will return nullptr if the BrowserContext has been destroyed.
|
||||
return getter.Run();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefMediaRouteImpl::CefMediaRouteImpl(
|
||||
const media_router::MediaRoute& route,
|
||||
const CefBrowserContext::Getter& browser_context_getter)
|
||||
: route_(route), browser_context_getter_(browser_context_getter) {
|
||||
CEF_REQUIRE_UIT();
|
||||
}
|
||||
|
||||
CefString CefMediaRouteImpl::GetId() {
|
||||
return route_.media_route_id();
|
||||
}
|
||||
|
||||
CefRefPtr<CefMediaSource> CefMediaRouteImpl::GetSource() {
|
||||
return new CefMediaSourceImpl(route_.media_source().id());
|
||||
}
|
||||
|
||||
CefRefPtr<CefMediaSink> CefMediaRouteImpl::GetSink() {
|
||||
// Note: The MediaRoute::media_sink_name() method is missing in this Chromium
|
||||
// verison, so we need to use an empty value.
|
||||
return new CefMediaSinkImpl(route_.media_sink_id(),
|
||||
std::string() /* sink_name */);
|
||||
}
|
||||
|
||||
void CefMediaRouteImpl::SendRouteMessage(const void* message,
|
||||
size_t message_size) {
|
||||
std::string message_str(reinterpret_cast<const char*>(message), message_size);
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(
|
||||
[](CefRefPtr<CefMediaRouteImpl> self, std::string message_str) {
|
||||
self->SendRouteMessageInternal(std::move(message_str));
|
||||
},
|
||||
CefRefPtr<CefMediaRouteImpl>(this), std::move(message_str)));
|
||||
return;
|
||||
}
|
||||
|
||||
SendRouteMessageInternal(std::move(message_str));
|
||||
}
|
||||
|
||||
void CefMediaRouteImpl::Terminate() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefMediaRouteImpl::Terminate, this));
|
||||
return;
|
||||
}
|
||||
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
return;
|
||||
|
||||
browser_context->GetMediaRouterManager()->TerminateRoute(
|
||||
route_.media_route_id());
|
||||
}
|
||||
|
||||
void CefMediaRouteImpl::SendRouteMessageInternal(std::string message) {
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
return;
|
||||
|
||||
browser_context->GetMediaRouterManager()->SendRouteMessage(
|
||||
route_.media_route_id(), message);
|
||||
}
|
40
libcef/browser/media_router/media_route_impl.h
Normal file
40
libcef/browser/media_router/media_route_impl.h
Normal file
@@ -0,0 +1,40 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_IMPL_H_
|
||||
#define CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_IMPL_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_media_router.h"
|
||||
#include "libcef/browser/browser_context.h"
|
||||
|
||||
#include "chrome/common/media_router/media_route.h"
|
||||
|
||||
// Implementation of the CefMediaRoute interface. Only created on the UI thread.
|
||||
class CefMediaRouteImpl : public CefMediaRoute {
|
||||
public:
|
||||
CefMediaRouteImpl(const media_router::MediaRoute& route,
|
||||
const CefBrowserContext::Getter& browser_context_getter);
|
||||
|
||||
// CefMediaRoute methods.
|
||||
CefString GetId() override;
|
||||
CefRefPtr<CefMediaSource> GetSource() override;
|
||||
CefRefPtr<CefMediaSink> GetSink() override;
|
||||
void SendRouteMessage(const void* message, size_t message_size) override;
|
||||
void Terminate() override;
|
||||
|
||||
const media_router::MediaRoute& route() const { return route_; }
|
||||
|
||||
private:
|
||||
void SendRouteMessageInternal(std::string message);
|
||||
|
||||
// Read-only after creation.
|
||||
const media_router::MediaRoute route_;
|
||||
const CefBrowserContext::Getter browser_context_getter_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefMediaRouteImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefMediaRouteImpl);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_IMPL_H_
|
290
libcef/browser/media_router/media_router_impl.cc
Normal file
290
libcef/browser/media_router/media_router_impl.cc
Normal file
@@ -0,0 +1,290 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/media_router/media_router_impl.h"
|
||||
|
||||
#include "libcef/browser/media_router/media_route_impl.h"
|
||||
#include "libcef/browser/media_router/media_router_manager.h"
|
||||
#include "libcef/browser/media_router/media_sink_impl.h"
|
||||
#include "libcef/browser/media_router/media_source_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// Do not keep a reference to the object returned by this method.
|
||||
CefBrowserContext* GetBrowserContext(const CefBrowserContext::Getter& getter) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!getter.is_null());
|
||||
|
||||
// Will return nullptr if the BrowserContext has been destroyed.
|
||||
return getter.Run();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
class CefRegistrationImpl : public CefRegistration,
|
||||
public CefMediaRouterManager::Observer {
|
||||
public:
|
||||
explicit CefRegistrationImpl(CefRefPtr<CefMediaObserver> observer)
|
||||
: observer_(observer) {
|
||||
DCHECK(observer_);
|
||||
}
|
||||
|
||||
~CefRegistrationImpl() override {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
// May be null if OnMediaRouterDestroyed was called.
|
||||
if (browser_context_getter_.is_null())
|
||||
return;
|
||||
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
return;
|
||||
|
||||
browser_context->GetMediaRouterManager()->RemoveObserver(this);
|
||||
}
|
||||
|
||||
void Initialize(const CefBrowserContext::Getter& browser_context_getter) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!browser_context_getter.is_null());
|
||||
DCHECK(browser_context_getter_.is_null());
|
||||
browser_context_getter_ = browser_context_getter;
|
||||
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
return;
|
||||
|
||||
browser_context->GetMediaRouterManager()->AddObserver(this);
|
||||
}
|
||||
|
||||
private:
|
||||
// CefMediaRouterManager::Observer methods:
|
||||
void OnMediaRouterDestroyed() override { browser_context_getter_.Reset(); }
|
||||
|
||||
void OnMediaSinks(
|
||||
const CefMediaRouterManager::MediaSinkVector& sinks) override {
|
||||
std::vector<CefRefPtr<CefMediaSink>> cef_sinks;
|
||||
for (const auto& sink : sinks) {
|
||||
cef_sinks.push_back(new CefMediaSinkImpl(sink.sink));
|
||||
}
|
||||
observer_->OnSinks(cef_sinks);
|
||||
}
|
||||
|
||||
void OnMediaRoutes(
|
||||
const CefMediaRouterManager::MediaRouteVector& routes) override {
|
||||
std::vector<CefRefPtr<CefMediaRoute>> cef_routes;
|
||||
for (const auto& route : routes) {
|
||||
cef_routes.push_back(MakeCefRoute(route));
|
||||
}
|
||||
observer_->OnRoutes(cef_routes);
|
||||
}
|
||||
|
||||
void OnMediaRouteMessages(
|
||||
const media_router::MediaRoute& route,
|
||||
const CefMediaRouterManager::MediaMessageVector& messages) override {
|
||||
CefRefPtr<CefMediaRoute> cef_route = MakeCefRoute(route);
|
||||
for (const auto& message : messages) {
|
||||
if (message->type == media_router::mojom::RouteMessage::Type::TEXT) {
|
||||
if (message->message.has_value()) {
|
||||
const std::string& str = *(message->message);
|
||||
observer_->OnRouteMessageReceived(cef_route, str.c_str(), str.size());
|
||||
}
|
||||
} else if (message->type ==
|
||||
media_router::mojom::RouteMessage::Type::BINARY) {
|
||||
if (message->data.has_value()) {
|
||||
const std::vector<uint8_t>& data = *(message->data);
|
||||
observer_->OnRouteMessageReceived(cef_route, data.data(),
|
||||
data.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnMediaRouteStateChange(
|
||||
const media_router::MediaRoute& route,
|
||||
const content::PresentationConnectionStateChangeInfo& info) override {
|
||||
observer_->OnRouteStateChanged(MakeCefRoute(route),
|
||||
ToConnectionState(info.state));
|
||||
}
|
||||
|
||||
CefRefPtr<CefMediaRoute> MakeCefRoute(const media_router::MediaRoute& route) {
|
||||
return new CefMediaRouteImpl(route, browser_context_getter_);
|
||||
}
|
||||
|
||||
static CefMediaObserver::ConnectionState ToConnectionState(
|
||||
blink::mojom::PresentationConnectionState state) {
|
||||
switch (state) {
|
||||
case blink::mojom::PresentationConnectionState::CONNECTING:
|
||||
return CEF_MRCS_CONNECTING;
|
||||
case blink::mojom::PresentationConnectionState::CONNECTED:
|
||||
return CEF_MRCS_CONNECTED;
|
||||
case blink::mojom::PresentationConnectionState::CLOSED:
|
||||
return CEF_MRCS_CLOSED;
|
||||
case blink::mojom::PresentationConnectionState::TERMINATED:
|
||||
return CEF_MRCS_TERMINATED;
|
||||
}
|
||||
NOTREACHED();
|
||||
return CEF_MRCS_UNKNOWN;
|
||||
}
|
||||
|
||||
CefRefPtr<CefMediaObserver> observer_;
|
||||
CefBrowserContext::Getter browser_context_getter_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefRegistrationImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefRegistrationImpl);
|
||||
};
|
||||
|
||||
CefMediaRouterImpl::CefMediaRouterImpl() {
|
||||
// Verify that our enum matches Chromium's values.
|
||||
static_assert(
|
||||
static_cast<int>(CEF_MRCR_TOTAL_COUNT) ==
|
||||
static_cast<int>(media_router::RouteRequestResult::TOTAL_COUNT),
|
||||
"enum mismatch");
|
||||
}
|
||||
|
||||
void CefMediaRouterImpl::Initialize(
|
||||
const CefBrowserContext::Getter& browser_context_getter) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!browser_context_getter.is_null());
|
||||
DCHECK(browser_context_getter_.is_null());
|
||||
browser_context_getter_ = browser_context_getter;
|
||||
}
|
||||
|
||||
CefRefPtr<CefRegistration> CefMediaRouterImpl::AddObserver(
|
||||
CefRefPtr<CefMediaObserver> observer) {
|
||||
if (!observer)
|
||||
return nullptr;
|
||||
CefRefPtr<CefRegistrationImpl> registration =
|
||||
new CefRegistrationImpl(observer);
|
||||
InitializeRegistrationOnUIThread(registration);
|
||||
return registration.get();
|
||||
}
|
||||
|
||||
CefRefPtr<CefMediaSource> CefMediaRouterImpl::GetSource(const CefString& urn) {
|
||||
if (urn.empty())
|
||||
return nullptr;
|
||||
|
||||
// Check for a valid URL and supported Cast/DIAL schemes.
|
||||
GURL presentation_url(urn.ToString());
|
||||
if (!media_router::IsValidPresentationUrl(presentation_url)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (presentation_url.SchemeIsHTTPOrHTTPS()) {
|
||||
// We don't support tab/desktop mirroring, which is what Cast uses for
|
||||
// arbitrary HTTP/HTTPS URLs (see CastMediaSource).
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return new CefMediaSourceImpl(presentation_url);
|
||||
}
|
||||
|
||||
void CefMediaRouterImpl::NotifyCurrentSinks() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT, base::BindOnce(&CefMediaRouterImpl::NotifyCurrentSinks, this));
|
||||
return;
|
||||
}
|
||||
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
return;
|
||||
|
||||
browser_context->GetMediaRouterManager()->NotifyCurrentSinks();
|
||||
}
|
||||
|
||||
void CefMediaRouterImpl::CreateRoute(
|
||||
CefRefPtr<CefMediaSource> source,
|
||||
CefRefPtr<CefMediaSink> sink,
|
||||
CefRefPtr<CefMediaRouteCreateCallback> callback) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefMediaRouterImpl::CreateRoute,
|
||||
this, source, sink, callback));
|
||||
return;
|
||||
}
|
||||
|
||||
std::string error;
|
||||
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context) {
|
||||
error = "Context has already been destroyed";
|
||||
} else if (!source || !source->IsValid()) {
|
||||
error = "Source is empty or invalid";
|
||||
} else if (!sink || !sink->IsValid()) {
|
||||
error = "Sink is empty or invalid";
|
||||
} else if (!sink->IsCompatibleWith(source)) {
|
||||
error = "Sink is not compatible with source";
|
||||
}
|
||||
|
||||
if (!error.empty()) {
|
||||
LOG(WARNING) << "Media route creation failed: " << error;
|
||||
if (callback) {
|
||||
callback->OnMediaRouteCreateFinished(CEF_MRCR_UNKNOWN_ERROR, error,
|
||||
nullptr);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
auto source_impl = static_cast<CefMediaSourceImpl*>(source.get());
|
||||
auto sink_impl = static_cast<CefMediaSinkImpl*>(sink.get());
|
||||
|
||||
browser_context->GetMediaRouterManager()->CreateRoute(
|
||||
source_impl->source().id(), sink_impl->sink().id(), url::Origin(),
|
||||
base::BindOnce(&CefMediaRouterImpl::CreateRouteCallback, this, callback));
|
||||
}
|
||||
|
||||
void CefMediaRouterImpl::NotifyCurrentRoutes() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(
|
||||
&CefMediaRouterImpl::NotifyCurrentRoutes, this));
|
||||
return;
|
||||
}
|
||||
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
return;
|
||||
|
||||
browser_context->GetMediaRouterManager()->NotifyCurrentRoutes();
|
||||
}
|
||||
|
||||
void CefMediaRouterImpl::InitializeRegistrationOnUIThread(
|
||||
CefRefPtr<CefRegistrationImpl> registration) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefMediaRouterImpl::InitializeRegistrationOnUIThread,
|
||||
this, registration));
|
||||
return;
|
||||
}
|
||||
registration->Initialize(browser_context_getter_);
|
||||
}
|
||||
|
||||
void CefMediaRouterImpl::CreateRouteCallback(
|
||||
CefRefPtr<CefMediaRouteCreateCallback> callback,
|
||||
const media_router::RouteRequestResult& result) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
if (result.result_code() != media_router::RouteRequestResult::OK) {
|
||||
LOG(WARNING) << "Media route creation failed: " << result.error() << " ("
|
||||
<< result.result_code() << ")";
|
||||
}
|
||||
|
||||
if (!callback)
|
||||
return;
|
||||
|
||||
CefRefPtr<CefMediaRoute> route;
|
||||
if (result.result_code() == media_router::RouteRequestResult::OK &&
|
||||
result.route()) {
|
||||
route = new CefMediaRouteImpl(*result.route(), browser_context_getter_);
|
||||
}
|
||||
|
||||
callback->OnMediaRouteCreateFinished(
|
||||
static_cast<cef_media_route_create_result_t>(result.result_code()),
|
||||
result.error(), route);
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefMediaRouter> CefMediaRouter::GetGlobalMediaRouter() {
|
||||
return CefRequestContext::GetGlobalContext()->GetMediaRouter();
|
||||
}
|
49
libcef/browser/media_router/media_router_impl.h
Normal file
49
libcef/browser/media_router/media_router_impl.h
Normal file
@@ -0,0 +1,49 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_IMPL_H_
|
||||
#define CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_IMPL_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_media_router.h"
|
||||
#include "libcef/browser/browser_context.h"
|
||||
|
||||
#include "chrome/common/media_router/mojom/media_router.mojom.h"
|
||||
|
||||
class CefRegistrationImpl;
|
||||
|
||||
// Implementation of the CefMediaRouter interface. May be created on any thread.
|
||||
class CefMediaRouterImpl : public CefMediaRouter {
|
||||
public:
|
||||
CefMediaRouterImpl();
|
||||
|
||||
// Called on the UI thread after object creation and before any other object
|
||||
// methods are executed on the UI thread.
|
||||
void Initialize(const CefBrowserContext::Getter& browser_context_getter);
|
||||
|
||||
// CefMediaRouter methods.
|
||||
CefRefPtr<CefRegistration> AddObserver(
|
||||
CefRefPtr<CefMediaObserver> observer) override;
|
||||
CefRefPtr<CefMediaSource> GetSource(const CefString& urn) override;
|
||||
void NotifyCurrentSinks() override;
|
||||
void CreateRoute(CefRefPtr<CefMediaSource> source,
|
||||
CefRefPtr<CefMediaSink> sink,
|
||||
CefRefPtr<CefMediaRouteCreateCallback> callback) override;
|
||||
void NotifyCurrentRoutes() override;
|
||||
|
||||
private:
|
||||
void InitializeRegistrationOnUIThread(
|
||||
CefRefPtr<CefRegistrationImpl> registration);
|
||||
|
||||
void CreateRouteCallback(CefRefPtr<CefMediaRouteCreateCallback> callback,
|
||||
const media_router::RouteRequestResult& result);
|
||||
|
||||
// Only accessed on the UI thread. Will be non-null after Initialize().
|
||||
CefBrowserContext::Getter browser_context_getter_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefMediaRouterImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefMediaRouterImpl);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_IMPL_H_
|
292
libcef/browser/media_router/media_router_manager.cc
Normal file
292
libcef/browser/media_router/media_router_manager.cc
Normal file
@@ -0,0 +1,292 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/media_router/media_router_manager.h"
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "chrome/browser/media/router/media_router_factory.h"
|
||||
#include "chrome/browser/media/router/media_routes_observer.h"
|
||||
#include "chrome/browser/media/router/route_message_observer.h"
|
||||
#include "chrome/browser/media/router/route_message_util.h"
|
||||
|
||||
namespace {
|
||||
|
||||
const int kTimeoutMs = 5 * 1000;
|
||||
const char kDefaultPresentationUrl[] = "https://google.com";
|
||||
|
||||
} // namespace
|
||||
|
||||
class CefMediaRoutesObserver : public media_router::MediaRoutesObserver {
|
||||
public:
|
||||
explicit CefMediaRoutesObserver(CefMediaRouterManager* manager)
|
||||
: media_router::MediaRoutesObserver(manager->GetMediaRouter()),
|
||||
manager_(manager) {}
|
||||
|
||||
void OnRoutesUpdated(const std::vector<media_router::MediaRoute>& routes,
|
||||
const std::vector<media_router::MediaRoute::Id>&
|
||||
joinable_route_ids) override {
|
||||
manager_->routes_ = routes;
|
||||
manager_->NotifyCurrentRoutes();
|
||||
}
|
||||
|
||||
private:
|
||||
CefMediaRouterManager* const manager_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefMediaRoutesObserver);
|
||||
};
|
||||
|
||||
// Used to receive messages if PresentationConnection is not supported.
|
||||
class CefRouteMessageObserver : public media_router::RouteMessageObserver {
|
||||
public:
|
||||
CefRouteMessageObserver(CefMediaRouterManager* manager,
|
||||
const media_router::MediaRoute& route)
|
||||
: media_router::RouteMessageObserver(manager->GetMediaRouter(),
|
||||
route.media_route_id()),
|
||||
manager_(manager),
|
||||
route_(route) {}
|
||||
|
||||
void OnMessagesReceived(
|
||||
CefMediaRouterManager::MediaMessageVector messages) override {
|
||||
manager_->OnMessagesReceived(route_, messages);
|
||||
}
|
||||
|
||||
private:
|
||||
CefMediaRouterManager* const manager_;
|
||||
const media_router::MediaRoute route_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefRouteMessageObserver);
|
||||
};
|
||||
|
||||
// Used for messaging and route status notifications with Cast.
|
||||
class CefPresentationConnection : public blink::mojom::PresentationConnection {
|
||||
public:
|
||||
explicit CefPresentationConnection(
|
||||
CefMediaRouterManager* manager,
|
||||
const media_router::MediaRoute& route,
|
||||
media_router::mojom::RoutePresentationConnectionPtr connections)
|
||||
: manager_(manager),
|
||||
route_(route),
|
||||
connection_receiver_(this, std::move(connections->connection_receiver)),
|
||||
connection_remote_(std::move(connections->connection_remote)) {}
|
||||
|
||||
void OnMessage(
|
||||
blink::mojom::PresentationConnectionMessagePtr message) override {
|
||||
CefMediaRouterManager::MediaMessageVector messages;
|
||||
if (message->is_message()) {
|
||||
messages.push_back(media_router::message_util::RouteMessageFromString(
|
||||
message->get_message()));
|
||||
} else if (message->is_data()) {
|
||||
messages.push_back(media_router::message_util::RouteMessageFromData(
|
||||
message->get_data()));
|
||||
}
|
||||
if (!messages.empty()) {
|
||||
manager_->OnMessagesReceived(route_, messages);
|
||||
}
|
||||
}
|
||||
|
||||
void DidChangeState(
|
||||
blink::mojom::PresentationConnectionState state) override {
|
||||
// May result in |this| being deleted, so post async and allow the call
|
||||
// stack to unwind.
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefMediaRouterManager::OnRouteStateChange,
|
||||
manager_->weak_ptr_factory_.GetWeakPtr(), route_,
|
||||
content::PresentationConnectionStateChangeInfo(state)));
|
||||
}
|
||||
|
||||
void DidClose(
|
||||
blink::mojom::PresentationConnectionCloseReason reason) override {
|
||||
DidChangeState(blink::mojom::PresentationConnectionState::CLOSED);
|
||||
}
|
||||
|
||||
void SendRouteMessage(const std::string& message) {
|
||||
connection_remote_->OnMessage(
|
||||
blink::mojom::PresentationConnectionMessage::NewMessage(message));
|
||||
}
|
||||
|
||||
private:
|
||||
CefMediaRouterManager* const manager_;
|
||||
const media_router::MediaRoute route_;
|
||||
|
||||
// Used to receive messages from the MRP.
|
||||
mojo::Receiver<blink::mojom::PresentationConnection> connection_receiver_;
|
||||
|
||||
// Used to send messages to the MRP.
|
||||
mojo::Remote<blink::mojom::PresentationConnection> connection_remote_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefPresentationConnection);
|
||||
};
|
||||
|
||||
CefMediaRouterManager::CefMediaRouterManager(CefBrowserContext* browser_context)
|
||||
: browser_context_(browser_context),
|
||||
query_result_manager_(GetMediaRouter()),
|
||||
weak_ptr_factory_(this) {
|
||||
// Perform initialization.
|
||||
GetMediaRouter()->OnUserGesture();
|
||||
|
||||
query_result_manager_.AddObserver(this);
|
||||
|
||||
// A non-empty presentation URL to required for discovery of Cast devices.
|
||||
query_result_manager_.SetSourcesForCastMode(
|
||||
media_router::MediaCastMode::PRESENTATION,
|
||||
{media_router::MediaSource::ForPresentationUrl(
|
||||
GURL(kDefaultPresentationUrl))},
|
||||
url::Origin());
|
||||
|
||||
routes_observer_ = std::make_unique<CefMediaRoutesObserver>(this);
|
||||
}
|
||||
|
||||
CefMediaRouterManager::~CefMediaRouterManager() {
|
||||
CEF_REQUIRE_UIT();
|
||||
for (auto& observer : observers_) {
|
||||
observers_.RemoveObserver(&observer);
|
||||
observer.OnMediaRouterDestroyed();
|
||||
}
|
||||
|
||||
query_result_manager_.RemoveObserver(this);
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::AddObserver(Observer* observer) {
|
||||
CEF_REQUIRE_UIT();
|
||||
observers_.AddObserver(observer);
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::RemoveObserver(Observer* observer) {
|
||||
CEF_REQUIRE_UIT();
|
||||
observers_.RemoveObserver(observer);
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::NotifyCurrentSinks() {
|
||||
CEF_REQUIRE_UIT();
|
||||
for (auto& observer : observers_) {
|
||||
observer.OnMediaSinks(sinks_);
|
||||
}
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::NotifyCurrentRoutes() {
|
||||
CEF_REQUIRE_UIT();
|
||||
for (auto& observer : observers_) {
|
||||
observer.OnMediaRoutes(routes_);
|
||||
}
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::CreateRoute(
|
||||
const media_router::MediaSource::Id& source_id,
|
||||
const media_router::MediaSink::Id& sink_id,
|
||||
const url::Origin& origin,
|
||||
CreateRouteResultCallback callback) {
|
||||
GetMediaRouter()->CreateRoute(
|
||||
source_id, sink_id, origin, nullptr /* web_contents */,
|
||||
base::BindOnce(&CefMediaRouterManager::OnCreateRoute,
|
||||
weak_ptr_factory_.GetWeakPtr(), std::move(callback)),
|
||||
base::TimeDelta::FromMilliseconds(kTimeoutMs), false /* incognito */);
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::SendRouteMessage(
|
||||
const media_router::MediaRoute::Id& route_id,
|
||||
const std::string& message) {
|
||||
// Must use PresentationConnection to send messages if it exists.
|
||||
auto state = GetRouteState(route_id);
|
||||
if (state && state->presentation_connection_) {
|
||||
state->presentation_connection_->SendRouteMessage(message);
|
||||
return;
|
||||
}
|
||||
|
||||
GetMediaRouter()->SendRouteMessage(route_id, message);
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::TerminateRoute(
|
||||
const media_router::MediaRoute::Id& route_id) {
|
||||
GetMediaRouter()->TerminateRoute(route_id);
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::OnResultsUpdated(const MediaSinkVector& sinks) {
|
||||
sinks_ = sinks;
|
||||
NotifyCurrentSinks();
|
||||
}
|
||||
|
||||
media_router::MediaRouter* CefMediaRouterManager::GetMediaRouter() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
return media_router::MediaRouterFactory::GetApiForBrowserContext(
|
||||
browser_context_);
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::OnCreateRoute(
|
||||
CreateRouteResultCallback callback,
|
||||
media_router::mojom::RoutePresentationConnectionPtr connection,
|
||||
const media_router::RouteRequestResult& result) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (result.route()) {
|
||||
CreateRouteState(*result.route(), std::move(connection));
|
||||
}
|
||||
|
||||
std::move(callback).Run(result);
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::OnRouteStateChange(
|
||||
const media_router::MediaRoute& route,
|
||||
const content::PresentationConnectionStateChangeInfo& info) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (info.state == blink::mojom::PresentationConnectionState::CLOSED ||
|
||||
info.state == blink::mojom::PresentationConnectionState::TERMINATED) {
|
||||
RemoveRouteState(route.media_route_id());
|
||||
}
|
||||
|
||||
for (auto& observer : observers_) {
|
||||
observer.OnMediaRouteStateChange(route, info);
|
||||
}
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::OnMessagesReceived(
|
||||
const media_router::MediaRoute& route,
|
||||
const MediaMessageVector& messages) {
|
||||
CEF_REQUIRE_UIT();
|
||||
for (auto& observer : observers_) {
|
||||
observer.OnMediaRouteMessages(route, messages);
|
||||
}
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::CreateRouteState(
|
||||
const media_router::MediaRoute& route,
|
||||
media_router::mojom::RoutePresentationConnectionPtr connection) {
|
||||
const auto route_id = route.media_route_id();
|
||||
auto state = std::make_unique<RouteState>();
|
||||
|
||||
if (!connection.is_null()) {
|
||||
// PresentationConnection must be used for messaging and status
|
||||
// notifications if it exists.
|
||||
state->presentation_connection_ =
|
||||
std::make_unique<CefPresentationConnection>(this, route,
|
||||
std::move(connection));
|
||||
} else {
|
||||
// Fallback if PresentationConnection is not supported.
|
||||
state->message_observer_ =
|
||||
std::make_unique<CefRouteMessageObserver>(this, route);
|
||||
state->state_subscription_ =
|
||||
GetMediaRouter()->AddPresentationConnectionStateChangedCallback(
|
||||
route_id,
|
||||
base::BindRepeating(&CefMediaRouterManager::OnRouteStateChange,
|
||||
weak_ptr_factory_.GetWeakPtr(), route));
|
||||
}
|
||||
|
||||
route_state_map_.insert(std::make_pair(route_id, std::move(state)));
|
||||
}
|
||||
|
||||
CefMediaRouterManager::RouteState* CefMediaRouterManager::GetRouteState(
|
||||
const media_router::MediaRoute::Id& route_id) {
|
||||
const auto it = route_state_map_.find(route_id);
|
||||
if (it != route_state_map_.end())
|
||||
return it->second.get();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::RemoveRouteState(
|
||||
const media_router::MediaRoute::Id& route_id) {
|
||||
auto it = route_state_map_.find(route_id);
|
||||
if (it != route_state_map_.end())
|
||||
route_state_map_.erase(it);
|
||||
}
|
125
libcef/browser/media_router/media_router_manager.h
Normal file
125
libcef/browser/media_router/media_router_manager.h
Normal file
@@ -0,0 +1,125 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MANAGER_H_
|
||||
#define CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MANAGER_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_media_router.h"
|
||||
#include "libcef/browser/browser_context.h"
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/observer_list.h"
|
||||
#include "chrome/browser/media/router/media_router.h"
|
||||
#include "chrome/browser/ui/media_router/query_result_manager.h"
|
||||
#include "chrome/common/media_router/mojom/media_router.mojom.h"
|
||||
|
||||
class CefBrowserContext;
|
||||
class CefMediaRoutesObserver;
|
||||
class CefPresentationConnection;
|
||||
class CefRouteMessageObserver;
|
||||
|
||||
// Manages CEF usage of MediaRouter. Owned by CefBrowserContext and only
|
||||
// accessed on the UI thread.
|
||||
class CefMediaRouterManager
|
||||
: public media_router::QueryResultManager::Observer {
|
||||
public:
|
||||
using MediaRouteVector = std::vector<media_router::MediaRoute>;
|
||||
using MediaSinkVector = std::vector<media_router::MediaSinkWithCastModes>;
|
||||
using MediaMessageVector = std::vector<media_router::mojom::RouteMessagePtr>;
|
||||
|
||||
class Observer : public base::CheckedObserver {
|
||||
public:
|
||||
virtual void OnMediaRouterDestroyed() = 0;
|
||||
|
||||
virtual void OnMediaSinks(const MediaSinkVector& sinks) = 0;
|
||||
virtual void OnMediaRoutes(const MediaRouteVector& routes) = 0;
|
||||
|
||||
virtual void OnMediaRouteMessages(const media_router::MediaRoute& route,
|
||||
const MediaMessageVector& messages) = 0;
|
||||
virtual void OnMediaRouteStateChange(
|
||||
const media_router::MediaRoute& route,
|
||||
const content::PresentationConnectionStateChangeInfo& info) = 0;
|
||||
|
||||
protected:
|
||||
~Observer() override {}
|
||||
};
|
||||
|
||||
explicit CefMediaRouterManager(CefBrowserContext* browser_context);
|
||||
~CefMediaRouterManager() override;
|
||||
|
||||
// |observer| must outlive this object or be removed.
|
||||
void AddObserver(Observer* observer);
|
||||
void RemoveObserver(Observer* observer);
|
||||
|
||||
void NotifyCurrentSinks();
|
||||
void NotifyCurrentRoutes();
|
||||
|
||||
using CreateRouteResultCallback =
|
||||
base::OnceCallback<void(const media_router::RouteRequestResult& result)>;
|
||||
|
||||
void CreateRoute(const media_router::MediaSource::Id& source_id,
|
||||
const media_router::MediaSink::Id& sink_id,
|
||||
const url::Origin& origin,
|
||||
CreateRouteResultCallback callback);
|
||||
|
||||
void SendRouteMessage(const media_router::MediaRoute::Id& route_id,
|
||||
const std::string& message);
|
||||
void TerminateRoute(const media_router::MediaRoute::Id& route_id);
|
||||
|
||||
// QueryResultManager::Observer methods.
|
||||
void OnResultsUpdated(const MediaSinkVector& sinks) override;
|
||||
|
||||
private:
|
||||
friend class CefMediaRoutesObserver;
|
||||
friend class CefPresentationConnection;
|
||||
friend class CefRouteMessageObserver;
|
||||
|
||||
// Do not keep a reference to the object returned by this method.
|
||||
media_router::MediaRouter* GetMediaRouter() const;
|
||||
|
||||
void OnCreateRoute(
|
||||
CreateRouteResultCallback callback,
|
||||
media_router::mojom::RoutePresentationConnectionPtr connection,
|
||||
const media_router::RouteRequestResult& result);
|
||||
void OnRouteStateChange(
|
||||
const media_router::MediaRoute& route,
|
||||
const content::PresentationConnectionStateChangeInfo& info);
|
||||
void OnMessagesReceived(const media_router::MediaRoute& route,
|
||||
const MediaMessageVector& messages);
|
||||
|
||||
struct RouteState {
|
||||
std::unique_ptr<CefPresentationConnection> presentation_connection_;
|
||||
|
||||
// Used if there is no RoutePresentationConnectionPtr.
|
||||
std::unique_ptr<CefRouteMessageObserver> message_observer_;
|
||||
std::unique_ptr<media_router::PresentationConnectionStateSubscription>
|
||||
state_subscription_;
|
||||
};
|
||||
void CreateRouteState(
|
||||
const media_router::MediaRoute& route,
|
||||
media_router::mojom::RoutePresentationConnectionPtr connection);
|
||||
RouteState* GetRouteState(const media_router::MediaRoute::Id& route_id);
|
||||
void RemoveRouteState(const media_router::MediaRoute::Id& route_id);
|
||||
|
||||
CefBrowserContext* const browser_context_;
|
||||
|
||||
base::ObserverList<Observer> observers_;
|
||||
|
||||
media_router::QueryResultManager query_result_manager_;
|
||||
std::unique_ptr<CefMediaRoutesObserver> routes_observer_;
|
||||
|
||||
MediaRouteVector routes_;
|
||||
MediaSinkVector sinks_;
|
||||
|
||||
using RouteStateMap =
|
||||
std::map<media_router::MediaRoute::Id, std::unique_ptr<RouteState>>;
|
||||
RouteStateMap route_state_map_;
|
||||
|
||||
base::WeakPtrFactory<CefMediaRouterManager> weak_ptr_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefMediaRouterManager);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MANAGER_H_
|
46
libcef/browser/media_router/media_sink_impl.cc
Normal file
46
libcef/browser/media_router/media_sink_impl.cc
Normal file
@@ -0,0 +1,46 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/media_router/media_sink_impl.h"
|
||||
|
||||
CefMediaSinkImpl::CefMediaSinkImpl(const media_router::MediaSink& sink)
|
||||
: sink_(sink) {}
|
||||
|
||||
CefMediaSinkImpl::CefMediaSinkImpl(const media_router::MediaSink::Id& sink_id,
|
||||
const std::string& sink_name)
|
||||
: sink_(sink_id, sink_name, media_router::SinkIconType::GENERIC) {}
|
||||
|
||||
CefString CefMediaSinkImpl::GetId() {
|
||||
return sink_.id();
|
||||
}
|
||||
|
||||
bool CefMediaSinkImpl::IsValid() {
|
||||
return true;
|
||||
}
|
||||
|
||||
CefString CefMediaSinkImpl::GetName() {
|
||||
return sink_.name();
|
||||
}
|
||||
|
||||
CefString CefMediaSinkImpl::GetDescription() {
|
||||
return sink_.description().value_or("");
|
||||
}
|
||||
|
||||
bool CefMediaSinkImpl::IsCastSink() {
|
||||
return sink_.provider_id() == media_router::CAST;
|
||||
}
|
||||
|
||||
bool CefMediaSinkImpl::IsDialSink() {
|
||||
return sink_.provider_id() == media_router::DIAL;
|
||||
}
|
||||
|
||||
bool CefMediaSinkImpl::IsCompatibleWith(CefRefPtr<CefMediaSource> source) {
|
||||
if (source) {
|
||||
if (IsCastSink())
|
||||
return source->IsCastSource();
|
||||
if (IsDialSink())
|
||||
return source->IsDialSource();
|
||||
}
|
||||
return false;
|
||||
}
|
39
libcef/browser/media_router/media_sink_impl.h
Normal file
39
libcef/browser/media_router/media_sink_impl.h
Normal file
@@ -0,0 +1,39 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_SINK_IMPL_H_
|
||||
#define CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_SINK_IMPL_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_media_router.h"
|
||||
|
||||
#include "chrome/common/media_router/media_sink.h"
|
||||
|
||||
// Implementation of the CefMediaSink interface. May be created on any thread.
|
||||
class CefMediaSinkImpl : public CefMediaSink {
|
||||
public:
|
||||
explicit CefMediaSinkImpl(const media_router::MediaSink& sink);
|
||||
CefMediaSinkImpl(const media_router::MediaSink::Id& sink_id,
|
||||
const std::string& sink_name);
|
||||
|
||||
// CefMediaSink methods.
|
||||
CefString GetId() override;
|
||||
bool IsValid() override;
|
||||
CefString GetName() override;
|
||||
CefString GetDescription() override;
|
||||
bool IsCastSink() override;
|
||||
bool IsDialSink() override;
|
||||
bool IsCompatibleWith(CefRefPtr<CefMediaSource> source) override;
|
||||
|
||||
const media_router::MediaSink& sink() const { return sink_; }
|
||||
|
||||
private:
|
||||
// Read-only after creation.
|
||||
const media_router::MediaSink sink_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefMediaSinkImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefMediaSinkImpl);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_SINK_IMPL_H_
|
28
libcef/browser/media_router/media_source_impl.cc
Normal file
28
libcef/browser/media_router/media_source_impl.cc
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/media_router/media_source_impl.h"
|
||||
|
||||
CefMediaSourceImpl::CefMediaSourceImpl(
|
||||
const media_router::MediaSource::Id& source_id)
|
||||
: source_(source_id) {}
|
||||
|
||||
CefMediaSourceImpl::CefMediaSourceImpl(const GURL& presentation_url)
|
||||
: source_(presentation_url) {}
|
||||
|
||||
CefString CefMediaSourceImpl::GetId() {
|
||||
return source_.id();
|
||||
}
|
||||
|
||||
bool CefMediaSourceImpl::IsValid() {
|
||||
return source_.IsValid();
|
||||
}
|
||||
|
||||
bool CefMediaSourceImpl::IsCastSource() {
|
||||
return !IsDialSource();
|
||||
}
|
||||
|
||||
bool CefMediaSourceImpl::IsDialSource() {
|
||||
return source_.IsDialSource();
|
||||
}
|
35
libcef/browser/media_router/media_source_impl.h
Normal file
35
libcef/browser/media_router/media_source_impl.h
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_IMPL_H_
|
||||
#define CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_IMPL_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_media_router.h"
|
||||
|
||||
#include "chrome/common/media_router/media_source.h"
|
||||
|
||||
// Implementation of the CefMediaSource interface. May be created on any thread.
|
||||
class CefMediaSourceImpl : public CefMediaSource {
|
||||
public:
|
||||
explicit CefMediaSourceImpl(const media_router::MediaSource::Id& source_id);
|
||||
explicit CefMediaSourceImpl(const GURL& presentation_url);
|
||||
|
||||
// CefMediaSource methods.
|
||||
CefString GetId() override;
|
||||
bool IsValid() override;
|
||||
bool IsCastSource() override;
|
||||
bool IsDialSource() override;
|
||||
|
||||
const media_router::MediaSource& source() const { return source_; }
|
||||
|
||||
private:
|
||||
// Read-only after creation.
|
||||
const media_router::MediaSource source_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefMediaSourceImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefMediaSourceImpl);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_IMPL_H_
|
@@ -33,7 +33,7 @@ bool CefBrowserPlatformDelegateNative::CanUseExternalBeginFrame() const {
|
||||
return use_external_begin_frame_;
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNative::SynchronizeVisualProperties() {
|
||||
void CefBrowserPlatformDelegateNative::WasResized() {
|
||||
content::RenderViewHost* host = browser_->web_contents()->GetRenderViewHost();
|
||||
if (host)
|
||||
host->GetWidget()->SynchronizeVisualProperties();
|
||||
|
@@ -28,7 +28,7 @@ class CefBrowserPlatformDelegateNative : public CefBrowserPlatformDelegate {
|
||||
bool CanUseSharedTexture() const override;
|
||||
bool CanUseExternalBeginFrame() const override;
|
||||
SkColor GetBackgroundColor() const override;
|
||||
void SynchronizeVisualProperties() override;
|
||||
void WasResized() override;
|
||||
bool IsWindowless() const override;
|
||||
bool IsViewsHosted() const override;
|
||||
|
||||
|
@@ -176,7 +176,8 @@ ui::MouseWheelEvent CefBrowserPlatformDelegateNativeAura::TranslateUiWheelEvent(
|
||||
int changed_button_flags =
|
||||
TranslateUiChangedButtonFlags(mouse_event.modifiers);
|
||||
|
||||
return ui::MouseWheelEvent(offset, location, root_location, time_stamp, flags,
|
||||
return ui::MouseWheelEvent(offset, location, root_location, time_stamp,
|
||||
(ui::EF_PRECISION_SCROLLING_DELTA | flags),
|
||||
changed_button_flags);
|
||||
}
|
||||
|
||||
@@ -209,6 +210,8 @@ int CefBrowserPlatformDelegateNativeAura::TranslateUiEventModifiers(
|
||||
result |= ui::EF_CAPS_LOCK_ON;
|
||||
if (cef_modifiers & EVENTFLAG_NUM_LOCK_ON)
|
||||
result |= ui::EF_NUM_LOCK_ON;
|
||||
if (cef_modifiers & EVENTFLAG_ALTGR_DOWN)
|
||||
result |= ui::EF_ALTGR_DOWN;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@@ -313,6 +313,16 @@ ui::KeyEvent CefBrowserPlatformDelegateNativeLinux::TranslateUiKeyEvent(
|
||||
return ui::KeyEvent(type, key_code, dom_code, flags, dom_key, time_stamp);
|
||||
}
|
||||
|
||||
content::NativeWebKeyboardEvent
|
||||
CefBrowserPlatformDelegateNativeLinux::TranslateWebKeyEvent(
|
||||
const CefKeyEvent& key_event) const {
|
||||
ui::KeyEvent ui_event = TranslateUiKeyEvent(key_event);
|
||||
if (key_event.type == KEYEVENT_CHAR) {
|
||||
return content::NativeWebKeyboardEvent(ui_event, key_event.character);
|
||||
}
|
||||
return content::NativeWebKeyboardEvent(ui_event);
|
||||
}
|
||||
|
||||
base::TimeTicks CefBrowserPlatformDelegateNativeLinux::GetEventTimeStamp()
|
||||
const {
|
||||
return base::TimeTicks() + base::TimeDelta::FromSeconds(GetSystemUptime());
|
||||
|
@@ -40,6 +40,8 @@ class CefBrowserPlatformDelegateNativeLinux
|
||||
|
||||
// CefBrowserPlatformDelegateNativeAura methods:
|
||||
ui::KeyEvent TranslateUiKeyEvent(const CefKeyEvent& key_event) const override;
|
||||
content::NativeWebKeyboardEvent TranslateWebKeyEvent(
|
||||
const CefKeyEvent& key_event) const override;
|
||||
base::TimeTicks GetEventTimeStamp() const override;
|
||||
|
||||
private:
|
||||
|
@@ -18,11 +18,19 @@ using network::mojom::CookieManager;
|
||||
|
||||
namespace {
|
||||
|
||||
// Do not keep a reference to the CookieManager returned by this method.
|
||||
CookieManager* GetCookieManager(CefRequestContextImpl* request_context) {
|
||||
// Do not keep a reference to the object returned by this method.
|
||||
CefBrowserContext* GetBrowserContext(const CefBrowserContext::Getter& getter) {
|
||||
CEF_REQUIRE_UIT();
|
||||
return content::BrowserContext::GetDefaultStoragePartition(
|
||||
request_context->GetBrowserContext())
|
||||
DCHECK(!getter.is_null());
|
||||
|
||||
// Will return nullptr if the BrowserContext has been destroyed.
|
||||
return getter.Run();
|
||||
}
|
||||
|
||||
// Do not keep a reference to the object returned by this method.
|
||||
CookieManager* GetCookieManager(CefBrowserContext* browser_context) {
|
||||
CEF_REQUIRE_UIT();
|
||||
return content::BrowserContext::GetDefaultStoragePartition(browser_context)
|
||||
->GetCookieManagerForBrowserProcess();
|
||||
}
|
||||
|
||||
@@ -53,11 +61,15 @@ void DeleteCookiesCallbackImpl(CefRefPtr<CefDeleteCookiesCallback> callback,
|
||||
}
|
||||
|
||||
void ExecuteVisitor(CefRefPtr<CefCookieVisitor> visitor,
|
||||
CefRefPtr<CefRequestContextImpl> request_context,
|
||||
const CefBrowserContext::Getter& browser_context_getter,
|
||||
const std::vector<net::CanonicalCookie>& cookies) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
CookieManager* cookie_manager = GetCookieManager(request_context.get());
|
||||
auto browser_context = GetBrowserContext(browser_context_getter);
|
||||
if (!browser_context)
|
||||
return;
|
||||
|
||||
auto cookie_manager = GetCookieManager(browser_context);
|
||||
|
||||
int total = cookies.size(), count = 0;
|
||||
for (const auto& cc : cookies) {
|
||||
@@ -77,22 +89,24 @@ void ExecuteVisitor(CefRefPtr<CefCookieVisitor> visitor,
|
||||
}
|
||||
|
||||
// Always execute the callback asynchronously.
|
||||
void GetAllCookiesCallbackImpl(CefRefPtr<CefCookieVisitor> visitor,
|
||||
CefRefPtr<CefRequestContextImpl> request_context,
|
||||
const net::CookieList& cookies) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&ExecuteVisitor, visitor, request_context, cookies));
|
||||
void GetAllCookiesCallbackImpl(
|
||||
CefRefPtr<CefCookieVisitor> visitor,
|
||||
const CefBrowserContext::Getter& browser_context_getter,
|
||||
const net::CookieList& cookies) {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&ExecuteVisitor, visitor,
|
||||
browser_context_getter, cookies));
|
||||
}
|
||||
|
||||
void GetCookiesCallbackImpl(CefRefPtr<CefCookieVisitor> visitor,
|
||||
CefRefPtr<CefRequestContextImpl> request_context,
|
||||
const net::CookieStatusList& include_cookies,
|
||||
const net::CookieStatusList&) {
|
||||
void GetCookiesCallbackImpl(
|
||||
CefRefPtr<CefCookieVisitor> visitor,
|
||||
const CefBrowserContext::Getter& browser_context_getter,
|
||||
const net::CookieStatusList& include_cookies,
|
||||
const net::CookieStatusList&) {
|
||||
net::CookieList cookies;
|
||||
for (const auto& status : include_cookies) {
|
||||
cookies.push_back(status.cookie);
|
||||
}
|
||||
GetAllCookiesCallbackImpl(visitor, request_context, cookies);
|
||||
GetAllCookiesCallbackImpl(visitor, browser_context_getter, cookies);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -100,11 +114,12 @@ void GetCookiesCallbackImpl(CefRefPtr<CefCookieVisitor> visitor,
|
||||
CefCookieManagerImpl::CefCookieManagerImpl() {}
|
||||
|
||||
void CefCookieManagerImpl::Initialize(
|
||||
CefRefPtr<CefRequestContextImpl> request_context,
|
||||
CefBrowserContext::Getter browser_context_getter,
|
||||
CefRefPtr<CefCompletionCallback> callback) {
|
||||
DCHECK(request_context);
|
||||
DCHECK(!request_context_);
|
||||
request_context_ = request_context;
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!browser_context_getter.is_null());
|
||||
DCHECK(browser_context_getter_.is_null());
|
||||
browser_context_getter_ = browser_context_getter;
|
||||
RunAsyncCompletionOnUIThread(callback);
|
||||
}
|
||||
|
||||
@@ -132,11 +147,14 @@ void CefCookieManagerImpl::SetSupportedSchemes(
|
||||
all_schemes.push_back("wss");
|
||||
}
|
||||
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
return;
|
||||
|
||||
// This will be forwarded to the CookieMonster that lives in the
|
||||
// NetworkService process when the NetworkContext is created via
|
||||
// CefContentBrowserClient::CreateNetworkContext.
|
||||
request_context_->GetBrowserContext()->set_cookieable_schemes(
|
||||
base::make_optional(all_schemes));
|
||||
browser_context->set_cookieable_schemes(base::make_optional(all_schemes));
|
||||
RunAsyncCompletionOnUIThread(callback);
|
||||
}
|
||||
|
||||
@@ -153,9 +171,13 @@ bool CefCookieManagerImpl::VisitAllCookies(
|
||||
return true;
|
||||
}
|
||||
|
||||
GetCookieManager(request_context_.get())
|
||||
->GetAllCookies(
|
||||
base::Bind(&GetAllCookiesCallbackImpl, visitor, request_context_));
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
return false;
|
||||
|
||||
GetCookieManager(browser_context)
|
||||
->GetAllCookies(base::Bind(&GetAllCookiesCallbackImpl, visitor,
|
||||
browser_context_getter_));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -182,10 +204,14 @@ bool CefCookieManagerImpl::VisitUrlCookies(
|
||||
if (includeHttpOnly)
|
||||
options.set_include_httponly();
|
||||
|
||||
GetCookieManager(request_context_.get())
|
||||
->GetCookieList(
|
||||
gurl, options,
|
||||
base::Bind(&GetCookiesCallbackImpl, visitor, request_context_));
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
return false;
|
||||
|
||||
GetCookieManager(browser_context)
|
||||
->GetCookieList(gurl, options,
|
||||
base::Bind(&GetCookiesCallbackImpl, visitor,
|
||||
browser_context_getter_));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -233,7 +259,11 @@ bool CefCookieManagerImpl::SetCookie(const CefString& url,
|
||||
if (cookie.httponly)
|
||||
options.set_include_httponly();
|
||||
|
||||
GetCookieManager(request_context_.get())
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
return false;
|
||||
|
||||
GetCookieManager(browser_context)
|
||||
->SetCanonicalCookie(*canonical_cookie, gurl.scheme(), options,
|
||||
base::Bind(SetCookieCallbackImpl, callback));
|
||||
return true;
|
||||
@@ -270,7 +300,11 @@ bool CefCookieManagerImpl::DeleteCookies(
|
||||
deletion_filter->cookie_name = cookie_name;
|
||||
}
|
||||
|
||||
GetCookieManager(request_context_.get())
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
return false;
|
||||
|
||||
GetCookieManager(browser_context)
|
||||
->DeleteCookies(std::move(deletion_filter),
|
||||
base::Bind(DeleteCookiesCallbackImpl, callback));
|
||||
return true;
|
||||
@@ -286,7 +320,11 @@ bool CefCookieManagerImpl::FlushStore(
|
||||
return true;
|
||||
}
|
||||
|
||||
GetCookieManager(request_context_.get())
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
return false;
|
||||
|
||||
GetCookieManager(browser_context)
|
||||
->FlushCookieStore(base::Bind(RunAsyncCompletionOnUIThread, callback));
|
||||
return true;
|
||||
}
|
||||
|
@@ -6,19 +6,20 @@
|
||||
#define CEF_LIBCEF_BROWSER_NET_SERVICE_COOKIE_MANAGER_IMPL_H_
|
||||
|
||||
#include "include/cef_cookie.h"
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
|
||||
// Implementation of the CefCookieManager interface.
|
||||
// Implementation of the CefCookieManager interface. May be created on any
|
||||
// thread.
|
||||
class CefCookieManagerImpl : public CefCookieManager {
|
||||
public:
|
||||
CefCookieManagerImpl();
|
||||
|
||||
// Must be called immediately after this object is created when |is_blocking|
|
||||
// is false.
|
||||
void Initialize(CefRefPtr<CefRequestContextImpl> request_context,
|
||||
// Called on the UI thread after object creation and before any other object
|
||||
// methods are executed on the UI thread.
|
||||
void Initialize(CefBrowserContext::Getter browser_context_getter,
|
||||
CefRefPtr<CefCompletionCallback> callback);
|
||||
|
||||
// CefCookieManager methods.
|
||||
@@ -38,10 +39,11 @@ class CefCookieManagerImpl : public CefCookieManager {
|
||||
bool FlushStore(CefRefPtr<CefCompletionCallback> callback) override;
|
||||
|
||||
private:
|
||||
// Context that owns the cookie manager.
|
||||
CefRefPtr<CefRequestContextImpl> request_context_;
|
||||
// Only accessed on the UI thread. Will be non-null after Initialize().
|
||||
CefBrowserContext::Getter browser_context_getter_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefCookieManagerImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefCookieManagerImpl);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_NET_SERVICE_COOKIE_MANAGER_IMPL_H_
|
||||
|
@@ -831,15 +831,26 @@ void InterceptedRequest::ContinueToBeforeRedirect(
|
||||
request_.url = redirect_info.new_url;
|
||||
}
|
||||
|
||||
// If request_ changes from POST to GET, strip POST headers.
|
||||
const bool post_to_get =
|
||||
request_.method == "POST" &&
|
||||
redirect_info.new_method == net::HttpRequestHeaders::kGetMethod;
|
||||
|
||||
request_.method = redirect_info.new_method;
|
||||
request_.site_for_cookies = redirect_info.new_site_for_cookies;
|
||||
request_.referrer = GURL(redirect_info.new_referrer);
|
||||
request_.referrer_policy = redirect_info.new_referrer_policy;
|
||||
|
||||
// The request method can be changed to "GET". In this case we need to
|
||||
// reset the request body manually.
|
||||
if (request_.method == net::HttpRequestHeaders::kGetMethod)
|
||||
// reset the request body manually, and strip the POST headers.
|
||||
if (request_.method == net::HttpRequestHeaders::kGetMethod) {
|
||||
request_.request_body = nullptr;
|
||||
|
||||
if (post_to_get) {
|
||||
request_.headers.RemoveHeader(net::HttpRequestHeaders::kContentLength);
|
||||
request_.headers.RemoveHeader(net::HttpRequestHeaders::kContentType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InterceptedRequest::ContinueToResponseStarted(int error_code) {
|
||||
|
@@ -85,10 +85,10 @@ SkColor CefBrowserPlatformDelegateOsr::GetBackgroundColor() const {
|
||||
return native_delegate_->GetBackgroundColor();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateOsr::SynchronizeVisualProperties() {
|
||||
void CefBrowserPlatformDelegateOsr::WasResized() {
|
||||
CefRenderWidgetHostViewOSR* view = GetOSRHostView();
|
||||
if (view)
|
||||
view->SynchronizeVisualProperties();
|
||||
view->WasResized();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateOsr::SendKeyEvent(const CefKeyEvent& event) {
|
||||
|
@@ -30,7 +30,7 @@ class CefBrowserPlatformDelegateOsr
|
||||
SkColor GetBackgroundColor() const override;
|
||||
bool CanUseSharedTexture() const override;
|
||||
bool CanUseExternalBeginFrame() const override;
|
||||
void SynchronizeVisualProperties() override;
|
||||
void WasResized() override;
|
||||
void SendKeyEvent(const CefKeyEvent& event) override;
|
||||
void SendMouseClickEvent(const CefMouseEvent& event,
|
||||
CefBrowserHost::MouseButtonType type,
|
||||
|
@@ -149,6 +149,36 @@ ui::LatencyInfo CreateLatencyInfo(const blink::WebInputEvent& event) {
|
||||
return latency_info;
|
||||
}
|
||||
|
||||
gfx::Rect GetViewBounds(CefBrowserHostImpl* browser) {
|
||||
if (!browser)
|
||||
return gfx::Rect();
|
||||
|
||||
CefRect rc;
|
||||
CefRefPtr<CefRenderHandler> handler =
|
||||
browser->GetClient()->GetRenderHandler();
|
||||
CHECK(handler);
|
||||
|
||||
handler->GetViewRect(browser, rc);
|
||||
CHECK_GT(rc.width, 0);
|
||||
CHECK_GT(rc.height, 0);
|
||||
|
||||
return gfx::Rect(rc.x, rc.y, rc.width, rc.height);
|
||||
}
|
||||
|
||||
float GetDeviceScaleFactor(CefBrowserHostImpl* browser) {
|
||||
if (!browser)
|
||||
return kDefaultScaleFactor;
|
||||
|
||||
CefScreenInfo screen_info(kDefaultScaleFactor, 0, 0, false, CefRect(),
|
||||
CefRect());
|
||||
CefRefPtr<CefRenderHandler> handler = browser->client()->GetRenderHandler();
|
||||
CHECK(handler);
|
||||
if (!handler->GetScreenInfo(browser, screen_info))
|
||||
return kDefaultScaleFactor;
|
||||
|
||||
return screen_info.device_scale_factor;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
@@ -159,23 +189,12 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
CefRenderWidgetHostViewOSR* parent_host_view)
|
||||
: content::RenderWidgetHostViewBase(widget),
|
||||
background_color_(background_color),
|
||||
frame_rate_threshold_us_(0),
|
||||
host_display_client_(nullptr),
|
||||
hold_resize_(false),
|
||||
pending_resize_(false),
|
||||
pending_resize_force_(false),
|
||||
render_widget_host_(content::RenderWidgetHostImpl::From(widget)),
|
||||
has_parent_(parent_host_view != nullptr),
|
||||
parent_host_view_(parent_host_view),
|
||||
popup_host_view_(nullptr),
|
||||
child_host_view_(nullptr),
|
||||
is_showing_(false),
|
||||
is_destroyed_(false),
|
||||
pinch_zoom_enabled_(content::IsPinchToZoomEnabled()),
|
||||
is_scroll_offset_changed_pending_(false),
|
||||
mouse_wheel_phase_handler_(this),
|
||||
gesture_provider_(CreateGestureProviderConfig(), this),
|
||||
forward_touch_to_popup_(false),
|
||||
weak_ptr_factory_(this) {
|
||||
DCHECK(render_widget_host_);
|
||||
DCHECK(!render_widget_host_->GetView());
|
||||
@@ -191,9 +210,6 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
content::RenderViewHost::From(render_widget_host_));
|
||||
}
|
||||
|
||||
local_surface_id_allocator_.GenerateId();
|
||||
local_surface_id_allocation_ =
|
||||
local_surface_id_allocator_.GetCurrentLocalSurfaceIdAllocation();
|
||||
delegated_frame_host_client_.reset(new CefDelegatedFrameHostClient(this));
|
||||
|
||||
// Matching the attributes from BrowserCompositorMac.
|
||||
@@ -231,12 +247,9 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
if (render_widget_host_impl)
|
||||
render_widget_host_impl->SetCompositorForFlingScheduler(compositor_.get());
|
||||
|
||||
if (browser_impl_.get())
|
||||
ResizeRootLayer(false);
|
||||
|
||||
cursor_manager_.reset(new content::CursorManager(this));
|
||||
|
||||
// Do this last because it may result in a call to SetNeedsBeginFrames.
|
||||
// This may result in a call to GetFrameSinkId().
|
||||
render_widget_host_->SetView(this);
|
||||
|
||||
if (GetTextInputManager())
|
||||
@@ -248,15 +261,12 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
GetFrameSinkId(), this);
|
||||
}
|
||||
|
||||
if (!render_widget_host_->is_hidden()) {
|
||||
Show();
|
||||
}
|
||||
|
||||
if (!content::GpuDataManagerImpl::GetInstance()->IsGpuCompositingDisabled()) {
|
||||
video_consumer_.reset(new CefVideoConsumerOSR(this));
|
||||
video_consumer_->SetActive(true);
|
||||
video_consumer_->SetFrameRate(
|
||||
base::TimeDelta::FromMicroseconds(frame_rate_threshold_us_));
|
||||
if (browser_impl_ && !parent_host_view_) {
|
||||
// For child/popup views this will be called from the associated InitAs*()
|
||||
// method.
|
||||
SetRootLayerSize(false /* force */);
|
||||
if (!render_widget_host_->is_hidden())
|
||||
Show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,7 +307,7 @@ void CefRenderWidgetHostViewOSR::InitAsChild(gfx::NativeView parent_view) {
|
||||
// The parent view should not render while the full-screen view exists.
|
||||
parent_host_view_->Hide();
|
||||
|
||||
ResizeRootLayer(false);
|
||||
SetRootLayerSize(false /* force */);
|
||||
Show();
|
||||
}
|
||||
|
||||
@@ -321,25 +331,55 @@ bool CefRenderWidgetHostViewOSR::HasFocus() {
|
||||
}
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::IsSurfaceAvailableForCopy() {
|
||||
return GetDelegatedFrameHost()->CanCopyFromCompositingSurface();
|
||||
return delegated_frame_host_->CanCopyFromCompositingSurface();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::Show() {
|
||||
if (is_showing_)
|
||||
return;
|
||||
|
||||
if (!content::GpuDataManagerImpl::GetInstance()->IsGpuCompositingDisabled() &&
|
||||
!browser_impl_ &&
|
||||
(!parent_host_view_ || !parent_host_view_->browser_impl_)) {
|
||||
return;
|
||||
}
|
||||
|
||||
is_showing_ = true;
|
||||
|
||||
// If the viz::LocalSurfaceIdAllocation is invalid, we may have been evicted,
|
||||
// and no other visual properties have since been changed. Allocate a new id
|
||||
// and start synchronizing.
|
||||
if (!GetLocalSurfaceIdAllocation().IsValid()) {
|
||||
AllocateLocalSurfaceId();
|
||||
SynchronizeVisualProperties(cc::DeadlinePolicy::UseDefaultDeadline(),
|
||||
GetLocalSurfaceIdAllocation());
|
||||
}
|
||||
|
||||
if (render_widget_host_) {
|
||||
render_widget_host_->WasShown(
|
||||
base::nullopt /* record_tab_switch_time_request */);
|
||||
}
|
||||
|
||||
delegated_frame_host_->AttachToCompositor(compositor_.get());
|
||||
delegated_frame_host_->WasShown(
|
||||
GetLocalSurfaceIdAllocation().local_surface_id(),
|
||||
GetRootLayer()->bounds().size(), base::nullopt);
|
||||
GetLocalSurfaceIdAllocation().local_surface_id(), GetViewBounds().size(),
|
||||
base::nullopt);
|
||||
|
||||
// Note that |render_widget_host_| will retrieve size parameters from the
|
||||
// DelegatedFrameHost, so it must have WasShown called after.
|
||||
if (render_widget_host_)
|
||||
render_widget_host_->WasShown(
|
||||
base::nullopt /* record_tab_switch_time_request */);
|
||||
if (!content::GpuDataManagerImpl::GetInstance()->IsGpuCompositingDisabled()) {
|
||||
// Start generating frames when we're visible and at the correct size.
|
||||
if (!video_consumer_) {
|
||||
video_consumer_.reset(new CefVideoConsumerOSR(this));
|
||||
UpdateFrameRate();
|
||||
|
||||
// Call OnRenderFrameMetadataChangedAfterActivation for every frame.
|
||||
content::RenderFrameMetadataProviderImpl* provider =
|
||||
content::RenderWidgetHostImpl::From(render_widget_host_)
|
||||
->render_frame_metadata_provider();
|
||||
provider->ReportAllFrameSubmissionsForTesting(true);
|
||||
} else {
|
||||
video_consumer_->SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::Hide() {
|
||||
@@ -351,12 +391,16 @@ void CefRenderWidgetHostViewOSR::Hide() {
|
||||
if (browser_impl_.get())
|
||||
browser_impl_->CancelContextMenu();
|
||||
|
||||
if (video_consumer_) {
|
||||
video_consumer_->SetActive(false);
|
||||
}
|
||||
|
||||
if (render_widget_host_)
|
||||
render_widget_host_->WasHidden();
|
||||
|
||||
GetDelegatedFrameHost()->WasHidden(
|
||||
delegated_frame_host_->WasHidden(
|
||||
content::DelegatedFrameHost::HiddenCause::kOther);
|
||||
GetDelegatedFrameHost()->DetachFromCompositor();
|
||||
delegated_frame_host_->DetachFromCompositor();
|
||||
}
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::IsShowing() {
|
||||
@@ -365,26 +409,15 @@ bool CefRenderWidgetHostViewOSR::IsShowing() {
|
||||
|
||||
void CefRenderWidgetHostViewOSR::EnsureSurfaceSynchronizedForWebTest() {
|
||||
++latest_capture_sequence_number_;
|
||||
SynchronizeVisualProperties();
|
||||
SynchronizeVisualProperties(cc::DeadlinePolicy::UseInfiniteDeadline(),
|
||||
base::nullopt);
|
||||
}
|
||||
|
||||
gfx::Rect CefRenderWidgetHostViewOSR::GetViewBounds() {
|
||||
if (IsPopupWidget())
|
||||
return popup_position_;
|
||||
|
||||
if (!browser_impl_.get())
|
||||
return gfx::Rect();
|
||||
|
||||
CefRect rc;
|
||||
CefRefPtr<CefRenderHandler> handler =
|
||||
browser_impl_->GetClient()->GetRenderHandler();
|
||||
CHECK(handler);
|
||||
|
||||
handler->GetViewRect(browser_impl_.get(), rc);
|
||||
CHECK_GT(rc.width, 0);
|
||||
CHECK_GT(rc.height, 0);
|
||||
|
||||
return gfx::Rect(rc.x, rc.y, rc.width, rc.height);
|
||||
return current_view_bounds_;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SetBackgroundColor(SkColor color) {
|
||||
@@ -416,9 +449,9 @@ void CefRenderWidgetHostViewOSR::TakeFallbackContentFrom(
|
||||
CefRenderWidgetHostViewOSR* view_cef =
|
||||
static_cast<CefRenderWidgetHostViewOSR*>(view);
|
||||
SetBackgroundColor(view_cef->background_color_);
|
||||
if (GetDelegatedFrameHost() && view_cef->GetDelegatedFrameHost()) {
|
||||
GetDelegatedFrameHost()->TakeFallbackContentFrom(
|
||||
view_cef->GetDelegatedFrameHost());
|
||||
if (delegated_frame_host_ && view_cef->delegated_frame_host_) {
|
||||
delegated_frame_host_->TakeFallbackContentFrom(
|
||||
view_cef->delegated_frame_host_.get());
|
||||
}
|
||||
host()->GetContentRenderingTimeoutFrom(view_cef->host());
|
||||
}
|
||||
@@ -432,13 +465,55 @@ void CefRenderWidgetHostViewOSR::OnPresentCompositorFrame() {}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnDidUpdateVisualPropertiesComplete(
|
||||
const cc::RenderFrameMetadata& metadata) {
|
||||
bool force = false;
|
||||
if (metadata.local_surface_id_allocation) {
|
||||
force = local_surface_id_allocator_.UpdateFromChild(
|
||||
*metadata.local_surface_id_allocation);
|
||||
if (host()->is_hidden()) {
|
||||
// When an embedded child responds, we want to accept its changes to the
|
||||
// viz::LocalSurfaceId. However we do not want to embed surfaces while
|
||||
// hidden. Nor do we want to embed invalid ids when we are evicted. Becoming
|
||||
// visible will generate a new id, if necessary, and begin embedding.
|
||||
UpdateLocalSurfaceIdFromEmbeddedClient(
|
||||
metadata.local_surface_id_allocation);
|
||||
} else {
|
||||
SynchronizeVisualProperties(cc::DeadlinePolicy::UseDefaultDeadline(),
|
||||
metadata.local_surface_id_allocation);
|
||||
}
|
||||
}
|
||||
|
||||
SynchronizeVisualProperties(force);
|
||||
void CefRenderWidgetHostViewOSR::AllocateLocalSurfaceId() {
|
||||
if (!parent_local_surface_id_allocator_) {
|
||||
parent_local_surface_id_allocator_ =
|
||||
std::make_unique<viz::ParentLocalSurfaceIdAllocator>();
|
||||
}
|
||||
parent_local_surface_id_allocator_->GenerateId();
|
||||
}
|
||||
|
||||
const viz::LocalSurfaceIdAllocation&
|
||||
CefRenderWidgetHostViewOSR::GetCurrentLocalSurfaceIdAllocation() const {
|
||||
return parent_local_surface_id_allocator_
|
||||
->GetCurrentLocalSurfaceIdAllocation();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::UpdateLocalSurfaceIdFromEmbeddedClient(
|
||||
const base::Optional<viz::LocalSurfaceIdAllocation>&
|
||||
embedded_client_local_surface_id_allocation) {
|
||||
if (embedded_client_local_surface_id_allocation) {
|
||||
parent_local_surface_id_allocator_->UpdateFromChild(
|
||||
*embedded_client_local_surface_id_allocation);
|
||||
} else {
|
||||
AllocateLocalSurfaceId();
|
||||
}
|
||||
}
|
||||
|
||||
const viz::LocalSurfaceIdAllocation&
|
||||
CefRenderWidgetHostViewOSR::GetOrCreateLocalSurfaceIdAllocation() {
|
||||
if (!parent_local_surface_id_allocator_)
|
||||
AllocateLocalSurfaceId();
|
||||
return GetCurrentLocalSurfaceIdAllocation();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::InvalidateLocalSurfaceId() {
|
||||
if (!parent_local_surface_id_allocator_)
|
||||
return;
|
||||
parent_local_surface_id_allocator_->Invalidate();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::AddDamageRect(uint32_t sequence,
|
||||
@@ -465,7 +540,7 @@ void CefRenderWidgetHostViewOSR::SubmitCompositorFrame(
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ResetFallbackToFirstNavigationSurface() {
|
||||
GetDelegatedFrameHost()->ResetFallbackToFirstNavigationSurface();
|
||||
delegated_frame_host_->ResetFallbackToFirstNavigationSurface();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::InitAsPopup(
|
||||
@@ -487,18 +562,22 @@ void CefRenderWidgetHostViewOSR::InitAsPopup(
|
||||
|
||||
handler->OnPopupShow(browser_impl_.get(), true);
|
||||
|
||||
popup_position_ = pos;
|
||||
CefRect view_rect;
|
||||
handler->GetViewRect(browser_impl_.get(), view_rect);
|
||||
gfx::Rect client_pos(pos.x() - view_rect.x, pos.y() - view_rect.y,
|
||||
pos.width(), pos.height());
|
||||
|
||||
popup_position_ = client_pos;
|
||||
|
||||
CefRect widget_pos(client_pos.x(), client_pos.y(), client_pos.width(),
|
||||
client_pos.height());
|
||||
|
||||
CefRect widget_pos(pos.x(), pos.y(), pos.width(), pos.height());
|
||||
if (handler.get())
|
||||
handler->OnPopupSize(browser_impl_.get(), widget_pos);
|
||||
|
||||
if (video_consumer_) {
|
||||
video_consumer_->SizeChanged();
|
||||
}
|
||||
|
||||
ResizeRootLayer(false);
|
||||
|
||||
// The size doesn't change for popups so we need to force the
|
||||
// initialization.
|
||||
SetRootLayerSize(true /* force */);
|
||||
Show();
|
||||
}
|
||||
|
||||
@@ -635,8 +714,8 @@ void CefRenderWidgetHostViewOSR::CopyFromSurface(
|
||||
const gfx::Rect& src_rect,
|
||||
const gfx::Size& output_size,
|
||||
base::OnceCallback<void(const SkBitmap&)> callback) {
|
||||
GetDelegatedFrameHost()->CopyFromCompositingSurface(src_rect, output_size,
|
||||
std::move(callback));
|
||||
delegated_frame_host_->CopyFromCompositingSurface(src_rect, output_size,
|
||||
std::move(callback));
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::GetScreenInfo(content::ScreenInfo* results) {
|
||||
@@ -702,9 +781,8 @@ CefRenderWidgetHostViewOSR::DidUpdateVisualProperties(
|
||||
#endif
|
||||
|
||||
viz::SurfaceId CefRenderWidgetHostViewOSR::GetCurrentSurfaceId() const {
|
||||
return GetDelegatedFrameHost()
|
||||
? GetDelegatedFrameHost()->GetCurrentSurfaceId()
|
||||
: viz::SurfaceId();
|
||||
return delegated_frame_host_ ? delegated_frame_host_->GetCurrentSurfaceId()
|
||||
: viz::SurfaceId();
|
||||
}
|
||||
|
||||
content::BrowserAccessibilityManager*
|
||||
@@ -806,17 +884,28 @@ void CefRenderWidgetHostViewOSR::SelectionChanged(const base::string16& text,
|
||||
|
||||
const viz::LocalSurfaceIdAllocation&
|
||||
CefRenderWidgetHostViewOSR::GetLocalSurfaceIdAllocation() const {
|
||||
return local_surface_id_allocation_;
|
||||
return const_cast<CefRenderWidgetHostViewOSR*>(this)
|
||||
->GetOrCreateLocalSurfaceIdAllocation();
|
||||
}
|
||||
|
||||
const viz::FrameSinkId& CefRenderWidgetHostViewOSR::GetFrameSinkId() const {
|
||||
return GetDelegatedFrameHost()->frame_sink_id();
|
||||
return delegated_frame_host_->frame_sink_id();
|
||||
}
|
||||
|
||||
viz::FrameSinkId CefRenderWidgetHostViewOSR::GetRootFrameSinkId() {
|
||||
return compositor_->frame_sink_id();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnRenderFrameMetadataChangedAfterActivation() {
|
||||
if (video_consumer_) {
|
||||
// Need to wait for the first frame of the new size before calling
|
||||
// SizeChanged. Otherwise, the video frame will be letterboxed.
|
||||
auto metadata =
|
||||
host_->render_frame_metadata_provider()->LastRenderFrameMetadata();
|
||||
video_consumer_->SizeChanged(metadata.viewport_size_in_pixels);
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<content::SyntheticGestureTarget>
|
||||
CefRenderWidgetHostViewOSR::CreateSyntheticGestureTarget() {
|
||||
return std::make_unique<CefSyntheticGestureTargetOSR>(host());
|
||||
@@ -831,8 +920,8 @@ void CefRenderWidgetHostViewOSR::SetNeedsBeginFrames(bool enabled) {
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SetWantsAnimateOnlyBeginFrames() {
|
||||
if (GetDelegatedFrameHost()) {
|
||||
GetDelegatedFrameHost()->SetWantsAnimateOnlyBeginFrames();
|
||||
if (delegated_frame_host_) {
|
||||
delegated_frame_host_->SetWantsAnimateOnlyBeginFrames();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -850,11 +939,25 @@ bool CefRenderWidgetHostViewOSR::TransformPointToCoordSpaceForView(
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::DidNavigate() {
|
||||
// With surface synchronization enabled we need to force synchronization on
|
||||
// first navigation.
|
||||
ResizeRootLayer(true);
|
||||
if (!IsShowing()) {
|
||||
// Navigating while hidden should not allocate a new LocalSurfaceID. Once
|
||||
// sizes are ready, or we begin to Show, we can then allocate the new
|
||||
// LocalSurfaceId.
|
||||
InvalidateLocalSurfaceId();
|
||||
} else {
|
||||
if (is_first_navigation_) {
|
||||
// The first navigation does not need a new LocalSurfaceID. The renderer
|
||||
// can use the ID that was already provided.
|
||||
SynchronizeVisualProperties(cc::DeadlinePolicy::UseExistingDeadline(),
|
||||
GetLocalSurfaceIdAllocation());
|
||||
} else {
|
||||
SynchronizeVisualProperties(cc::DeadlinePolicy::UseExistingDeadline(),
|
||||
base::nullopt);
|
||||
}
|
||||
}
|
||||
if (delegated_frame_host_)
|
||||
delegated_frame_host_->DidNavigate();
|
||||
is_first_navigation_ = false;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnFrameComplete(
|
||||
@@ -881,16 +984,53 @@ bool CefRenderWidgetHostViewOSR::InstallTransparency() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SynchronizeVisualProperties(bool force) {
|
||||
void CefRenderWidgetHostViewOSR::WasResized() {
|
||||
// Only one resize will be in-flight at a time.
|
||||
if (hold_resize_) {
|
||||
if (!pending_resize_)
|
||||
pending_resize_ = true;
|
||||
if (force)
|
||||
pending_resize_force_ = true;
|
||||
return;
|
||||
}
|
||||
|
||||
ResizeRootLayer(force);
|
||||
SynchronizeVisualProperties(cc::DeadlinePolicy::UseExistingDeadline(),
|
||||
base::nullopt);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SynchronizeVisualProperties(
|
||||
const cc::DeadlinePolicy& deadline_policy,
|
||||
const base::Optional<viz::LocalSurfaceIdAllocation>&
|
||||
child_local_surface_id_allocation) {
|
||||
SetFrameRate();
|
||||
|
||||
const bool resized = ResizeRootLayer();
|
||||
bool surface_id_updated = false;
|
||||
|
||||
if (!resized && child_local_surface_id_allocation) {
|
||||
// Update the current surface ID.
|
||||
parent_local_surface_id_allocator_->UpdateFromChild(
|
||||
*child_local_surface_id_allocation);
|
||||
surface_id_updated = true;
|
||||
}
|
||||
|
||||
// Allocate a new surface ID if the surface has been resized or if the current
|
||||
// ID is invalid (meaning we may have been evicted).
|
||||
if (resized || !GetCurrentLocalSurfaceIdAllocation().IsValid()) {
|
||||
AllocateLocalSurfaceId();
|
||||
surface_id_updated = true;
|
||||
}
|
||||
|
||||
if (surface_id_updated) {
|
||||
delegated_frame_host_->EmbedSurface(
|
||||
GetCurrentLocalSurfaceIdAllocation().local_surface_id(),
|
||||
GetViewBounds().size(), deadline_policy);
|
||||
|
||||
// |render_widget_host_| will retrieve resize parameters from the
|
||||
// DelegatedFrameHost and this view, so SynchronizeVisualProperties must be
|
||||
// called last.
|
||||
if (render_widget_host_) {
|
||||
render_widget_host_->SynchronizeVisualProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnScreenInfoChanged() {
|
||||
@@ -898,7 +1038,8 @@ void CefRenderWidgetHostViewOSR::OnScreenInfoChanged() {
|
||||
if (!render_widget_host_)
|
||||
return;
|
||||
|
||||
SynchronizeVisualProperties();
|
||||
SynchronizeVisualProperties(cc::DeadlinePolicy::UseDefaultDeadline(),
|
||||
base::nullopt);
|
||||
|
||||
if (render_widget_host_->delegate())
|
||||
render_widget_host_->delegate()->SendScreenRects();
|
||||
@@ -1259,32 +1400,16 @@ void CefRenderWidgetHostViewOSR::UpdateFrameRate() {
|
||||
frame_rate_threshold_us_ = 0;
|
||||
SetFrameRate();
|
||||
|
||||
if (video_consumer_) {
|
||||
video_consumer_->SetFrameRate(
|
||||
base::TimeDelta::FromMicroseconds(frame_rate_threshold_us_));
|
||||
}
|
||||
|
||||
// Notify the guest hosts if any.
|
||||
for (auto guest_host_view : guest_host_views_)
|
||||
guest_host_view->UpdateFrameRate();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::HoldResize() {
|
||||
if (!hold_resize_)
|
||||
hold_resize_ = true;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ReleaseResize() {
|
||||
if (!hold_resize_)
|
||||
return;
|
||||
|
||||
hold_resize_ = false;
|
||||
if (pending_resize_) {
|
||||
bool force = pending_resize_force_;
|
||||
pending_resize_ = false;
|
||||
pending_resize_force_ = false;
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(&CefRenderWidgetHostViewOSR::SynchronizeVisualProperties,
|
||||
weak_ptr_factory_.GetWeakPtr(), force));
|
||||
}
|
||||
}
|
||||
|
||||
gfx::Size CefRenderWidgetHostViewOSR::SizeInPixels() {
|
||||
return gfx::ConvertSizeToPixel(current_device_scale_factor_,
|
||||
GetViewBounds().size());
|
||||
@@ -1316,10 +1441,6 @@ void CefRenderWidgetHostViewOSR::OnPaint(const gfx::Rect& damage_rect,
|
||||
browser_impl_->client()->GetRenderHandler();
|
||||
CHECK(handler);
|
||||
|
||||
// Don't execute SynchronizeVisualProperties while the OnPaint callback is
|
||||
// pending.
|
||||
HoldResize();
|
||||
|
||||
gfx::Rect rect_in_pixels(0, 0, pixel_size.width(), pixel_size.height());
|
||||
rect_in_pixels.Intersect(damage_rect);
|
||||
|
||||
@@ -1330,18 +1451,15 @@ void CefRenderWidgetHostViewOSR::OnPaint(const gfx::Rect& damage_rect,
|
||||
handler->OnPaint(browser_impl_.get(), IsPopupWidget() ? PET_POPUP : PET_VIEW,
|
||||
rcList, pixels, pixel_size.width(), pixel_size.height());
|
||||
|
||||
ReleaseResize();
|
||||
// Release the resize hold when we reach the desired size.
|
||||
if (hold_resize_ && pixel_size == SizeInPixels())
|
||||
ReleaseResizeHold();
|
||||
}
|
||||
|
||||
ui::Layer* CefRenderWidgetHostViewOSR::GetRootLayer() const {
|
||||
return root_layer_.get();
|
||||
}
|
||||
|
||||
content::DelegatedFrameHost* CefRenderWidgetHostViewOSR::GetDelegatedFrameHost()
|
||||
const {
|
||||
return delegated_frame_host_.get();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SetFrameRate() {
|
||||
CefRefPtr<CefBrowserHostImpl> browser;
|
||||
if (parent_host_view_) {
|
||||
@@ -1373,19 +1491,13 @@ void CefRenderWidgetHostViewOSR::SetFrameRate() {
|
||||
}
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SetDeviceScaleFactor() {
|
||||
float new_scale_factor = kDefaultScaleFactor;
|
||||
bool CefRenderWidgetHostViewOSR::SetDeviceScaleFactor() {
|
||||
// This method should not be called while the resize hold is active.
|
||||
DCHECK(!hold_resize_);
|
||||
|
||||
if (browser_impl_.get()) {
|
||||
CefScreenInfo screen_info(kDefaultScaleFactor, 0, 0, false, CefRect(),
|
||||
CefRect());
|
||||
CefRefPtr<CefRenderHandler> handler =
|
||||
browser_impl_->client()->GetRenderHandler();
|
||||
CHECK(handler);
|
||||
if (handler->GetScreenInfo(browser_impl_.get(), screen_info)) {
|
||||
new_scale_factor = screen_info.device_scale_factor;
|
||||
}
|
||||
}
|
||||
const float new_scale_factor = ::GetDeviceScaleFactor(browser_impl_.get());
|
||||
if (new_scale_factor == current_device_scale_factor_)
|
||||
return false;
|
||||
|
||||
current_device_scale_factor_ = new_scale_factor;
|
||||
|
||||
@@ -1397,52 +1509,69 @@ void CefRenderWidgetHostViewOSR::SetDeviceScaleFactor() {
|
||||
if (rwhi->GetView())
|
||||
rwhi->GetView()->set_current_device_scale_factor(new_scale_factor);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ResizeRootLayer(bool force) {
|
||||
SetFrameRate();
|
||||
bool CefRenderWidgetHostViewOSR::SetViewBounds() {
|
||||
// This method should not be called while the resize hold is active.
|
||||
DCHECK(!hold_resize_);
|
||||
|
||||
const float orgScaleFactor = current_device_scale_factor_;
|
||||
SetDeviceScaleFactor();
|
||||
const bool scaleFactorDidChange =
|
||||
(orgScaleFactor != current_device_scale_factor_);
|
||||
// Popup bounds are set in InitAsPopup.
|
||||
if (IsPopupWidget())
|
||||
return false;
|
||||
|
||||
gfx::Size size;
|
||||
if (!IsPopupWidget())
|
||||
size = GetViewBounds().size();
|
||||
else
|
||||
size = popup_position_.size();
|
||||
const gfx::Rect& new_bounds = ::GetViewBounds(browser_impl_.get());
|
||||
if (new_bounds == current_view_bounds_)
|
||||
return false;
|
||||
|
||||
if (!force && !scaleFactorDidChange &&
|
||||
size == GetRootLayer()->bounds().size()) {
|
||||
return;
|
||||
}
|
||||
current_view_bounds_ = new_bounds;
|
||||
return true;
|
||||
}
|
||||
|
||||
GetRootLayer()->SetBounds(gfx::Rect(size));
|
||||
bool CefRenderWidgetHostViewOSR::SetRootLayerSize(bool force) {
|
||||
const bool scale_factor_changed = SetDeviceScaleFactor();
|
||||
const bool view_bounds_changed = SetViewBounds();
|
||||
if (!force && !scale_factor_changed && !view_bounds_changed)
|
||||
return false;
|
||||
|
||||
const gfx::Size& size_in_pixels =
|
||||
gfx::ConvertSizeToPixel(current_device_scale_factor_, size);
|
||||
|
||||
local_surface_id_allocator_.GenerateId();
|
||||
local_surface_id_allocation_ =
|
||||
local_surface_id_allocator_.GetCurrentLocalSurfaceIdAllocation();
|
||||
GetRootLayer()->SetBounds(gfx::Rect(GetViewBounds().size()));
|
||||
|
||||
if (compositor_) {
|
||||
compositor_local_surface_id_allocator_.GenerateId();
|
||||
compositor_->SetScaleAndSize(current_device_scale_factor_, size_in_pixels,
|
||||
compositor_->SetScaleAndSize(current_device_scale_factor_, SizeInPixels(),
|
||||
compositor_local_surface_id_allocator_
|
||||
.GetCurrentLocalSurfaceIdAllocation());
|
||||
}
|
||||
|
||||
GetDelegatedFrameHost()->EmbedSurface(
|
||||
local_surface_id_allocation_.local_surface_id(), size,
|
||||
cc::DeadlinePolicy::UseDefaultDeadline());
|
||||
return (scale_factor_changed || view_bounds_changed);
|
||||
}
|
||||
|
||||
// Note that |render_widget_host_| will retrieve resize parameters from the
|
||||
// DelegatedFrameHost, so it must have SynchronizeVisualProperties called
|
||||
// after.
|
||||
if (render_widget_host_)
|
||||
render_widget_host_->SynchronizeVisualProperties();
|
||||
bool CefRenderWidgetHostViewOSR::ResizeRootLayer() {
|
||||
if (!hold_resize_) {
|
||||
// The resize hold is not currently active.
|
||||
if (SetRootLayerSize(false /* force */)) {
|
||||
// The size has changed. Avoid resizing again until ReleaseResizeHold() is
|
||||
// called.
|
||||
hold_resize_ = true;
|
||||
return true;
|
||||
}
|
||||
} else if (!pending_resize_) {
|
||||
// The resize hold is currently active. Another resize will be triggered
|
||||
// from ReleaseResizeHold().
|
||||
pending_resize_ = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ReleaseResizeHold() {
|
||||
DCHECK(hold_resize_);
|
||||
hold_resize_ = false;
|
||||
if (pending_resize_) {
|
||||
pending_resize_ = false;
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefRenderWidgetHostViewOSR::WasResized,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
}
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::CancelWidget() {
|
||||
@@ -1509,7 +1638,7 @@ void CefRenderWidgetHostViewOSR::RemoveGuestHostView(
|
||||
void CefRenderWidgetHostViewOSR::InvalidateInternal(
|
||||
const gfx::Rect& bounds_in_pixels) {
|
||||
if (video_consumer_) {
|
||||
video_consumer_->SizeChanged();
|
||||
video_consumer_->RequestRefreshFrame(bounds_in_pixels);
|
||||
} else if (host_display_client_) {
|
||||
OnPaint(bounds_in_pixels, host_display_client_->GetPixelSize(),
|
||||
host_display_client_->GetPixelMemory());
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/optional.h"
|
||||
#include "build/build_config.h"
|
||||
#include "cc/layers/deadline_policy.h"
|
||||
#include "components/viz/common/frame_sinks/begin_frame_source.h"
|
||||
#include "components/viz/common/surfaces/parent_local_surface_id_allocator.h"
|
||||
#include "content/browser/renderer_host/input/mouse_wheel_phase_handler.h"
|
||||
@@ -189,6 +190,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
const override;
|
||||
const viz::FrameSinkId& GetFrameSinkId() const override;
|
||||
viz::FrameSinkId GetRootFrameSinkId() override;
|
||||
void OnRenderFrameMetadataChangedAfterActivation() override;
|
||||
|
||||
void OnFrameComplete(const viz::BeginFrameAck& ack);
|
||||
|
||||
@@ -208,7 +210,11 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
|
||||
bool InstallTransparency();
|
||||
|
||||
void SynchronizeVisualProperties(bool force = false);
|
||||
void WasResized();
|
||||
void SynchronizeVisualProperties(
|
||||
const cc::DeadlinePolicy& deadline_policy,
|
||||
const base::Optional<viz::LocalSurfaceIdAllocation>&
|
||||
child_local_surface_id_allocation);
|
||||
void OnScreenInfoChanged();
|
||||
void Invalidate(CefBrowserHost::PaintElementType type);
|
||||
void SendExternalBeginFrame();
|
||||
@@ -220,9 +226,6 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
void SendFocusEvent(bool focus);
|
||||
void UpdateFrameRate();
|
||||
|
||||
void HoldResize();
|
||||
void ReleaseResize();
|
||||
|
||||
gfx::Size SizeInPixels();
|
||||
void OnPaint(const gfx::Rect& damage_rect,
|
||||
const gfx::Size& pixel_size,
|
||||
@@ -269,11 +272,14 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
const cc::RenderFrameMetadata& metadata);
|
||||
|
||||
private:
|
||||
content::DelegatedFrameHost* GetDelegatedFrameHost() const;
|
||||
|
||||
void SetFrameRate();
|
||||
void SetDeviceScaleFactor();
|
||||
void ResizeRootLayer(bool force);
|
||||
bool SetDeviceScaleFactor();
|
||||
bool SetViewBounds();
|
||||
bool SetRootLayerSize(bool force);
|
||||
|
||||
// Manages resizing so that only one resize request is in-flight at a time.
|
||||
bool ResizeRootLayer();
|
||||
void ReleaseResizeHold();
|
||||
|
||||
void CancelWidget();
|
||||
|
||||
@@ -296,6 +302,27 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
|
||||
viz::FrameSinkId AllocateFrameSinkId();
|
||||
|
||||
// Forces the view to allocate a new viz::LocalSurfaceId for the next
|
||||
// CompositorFrame submission in anticipation of a synchronization operation
|
||||
// that does not involve a resize or a device scale factor change.
|
||||
void AllocateLocalSurfaceId();
|
||||
const viz::LocalSurfaceIdAllocation& GetCurrentLocalSurfaceIdAllocation()
|
||||
const;
|
||||
|
||||
// Sets the current viz::LocalSurfaceId, in cases where the embedded client
|
||||
// has allocated one. Also sets child sequence number component of the
|
||||
// viz::LocalSurfaceId allocator.
|
||||
void UpdateLocalSurfaceIdFromEmbeddedClient(
|
||||
const base::Optional<viz::LocalSurfaceIdAllocation>&
|
||||
local_surface_id_allocation);
|
||||
|
||||
// Returns the current viz::LocalSurfaceIdAllocation.
|
||||
const viz::LocalSurfaceIdAllocation& GetOrCreateLocalSurfaceIdAllocation();
|
||||
|
||||
// Marks the current viz::LocalSurfaceId as invalid. AllocateLocalSurfaceId
|
||||
// must be called before submitting new CompositorFrames.
|
||||
void InvalidateLocalSurfaceId();
|
||||
|
||||
void AddDamageRect(uint32_t sequence, const gfx::Rect& rect);
|
||||
|
||||
// Applies background color without notifying the RenderWidget about
|
||||
@@ -309,15 +336,17 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
// The background color of the web content.
|
||||
SkColor background_color_;
|
||||
|
||||
int frame_rate_threshold_us_;
|
||||
int frame_rate_threshold_us_ = 0;
|
||||
|
||||
std::unique_ptr<ui::Compositor> compositor_;
|
||||
std::unique_ptr<content::DelegatedFrameHost> delegated_frame_host_;
|
||||
std::unique_ptr<content::DelegatedFrameHostClient>
|
||||
delegated_frame_host_client_;
|
||||
std::unique_ptr<ui::Layer> root_layer_;
|
||||
viz::LocalSurfaceIdAllocation local_surface_id_allocation_;
|
||||
viz::ParentLocalSurfaceIdAllocator local_surface_id_allocator_;
|
||||
|
||||
// Used to allocate LocalSurfaceIds when this is embedding external content.
|
||||
std::unique_ptr<viz::ParentLocalSurfaceIdAllocator>
|
||||
parent_local_surface_id_allocator_;
|
||||
viz::ParentLocalSurfaceIdAllocator compositor_local_surface_id_allocator_;
|
||||
|
||||
#if defined(USE_X11)
|
||||
@@ -334,12 +363,11 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
bool external_begin_frame_enabled_ = false;
|
||||
bool needs_external_begin_frames_ = false;
|
||||
|
||||
CefHostDisplayClientOSR* host_display_client_;
|
||||
CefHostDisplayClientOSR* host_display_client_ = nullptr;
|
||||
std::unique_ptr<CefVideoConsumerOSR> video_consumer_;
|
||||
|
||||
bool hold_resize_;
|
||||
bool pending_resize_;
|
||||
bool pending_resize_force_;
|
||||
bool hold_resize_ = false;
|
||||
bool pending_resize_ = false;
|
||||
|
||||
// The associated Model. While |this| is being Destroyed,
|
||||
// |render_widget_host_| is NULL and the message loop is run one last time
|
||||
@@ -348,14 +376,16 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
|
||||
bool has_parent_;
|
||||
CefRenderWidgetHostViewOSR* parent_host_view_;
|
||||
CefRenderWidgetHostViewOSR* popup_host_view_;
|
||||
CefRenderWidgetHostViewOSR* child_host_view_;
|
||||
CefRenderWidgetHostViewOSR* popup_host_view_ = nullptr;
|
||||
CefRenderWidgetHostViewOSR* child_host_view_ = nullptr;
|
||||
std::set<CefRenderWidgetHostViewOSR*> guest_host_views_;
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser_impl_;
|
||||
|
||||
bool is_showing_;
|
||||
bool is_destroyed_;
|
||||
bool is_showing_ = false;
|
||||
bool is_destroyed_ = false;
|
||||
bool is_first_navigation_ = true;
|
||||
gfx::Rect current_view_bounds_;
|
||||
gfx::Rect popup_position_;
|
||||
base::Lock damage_rect_lock_;
|
||||
std::map<uint32_t, gfx::Rect> damage_rects_;
|
||||
@@ -366,7 +396,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
|
||||
// The last scroll offset of the view.
|
||||
gfx::Vector2dF last_scroll_offset_;
|
||||
bool is_scroll_offset_changed_pending_;
|
||||
bool is_scroll_offset_changed_pending_ = false;
|
||||
|
||||
content::MouseWheelPhaseHandler mouse_wheel_phase_handler_;
|
||||
|
||||
@@ -382,7 +412,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
ui::FilteredGestureProvider gesture_provider_;
|
||||
|
||||
CefMotionEventOSR pointer_state_;
|
||||
bool forward_touch_to_popup_;
|
||||
bool forward_touch_to_popup_ = false;
|
||||
|
||||
base::WeakPtrFactory<CefRenderWidgetHostViewOSR> weak_ptr_factory_;
|
||||
|
||||
|
@@ -11,16 +11,35 @@
|
||||
#include "media/capture/mojom/video_capture_types.mojom.h"
|
||||
#include "ui/gfx/skbitmap_operations.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// Helper to always call Done() at the end of OnFrameCaptured().
|
||||
class ScopedVideoFrameDone {
|
||||
public:
|
||||
explicit ScopedVideoFrameDone(
|
||||
mojo::PendingRemote<viz::mojom::FrameSinkVideoConsumerFrameCallbacks>
|
||||
callbacks)
|
||||
: callbacks_(std::move(callbacks)) {}
|
||||
~ScopedVideoFrameDone() { callbacks_->Done(); }
|
||||
|
||||
private:
|
||||
mojo::Remote<viz::mojom::FrameSinkVideoConsumerFrameCallbacks> callbacks_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
CefVideoConsumerOSR::CefVideoConsumerOSR(CefRenderWidgetHostViewOSR* view)
|
||||
: view_(view),
|
||||
video_capturer_(view->CreateVideoCapturer()),
|
||||
weak_ptr_factory_(this) {
|
||||
const gfx::Size view_size = view_->SizeInPixels();
|
||||
video_capturer_->SetResolutionConstraints(view_size, view_size, true);
|
||||
video_capturer_->SetAutoThrottlingEnabled(false);
|
||||
video_capturer_->SetMinSizeChangePeriod(base::TimeDelta());
|
||||
: view_(view), video_capturer_(view->CreateVideoCapturer()) {
|
||||
video_capturer_->SetFormat(media::PIXEL_FORMAT_ARGB,
|
||||
gfx::ColorSpace::CreateREC709());
|
||||
|
||||
// Always use the highest resolution within constraints that doesn't exceed
|
||||
// the source size.
|
||||
video_capturer_->SetAutoThrottlingEnabled(false);
|
||||
video_capturer_->SetMinSizeChangePeriod(base::TimeDelta());
|
||||
|
||||
SizeChanged(view_->SizeInPixels());
|
||||
SetActive(true);
|
||||
}
|
||||
|
||||
CefVideoConsumerOSR::~CefVideoConsumerOSR() = default;
|
||||
@@ -37,42 +56,49 @@ void CefVideoConsumerOSR::SetFrameRate(base::TimeDelta frame_rate) {
|
||||
video_capturer_->SetMinCapturePeriod(frame_rate);
|
||||
}
|
||||
|
||||
void CefVideoConsumerOSR::SizeChanged() {
|
||||
const gfx::Size view_size = view_->SizeInPixels();
|
||||
video_capturer_->SetResolutionConstraints(view_size, view_size, true);
|
||||
void CefVideoConsumerOSR::SizeChanged(const gfx::Size& size_in_pixels) {
|
||||
if (size_in_pixels_ == size_in_pixels)
|
||||
return;
|
||||
size_in_pixels_ = size_in_pixels;
|
||||
|
||||
// Capture resolution will be held constant.
|
||||
video_capturer_->SetResolutionConstraints(size_in_pixels, size_in_pixels,
|
||||
true /* use_fixed_aspect_ratio */);
|
||||
}
|
||||
|
||||
void CefVideoConsumerOSR::RequestRefreshFrame(
|
||||
const base::Optional<gfx::Rect>& bounds_in_pixels) {
|
||||
bounds_in_pixels_ = bounds_in_pixels;
|
||||
video_capturer_->RequestRefreshFrame();
|
||||
}
|
||||
|
||||
// Frame size values are as follows:
|
||||
// info->coded_size = Width and height of the video frame. Not all pixels in
|
||||
// this region are valid.
|
||||
// info->visible_rect = Region of coded_size that contains image data, also
|
||||
// known as the clean aperture.
|
||||
// content_rect = Region of the frame that contains the captured content, with
|
||||
// the rest of the frame having been letterboxed to adhere to resolution
|
||||
// constraints.
|
||||
void CefVideoConsumerOSR::OnFrameCaptured(
|
||||
base::ReadOnlySharedMemoryRegion data,
|
||||
::media::mojom::VideoFrameInfoPtr info,
|
||||
const gfx::Rect& content_rect,
|
||||
mojo::PendingRemote<viz::mojom::FrameSinkVideoConsumerFrameCallbacks>
|
||||
callbacks) {
|
||||
const gfx::Size view_size = view_->SizeInPixels();
|
||||
if (view_size != content_rect.size()) {
|
||||
video_capturer_->SetResolutionConstraints(view_size, view_size, true);
|
||||
video_capturer_->RequestRefreshFrame();
|
||||
return;
|
||||
}
|
||||
ScopedVideoFrameDone scoped_done(std::move(callbacks));
|
||||
|
||||
mojo::Remote<viz::mojom::FrameSinkVideoConsumerFrameCallbacks>
|
||||
callbacks_remote(std::move(callbacks));
|
||||
|
||||
if (!data.IsValid()) {
|
||||
callbacks_remote->Done();
|
||||
if (!data.IsValid())
|
||||
return;
|
||||
}
|
||||
|
||||
base::ReadOnlySharedMemoryMapping mapping = data.Map();
|
||||
if (!mapping.IsValid()) {
|
||||
DLOG(ERROR) << "Shared memory mapping failed.";
|
||||
callbacks_remote->Done();
|
||||
return;
|
||||
}
|
||||
if (mapping.size() <
|
||||
media::VideoFrame::AllocationSize(info->pixel_format, info->coded_size)) {
|
||||
DLOG(ERROR) << "Shared memory size was less than expected.";
|
||||
callbacks_remote->Done();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -84,15 +110,27 @@ void CefVideoConsumerOSR::OnFrameCaptured(
|
||||
metadata.MergeInternalValuesFrom(info->metadata);
|
||||
gfx::Rect damage_rect;
|
||||
|
||||
if (!metadata.GetRect(media::VideoFrameMetadata::CAPTURE_UPDATE_RECT,
|
||||
&damage_rect) ||
|
||||
damage_rect.IsEmpty()) {
|
||||
damage_rect = content_rect;
|
||||
if (bounds_in_pixels_) {
|
||||
// Use the bounds passed to RequestRefreshFrame().
|
||||
damage_rect = gfx::Rect(info->coded_size);
|
||||
damage_rect.Intersect(*bounds_in_pixels_);
|
||||
bounds_in_pixels_ = base::nullopt;
|
||||
} else {
|
||||
// Retrieve the rectangular region of the frame that has changed since the
|
||||
// frame with the directly preceding CAPTURE_COUNTER. If that frame was not
|
||||
// received, typically because it was dropped during transport from the
|
||||
// producer, clients must assume that the entire frame has changed.
|
||||
// This rectangle is relative to the full frame data, i.e. [0, 0,
|
||||
// coded_size.width(), coded_size.height()]. It does not have to be
|
||||
// fully contained within visible_rect.
|
||||
if (!metadata.GetRect(media::VideoFrameMetadata::CAPTURE_UPDATE_RECT,
|
||||
&damage_rect) ||
|
||||
damage_rect.IsEmpty()) {
|
||||
damage_rect = gfx::Rect(info->coded_size);
|
||||
}
|
||||
}
|
||||
|
||||
view_->OnPaint(damage_rect, info->coded_size, pixels);
|
||||
|
||||
callbacks_remote->Done();
|
||||
}
|
||||
|
||||
void CefVideoConsumerOSR::OnStopped() {}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define LIBCEF_BROWSER_OSR_VIDEO_CONSUMER_OSR_H_
|
||||
|
||||
#include "base/callback.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/optional.h"
|
||||
#include "components/viz/host/client_frame_sink_video_capturer.h"
|
||||
#include "media/capture/mojom/video_capture_types.mojom.h"
|
||||
|
||||
@@ -15,7 +15,8 @@ class CefVideoConsumerOSR : public viz::mojom::FrameSinkVideoConsumer {
|
||||
|
||||
void SetActive(bool active);
|
||||
void SetFrameRate(base::TimeDelta frame_rate);
|
||||
void SizeChanged();
|
||||
void SizeChanged(const gfx::Size& size_in_pixels);
|
||||
void RequestRefreshFrame(const base::Optional<gfx::Rect>& bounds_in_pixels);
|
||||
|
||||
private:
|
||||
// viz::mojom::FrameSinkVideoConsumer implementation.
|
||||
@@ -30,7 +31,8 @@ class CefVideoConsumerOSR : public viz::mojom::FrameSinkVideoConsumer {
|
||||
CefRenderWidgetHostViewOSR* const view_;
|
||||
std::unique_ptr<viz::ClientFrameSinkVideoCapturer> video_capturer_;
|
||||
|
||||
base::WeakPtrFactory<CefVideoConsumerOSR> weak_ptr_factory_;
|
||||
gfx::Size size_in_pixels_;
|
||||
base::Optional<gfx::Rect> bounds_in_pixels_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefVideoConsumerOSR);
|
||||
};
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include "base/values.h"
|
||||
#include "chrome/browser/accessibility/accessibility_ui.h"
|
||||
#include "chrome/browser/download/download_prefs.h"
|
||||
#include "chrome/browser/media/router/media_router_feature.h"
|
||||
#include "chrome/browser/net/prediction_options.h"
|
||||
#include "chrome/browser/net/profile_network_context_service.h"
|
||||
#include "chrome/browser/net/system_network_context_manager.h"
|
||||
@@ -82,6 +83,7 @@ std::string GetAcceptLanguageList(Profile* profile) {
|
||||
} // namespace
|
||||
|
||||
const char kUserPrefsFileName[] = "UserPrefs.json";
|
||||
const char kLocalPrefsFileName[] = "LocalPrefs.json";
|
||||
|
||||
std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
const base::FilePath& cache_path,
|
||||
@@ -117,8 +119,8 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
// Used to store user preferences.
|
||||
scoped_refptr<PersistentPrefStore> user_pref_store;
|
||||
if (store_on_disk) {
|
||||
const base::FilePath& pref_path =
|
||||
cache_path.AppendASCII(browser_prefs::kUserPrefsFileName);
|
||||
const base::FilePath& pref_path = cache_path.AppendASCII(
|
||||
profile ? kUserPrefsFileName : kLocalPrefsFileName);
|
||||
scoped_refptr<JsonPrefStore> json_pref_store = new JsonPrefStore(
|
||||
pref_path, std::unique_ptr<PrefFilter>(), sequenced_task_runner);
|
||||
factory.set_user_prefs(json_pref_store.get());
|
||||
@@ -177,6 +179,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
CefMediaCaptureDevicesDispatcher::RegisterPrefs(registry.get());
|
||||
certificate_transparency::prefs::RegisterPrefs(registry.get());
|
||||
flags_ui::PrefServiceFlagsStorage::RegisterPrefs(registry.get());
|
||||
media_router::RegisterLocalStatePrefs(registry.get());
|
||||
PluginInfoHostImpl::RegisterUserPrefs(registry.get());
|
||||
PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get());
|
||||
ProfileNetworkContextService::RegisterLocalStatePrefs(registry.get());
|
||||
@@ -225,6 +228,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
extensions::ExtensionPrefs::RegisterProfilePrefs(registry.get());
|
||||
HostContentSettingsMap::RegisterProfilePrefs(registry.get());
|
||||
language::LanguagePrefs::RegisterProfilePrefs(registry.get());
|
||||
media_router::RegisterProfilePrefs(registry.get());
|
||||
ProfileNetworkContextService::RegisterProfilePrefs(registry.get());
|
||||
|
||||
const std::string& locale =
|
||||
|
@@ -7,7 +7,6 @@
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/extensions/extension_system.h"
|
||||
#include "libcef/browser/net_service/cookie_manager_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
#include "libcef/common/task_runner_impl.h"
|
||||
@@ -315,7 +314,7 @@ CefString CefRequestContextImpl::GetCachePath() {
|
||||
CefRefPtr<CefCookieManager> CefRequestContextImpl::GetCookieManager(
|
||||
CefRefPtr<CefCompletionCallback> callback) {
|
||||
CefRefPtr<CefCookieManagerImpl> cookie_manager = new CefCookieManagerImpl();
|
||||
cookie_manager->Initialize(this, callback);
|
||||
InitializeCookieManagerOnUIThread(cookie_manager, callback);
|
||||
return cookie_manager.get();
|
||||
}
|
||||
|
||||
@@ -594,6 +593,12 @@ CefRefPtr<CefExtension> CefRequestContextImpl::GetExtension(
|
||||
return GetBrowserContext()->extension_system()->GetExtension(extension_id);
|
||||
}
|
||||
|
||||
CefRefPtr<CefMediaRouter> CefRequestContextImpl::GetMediaRouter() {
|
||||
CefRefPtr<CefMediaRouterImpl> media_router = new CefMediaRouterImpl();
|
||||
InitializeMediaRouterOnUIThread(media_router);
|
||||
return media_router.get();
|
||||
}
|
||||
|
||||
void CefRequestContextImpl::OnRenderFrameCreated(int render_process_id,
|
||||
int render_frame_id,
|
||||
int frame_tree_node_id,
|
||||
@@ -761,6 +766,35 @@ void CefRequestContextImpl::ResolveHostInternal(
|
||||
helper->Start(browser_context, origin);
|
||||
}
|
||||
|
||||
void CefRequestContextImpl::InitializeCookieManagerOnUIThread(
|
||||
CefRefPtr<CefCookieManagerImpl> cookie_manager,
|
||||
CefRefPtr<CefCompletionCallback> callback) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(&CefRequestContextImpl::InitializeCookieManagerOnUIThread,
|
||||
this, cookie_manager, callback));
|
||||
return;
|
||||
}
|
||||
|
||||
auto browser_context = GetBrowserContext();
|
||||
cookie_manager->Initialize(browser_context->getter(), callback);
|
||||
}
|
||||
|
||||
void CefRequestContextImpl::InitializeMediaRouterOnUIThread(
|
||||
CefRefPtr<CefMediaRouterImpl> media_router) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(&CefRequestContextImpl::InitializeMediaRouterOnUIThread,
|
||||
this, media_router));
|
||||
return;
|
||||
}
|
||||
|
||||
auto browser_context = GetBrowserContext();
|
||||
media_router->Initialize(browser_context->getter());
|
||||
}
|
||||
|
||||
CefBrowserContext* CefRequestContextImpl::browser_context() const {
|
||||
return browser_context_;
|
||||
}
|
||||
|
@@ -8,6 +8,8 @@
|
||||
|
||||
#include "include/cef_request_context.h"
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/media_router/media_router_impl.h"
|
||||
#include "libcef/browser/net_service/cookie_manager_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
class CefBrowserContext;
|
||||
@@ -75,6 +77,7 @@ class CefRequestContextImpl : public CefRequestContext {
|
||||
bool HasExtension(const CefString& extension_id) override;
|
||||
bool GetExtensions(std::vector<CefString>& extension_ids) override;
|
||||
CefRefPtr<CefExtension> GetExtension(const CefString& extension_id) override;
|
||||
CefRefPtr<CefMediaRouter> GetMediaRouter() override;
|
||||
|
||||
const CefRequestContextSettings& settings() const { return config_.settings; }
|
||||
|
||||
@@ -147,6 +150,12 @@ class CefRequestContextImpl : public CefRequestContext {
|
||||
CefRefPtr<CefResolveCallback> callback,
|
||||
CefBrowserContext* browser_context);
|
||||
|
||||
void InitializeCookieManagerOnUIThread(
|
||||
CefRefPtr<CefCookieManagerImpl> cookie_manager,
|
||||
CefRefPtr<CefCompletionCallback> callback);
|
||||
void InitializeMediaRouterOnUIThread(
|
||||
CefRefPtr<CefMediaRouterImpl> media_router);
|
||||
|
||||
CefBrowserContext* browser_context() const;
|
||||
|
||||
// We must disassociate from this on destruction.
|
||||
|
@@ -184,8 +184,8 @@ SkColor CefBrowserPlatformDelegateViews::GetBackgroundColor() const {
|
||||
return native_delegate_->GetBackgroundColor();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateViews::SynchronizeVisualProperties() {
|
||||
native_delegate_->SynchronizeVisualProperties();
|
||||
void CefBrowserPlatformDelegateViews::WasResized() {
|
||||
native_delegate_->WasResized();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateViews::SendKeyEvent(const CefKeyEvent& event) {
|
||||
|
@@ -42,7 +42,7 @@ class CefBrowserPlatformDelegateViews
|
||||
bool CanUseSharedTexture() const override;
|
||||
bool CanUseExternalBeginFrame() const override;
|
||||
SkColor GetBackgroundColor() const override;
|
||||
void SynchronizeVisualProperties() override;
|
||||
void WasResized() override;
|
||||
void SendKeyEvent(const CefKeyEvent& event) override;
|
||||
void SendMouseClickEvent(const CefMouseEvent& event,
|
||||
CefBrowserHost::MouseButtonType type,
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include "base/synchronization/waitable_event.h"
|
||||
#include "base/threading/thread.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/media/router/media_router_feature.h"
|
||||
#include "chrome/child/pdf_child_init.h"
|
||||
#include "chrome/common/chrome_constants.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
@@ -636,6 +637,33 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
|
||||
command_line->AppendSwitchASCII(switches::kDisableFeatures,
|
||||
disable_features_str);
|
||||
}
|
||||
|
||||
std::vector<std::string> enable_features;
|
||||
|
||||
if (media_router::kDialMediaRouteProvider.default_state ==
|
||||
base::FEATURE_DISABLED_BY_DEFAULT) {
|
||||
// Enable discovery of DIAL devices.
|
||||
enable_features.push_back(media_router::kDialMediaRouteProvider.name);
|
||||
}
|
||||
|
||||
if (media_router::kCastMediaRouteProvider.default_state ==
|
||||
base::FEATURE_DISABLED_BY_DEFAULT) {
|
||||
// Enable discovery of Cast devices.
|
||||
enable_features.push_back(media_router::kCastMediaRouteProvider.name);
|
||||
}
|
||||
|
||||
if (!enable_features.empty()) {
|
||||
DCHECK(!base::FeatureList::GetInstance());
|
||||
std::string enable_features_str =
|
||||
command_line->GetSwitchValueASCII(switches::kEnableFeatures);
|
||||
for (auto feature_str : enable_features) {
|
||||
if (!enable_features_str.empty())
|
||||
enable_features_str += ",";
|
||||
enable_features_str += feature_str;
|
||||
}
|
||||
command_line->AppendSwitchASCII(switches::kEnableFeatures,
|
||||
enable_features_str);
|
||||
}
|
||||
}
|
||||
|
||||
if (content_client_.application().get()) {
|
||||
|
161
libcef_dll/cpptoc/media_observer_cpptoc.cc
Normal file
161
libcef_dll/cpptoc/media_observer_cpptoc.cc
Normal file
@@ -0,0 +1,161 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=35f0e881b5a98c1da73789ecb72254fbe254a350$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/media_observer_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/media_route_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/media_sink_ctocpp.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
void CEF_CALLBACK
|
||||
media_observer_on_sinks(struct _cef_media_observer_t* self,
|
||||
size_t sinksCount,
|
||||
struct _cef_media_sink_t* const* sinks) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: sinks; type: refptr_vec_diff_byref_const
|
||||
DCHECK(sinksCount == 0 || sinks);
|
||||
if (sinksCount > 0 && !sinks)
|
||||
return;
|
||||
|
||||
// Translate param: sinks; type: refptr_vec_diff_byref_const
|
||||
std::vector<CefRefPtr<CefMediaSink>> sinksList;
|
||||
if (sinksCount > 0) {
|
||||
for (size_t i = 0; i < sinksCount; ++i) {
|
||||
CefRefPtr<CefMediaSink> sinksVal = CefMediaSinkCToCpp::Wrap(sinks[i]);
|
||||
sinksList.push_back(sinksVal);
|
||||
}
|
||||
}
|
||||
|
||||
// Execute
|
||||
CefMediaObserverCppToC::Get(self)->OnSinks(sinksList);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK
|
||||
media_observer_on_routes(struct _cef_media_observer_t* self,
|
||||
size_t routesCount,
|
||||
struct _cef_media_route_t* const* routes) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: routes; type: refptr_vec_diff_byref_const
|
||||
DCHECK(routesCount == 0 || routes);
|
||||
if (routesCount > 0 && !routes)
|
||||
return;
|
||||
|
||||
// Translate param: routes; type: refptr_vec_diff_byref_const
|
||||
std::vector<CefRefPtr<CefMediaRoute>> routesList;
|
||||
if (routesCount > 0) {
|
||||
for (size_t i = 0; i < routesCount; ++i) {
|
||||
CefRefPtr<CefMediaRoute> routesVal = CefMediaRouteCToCpp::Wrap(routes[i]);
|
||||
routesList.push_back(routesVal);
|
||||
}
|
||||
}
|
||||
|
||||
// Execute
|
||||
CefMediaObserverCppToC::Get(self)->OnRoutes(routesList);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK media_observer_on_route_state_changed(
|
||||
struct _cef_media_observer_t* self,
|
||||
struct _cef_media_route_t* route,
|
||||
cef_media_route_connection_state_t state) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: route; type: refptr_diff
|
||||
DCHECK(route);
|
||||
if (!route)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefMediaObserverCppToC::Get(self)->OnRouteStateChanged(
|
||||
CefMediaRouteCToCpp::Wrap(route), state);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK
|
||||
media_observer_on_route_message_received(struct _cef_media_observer_t* self,
|
||||
struct _cef_media_route_t* route,
|
||||
const void* message,
|
||||
size_t message_size) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: route; type: refptr_diff
|
||||
DCHECK(route);
|
||||
if (!route)
|
||||
return;
|
||||
// Verify param: message; type: simple_byaddr
|
||||
DCHECK(message);
|
||||
if (!message)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefMediaObserverCppToC::Get(self)->OnRouteMessageReceived(
|
||||
CefMediaRouteCToCpp::Wrap(route), message, message_size);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaObserverCppToC::CefMediaObserverCppToC() {
|
||||
GetStruct()->on_sinks = media_observer_on_sinks;
|
||||
GetStruct()->on_routes = media_observer_on_routes;
|
||||
GetStruct()->on_route_state_changed = media_observer_on_route_state_changed;
|
||||
GetStruct()->on_route_message_received =
|
||||
media_observer_on_route_message_received;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaObserverCppToC::~CefMediaObserverCppToC() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
CefRefPtr<CefMediaObserver> CefCppToCRefCounted<
|
||||
CefMediaObserverCppToC,
|
||||
CefMediaObserver,
|
||||
cef_media_observer_t>::UnwrapDerived(CefWrapperType type,
|
||||
cef_media_observer_t* s) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType CefCppToCRefCounted<CefMediaObserverCppToC,
|
||||
CefMediaObserver,
|
||||
cef_media_observer_t>::kWrapperType =
|
||||
WT_MEDIA_OBSERVER;
|
38
libcef_dll/cpptoc/media_observer_cpptoc.h
Normal file
38
libcef_dll/cpptoc/media_observer_cpptoc.h
Normal file
@@ -0,0 +1,38 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=14ef1b6f920a375e585174e4057c66221f3e1c05$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CPPTOC_MEDIA_OBSERVER_CPPTOC_H_
|
||||
#define CEF_LIBCEF_DLL_CPPTOC_MEDIA_OBSERVER_CPPTOC_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(WRAPPING_CEF_SHARED)
|
||||
#error This file can be included wrapper-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_media_router_capi.h"
|
||||
#include "include/cef_media_router.h"
|
||||
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
|
||||
|
||||
// Wrap a C++ class with a C structure.
|
||||
// This class may be instantiated and accessed wrapper-side only.
|
||||
class CefMediaObserverCppToC
|
||||
: public CefCppToCRefCounted<CefMediaObserverCppToC,
|
||||
CefMediaObserver,
|
||||
cef_media_observer_t> {
|
||||
public:
|
||||
CefMediaObserverCppToC();
|
||||
virtual ~CefMediaObserverCppToC();
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CPPTOC_MEDIA_OBSERVER_CPPTOC_H_
|
139
libcef_dll/cpptoc/media_route_cpptoc.cc
Normal file
139
libcef_dll/cpptoc/media_route_cpptoc.cc
Normal file
@@ -0,0 +1,139 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=47181b936b29037dd4ff5169d7175ac538f5be56$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/media_route_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/media_sink_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/media_source_cpptoc.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
cef_string_userfree_t CEF_CALLBACK
|
||||
media_route_get_id(struct _cef_media_route_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return NULL;
|
||||
|
||||
// Execute
|
||||
CefString _retval = CefMediaRouteCppToC::Get(self)->GetId();
|
||||
|
||||
// Return type: string
|
||||
return _retval.DetachToUserFree();
|
||||
}
|
||||
|
||||
struct _cef_media_source_t* CEF_CALLBACK
|
||||
media_route_get_source(struct _cef_media_route_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return NULL;
|
||||
|
||||
// Execute
|
||||
CefRefPtr<CefMediaSource> _retval =
|
||||
CefMediaRouteCppToC::Get(self)->GetSource();
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefMediaSourceCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
struct _cef_media_sink_t* CEF_CALLBACK
|
||||
media_route_get_sink(struct _cef_media_route_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return NULL;
|
||||
|
||||
// Execute
|
||||
CefRefPtr<CefMediaSink> _retval = CefMediaRouteCppToC::Get(self)->GetSink();
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefMediaSinkCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK
|
||||
media_route_send_route_message(struct _cef_media_route_t* self,
|
||||
const void* message,
|
||||
size_t message_size) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: message; type: simple_byaddr
|
||||
DCHECK(message);
|
||||
if (!message)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefMediaRouteCppToC::Get(self)->SendRouteMessage(message, message_size);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK media_route_terminate(struct _cef_media_route_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefMediaRouteCppToC::Get(self)->Terminate();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaRouteCppToC::CefMediaRouteCppToC() {
|
||||
GetStruct()->get_id = media_route_get_id;
|
||||
GetStruct()->get_source = media_route_get_source;
|
||||
GetStruct()->get_sink = media_route_get_sink;
|
||||
GetStruct()->send_route_message = media_route_send_route_message;
|
||||
GetStruct()->terminate = media_route_terminate;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaRouteCppToC::~CefMediaRouteCppToC() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
CefRefPtr<CefMediaRoute>
|
||||
CefCppToCRefCounted<CefMediaRouteCppToC, CefMediaRoute, cef_media_route_t>::
|
||||
UnwrapDerived(CefWrapperType type, cef_media_route_t* s) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType CefCppToCRefCounted<CefMediaRouteCppToC,
|
||||
CefMediaRoute,
|
||||
cef_media_route_t>::kWrapperType =
|
||||
WT_MEDIA_ROUTE;
|
37
libcef_dll/cpptoc/media_route_cpptoc.h
Normal file
37
libcef_dll/cpptoc/media_route_cpptoc.h
Normal file
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=26fe0f9bd956318d0e6c7e0216024b5b839429c2$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CPPTOC_MEDIA_ROUTE_CPPTOC_H_
|
||||
#define CEF_LIBCEF_DLL_CPPTOC_MEDIA_ROUTE_CPPTOC_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(BUILDING_CEF_SHARED)
|
||||
#error This file can be included DLL-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_media_router_capi.h"
|
||||
#include "include/cef_media_router.h"
|
||||
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
|
||||
|
||||
// Wrap a C++ class with a C structure.
|
||||
// This class may be instantiated and accessed DLL-side only.
|
||||
class CefMediaRouteCppToC : public CefCppToCRefCounted<CefMediaRouteCppToC,
|
||||
CefMediaRoute,
|
||||
cef_media_route_t> {
|
||||
public:
|
||||
CefMediaRouteCppToC();
|
||||
virtual ~CefMediaRouteCppToC();
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CPPTOC_MEDIA_ROUTE_CPPTOC_H_
|
72
libcef_dll/cpptoc/media_route_create_callback_cpptoc.cc
Normal file
72
libcef_dll/cpptoc/media_route_create_callback_cpptoc.cc
Normal file
@@ -0,0 +1,72 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=a27462c4bcc0ef4856230997718f95edae5c1ef1$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/media_route_create_callback_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/media_route_ctocpp.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
void CEF_CALLBACK media_route_create_callback_on_media_route_create_finished(
|
||||
struct _cef_media_route_create_callback_t* self,
|
||||
cef_media_route_create_result_t result,
|
||||
const cef_string_t* error,
|
||||
cef_media_route_t* route) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Unverified params: error, route
|
||||
|
||||
// Execute
|
||||
CefMediaRouteCreateCallbackCppToC::Get(self)->OnMediaRouteCreateFinished(
|
||||
result, CefString(error), CefMediaRouteCToCpp::Wrap(route));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaRouteCreateCallbackCppToC::CefMediaRouteCreateCallbackCppToC() {
|
||||
GetStruct()->on_media_route_create_finished =
|
||||
media_route_create_callback_on_media_route_create_finished;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaRouteCreateCallbackCppToC::~CefMediaRouteCreateCallbackCppToC() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
CefRefPtr<CefMediaRouteCreateCallback>
|
||||
CefCppToCRefCounted<CefMediaRouteCreateCallbackCppToC,
|
||||
CefMediaRouteCreateCallback,
|
||||
cef_media_route_create_callback_t>::
|
||||
UnwrapDerived(CefWrapperType type, cef_media_route_create_callback_t* s) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType
|
||||
CefCppToCRefCounted<CefMediaRouteCreateCallbackCppToC,
|
||||
CefMediaRouteCreateCallback,
|
||||
cef_media_route_create_callback_t>::kWrapperType =
|
||||
WT_MEDIA_ROUTE_CREATE_CALLBACK;
|
38
libcef_dll/cpptoc/media_route_create_callback_cpptoc.h
Normal file
38
libcef_dll/cpptoc/media_route_create_callback_cpptoc.h
Normal file
@@ -0,0 +1,38 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=8085b195054f43f67d4ee21d8b69b9e0ee8e2ac3$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CPPTOC_MEDIA_ROUTE_CREATE_CALLBACK_CPPTOC_H_
|
||||
#define CEF_LIBCEF_DLL_CPPTOC_MEDIA_ROUTE_CREATE_CALLBACK_CPPTOC_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(WRAPPING_CEF_SHARED)
|
||||
#error This file can be included wrapper-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_media_router_capi.h"
|
||||
#include "include/cef_media_router.h"
|
||||
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
|
||||
|
||||
// Wrap a C++ class with a C structure.
|
||||
// This class may be instantiated and accessed wrapper-side only.
|
||||
class CefMediaRouteCreateCallbackCppToC
|
||||
: public CefCppToCRefCounted<CefMediaRouteCreateCallbackCppToC,
|
||||
CefMediaRouteCreateCallback,
|
||||
cef_media_route_create_callback_t> {
|
||||
public:
|
||||
CefMediaRouteCreateCallbackCppToC();
|
||||
virtual ~CefMediaRouteCreateCallbackCppToC();
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CPPTOC_MEDIA_ROUTE_CREATE_CALLBACK_CPPTOC_H_
|
177
libcef_dll/cpptoc/media_router_cpptoc.cc
Normal file
177
libcef_dll/cpptoc/media_router_cpptoc.cc
Normal file
@@ -0,0 +1,177 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=6b52fceffec99c0f274b5031266c20da5480d0c1$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/media_router_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/media_sink_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/media_source_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/registration_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/media_observer_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/media_route_create_callback_ctocpp.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
// GLOBAL FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
CEF_EXPORT cef_media_router_t* cef_media_router_get_global() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
CefRefPtr<CefMediaRouter> _retval = CefMediaRouter::GetGlobalMediaRouter();
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefMediaRouterCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
struct _cef_registration_t* CEF_CALLBACK
|
||||
media_router_add_observer(struct _cef_media_router_t* self,
|
||||
struct _cef_media_observer_t* observer) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return NULL;
|
||||
// Verify param: observer; type: refptr_diff
|
||||
DCHECK(observer);
|
||||
if (!observer)
|
||||
return NULL;
|
||||
|
||||
// Execute
|
||||
CefRefPtr<CefRegistration> _retval =
|
||||
CefMediaRouterCppToC::Get(self)->AddObserver(
|
||||
CefMediaObserverCToCpp::Wrap(observer));
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefRegistrationCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
struct _cef_media_source_t* CEF_CALLBACK
|
||||
media_router_get_source(struct _cef_media_router_t* self,
|
||||
const cef_string_t* urn) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return NULL;
|
||||
// Verify param: urn; type: string_byref_const
|
||||
DCHECK(urn);
|
||||
if (!urn)
|
||||
return NULL;
|
||||
|
||||
// Execute
|
||||
CefRefPtr<CefMediaSource> _retval =
|
||||
CefMediaRouterCppToC::Get(self)->GetSource(CefString(urn));
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefMediaSourceCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK
|
||||
media_router_notify_current_sinks(struct _cef_media_router_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefMediaRouterCppToC::Get(self)->NotifyCurrentSinks();
|
||||
}
|
||||
|
||||
void CEF_CALLBACK
|
||||
media_router_create_route(struct _cef_media_router_t* self,
|
||||
struct _cef_media_source_t* source,
|
||||
struct _cef_media_sink_t* sink,
|
||||
struct _cef_media_route_create_callback_t* callback) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: source; type: refptr_same
|
||||
DCHECK(source);
|
||||
if (!source)
|
||||
return;
|
||||
// Verify param: sink; type: refptr_same
|
||||
DCHECK(sink);
|
||||
if (!sink)
|
||||
return;
|
||||
// Verify param: callback; type: refptr_diff
|
||||
DCHECK(callback);
|
||||
if (!callback)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefMediaRouterCppToC::Get(self)->CreateRoute(
|
||||
CefMediaSourceCppToC::Unwrap(source), CefMediaSinkCppToC::Unwrap(sink),
|
||||
CefMediaRouteCreateCallbackCToCpp::Wrap(callback));
|
||||
}
|
||||
|
||||
void CEF_CALLBACK
|
||||
media_router_notify_current_routes(struct _cef_media_router_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefMediaRouterCppToC::Get(self)->NotifyCurrentRoutes();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaRouterCppToC::CefMediaRouterCppToC() {
|
||||
GetStruct()->add_observer = media_router_add_observer;
|
||||
GetStruct()->get_source = media_router_get_source;
|
||||
GetStruct()->notify_current_sinks = media_router_notify_current_sinks;
|
||||
GetStruct()->create_route = media_router_create_route;
|
||||
GetStruct()->notify_current_routes = media_router_notify_current_routes;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaRouterCppToC::~CefMediaRouterCppToC() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
CefRefPtr<CefMediaRouter>
|
||||
CefCppToCRefCounted<CefMediaRouterCppToC, CefMediaRouter, cef_media_router_t>::
|
||||
UnwrapDerived(CefWrapperType type, cef_media_router_t* s) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType CefCppToCRefCounted<CefMediaRouterCppToC,
|
||||
CefMediaRouter,
|
||||
cef_media_router_t>::kWrapperType =
|
||||
WT_MEDIA_ROUTER;
|
37
libcef_dll/cpptoc/media_router_cpptoc.h
Normal file
37
libcef_dll/cpptoc/media_router_cpptoc.h
Normal file
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=cea747c7202b95684b7208a312da818ddb094c0a$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CPPTOC_MEDIA_ROUTER_CPPTOC_H_
|
||||
#define CEF_LIBCEF_DLL_CPPTOC_MEDIA_ROUTER_CPPTOC_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(BUILDING_CEF_SHARED)
|
||||
#error This file can be included DLL-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_media_router_capi.h"
|
||||
#include "include/cef_media_router.h"
|
||||
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
|
||||
|
||||
// Wrap a C++ class with a C structure.
|
||||
// This class may be instantiated and accessed DLL-side only.
|
||||
class CefMediaRouterCppToC : public CefCppToCRefCounted<CefMediaRouterCppToC,
|
||||
CefMediaRouter,
|
||||
cef_media_router_t> {
|
||||
public:
|
||||
CefMediaRouterCppToC();
|
||||
virtual ~CefMediaRouterCppToC();
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CPPTOC_MEDIA_ROUTER_CPPTOC_H_
|
177
libcef_dll/cpptoc/media_sink_cpptoc.cc
Normal file
177
libcef_dll/cpptoc/media_sink_cpptoc.cc
Normal file
@@ -0,0 +1,177 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=cbbac244f39cc1d644b0db80a3f7234399286368$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/media_sink_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/media_source_cpptoc.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
cef_string_userfree_t CEF_CALLBACK
|
||||
media_sink_get_id(struct _cef_media_sink_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return NULL;
|
||||
|
||||
// Execute
|
||||
CefString _retval = CefMediaSinkCppToC::Get(self)->GetId();
|
||||
|
||||
// Return type: string
|
||||
return _retval.DetachToUserFree();
|
||||
}
|
||||
|
||||
int CEF_CALLBACK media_sink_is_valid(struct _cef_media_sink_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefMediaSinkCppToC::Get(self)->IsValid();
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
cef_string_userfree_t CEF_CALLBACK
|
||||
media_sink_get_name(struct _cef_media_sink_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return NULL;
|
||||
|
||||
// Execute
|
||||
CefString _retval = CefMediaSinkCppToC::Get(self)->GetName();
|
||||
|
||||
// Return type: string
|
||||
return _retval.DetachToUserFree();
|
||||
}
|
||||
|
||||
cef_string_userfree_t CEF_CALLBACK
|
||||
media_sink_get_description(struct _cef_media_sink_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return NULL;
|
||||
|
||||
// Execute
|
||||
CefString _retval = CefMediaSinkCppToC::Get(self)->GetDescription();
|
||||
|
||||
// Return type: string
|
||||
return _retval.DetachToUserFree();
|
||||
}
|
||||
|
||||
int CEF_CALLBACK media_sink_is_cast_sink(struct _cef_media_sink_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefMediaSinkCppToC::Get(self)->IsCastSink();
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK media_sink_is_dial_sink(struct _cef_media_sink_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefMediaSinkCppToC::Get(self)->IsDialSink();
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK
|
||||
media_sink_is_compatible_with(struct _cef_media_sink_t* self,
|
||||
struct _cef_media_source_t* source) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
// Verify param: source; type: refptr_same
|
||||
DCHECK(source);
|
||||
if (!source)
|
||||
return 0;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefMediaSinkCppToC::Get(self)->IsCompatibleWith(
|
||||
CefMediaSourceCppToC::Unwrap(source));
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaSinkCppToC::CefMediaSinkCppToC() {
|
||||
GetStruct()->get_id = media_sink_get_id;
|
||||
GetStruct()->is_valid = media_sink_is_valid;
|
||||
GetStruct()->get_name = media_sink_get_name;
|
||||
GetStruct()->get_description = media_sink_get_description;
|
||||
GetStruct()->is_cast_sink = media_sink_is_cast_sink;
|
||||
GetStruct()->is_dial_sink = media_sink_is_dial_sink;
|
||||
GetStruct()->is_compatible_with = media_sink_is_compatible_with;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaSinkCppToC::~CefMediaSinkCppToC() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
CefRefPtr<CefMediaSink>
|
||||
CefCppToCRefCounted<CefMediaSinkCppToC, CefMediaSink, cef_media_sink_t>::
|
||||
UnwrapDerived(CefWrapperType type, cef_media_sink_t* s) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType CefCppToCRefCounted<CefMediaSinkCppToC,
|
||||
CefMediaSink,
|
||||
cef_media_sink_t>::kWrapperType =
|
||||
WT_MEDIA_SINK;
|
37
libcef_dll/cpptoc/media_sink_cpptoc.h
Normal file
37
libcef_dll/cpptoc/media_sink_cpptoc.h
Normal file
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=409478c735898bd4e13315183e185a80ae570b74$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CPPTOC_MEDIA_SINK_CPPTOC_H_
|
||||
#define CEF_LIBCEF_DLL_CPPTOC_MEDIA_SINK_CPPTOC_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(BUILDING_CEF_SHARED)
|
||||
#error This file can be included DLL-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_media_router_capi.h"
|
||||
#include "include/cef_media_router.h"
|
||||
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
|
||||
|
||||
// Wrap a C++ class with a C structure.
|
||||
// This class may be instantiated and accessed DLL-side only.
|
||||
class CefMediaSinkCppToC : public CefCppToCRefCounted<CefMediaSinkCppToC,
|
||||
CefMediaSink,
|
||||
cef_media_sink_t> {
|
||||
public:
|
||||
CefMediaSinkCppToC();
|
||||
virtual ~CefMediaSinkCppToC();
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CPPTOC_MEDIA_SINK_CPPTOC_H_
|
116
libcef_dll/cpptoc/media_source_cpptoc.cc
Normal file
116
libcef_dll/cpptoc/media_source_cpptoc.cc
Normal file
@@ -0,0 +1,116 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=ddd51b3c8020de1b10b00eef06d745a498168323$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/media_source_cpptoc.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
cef_string_userfree_t CEF_CALLBACK
|
||||
media_source_get_id(struct _cef_media_source_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return NULL;
|
||||
|
||||
// Execute
|
||||
CefString _retval = CefMediaSourceCppToC::Get(self)->GetId();
|
||||
|
||||
// Return type: string
|
||||
return _retval.DetachToUserFree();
|
||||
}
|
||||
|
||||
int CEF_CALLBACK media_source_is_valid(struct _cef_media_source_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefMediaSourceCppToC::Get(self)->IsValid();
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK media_source_is_cast_source(struct _cef_media_source_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefMediaSourceCppToC::Get(self)->IsCastSource();
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK media_source_is_dial_source(struct _cef_media_source_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefMediaSourceCppToC::Get(self)->IsDialSource();
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaSourceCppToC::CefMediaSourceCppToC() {
|
||||
GetStruct()->get_id = media_source_get_id;
|
||||
GetStruct()->is_valid = media_source_is_valid;
|
||||
GetStruct()->is_cast_source = media_source_is_cast_source;
|
||||
GetStruct()->is_dial_source = media_source_is_dial_source;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaSourceCppToC::~CefMediaSourceCppToC() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
CefRefPtr<CefMediaSource>
|
||||
CefCppToCRefCounted<CefMediaSourceCppToC, CefMediaSource, cef_media_source_t>::
|
||||
UnwrapDerived(CefWrapperType type, cef_media_source_t* s) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType CefCppToCRefCounted<CefMediaSourceCppToC,
|
||||
CefMediaSource,
|
||||
cef_media_source_t>::kWrapperType =
|
||||
WT_MEDIA_SOURCE;
|
37
libcef_dll/cpptoc/media_source_cpptoc.h
Normal file
37
libcef_dll/cpptoc/media_source_cpptoc.h
Normal file
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=aceafab724145242461fc9f5e7c76a365bb6d54c$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CPPTOC_MEDIA_SOURCE_CPPTOC_H_
|
||||
#define CEF_LIBCEF_DLL_CPPTOC_MEDIA_SOURCE_CPPTOC_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(BUILDING_CEF_SHARED)
|
||||
#error This file can be included DLL-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_media_router_capi.h"
|
||||
#include "include/cef_media_router.h"
|
||||
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
|
||||
|
||||
// Wrap a C++ class with a C structure.
|
||||
// This class may be instantiated and accessed DLL-side only.
|
||||
class CefMediaSourceCppToC : public CefCppToCRefCounted<CefMediaSourceCppToC,
|
||||
CefMediaSource,
|
||||
cef_media_source_t> {
|
||||
public:
|
||||
CefMediaSourceCppToC();
|
||||
virtual ~CefMediaSourceCppToC();
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CPPTOC_MEDIA_SOURCE_CPPTOC_H_
|
42
libcef_dll/cpptoc/registration_cpptoc.cc
Normal file
42
libcef_dll/cpptoc/registration_cpptoc.cc
Normal file
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=37c8c576c5bccd43f6124095e4ad55e88bc1a185$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/registration_cpptoc.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefRegistrationCppToC::CefRegistrationCppToC() {}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefRegistrationCppToC::~CefRegistrationCppToC() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
CefRefPtr<CefRegistration>
|
||||
CefCppToCRefCounted<CefRegistrationCppToC,
|
||||
CefRegistration,
|
||||
cef_registration_t>::UnwrapDerived(CefWrapperType type,
|
||||
cef_registration_t* s) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType CefCppToCRefCounted<CefRegistrationCppToC,
|
||||
CefRegistration,
|
||||
cef_registration_t>::kWrapperType =
|
||||
WT_REGISTRATION;
|
37
libcef_dll/cpptoc/registration_cpptoc.h
Normal file
37
libcef_dll/cpptoc/registration_cpptoc.h
Normal file
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=e27d69c1509e74c7f5d69f5829c27fa65e47fc2d$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CPPTOC_REGISTRATION_CPPTOC_H_
|
||||
#define CEF_LIBCEF_DLL_CPPTOC_REGISTRATION_CPPTOC_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(BUILDING_CEF_SHARED)
|
||||
#error This file can be included DLL-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_registration_capi.h"
|
||||
#include "include/cef_registration.h"
|
||||
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
|
||||
|
||||
// Wrap a C++ class with a C structure.
|
||||
// This class may be instantiated and accessed DLL-side only.
|
||||
class CefRegistrationCppToC : public CefCppToCRefCounted<CefRegistrationCppToC,
|
||||
CefRegistration,
|
||||
cef_registration_t> {
|
||||
public:
|
||||
CefRegistrationCppToC();
|
||||
virtual ~CefRegistrationCppToC();
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CPPTOC_REGISTRATION_CPPTOC_H_
|
@@ -9,13 +9,14 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=4af6d074b7de62b759a9555a0b0246e57c290328$
|
||||
// $hash=5168000f75f7911dce0bffcf47341e4ee1c2a275$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/request_context_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/cookie_manager_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/dictionary_value_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/extension_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/media_router_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/value_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/completion_callback_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/extension_handler_ctocpp.h"
|
||||
@@ -540,6 +541,22 @@ request_context_get_extension(struct _cef_request_context_t* self,
|
||||
return CefExtensionCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
cef_media_router_t* CEF_CALLBACK
|
||||
request_context_get_media_router(struct _cef_request_context_t* self) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return NULL;
|
||||
|
||||
// Execute
|
||||
CefRefPtr<CefMediaRouter> _retval =
|
||||
CefRequestContextCppToC::Get(self)->GetMediaRouter();
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefMediaRouterCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
@@ -573,6 +590,7 @@ CefRequestContextCppToC::CefRequestContextCppToC() {
|
||||
GetStruct()->has_extension = request_context_has_extension;
|
||||
GetStruct()->get_extensions = request_context_get_extensions;
|
||||
GetStruct()->get_extension = request_context_get_extension;
|
||||
GetStruct()->get_media_router = request_context_get_media_router;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
158
libcef_dll/ctocpp/media_observer_ctocpp.cc
Normal file
158
libcef_dll/ctocpp/media_observer_ctocpp.cc
Normal file
@@ -0,0 +1,158 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=6eed652a4bd13cf685980f7ea0b838d73e6071ba$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/media_observer_ctocpp.h"
|
||||
#include "libcef_dll/cpptoc/media_route_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/media_sink_cpptoc.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefMediaObserverCToCpp::OnSinks(
|
||||
const std::vector<CefRefPtr<CefMediaSink>>& sinks) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_observer_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_sinks))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Translate param: sinks; type: refptr_vec_diff_byref_const
|
||||
const size_t sinksCount = sinks.size();
|
||||
cef_media_sink_t** sinksList = NULL;
|
||||
if (sinksCount > 0) {
|
||||
sinksList = new cef_media_sink_t*[sinksCount];
|
||||
DCHECK(sinksList);
|
||||
if (sinksList) {
|
||||
for (size_t i = 0; i < sinksCount; ++i) {
|
||||
sinksList[i] = CefMediaSinkCppToC::Wrap(sinks[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Execute
|
||||
_struct->on_sinks(_struct, sinksCount, sinksList);
|
||||
|
||||
// Restore param:sinks; type: refptr_vec_diff_byref_const
|
||||
if (sinksList)
|
||||
delete[] sinksList;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefMediaObserverCToCpp::OnRoutes(
|
||||
const std::vector<CefRefPtr<CefMediaRoute>>& routes) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_observer_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_routes))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Translate param: routes; type: refptr_vec_diff_byref_const
|
||||
const size_t routesCount = routes.size();
|
||||
cef_media_route_t** routesList = NULL;
|
||||
if (routesCount > 0) {
|
||||
routesList = new cef_media_route_t*[routesCount];
|
||||
DCHECK(routesList);
|
||||
if (routesList) {
|
||||
for (size_t i = 0; i < routesCount; ++i) {
|
||||
routesList[i] = CefMediaRouteCppToC::Wrap(routes[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Execute
|
||||
_struct->on_routes(_struct, routesCount, routesList);
|
||||
|
||||
// Restore param:routes; type: refptr_vec_diff_byref_const
|
||||
if (routesList)
|
||||
delete[] routesList;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefMediaObserverCToCpp::OnRouteStateChanged(CefRefPtr<CefMediaRoute> route,
|
||||
ConnectionState state) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_observer_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_route_state_changed))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: route; type: refptr_diff
|
||||
DCHECK(route.get());
|
||||
if (!route.get())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
_struct->on_route_state_changed(_struct, CefMediaRouteCppToC::Wrap(route),
|
||||
state);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefMediaObserverCToCpp::OnRouteMessageReceived(
|
||||
CefRefPtr<CefMediaRoute> route,
|
||||
const void* message,
|
||||
size_t message_size) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_observer_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_route_message_received))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: route; type: refptr_diff
|
||||
DCHECK(route.get());
|
||||
if (!route.get())
|
||||
return;
|
||||
// Verify param: message; type: simple_byaddr
|
||||
DCHECK(message);
|
||||
if (!message)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
_struct->on_route_message_received(_struct, CefMediaRouteCppToC::Wrap(route),
|
||||
message, message_size);
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaObserverCToCpp::CefMediaObserverCToCpp() {}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaObserverCToCpp::~CefMediaObserverCToCpp() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
cef_media_observer_t*
|
||||
CefCToCppRefCounted<CefMediaObserverCToCpp,
|
||||
CefMediaObserver,
|
||||
cef_media_observer_t>::UnwrapDerived(CefWrapperType type,
|
||||
CefMediaObserver* c) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType CefCToCppRefCounted<CefMediaObserverCToCpp,
|
||||
CefMediaObserver,
|
||||
cef_media_observer_t>::kWrapperType =
|
||||
WT_MEDIA_OBSERVER;
|
48
libcef_dll/ctocpp/media_observer_ctocpp.h
Normal file
48
libcef_dll/ctocpp/media_observer_ctocpp.h
Normal file
@@ -0,0 +1,48 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=4c2e71870e5f8a31052431a5242f91392607502d$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_MEDIA_OBSERVER_CTOCPP_H_
|
||||
#define CEF_LIBCEF_DLL_CTOCPP_MEDIA_OBSERVER_CTOCPP_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(BUILDING_CEF_SHARED)
|
||||
#error This file can be included DLL-side only
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include "include/capi/cef_media_router_capi.h"
|
||||
#include "include/cef_media_router.h"
|
||||
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
|
||||
|
||||
// Wrap a C structure with a C++ class.
|
||||
// This class may be instantiated and accessed DLL-side only.
|
||||
class CefMediaObserverCToCpp
|
||||
: public CefCToCppRefCounted<CefMediaObserverCToCpp,
|
||||
CefMediaObserver,
|
||||
cef_media_observer_t> {
|
||||
public:
|
||||
CefMediaObserverCToCpp();
|
||||
virtual ~CefMediaObserverCToCpp();
|
||||
|
||||
// CefMediaObserver methods.
|
||||
void OnSinks(const std::vector<CefRefPtr<CefMediaSink>>& sinks) override;
|
||||
void OnRoutes(const std::vector<CefRefPtr<CefMediaRoute>>& routes) override;
|
||||
void OnRouteStateChanged(CefRefPtr<CefMediaRoute> route,
|
||||
ConnectionState state) override;
|
||||
void OnRouteMessageReceived(CefRefPtr<CefMediaRoute> route,
|
||||
const void* message,
|
||||
size_t message_size) override;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_MEDIA_OBSERVER_CTOCPP_H_
|
66
libcef_dll/ctocpp/media_route_create_callback_ctocpp.cc
Normal file
66
libcef_dll/ctocpp/media_route_create_callback_ctocpp.cc
Normal file
@@ -0,0 +1,66 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=93dd08de00931b1c00ec0307cc70496455936b0c$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/media_route_create_callback_ctocpp.h"
|
||||
#include "libcef_dll/cpptoc/media_route_cpptoc.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefMediaRouteCreateCallbackCToCpp::OnMediaRouteCreateFinished(
|
||||
RouteCreateResult result,
|
||||
const CefString& error,
|
||||
CefRefPtr<CefMediaRoute> route) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_route_create_callback_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_media_route_create_finished))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Unverified params: error, route
|
||||
|
||||
// Execute
|
||||
_struct->on_media_route_create_finished(_struct, result, error.GetStruct(),
|
||||
CefMediaRouteCppToC::Wrap(route));
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaRouteCreateCallbackCToCpp::CefMediaRouteCreateCallbackCToCpp() {}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaRouteCreateCallbackCToCpp::~CefMediaRouteCreateCallbackCToCpp() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
cef_media_route_create_callback_t*
|
||||
CefCToCppRefCounted<CefMediaRouteCreateCallbackCToCpp,
|
||||
CefMediaRouteCreateCallback,
|
||||
cef_media_route_create_callback_t>::
|
||||
UnwrapDerived(CefWrapperType type, CefMediaRouteCreateCallback* c) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType
|
||||
CefCToCppRefCounted<CefMediaRouteCreateCallbackCToCpp,
|
||||
CefMediaRouteCreateCallback,
|
||||
cef_media_route_create_callback_t>::kWrapperType =
|
||||
WT_MEDIA_ROUTE_CREATE_CALLBACK;
|
43
libcef_dll/ctocpp/media_route_create_callback_ctocpp.h
Normal file
43
libcef_dll/ctocpp/media_route_create_callback_ctocpp.h
Normal file
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=ac5657bccd7830fde1d3dddfad69d87dff2ae684$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_MEDIA_ROUTE_CREATE_CALLBACK_CTOCPP_H_
|
||||
#define CEF_LIBCEF_DLL_CTOCPP_MEDIA_ROUTE_CREATE_CALLBACK_CTOCPP_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(BUILDING_CEF_SHARED)
|
||||
#error This file can be included DLL-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_media_router_capi.h"
|
||||
#include "include/cef_media_router.h"
|
||||
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
|
||||
|
||||
// Wrap a C structure with a C++ class.
|
||||
// This class may be instantiated and accessed DLL-side only.
|
||||
class CefMediaRouteCreateCallbackCToCpp
|
||||
: public CefCToCppRefCounted<CefMediaRouteCreateCallbackCToCpp,
|
||||
CefMediaRouteCreateCallback,
|
||||
cef_media_route_create_callback_t> {
|
||||
public:
|
||||
CefMediaRouteCreateCallbackCToCpp();
|
||||
virtual ~CefMediaRouteCreateCallbackCToCpp();
|
||||
|
||||
// CefMediaRouteCreateCallback methods.
|
||||
void OnMediaRouteCreateFinished(RouteCreateResult result,
|
||||
const CefString& error,
|
||||
CefRefPtr<CefMediaRoute> route) override;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_MEDIA_ROUTE_CREATE_CALLBACK_CTOCPP_H_
|
129
libcef_dll/ctocpp/media_route_ctocpp.cc
Normal file
129
libcef_dll/ctocpp/media_route_ctocpp.cc
Normal file
@@ -0,0 +1,129 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=7fe34c4b79d10a88bfcf5ec46a54cf52d3657e87$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/media_route_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/media_sink_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/media_source_ctocpp.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
NO_SANITIZE("cfi-icall") CefString CefMediaRouteCToCpp::GetId() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_route_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, get_id))
|
||||
return CefString();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_string_userfree_t _retval = _struct->get_id(_struct);
|
||||
|
||||
// Return type: string
|
||||
CefString _retvalStr;
|
||||
_retvalStr.AttachToUserFree(_retval);
|
||||
return _retvalStr;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CefRefPtr<CefMediaSource> CefMediaRouteCToCpp::GetSource() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_route_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, get_source))
|
||||
return nullptr;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_media_source_t* _retval = _struct->get_source(_struct);
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefMediaSourceCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CefRefPtr<CefMediaSink> CefMediaRouteCToCpp::GetSink() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_route_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, get_sink))
|
||||
return nullptr;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_media_sink_t* _retval = _struct->get_sink(_struct);
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefMediaSinkCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefMediaRouteCToCpp::SendRouteMessage(const void* message,
|
||||
size_t message_size) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_route_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, send_route_message))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: message; type: simple_byaddr
|
||||
DCHECK(message);
|
||||
if (!message)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
_struct->send_route_message(_struct, message, message_size);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") void CefMediaRouteCToCpp::Terminate() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_route_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, terminate))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
_struct->terminate(_struct);
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaRouteCToCpp::CefMediaRouteCToCpp() {}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaRouteCToCpp::~CefMediaRouteCToCpp() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
cef_media_route_t*
|
||||
CefCToCppRefCounted<CefMediaRouteCToCpp, CefMediaRoute, cef_media_route_t>::
|
||||
UnwrapDerived(CefWrapperType type, CefMediaRoute* c) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType CefCToCppRefCounted<CefMediaRouteCToCpp,
|
||||
CefMediaRoute,
|
||||
cef_media_route_t>::kWrapperType =
|
||||
WT_MEDIA_ROUTE;
|
44
libcef_dll/ctocpp/media_route_ctocpp.h
Normal file
44
libcef_dll/ctocpp/media_route_ctocpp.h
Normal file
@@ -0,0 +1,44 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=cb792f909646d1ccd3644877ce2393080465471a$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_MEDIA_ROUTE_CTOCPP_H_
|
||||
#define CEF_LIBCEF_DLL_CTOCPP_MEDIA_ROUTE_CTOCPP_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(WRAPPING_CEF_SHARED)
|
||||
#error This file can be included wrapper-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_media_router_capi.h"
|
||||
#include "include/cef_media_router.h"
|
||||
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
|
||||
|
||||
// Wrap a C structure with a C++ class.
|
||||
// This class may be instantiated and accessed wrapper-side only.
|
||||
class CefMediaRouteCToCpp : public CefCToCppRefCounted<CefMediaRouteCToCpp,
|
||||
CefMediaRoute,
|
||||
cef_media_route_t> {
|
||||
public:
|
||||
CefMediaRouteCToCpp();
|
||||
virtual ~CefMediaRouteCToCpp();
|
||||
|
||||
// CefMediaRoute methods.
|
||||
CefString GetId() OVERRIDE;
|
||||
CefRefPtr<CefMediaSource> GetSource() OVERRIDE;
|
||||
CefRefPtr<CefMediaSink> GetSink() OVERRIDE;
|
||||
void SendRouteMessage(const void* message, size_t message_size) OVERRIDE;
|
||||
void Terminate() OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_MEDIA_ROUTE_CTOCPP_H_
|
167
libcef_dll/ctocpp/media_router_ctocpp.cc
Normal file
167
libcef_dll/ctocpp/media_router_ctocpp.cc
Normal file
@@ -0,0 +1,167 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=4b8ab6373fcb0a84a818c2c5ef8982600346f34b$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/media_router_ctocpp.h"
|
||||
#include "libcef_dll/cpptoc/media_observer_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/media_route_create_callback_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/media_sink_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/media_source_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/registration_ctocpp.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
// STATIC METHODS - Body may be edited by hand.
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CefRefPtr<CefMediaRouter> CefMediaRouter::GetGlobalMediaRouter() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_media_router_t* _retval = cef_media_router_get_global();
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefMediaRouterCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CefRefPtr<CefRegistration> CefMediaRouterCToCpp::AddObserver(
|
||||
CefRefPtr<CefMediaObserver> observer) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_router_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, add_observer))
|
||||
return nullptr;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: observer; type: refptr_diff
|
||||
DCHECK(observer.get());
|
||||
if (!observer.get())
|
||||
return nullptr;
|
||||
|
||||
// Execute
|
||||
cef_registration_t* _retval =
|
||||
_struct->add_observer(_struct, CefMediaObserverCppToC::Wrap(observer));
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefRegistrationCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CefRefPtr<CefMediaSource> CefMediaRouterCToCpp::GetSource(
|
||||
const CefString& urn) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_router_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, get_source))
|
||||
return nullptr;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: urn; type: string_byref_const
|
||||
DCHECK(!urn.empty());
|
||||
if (urn.empty())
|
||||
return nullptr;
|
||||
|
||||
// Execute
|
||||
cef_media_source_t* _retval = _struct->get_source(_struct, urn.GetStruct());
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefMediaSourceCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") void CefMediaRouterCToCpp::NotifyCurrentSinks() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_router_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, notify_current_sinks))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
_struct->notify_current_sinks(_struct);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefMediaRouterCToCpp::CreateRoute(
|
||||
CefRefPtr<CefMediaSource> source,
|
||||
CefRefPtr<CefMediaSink> sink,
|
||||
CefRefPtr<CefMediaRouteCreateCallback> callback) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_router_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, create_route))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: source; type: refptr_same
|
||||
DCHECK(source.get());
|
||||
if (!source.get())
|
||||
return;
|
||||
// Verify param: sink; type: refptr_same
|
||||
DCHECK(sink.get());
|
||||
if (!sink.get())
|
||||
return;
|
||||
// Verify param: callback; type: refptr_diff
|
||||
DCHECK(callback.get());
|
||||
if (!callback.get())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
_struct->create_route(_struct, CefMediaSourceCToCpp::Unwrap(source),
|
||||
CefMediaSinkCToCpp::Unwrap(sink),
|
||||
CefMediaRouteCreateCallbackCppToC::Wrap(callback));
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") void CefMediaRouterCToCpp::NotifyCurrentRoutes() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_router_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, notify_current_routes))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
_struct->notify_current_routes(_struct);
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaRouterCToCpp::CefMediaRouterCToCpp() {}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaRouterCToCpp::~CefMediaRouterCToCpp() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
cef_media_router_t*
|
||||
CefCToCppRefCounted<CefMediaRouterCToCpp, CefMediaRouter, cef_media_router_t>::
|
||||
UnwrapDerived(CefWrapperType type, CefMediaRouter* c) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType CefCToCppRefCounted<CefMediaRouterCToCpp,
|
||||
CefMediaRouter,
|
||||
cef_media_router_t>::kWrapperType =
|
||||
WT_MEDIA_ROUTER;
|
47
libcef_dll/ctocpp/media_router_ctocpp.h
Normal file
47
libcef_dll/ctocpp/media_router_ctocpp.h
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=e3d62de09a699415a839cadda52cca2582d90063$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_MEDIA_ROUTER_CTOCPP_H_
|
||||
#define CEF_LIBCEF_DLL_CTOCPP_MEDIA_ROUTER_CTOCPP_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(WRAPPING_CEF_SHARED)
|
||||
#error This file can be included wrapper-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_media_router_capi.h"
|
||||
#include "include/cef_media_router.h"
|
||||
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
|
||||
|
||||
// Wrap a C structure with a C++ class.
|
||||
// This class may be instantiated and accessed wrapper-side only.
|
||||
class CefMediaRouterCToCpp : public CefCToCppRefCounted<CefMediaRouterCToCpp,
|
||||
CefMediaRouter,
|
||||
cef_media_router_t> {
|
||||
public:
|
||||
CefMediaRouterCToCpp();
|
||||
virtual ~CefMediaRouterCToCpp();
|
||||
|
||||
// CefMediaRouter methods.
|
||||
CefRefPtr<CefRegistration> AddObserver(
|
||||
CefRefPtr<CefMediaObserver> observer) OVERRIDE;
|
||||
CefRefPtr<CefMediaSource> GetSource(const CefString& urn) OVERRIDE;
|
||||
void NotifyCurrentSinks() OVERRIDE;
|
||||
void CreateRoute(CefRefPtr<CefMediaSource> source,
|
||||
CefRefPtr<CefMediaSink> sink,
|
||||
CefRefPtr<CefMediaRouteCreateCallback> callback) OVERRIDE;
|
||||
void NotifyCurrentRoutes() OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_MEDIA_ROUTER_CTOCPP_H_
|
168
libcef_dll/ctocpp/media_sink_ctocpp.cc
Normal file
168
libcef_dll/ctocpp/media_sink_ctocpp.cc
Normal file
@@ -0,0 +1,168 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=bb39ec5e546482b707c1e01a83fc1b064d96a4e6$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/media_sink_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/media_source_ctocpp.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
NO_SANITIZE("cfi-icall") CefString CefMediaSinkCToCpp::GetId() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_sink_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, get_id))
|
||||
return CefString();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_string_userfree_t _retval = _struct->get_id(_struct);
|
||||
|
||||
// Return type: string
|
||||
CefString _retvalStr;
|
||||
_retvalStr.AttachToUserFree(_retval);
|
||||
return _retvalStr;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") bool CefMediaSinkCToCpp::IsValid() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_sink_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, is_valid))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->is_valid(_struct);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") CefString CefMediaSinkCToCpp::GetName() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_sink_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, get_name))
|
||||
return CefString();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_string_userfree_t _retval = _struct->get_name(_struct);
|
||||
|
||||
// Return type: string
|
||||
CefString _retvalStr;
|
||||
_retvalStr.AttachToUserFree(_retval);
|
||||
return _retvalStr;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") CefString CefMediaSinkCToCpp::GetDescription() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_sink_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, get_description))
|
||||
return CefString();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_string_userfree_t _retval = _struct->get_description(_struct);
|
||||
|
||||
// Return type: string
|
||||
CefString _retvalStr;
|
||||
_retvalStr.AttachToUserFree(_retval);
|
||||
return _retvalStr;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") bool CefMediaSinkCToCpp::IsCastSink() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_sink_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, is_cast_sink))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->is_cast_sink(_struct);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") bool CefMediaSinkCToCpp::IsDialSink() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_sink_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, is_dial_sink))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->is_dial_sink(_struct);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
bool CefMediaSinkCToCpp::IsCompatibleWith(CefRefPtr<CefMediaSource> source) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_sink_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, is_compatible_with))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: source; type: refptr_same
|
||||
DCHECK(source.get());
|
||||
if (!source.get())
|
||||
return false;
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->is_compatible_with(
|
||||
_struct, CefMediaSourceCToCpp::Unwrap(source));
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaSinkCToCpp::CefMediaSinkCToCpp() {}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaSinkCToCpp::~CefMediaSinkCToCpp() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
cef_media_sink_t*
|
||||
CefCToCppRefCounted<CefMediaSinkCToCpp, CefMediaSink, cef_media_sink_t>::
|
||||
UnwrapDerived(CefWrapperType type, CefMediaSink* c) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType CefCToCppRefCounted<CefMediaSinkCToCpp,
|
||||
CefMediaSink,
|
||||
cef_media_sink_t>::kWrapperType =
|
||||
WT_MEDIA_SINK;
|
46
libcef_dll/ctocpp/media_sink_ctocpp.h
Normal file
46
libcef_dll/ctocpp/media_sink_ctocpp.h
Normal file
@@ -0,0 +1,46 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=d69c0bdadc802bc7cb970c316f3a0ed8529c5f9c$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_MEDIA_SINK_CTOCPP_H_
|
||||
#define CEF_LIBCEF_DLL_CTOCPP_MEDIA_SINK_CTOCPP_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(WRAPPING_CEF_SHARED)
|
||||
#error This file can be included wrapper-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_media_router_capi.h"
|
||||
#include "include/cef_media_router.h"
|
||||
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
|
||||
|
||||
// Wrap a C structure with a C++ class.
|
||||
// This class may be instantiated and accessed wrapper-side only.
|
||||
class CefMediaSinkCToCpp : public CefCToCppRefCounted<CefMediaSinkCToCpp,
|
||||
CefMediaSink,
|
||||
cef_media_sink_t> {
|
||||
public:
|
||||
CefMediaSinkCToCpp();
|
||||
virtual ~CefMediaSinkCToCpp();
|
||||
|
||||
// CefMediaSink methods.
|
||||
CefString GetId() OVERRIDE;
|
||||
bool IsValid() OVERRIDE;
|
||||
CefString GetName() OVERRIDE;
|
||||
CefString GetDescription() OVERRIDE;
|
||||
bool IsCastSink() OVERRIDE;
|
||||
bool IsDialSink() OVERRIDE;
|
||||
bool IsCompatibleWith(CefRefPtr<CefMediaSource> source) OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_MEDIA_SINK_CTOCPP_H_
|
108
libcef_dll/ctocpp/media_source_ctocpp.cc
Normal file
108
libcef_dll/ctocpp/media_source_ctocpp.cc
Normal file
@@ -0,0 +1,108 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=2b4f20db4eccd1429c748f39db19852cd1644b4a$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/media_source_ctocpp.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
NO_SANITIZE("cfi-icall") CefString CefMediaSourceCToCpp::GetId() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_source_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, get_id))
|
||||
return CefString();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_string_userfree_t _retval = _struct->get_id(_struct);
|
||||
|
||||
// Return type: string
|
||||
CefString _retvalStr;
|
||||
_retvalStr.AttachToUserFree(_retval);
|
||||
return _retvalStr;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") bool CefMediaSourceCToCpp::IsValid() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_source_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, is_valid))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->is_valid(_struct);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") bool CefMediaSourceCToCpp::IsCastSource() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_source_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, is_cast_source))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->is_cast_source(_struct);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") bool CefMediaSourceCToCpp::IsDialSource() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_source_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, is_dial_source))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->is_dial_source(_struct);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaSourceCToCpp::CefMediaSourceCToCpp() {}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaSourceCToCpp::~CefMediaSourceCToCpp() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
cef_media_source_t*
|
||||
CefCToCppRefCounted<CefMediaSourceCToCpp, CefMediaSource, cef_media_source_t>::
|
||||
UnwrapDerived(CefWrapperType type, CefMediaSource* c) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType CefCToCppRefCounted<CefMediaSourceCToCpp,
|
||||
CefMediaSource,
|
||||
cef_media_source_t>::kWrapperType =
|
||||
WT_MEDIA_SOURCE;
|
43
libcef_dll/ctocpp/media_source_ctocpp.h
Normal file
43
libcef_dll/ctocpp/media_source_ctocpp.h
Normal file
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=73aeb0f58611c0d7a9fa13f1d9268912e0fba0bd$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_MEDIA_SOURCE_CTOCPP_H_
|
||||
#define CEF_LIBCEF_DLL_CTOCPP_MEDIA_SOURCE_CTOCPP_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(WRAPPING_CEF_SHARED)
|
||||
#error This file can be included wrapper-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_media_router_capi.h"
|
||||
#include "include/cef_media_router.h"
|
||||
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
|
||||
|
||||
// Wrap a C structure with a C++ class.
|
||||
// This class may be instantiated and accessed wrapper-side only.
|
||||
class CefMediaSourceCToCpp : public CefCToCppRefCounted<CefMediaSourceCToCpp,
|
||||
CefMediaSource,
|
||||
cef_media_source_t> {
|
||||
public:
|
||||
CefMediaSourceCToCpp();
|
||||
virtual ~CefMediaSourceCToCpp();
|
||||
|
||||
// CefMediaSource methods.
|
||||
CefString GetId() OVERRIDE;
|
||||
bool IsValid() OVERRIDE;
|
||||
bool IsCastSource() OVERRIDE;
|
||||
bool IsDialSource() OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_MEDIA_SOURCE_CTOCPP_H_
|
42
libcef_dll/ctocpp/registration_ctocpp.cc
Normal file
42
libcef_dll/ctocpp/registration_ctocpp.cc
Normal file
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=89f0f0c0ae2485adbf8140a419969901e5766b51$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/registration_ctocpp.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefRegistrationCToCpp::CefRegistrationCToCpp() {}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefRegistrationCToCpp::~CefRegistrationCToCpp() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
cef_registration_t*
|
||||
CefCToCppRefCounted<CefRegistrationCToCpp,
|
||||
CefRegistration,
|
||||
cef_registration_t>::UnwrapDerived(CefWrapperType type,
|
||||
CefRegistration* c) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType CefCToCppRefCounted<CefRegistrationCToCpp,
|
||||
CefRegistration,
|
||||
cef_registration_t>::kWrapperType =
|
||||
WT_REGISTRATION;
|
39
libcef_dll/ctocpp/registration_ctocpp.h
Normal file
39
libcef_dll/ctocpp/registration_ctocpp.h
Normal file
@@ -0,0 +1,39 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=6d458b0a8e42e3f3347d5101f8d3f1f88264ecc7$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_REGISTRATION_CTOCPP_H_
|
||||
#define CEF_LIBCEF_DLL_CTOCPP_REGISTRATION_CTOCPP_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(WRAPPING_CEF_SHARED)
|
||||
#error This file can be included wrapper-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_registration_capi.h"
|
||||
#include "include/cef_registration.h"
|
||||
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
|
||||
|
||||
// Wrap a C structure with a C++ class.
|
||||
// This class may be instantiated and accessed wrapper-side only.
|
||||
class CefRegistrationCToCpp : public CefCToCppRefCounted<CefRegistrationCToCpp,
|
||||
CefRegistration,
|
||||
cef_registration_t> {
|
||||
public:
|
||||
CefRegistrationCToCpp();
|
||||
virtual ~CefRegistrationCToCpp();
|
||||
|
||||
// CefRegistration methods.
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_REGISTRATION_CTOCPP_H_
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=dd21194253186ee403d7ffe5098e87b030eeb4c8$
|
||||
// $hash=a29d8f9e49143e42a0ae0204c7d439c76b3c371c$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/request_context_ctocpp.h"
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "libcef_dll/ctocpp/cookie_manager_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/dictionary_value_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/extension_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/media_router_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/value_ctocpp.h"
|
||||
#include "libcef_dll/transfer_util.h"
|
||||
|
||||
@@ -525,6 +526,21 @@ CefRefPtr<CefExtension> CefRequestContextCToCpp::GetExtension(
|
||||
return CefExtensionCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CefRefPtr<CefMediaRouter> CefRequestContextCToCpp::GetMediaRouter() {
|
||||
cef_request_context_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, get_media_router))
|
||||
return nullptr;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_media_router_t* _retval = _struct->get_media_router(_struct);
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefMediaRouterCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefRequestContextCToCpp::CefRequestContextCToCpp() {}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=d962f641e63a8dd86bdb44eb058c39d97db7f880$
|
||||
// $hash=7841eec57c44171080b5d958ca03760cbe23f22b$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_REQUEST_CONTEXT_CTOCPP_H_
|
||||
@@ -75,6 +75,7 @@ class CefRequestContextCToCpp
|
||||
bool HasExtension(const CefString& extension_id) OVERRIDE;
|
||||
bool GetExtensions(std::vector<CefString>& extension_ids) OVERRIDE;
|
||||
CefRefPtr<CefExtension> GetExtension(const CefString& extension_id) OVERRIDE;
|
||||
CefRefPtr<CefMediaRouter> GetMediaRouter() OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_REQUEST_CONTEXT_CTOCPP_H_
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=5e0a3a27b41b550a1dd4985eec9034a6f7c2b7d7$
|
||||
// $hash=bf82965f02cafae5a1afc80ab0c976436be9712e$
|
||||
//
|
||||
|
||||
#include <dlfcn.h>
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "include/capi/cef_drag_data_capi.h"
|
||||
#include "include/capi/cef_file_util_capi.h"
|
||||
#include "include/capi/cef_image_capi.h"
|
||||
#include "include/capi/cef_media_router_capi.h"
|
||||
#include "include/capi/cef_menu_model_capi.h"
|
||||
#include "include/capi/cef_origin_whitelist_capi.h"
|
||||
#include "include/capi/cef_parser_capi.h"
|
||||
@@ -201,6 +202,7 @@ typedef struct _cef_cookie_manager_t* (
|
||||
struct _cef_completion_callback_t*);
|
||||
typedef struct _cef_drag_data_t* (*cef_drag_data_create_ptr)();
|
||||
typedef struct _cef_image_t* (*cef_image_create_ptr)();
|
||||
typedef struct _cef_media_router_t* (*cef_media_router_get_global_ptr)();
|
||||
typedef struct _cef_menu_model_t* (*cef_menu_model_create_ptr)(
|
||||
struct _cef_menu_model_delegate_t*);
|
||||
typedef struct _cef_print_settings_t* (*cef_print_settings_create_ptr)();
|
||||
@@ -575,6 +577,7 @@ struct libcef_pointers {
|
||||
cef_cookie_manager_get_global_manager;
|
||||
cef_drag_data_create_ptr cef_drag_data_create;
|
||||
cef_image_create_ptr cef_image_create;
|
||||
cef_media_router_get_global_ptr cef_media_router_get_global;
|
||||
cef_menu_model_create_ptr cef_menu_model_create;
|
||||
cef_print_settings_create_ptr cef_print_settings_create;
|
||||
cef_process_message_create_ptr cef_process_message_create;
|
||||
@@ -788,6 +791,7 @@ int libcef_init_pointers(const char* path) {
|
||||
INIT_ENTRY(cef_cookie_manager_get_global_manager);
|
||||
INIT_ENTRY(cef_drag_data_create);
|
||||
INIT_ENTRY(cef_image_create);
|
||||
INIT_ENTRY(cef_media_router_get_global);
|
||||
INIT_ENTRY(cef_menu_model_create);
|
||||
INIT_ENTRY(cef_print_settings_create);
|
||||
INIT_ENTRY(cef_process_message_create);
|
||||
@@ -1301,6 +1305,11 @@ NO_SANITIZE("cfi-icall") struct _cef_image_t* cef_image_create() {
|
||||
return g_libcef_pointers.cef_image_create();
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
struct _cef_media_router_t* cef_media_router_get_global() {
|
||||
return g_libcef_pointers.cef_media_router_get_global();
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
struct _cef_menu_model_t* cef_menu_model_create(
|
||||
struct _cef_menu_model_delegate_t* delegate) {
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=946864e8254e77f0555d607d1d99a8ba3f1c45db$
|
||||
// $hash=089392d929a9f7a3ca4fe7f53d63b98536505261$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_WRAPPER_TYPES_H_
|
||||
@@ -73,6 +73,12 @@ enum CefWrapperType {
|
||||
WT_LIFE_SPAN_HANDLER,
|
||||
WT_LIST_VALUE,
|
||||
WT_LOAD_HANDLER,
|
||||
WT_MEDIA_OBSERVER,
|
||||
WT_MEDIA_ROUTE,
|
||||
WT_MEDIA_ROUTE_CREATE_CALLBACK,
|
||||
WT_MEDIA_ROUTER,
|
||||
WT_MEDIA_SINK,
|
||||
WT_MEDIA_SOURCE,
|
||||
WT_MENU_BUTTON,
|
||||
WT_MENU_BUTTON_DELEGATE,
|
||||
WT_MENU_BUTTON_PRESSED_LOCK,
|
||||
@@ -92,6 +98,7 @@ enum CefWrapperType {
|
||||
WT_PROCESS_MESSAGE,
|
||||
WT_READ_HANDLER,
|
||||
WT_REGISTER_CDM_CALLBACK,
|
||||
WT_REGISTRATION,
|
||||
WT_RENDER_HANDLER,
|
||||
WT_RENDER_PROCESS_HANDLER,
|
||||
WT_REQUEST,
|
||||
|
@@ -53,7 +53,7 @@ index 3f790e96da74..7deec3e4b0ce 100644
|
||||
event_router->GetEngineIfActive(extension_id, error);
|
||||
return engine;
|
||||
diff --git chrome/browser/optimization_guide/optimization_guide_navigation_data.cc chrome/browser/optimization_guide/optimization_guide_navigation_data.cc
|
||||
index acbec3d510c4..3f640008ddc0 100644
|
||||
index 756a80c5565b..cb91b30e7882 100644
|
||||
--- chrome/browser/optimization_guide/optimization_guide_navigation_data.cc
|
||||
+++ chrome/browser/optimization_guide/optimization_guide_navigation_data.cc
|
||||
@@ -8,6 +8,7 @@
|
||||
@@ -91,10 +91,10 @@ index acbec3d510c4..3f640008ddc0 100644
|
||||
int64_t navigation_id)
|
||||
: navigation_id_(navigation_id) {}
|
||||
diff --git chrome/browser/optimization_guide/prediction/prediction_manager.cc chrome/browser/optimization_guide/prediction/prediction_manager.cc
|
||||
index f8eb245f6b48..6b24f4d43d5f 100644
|
||||
index dfb47dfd1886..bf0753323b61 100644
|
||||
--- chrome/browser/optimization_guide/prediction/prediction_manager.cc
|
||||
+++ chrome/browser/optimization_guide/prediction/prediction_manager.cc
|
||||
@@ -61,7 +61,9 @@ bool ShouldUseCurrentOptimizationTargetDecision(
|
||||
@@ -62,7 +62,9 @@ bool ShouldUseCurrentOptimizationTargetDecision(
|
||||
|
||||
// Delay between retries on failed fetch and store of prediction models and
|
||||
// host model features from the remote Optimization Guide Service.
|
||||
@@ -104,7 +104,7 @@ index f8eb245f6b48..6b24f4d43d5f 100644
|
||||
|
||||
// The amount of time to wait after a successful fetch of models and host model
|
||||
// features before requesting an update from the remote Optimization Guide
|
||||
@@ -71,11 +73,13 @@ constexpr base::TimeDelta kUpdateModelsAndFeaturesDelay =
|
||||
@@ -72,11 +74,13 @@ constexpr base::TimeDelta kUpdateModelsAndFeaturesDelay =
|
||||
|
||||
// Provide a random time delta in seconds before fetching models and host model
|
||||
// features.
|
||||
@@ -118,7 +118,7 @@ index f8eb245f6b48..6b24f4d43d5f 100644
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -694,12 +698,12 @@ void PredictionManager::ScheduleModelsAndHostModelFeaturesFetch() {
|
||||
@@ -734,12 +738,12 @@ void PredictionManager::ScheduleModelsAndHostModelFeaturesFetch() {
|
||||
model_and_features_store_->GetHostModelFeaturesUpdateTime() -
|
||||
clock_->Now();
|
||||
const base::TimeDelta time_until_retry =
|
||||
@@ -432,6 +432,29 @@ index 8a49f3591a73..0345548ec18f 100644
|
||||
}
|
||||
}
|
||||
|
||||
diff --git third_party/blink/renderer/platform/audio/audio_delay_dsp_kernel.cc third_party/blink/renderer/platform/audio/audio_delay_dsp_kernel.cc
|
||||
index 3e2f1a5a3fad..613745b93595 100644
|
||||
--- third_party/blink/renderer/platform/audio/audio_delay_dsp_kernel.cc
|
||||
+++ third_party/blink/renderer/platform/audio/audio_delay_dsp_kernel.cc
|
||||
@@ -32,7 +32,9 @@
|
||||
namespace blink {
|
||||
|
||||
// Delay nodes have a max allowed delay time of this many seconds.
|
||||
+namespace i {
|
||||
const float kMaxDelayTimeSeconds = 30;
|
||||
+}
|
||||
|
||||
AudioDelayDSPKernel::AudioDelayDSPKernel(AudioDSPKernelProcessor* processor,
|
||||
size_t processing_size_in_frames)
|
||||
@@ -46,7 +48,7 @@ AudioDelayDSPKernel::AudioDelayDSPKernel(double max_delay_time,
|
||||
max_delay_time_(max_delay_time),
|
||||
write_index_(0) {
|
||||
DCHECK_GT(max_delay_time_, 0.0);
|
||||
- DCHECK_LE(max_delay_time_, kMaxDelayTimeSeconds);
|
||||
+ DCHECK_LE(max_delay_time_, i::kMaxDelayTimeSeconds);
|
||||
DCHECK(std::isfinite(max_delay_time_));
|
||||
|
||||
size_t buffer_length = BufferLengthForDelay(max_delay_time, sample_rate);
|
||||
diff --git third_party/blink/renderer/platform/fonts/font_matching_metrics.cc third_party/blink/renderer/platform/fonts/font_matching_metrics.cc
|
||||
index 5e1005a2e4d3..ef83cadc9957 100644
|
||||
--- third_party/blink/renderer/platform/fonts/font_matching_metrics.cc
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git chrome/browser/BUILD.gn chrome/browser/BUILD.gn
|
||||
index 6751a787272b..751b62c50a81 100644
|
||||
index aefba4a5a3ca..eaa48b96c12a 100644
|
||||
--- chrome/browser/BUILD.gn
|
||||
+++ chrome/browser/BUILD.gn
|
||||
@@ -10,6 +10,7 @@ import("//build/config/features.gni")
|
||||
@@ -10,7 +10,7 @@ index 6751a787272b..751b62c50a81 100644
|
||||
import("//chrome/browser/buildflags.gni")
|
||||
import("//chrome/common/features.gni")
|
||||
import("//components/feature_engagement/features.gni")
|
||||
@@ -1959,6 +1960,7 @@ jumbo_static_library("browser") {
|
||||
@@ -1961,6 +1962,7 @@ jumbo_static_library("browser") {
|
||||
"//base/util/values:values_util",
|
||||
"//build:branding_buildflags",
|
||||
"//cc",
|
||||
@@ -18,7 +18,7 @@ index 6751a787272b..751b62c50a81 100644
|
||||
"//chrome:extra_resources",
|
||||
"//chrome:resources",
|
||||
"//chrome:strings",
|
||||
@@ -2263,6 +2265,10 @@ jumbo_static_library("browser") {
|
||||
@@ -2266,6 +2268,10 @@ jumbo_static_library("browser") {
|
||||
]
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn
|
||||
index faa1344bd0a9..4528f101adb8 100644
|
||||
index 7932e2421de6..04068aac7334 100644
|
||||
--- chrome/browser/ui/BUILD.gn
|
||||
+++ chrome/browser/ui/BUILD.gn
|
||||
@@ -9,6 +9,7 @@ import("//build/config/features.gni")
|
||||
|
@@ -1,8 +1,8 @@
|
||||
diff --git chrome/browser/profiles/profile_manager.cc chrome/browser/profiles/profile_manager.cc
|
||||
index 1abea76ebc02..d9fc9c0450c2 100644
|
||||
index c5ab679fb529..3f1c807c65a7 100644
|
||||
--- chrome/browser/profiles/profile_manager.cc
|
||||
+++ chrome/browser/profiles/profile_manager.cc
|
||||
@@ -359,7 +359,7 @@ ProfileManager::ProfileManager(const base::FilePath& user_data_dir)
|
||||
@@ -360,7 +360,7 @@ ProfileManager::ProfileManager(const base::FilePath& user_data_dir)
|
||||
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED,
|
||||
content::NotificationService::AllSources());
|
||||
|
||||
@@ -43,7 +43,7 @@ index 7d02af7f8f60..eb70e533dbfb 100644
|
||||
// Get the path of the last used profile, or if that's undefined, the default
|
||||
// profile.
|
||||
diff --git chrome/browser/profiles/renderer_updater.cc chrome/browser/profiles/renderer_updater.cc
|
||||
index 07e6f8d726df..9a3c6b38b8eb 100644
|
||||
index ce50c9ee3f92..eba0894ee2b4 100644
|
||||
--- chrome/browser/profiles/renderer_updater.cc
|
||||
+++ chrome/browser/profiles/renderer_updater.cc
|
||||
@@ -7,6 +7,7 @@
|
||||
@@ -54,7 +54,7 @@ index 07e6f8d726df..9a3c6b38b8eb 100644
|
||||
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/signin/identity_manager_factory.h"
|
||||
@@ -67,8 +68,12 @@ void GetGuestViewDefaultContentSettingRules(
|
||||
@@ -62,8 +63,12 @@ void GetGuestViewDefaultContentSettingRules(
|
||||
|
||||
RendererUpdater::RendererUpdater(Profile* profile)
|
||||
: profile_(profile), identity_manager_observer_(this) {
|
||||
@@ -67,7 +67,7 @@ index 07e6f8d726df..9a3c6b38b8eb 100644
|
||||
#if defined(OS_CHROMEOS)
|
||||
oauth2_login_manager_ =
|
||||
chromeos::OAuth2LoginManagerFactory::GetForProfile(profile_);
|
||||
@@ -238,7 +243,7 @@ void RendererUpdater::UpdateRenderer(
|
||||
@@ -233,7 +238,7 @@ void RendererUpdater::UpdateRenderer(
|
||||
force_google_safesearch_.GetValue(),
|
||||
force_youtube_restrict_.GetValue(),
|
||||
allowed_domains_for_apps_.GetValue(),
|
||||
|
@@ -226,10 +226,10 @@ index 632ae86c6fd6..55b749ec1242 100644
|
||||
const std::vector<WebPluginInfo>& all_plugins);
|
||||
|
||||
diff --git content/common/frame_messages.h content/common/frame_messages.h
|
||||
index 06c8e08ba8d5..1e349e3c06b6 100644
|
||||
index 5b5582520873..65f1931564ed 100644
|
||||
--- content/common/frame_messages.h
|
||||
+++ content/common/frame_messages.h
|
||||
@@ -1060,9 +1060,10 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperStopsPlayback,
|
||||
@@ -1055,9 +1055,10 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperStopsPlayback,
|
||||
// type. If there is no matching plugin, |found| is false.
|
||||
// |actual_mime_type| is the actual mime type supported by the
|
||||
// found plugin.
|
||||
@@ -329,10 +329,10 @@ index 6002ce70bb17..4198134b1b73 100644
|
||||
// started.
|
||||
virtual void SetRuntimeFeaturesDefaultsBeforeBlinkInitialization() {}
|
||||
diff --git content/renderer/render_frame_impl.cc content/renderer/render_frame_impl.cc
|
||||
index 32a6927eaa93..540a6cbf450b 100644
|
||||
index f92ca261b2f2..67e2f2809d4a 100644
|
||||
--- content/renderer/render_frame_impl.cc
|
||||
+++ content/renderer/render_frame_impl.cc
|
||||
@@ -3892,7 +3892,8 @@ blink::WebPlugin* RenderFrameImpl::CreatePlugin(
|
||||
@@ -3881,7 +3881,8 @@ blink::WebPlugin* RenderFrameImpl::CreatePlugin(
|
||||
std::string mime_type;
|
||||
bool found = false;
|
||||
Send(new FrameHostMsg_GetPluginInfo(
|
||||
|
@@ -1,8 +1,8 @@
|
||||
diff --git chrome/test/BUILD.gn chrome/test/BUILD.gn
|
||||
index 5c45bc5e6b75..97282b45f57e 100644
|
||||
index 4af881eba8a7..cf37d7b78107 100644
|
||||
--- chrome/test/BUILD.gn
|
||||
+++ chrome/test/BUILD.gn
|
||||
@@ -4720,7 +4720,7 @@ test("unit_tests") {
|
||||
@@ -4729,7 +4729,7 @@ test("unit_tests") {
|
||||
if (use_gio) {
|
||||
configs += [ "//build/linux:gio_config" ]
|
||||
}
|
||||
@@ -11,7 +11,7 @@ index 5c45bc5e6b75..97282b45f57e 100644
|
||||
deps += [ "//chrome/browser/ui/libgtkui" ]
|
||||
}
|
||||
|
||||
@@ -5708,7 +5708,7 @@ if (!is_android) {
|
||||
@@ -5717,7 +5717,7 @@ if (!is_android) {
|
||||
# suites, it seems like one or another starts timing out too.
|
||||
"../browser/ui/views/keyboard_access_browsertest.cc",
|
||||
]
|
||||
|
@@ -41,10 +41,10 @@ index cc4b13a7b9c6..84f3b9ed7cf4 100644
|
||||
|
||||
} // namespace content
|
||||
diff --git content/browser/renderer_host/render_widget_host_impl.cc content/browser/renderer_host/render_widget_host_impl.cc
|
||||
index a91a66bca29d..bff1662c7323 100644
|
||||
index 2427458b6b28..ef201f18a0c0 100644
|
||||
--- content/browser/renderer_host/render_widget_host_impl.cc
|
||||
+++ content/browser/renderer_host/render_widget_host_impl.cc
|
||||
@@ -2692,6 +2692,11 @@ void RenderWidgetHostImpl::SetNeedsBeginFrameForFlingProgress() {
|
||||
@@ -2683,6 +2683,11 @@ void RenderWidgetHostImpl::SetNeedsBeginFrameForFlingProgress() {
|
||||
SetNeedsBeginFrame(true);
|
||||
}
|
||||
|
||||
@@ -57,10 +57,10 @@ index a91a66bca29d..bff1662c7323 100644
|
||||
const WebInputEvent& event) {
|
||||
if (base::FeatureList::IsEnabled(features::kBrowserVerifiedUserActivation) &&
|
||||
diff --git content/browser/renderer_host/render_widget_host_impl.h content/browser/renderer_host/render_widget_host_impl.h
|
||||
index 15a23f954089..87715137b8b4 100644
|
||||
index 459d06cd7f5e..728026ae0afa 100644
|
||||
--- content/browser/renderer_host/render_widget_host_impl.h
|
||||
+++ content/browser/renderer_host/render_widget_host_impl.h
|
||||
@@ -736,6 +736,7 @@ class CONTENT_EXPORT RenderWidgetHostImpl
|
||||
@@ -726,6 +726,7 @@ class CONTENT_EXPORT RenderWidgetHostImpl
|
||||
void ProgressFlingIfNeeded(base::TimeTicks current_time);
|
||||
void StopFling();
|
||||
void SetNeedsBeginFrameForFlingProgress();
|
||||
|
@@ -35,7 +35,7 @@ index 04c03cfcb774..4f5488ef1699 100644
|
||||
bool record_whole_document;
|
||||
|
||||
diff --git content/renderer/render_view_impl.cc content/renderer/render_view_impl.cc
|
||||
index 556a107ed038..2dbf8cc69c7e 100644
|
||||
index 7bf0464c14f8..e3a000e0f480 100644
|
||||
--- content/renderer/render_view_impl.cc
|
||||
+++ content/renderer/render_view_impl.cc
|
||||
@@ -1015,6 +1015,8 @@ void RenderView::ApplyWebPreferences(const WebPreferences& prefs,
|
||||
|
@@ -262,7 +262,7 @@ index 0881b3dd9303..4df6883d4d05 100644
|
||||
Profile* const profile_;
|
||||
PrintPreviewStickySettings* const sticky_settings_;
|
||||
diff --git chrome/browser/ui/webui/print_preview/print_preview_handler.cc chrome/browser/ui/webui/print_preview/print_preview_handler.cc
|
||||
index 9bdbc0212f55..d93673e5b0c1 100644
|
||||
index 9d9c689a4b9f..e2a90255acab 100644
|
||||
--- chrome/browser/ui/webui/print_preview/print_preview_handler.cc
|
||||
+++ chrome/browser/ui/webui/print_preview/print_preview_handler.cc
|
||||
@@ -25,6 +25,7 @@
|
||||
@@ -273,7 +273,7 @@ index 9bdbc0212f55..d93673e5b0c1 100644
|
||||
#include "chrome/browser/app_mode/app_mode_utils.h"
|
||||
#include "chrome/browser/bad_message.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
@@ -1107,7 +1108,7 @@ void PrintPreviewHandler::SendInitialSettings(
|
||||
@@ -1128,7 +1129,7 @@ void PrintPreviewHandler::SendInitialSettings(
|
||||
initial_settings.SetKey(kPolicies, std::move(policies));
|
||||
|
||||
if (IsCloudPrintEnabled() &&
|
||||
@@ -282,7 +282,7 @@ index 9bdbc0212f55..d93673e5b0c1 100644
|
||||
initial_settings.SetStringKey(
|
||||
kCloudPrintURL, GURL(cloud_devices::GetCloudPrintURL()).spec());
|
||||
}
|
||||
@@ -1366,6 +1367,9 @@ PrinterHandler* PrintPreviewHandler::GetPrinterHandler(
|
||||
@@ -1393,6 +1394,9 @@ PrinterHandler* PrintPreviewHandler::GetPrinterHandler(
|
||||
}
|
||||
return privet_printer_handler_.get();
|
||||
}
|
||||
@@ -292,7 +292,7 @@ index 9bdbc0212f55..d93673e5b0c1 100644
|
||||
#endif
|
||||
if (printer_type == PrinterType::kPdfPrinter) {
|
||||
if (!pdf_printer_handler_) {
|
||||
@@ -1385,7 +1389,7 @@ PrinterHandler* PrintPreviewHandler::GetPrinterHandler(
|
||||
@@ -1412,7 +1416,7 @@ PrinterHandler* PrintPreviewHandler::GetPrinterHandler(
|
||||
if (printer_type == PrinterType::kCloudPrinter) {
|
||||
// This printer handler is currently experimental. Ensure it is never
|
||||
// created unless the flag is enabled.
|
||||
@@ -301,7 +301,7 @@ index 9bdbc0212f55..d93673e5b0c1 100644
|
||||
if (!cloud_printer_handler_)
|
||||
cloud_printer_handler_ = PrinterHandler::CreateForCloudPrinters();
|
||||
return cloud_printer_handler_.get();
|
||||
@@ -1448,6 +1452,7 @@ void PrintPreviewHandler::OnPrintResult(const std::string& callback_id,
|
||||
@@ -1475,6 +1479,7 @@ void PrintPreviewHandler::OnPrintResult(const std::string& callback_id,
|
||||
}
|
||||
|
||||
void PrintPreviewHandler::RegisterForGaiaCookieChanges() {
|
||||
@@ -309,7 +309,7 @@ index 9bdbc0212f55..d93673e5b0c1 100644
|
||||
DCHECK(!identity_manager_);
|
||||
cloud_print_enabled_ =
|
||||
!base::Contains(printer_type_deny_list_, kCloudPrinter) &&
|
||||
@@ -1464,6 +1469,7 @@ void PrintPreviewHandler::RegisterForGaiaCookieChanges() {
|
||||
@@ -1491,6 +1496,7 @@ void PrintPreviewHandler::RegisterForGaiaCookieChanges() {
|
||||
|
||||
identity_manager_ = IdentityManagerFactory::GetForProfile(profile);
|
||||
identity_manager_->AddObserver(this);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
diff --git content/browser/renderer_host/render_widget_host_view_aura.cc content/browser/renderer_host/render_widget_host_view_aura.cc
|
||||
index 4d7831ae6b04..9c1b215220ab 100644
|
||||
index b5180b130204..7c18c0f1aad9 100644
|
||||
--- content/browser/renderer_host/render_widget_host_view_aura.cc
|
||||
+++ content/browser/renderer_host/render_widget_host_view_aura.cc
|
||||
@@ -721,10 +721,12 @@ gfx::Rect RenderWidgetHostViewAura::GetViewBounds() {
|
||||
@@ -732,10 +732,12 @@ gfx::Rect RenderWidgetHostViewAura::GetViewBounds() {
|
||||
void RenderWidgetHostViewAura::UpdateBackgroundColor() {
|
||||
DCHECK(GetBackgroundColor());
|
||||
|
||||
@@ -19,7 +19,7 @@ index 4d7831ae6b04..9c1b215220ab 100644
|
||||
}
|
||||
|
||||
void RenderWidgetHostViewAura::WindowTitleChanged() {
|
||||
@@ -2001,6 +2003,15 @@ void RenderWidgetHostViewAura::CreateAuraWindow(aura::client::WindowType type) {
|
||||
@@ -2022,6 +2024,15 @@ void RenderWidgetHostViewAura::CreateAuraWindow(aura::client::WindowType type) {
|
||||
// Init(), because it needs to have the layer.
|
||||
if (frame_sink_id_.is_valid())
|
||||
window_->SetEmbedFrameSinkId(frame_sink_id_);
|
||||
|
@@ -139,10 +139,10 @@ index 5dbc9d2dfcfb..1c31d97825c2 100644
|
||||
|
||||
void CookieManager::SetForceKeepSessionState() {
|
||||
diff --git services/network/network_context.cc services/network/network_context.cc
|
||||
index b1740e9c8a2f..3509c005191c 100644
|
||||
index 83d6b8a9e1d9..583e323a9d5a 100644
|
||||
--- services/network/network_context.cc
|
||||
+++ services/network/network_context.cc
|
||||
@@ -1745,6 +1745,7 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
|
||||
@@ -1727,6 +1727,7 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext() {
|
||||
}
|
||||
|
||||
scoped_refptr<SessionCleanupCookieStore> session_cleanup_cookie_store;
|
||||
@@ -150,7 +150,7 @@ index b1740e9c8a2f..3509c005191c 100644
|
||||
if (params_->cookie_path) {
|
||||
scoped_refptr<base::SequencedTaskRunner> client_task_runner =
|
||||
base::ThreadTaskRunnerHandle::Get();
|
||||
@@ -1772,18 +1773,27 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
|
||||
@@ -1754,18 +1755,27 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext() {
|
||||
session_cleanup_cookie_store =
|
||||
base::MakeRefCounted<SessionCleanupCookieStore>(sqlite_store);
|
||||
|
||||
|
@@ -13,7 +13,7 @@ index 5e7af339b157..26bdb73c5086 100644
|
||||
{base::ThreadPool(), base::MayBlock(),
|
||||
base::TaskPriority::USER_VISIBLE,
|
||||
diff --git content/browser/browser_context.cc content/browser/browser_context.cc
|
||||
index 7b48f428955b..0bd02ca49d05 100644
|
||||
index 80fd00865e83..2a5434f9b005 100644
|
||||
--- content/browser/browser_context.cc
|
||||
+++ content/browser/browser_context.cc
|
||||
@@ -57,6 +57,7 @@
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user