mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
43 Commits
5bafd32ee1
...
4044
Author | SHA1 | Date | |
---|---|---|---|
|
e4f25cec32 | ||
|
b223419041 | ||
|
bb98749dba | ||
|
1a0137cfb8 | ||
|
89b49aac2f | ||
|
3d028a9efa | ||
|
b547de9ee5 | ||
|
8e9984b3e3 | ||
|
072a5f5c70 | ||
|
b9282cc6f6 | ||
|
b2b49f1076 | ||
|
4e13d9991b | ||
|
3afea627b4 | ||
|
c0b313d1bf | ||
|
56f4784cae | ||
|
23f4473cca | ||
|
e864886056 | ||
|
a796f47ab6 | ||
|
3b56636993 | ||
|
b1bb21ce4b | ||
|
b382c6232d | ||
|
dacda4f675 | ||
|
e07275dc37 | ||
|
11b3194d5b | ||
|
46e4fef7e3 | ||
|
7aed8c8873 | ||
|
6a3b8bdae3 | ||
|
266704291e | ||
|
754b4eefca | ||
|
0a69d0d6e3 | ||
|
51e8afaeef | ||
|
b1789de00f | ||
|
8341771462 | ||
|
468bc37d1a | ||
|
1606b8e456 | ||
|
910a87e24d | ||
|
5633445222 | ||
|
409e14fe5a | ||
|
42583eb1a2 | ||
|
cd126463a0 | ||
|
d33bb683b3 | ||
|
33b89e9389 | ||
|
dfbb9418fc |
@@ -1,6 +1,8 @@
|
||||
# This file is an addendum to the Chromium AUTHORS file.
|
||||
# Names should be added to this file like so:
|
||||
# Name or Organization <email address>
|
||||
# This file is an addendum to the Chromium AUTHORS file. It lists authors
|
||||
# through March 16, 2015 when Git was introduced for source code management.
|
||||
# A list of additional authors added after that date can be found by executing
|
||||
# this command on a local Git checkout:
|
||||
# git log --all --format="%aN <%aE>" | sort -u
|
||||
|
||||
Marshall Greenblatt <magreenblatt@gmail.com>
|
||||
Jamie Kirkpatrick <jkp@spotify.com>
|
||||
|
10
BUILD.gn
10
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",
|
||||
|
@@ -7,5 +7,6 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'refs/tags/81.0.4044.0'
|
||||
'chromium_checkout': 'refs/tags/81.0.4044.138',
|
||||
'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',
|
||||
|
328
include/capi/cef_media_router_capi.h
Normal file
328
include/capi/cef_media_router_capi.h
Normal file
@@ -0,0 +1,328 @@
|
||||
// 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=aa1310919932145744d5347d449d6ee10a3a0813$
|
||||
//
|
||||
|
||||
#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 the icon type for this sink.
|
||||
///
|
||||
cef_media_sink_icon_type_t(CEF_CALLBACK* get_icon_type)(
|
||||
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=fd013f5bdcf2333b1f0fb452442d300dffe598e5$
|
||||
//
|
||||
|
||||
#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 "c80d4c5f1dc72279ac7a44d7b174fb80cf728abc"
|
||||
#if defined(OS_WIN)
|
||||
#define CEF_API_HASH_PLATFORM "3b8e38ae40c1a930227c6277c39dbc24081ccec1"
|
||||
#define CEF_API_HASH_PLATFORM "bde71fdc88914ed7353ee7308d060cd6b4f8c8af"
|
||||
#elif defined(OS_MACOSX)
|
||||
#define CEF_API_HASH_PLATFORM "4a77f1908fabccdb01a2d3bdbede5ca09fbaa394"
|
||||
#define CEF_API_HASH_PLATFORM "2fb3e42a6d2e594aa55792b5852d7f57524ab011"
|
||||
#elif defined(OS_LINUX)
|
||||
#define CEF_API_HASH_PLATFORM "434da6be7db70fd90c4265118ac47ace4073c6ae"
|
||||
#define CEF_API_HASH_PLATFORM "222824f83536a111c6480dba64833251c01cd6fd"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
308
include/cef_media_router.h
Normal file
308
include/cef_media_router.h
Normal file
@@ -0,0 +1,308 @@
|
||||
// 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:
|
||||
typedef cef_media_sink_icon_type_t IconType;
|
||||
|
||||
///
|
||||
// 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 the icon type for this sink.
|
||||
///
|
||||
/*--cef(default_retval=CEF_MSIT_GENERIC)--*/
|
||||
virtual IconType GetIconType() = 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_
|
||||
|
@@ -725,6 +725,11 @@ typedef struct _cef_urlparts_t {
|
||||
// Query string component (i.e., everything following the '?').
|
||||
///
|
||||
cef_string_t query;
|
||||
|
||||
///
|
||||
// Fragment (hash) identifier component (i.e., the string following the '#').
|
||||
///
|
||||
cef_string_t fragment;
|
||||
} cef_urlparts_t;
|
||||
|
||||
///
|
||||
@@ -1092,6 +1097,16 @@ typedef enum {
|
||||
// A resource that a plugin requested.
|
||||
///
|
||||
RT_PLUGIN_RESOURCE,
|
||||
|
||||
///
|
||||
// A main-frame service worker navigation preload request.
|
||||
///
|
||||
RT_NAVIGATION_PRELOAD_MAIN_FRAME = 19,
|
||||
|
||||
///
|
||||
// A sub-frame service worker navigation preload request.
|
||||
///
|
||||
RT_NAVIGATION_PRELOAD_SUB_FRAME,
|
||||
} cef_resource_type_t;
|
||||
|
||||
///
|
||||
@@ -1775,6 +1790,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 +2308,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;
|
||||
|
||||
///
|
||||
@@ -2429,13 +2434,13 @@ typedef struct _cef_pdf_print_settings_t {
|
||||
int scale_factor;
|
||||
|
||||
///
|
||||
// Margins in millimeters. Only used if |margin_type| is set to
|
||||
// Margins in points. Only used if |margin_type| is set to
|
||||
// PDF_PRINT_MARGIN_CUSTOM.
|
||||
///
|
||||
double margin_top;
|
||||
double margin_right;
|
||||
double margin_bottom;
|
||||
double margin_left;
|
||||
int margin_top;
|
||||
int margin_right;
|
||||
int margin_bottom;
|
||||
int margin_left;
|
||||
|
||||
///
|
||||
// Margin type.
|
||||
@@ -2968,6 +2973,52 @@ typedef struct _cef_composition_underline_t {
|
||||
cef_composition_underline_style_t style;
|
||||
} cef_composition_underline_t;
|
||||
|
||||
///
|
||||
// Result codes for CefMediaRouter::CreateRoute. Should be kept in sync with
|
||||
// Chromium's media_router::RouteRequestResult::ResultCode type.
|
||||
///
|
||||
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;
|
||||
|
||||
///
|
||||
// Icon types for a MediaSink object. Should be kept in sync with Chromium's
|
||||
// media_router::SinkIconType type.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_MSIT_CAST,
|
||||
CEF_MSIT_CAST_AUDIO_GROUP,
|
||||
CEF_MSIT_CAST_AUDIO,
|
||||
CEF_MSIT_MEETING,
|
||||
CEF_MSIT_HANGOUT,
|
||||
CEF_MSIT_EDUCATION,
|
||||
CEF_MSIT_WIRED_DISPLAY,
|
||||
CEF_MSIT_GENERIC,
|
||||
|
||||
CEF_MSIT_TOTAL_COUNT, // The total number of values.
|
||||
} cef_media_sink_icon_type_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -743,6 +743,7 @@ struct CefURLPartsTraits {
|
||||
cef_string_clear(&s->origin);
|
||||
cef_string_clear(&s->path);
|
||||
cef_string_clear(&s->query);
|
||||
cef_string_clear(&s->fragment);
|
||||
}
|
||||
|
||||
static inline void set(const struct_type* src,
|
||||
@@ -759,6 +760,8 @@ struct CefURLPartsTraits {
|
||||
cef_string_set(src->origin.str, src->origin.length, &target->origin, copy);
|
||||
cef_string_set(src->path.str, src->path.length, &target->path, copy);
|
||||
cef_string_set(src->query.str, src->query.length, &target->query, copy);
|
||||
cef_string_set(src->fragment.str, src->fragment.length, &target->fragment,
|
||||
copy);
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -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);
|
||||
};
|
||||
|
||||
|
@@ -2531,6 +2531,13 @@ void CefBrowserHostImpl::RenderViewCreated(
|
||||
RenderFrameCreated(render_view_host->GetMainFrame());
|
||||
|
||||
platform_delegate_->RenderViewCreated(render_view_host);
|
||||
|
||||
// Make sure the background color is set on the WebView and the Widget.
|
||||
render_view_host->OnWebkitPreferencesChanged();
|
||||
if (render_view_host->GetWidget()->GetView()) {
|
||||
render_view_host->GetWidget()->GetView()->SetBackgroundColor(
|
||||
GetBackgroundColor());
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::RenderViewDeleted(
|
||||
|
@@ -50,6 +50,7 @@
|
||||
#include "ui/wm/core/wm_state.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "chrome/browser/chrome_browser_main_win.h"
|
||||
#include "components/os_crypt/os_crypt.h"
|
||||
#include "ui/base/cursor/cursor_loader_win.h"
|
||||
#endif
|
||||
@@ -124,7 +125,11 @@ void CefBrowserMainParts::PreMainMessageLoopStart() {
|
||||
DCHECK(local_state);
|
||||
bool os_crypt_init = OSCrypt::Init(local_state);
|
||||
DCHECK(os_crypt_init);
|
||||
#endif
|
||||
|
||||
// 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() {
|
||||
|
@@ -157,13 +157,17 @@ ProfileManager* ChromeBrowserProcessStub::profile_manager() {
|
||||
PrefService* ChromeBrowserProcessStub::local_state() {
|
||||
DCHECK(initialized_);
|
||||
if (!local_state_) {
|
||||
// Use a location that is shared by all request contexts.
|
||||
const CefSettings& settings = CefContext::Get()->settings();
|
||||
const base::FilePath& cache_path =
|
||||
base::FilePath(CefString(&settings.cache_path));
|
||||
const base::FilePath& root_cache_path =
|
||||
base::FilePath(CefString(&settings.root_cache_path));
|
||||
|
||||
// Used for very early NetworkService initialization.
|
||||
local_state_ = browser_prefs::CreatePrefService(
|
||||
nullptr, cache_path, !!settings.persist_user_preferences);
|
||||
// Always persist preferences for this PrefService if possible because it
|
||||
// contains the cookie encryption key on Windows.
|
||||
local_state_ =
|
||||
browser_prefs::CreatePrefService(nullptr /* profile */, root_cache_path,
|
||||
true /* persist_user_preferences */);
|
||||
}
|
||||
return local_state_.get();
|
||||
}
|
||||
|
@@ -77,7 +77,6 @@
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/browser_ppapi_host.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/child_process_security_policy.h"
|
||||
#include "content/public/browser/client_certificate_delegate.h"
|
||||
#include "content/public/browser/navigation_handle.h"
|
||||
#include "content/public/browser/overlay_window.h"
|
||||
@@ -102,6 +101,7 @@
|
||||
#include "extensions/browser/extensions_browser_client.h"
|
||||
#include "extensions/browser/guest_view/extensions_guest_view_message_filter.h"
|
||||
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
|
||||
#include "extensions/browser/url_loader_factory_manager.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "extensions/common/switches.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
@@ -600,6 +600,17 @@ bool CefContentBrowserClient::DoesSiteRequireDedicatedProcess(
|
||||
return extension != nullptr;
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::OverrideURLLoaderFactoryParams(
|
||||
content::BrowserContext* browser_context,
|
||||
const url::Origin& origin,
|
||||
bool is_for_isolated_world,
|
||||
network::mojom::URLLoaderFactoryParams* factory_params) {
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
extensions::URLLoaderFactoryManager::OverrideURLLoaderFactoryParams(
|
||||
browser_context, origin, is_for_isolated_world, factory_params);
|
||||
}
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::GetAdditionalWebUISchemes(
|
||||
std::vector<std::string>* additional_schemes) {
|
||||
// Any schemes listed here are treated as WebUI schemes but do not get WebUI
|
||||
@@ -1013,11 +1024,6 @@ void CefContentBrowserClient::OverrideWebkitPrefs(
|
||||
// Using RVH instead of RFH here because rvh->GetMainFrame() may be nullptr
|
||||
// when this method is called.
|
||||
renderer_prefs::PopulateWebPreferences(rvh, *prefs);
|
||||
|
||||
if (rvh->GetWidget()->GetView()) {
|
||||
rvh->GetWidget()->GetView()->SetBackgroundColor(
|
||||
prefs->base_background_color);
|
||||
}
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::BrowserURLHandlerCreated(
|
||||
@@ -1442,16 +1448,6 @@ CefContentBrowserClient::GetPluginMimeTypesWithExternalHandlers(
|
||||
return mime_types;
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::RegisterCustomScheme(const std::string& scheme) {
|
||||
// Register as a Web-safe scheme so that requests for the scheme from a
|
||||
// render process will be allowed in resource_dispatcher_host_impl.cc
|
||||
// ShouldServiceRequest.
|
||||
content::ChildProcessSecurityPolicy* policy =
|
||||
content::ChildProcessSecurityPolicy::GetInstance();
|
||||
if (!policy->IsWebSafeScheme(scheme))
|
||||
policy->RegisterWebSafeScheme(scheme);
|
||||
}
|
||||
|
||||
CefRefPtr<CefRequestContextImpl> CefContentBrowserClient::request_context()
|
||||
const {
|
||||
return browser_main_parts_->request_context();
|
||||
|
@@ -46,6 +46,11 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
const GURL& effective_url) override;
|
||||
bool DoesSiteRequireDedicatedProcess(content::BrowserContext* browser_context,
|
||||
const GURL& effective_site_url) override;
|
||||
void OverrideURLLoaderFactoryParams(
|
||||
content::BrowserContext* browser_context,
|
||||
const url::Origin& origin,
|
||||
bool is_for_isolated_world,
|
||||
network::mojom::URLLoaderFactoryParams* factory_params) override;
|
||||
void GetAdditionalWebUISchemes(
|
||||
std::vector<std::string>* additional_schemes) override;
|
||||
void GetAdditionalViewSourceSchemes(
|
||||
@@ -205,9 +210,6 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
base::flat_set<std::string> GetPluginMimeTypesWithExternalHandlers(
|
||||
content::BrowserContext* browser_context) override;
|
||||
|
||||
// Perform browser process registration for the custom scheme.
|
||||
void RegisterCustomScheme(const std::string& scheme);
|
||||
|
||||
CefRefPtr<CefRequestContextImpl> request_context() const;
|
||||
CefDevToolsDelegate* devtools_delegate() const;
|
||||
|
||||
|
@@ -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 =
|
||||
|
@@ -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;
|
||||
|
83
libcef/browser/media_router/media_route_impl.cc
Normal file
83
libcef/browser/media_router/media_route_impl.cc
Normal file
@@ -0,0 +1,83 @@
|
||||
// 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() {
|
||||
return new CefMediaSinkImpl(route_.media_sink_id(), route_.media_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_
|
55
libcef/browser/media_router/media_sink_impl.cc
Normal file
55
libcef/browser/media_router/media_sink_impl.cc
Normal file
@@ -0,0 +1,55 @@
|
||||
// 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("");
|
||||
}
|
||||
|
||||
CefMediaSink::IconType CefMediaSinkImpl::GetIconType() {
|
||||
// Verify that our enum matches Chromium's values.
|
||||
static_assert(static_cast<int>(CEF_MSIT_TOTAL_COUNT) ==
|
||||
static_cast<int>(media_router::SinkIconType::TOTAL_COUNT),
|
||||
"enum mismatch");
|
||||
|
||||
return static_cast<CefMediaSink::IconType>(sink_.icon_type());
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
40
libcef/browser/media_router/media_sink_impl.h
Normal file
40
libcef/browser/media_router/media_sink_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_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;
|
||||
IconType GetIconType() 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_
|
@@ -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_
|
||||
|
@@ -475,9 +475,10 @@ void InterceptedRequest::OnReceiveRedirect(
|
||||
if (current_request_uses_header_client_) {
|
||||
// Use the headers we got from OnHeadersReceived as that'll contain
|
||||
// Set-Cookie if it existed. May be null for synthetic redirects.
|
||||
DCHECK(current_headers_);
|
||||
current_response_->headers = current_headers_;
|
||||
current_headers_ = nullptr;
|
||||
if (current_headers_) {
|
||||
current_response_->headers = current_headers_;
|
||||
current_headers_ = nullptr;
|
||||
}
|
||||
} else {
|
||||
needs_callback = true;
|
||||
}
|
||||
@@ -839,15 +840,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) {
|
||||
|
@@ -610,9 +610,12 @@ void StreamReaderURLLoader::OnReaderSkipCompleted(int64_t bytes_skipped) {
|
||||
HeadersComplete(net::HTTP_OK, -1);
|
||||
} else if (bytes_skipped == byte_range_.first_byte_position()) {
|
||||
// We skipped the expected number of bytes.
|
||||
int64_t expected_content_length = byte_range_.last_byte_position() -
|
||||
byte_range_.first_byte_position() + 1;
|
||||
DCHECK_GE(expected_content_length, 0);
|
||||
int64_t expected_content_length = -1;
|
||||
if (byte_range_.HasLastBytePosition()) {
|
||||
expected_content_length = byte_range_.last_byte_position() -
|
||||
byte_range_.first_byte_position() + 1;
|
||||
DCHECK_GE(expected_content_length, 0);
|
||||
}
|
||||
HeadersComplete(net::HTTP_OK, expected_content_length);
|
||||
} else {
|
||||
RequestComplete(bytes_skipped < 0 ? bytes_skipped : net::ERR_FAILED);
|
||||
|
@@ -349,6 +349,12 @@ 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,
|
||||
@@ -555,9 +561,16 @@ 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);
|
||||
|
||||
@@ -1072,9 +1085,18 @@ void CefRenderWidgetHostViewOSR::SendExternalBeginFrame() {
|
||||
void CefRenderWidgetHostViewOSR::SendKeyEvent(
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
TRACE_EVENT0("cef", "CefRenderWidgetHostViewOSR::SendKeyEvent");
|
||||
if (render_widget_host_ && render_widget_host_->GetView()) {
|
||||
content::RenderWidgetHostImpl* target_host = render_widget_host_;
|
||||
|
||||
// If there are multiple widgets on the page (such as when there are
|
||||
// out-of-process iframes), pick the one that should process this event.
|
||||
if (render_widget_host_ && render_widget_host_->delegate()) {
|
||||
target_host = render_widget_host_->delegate()->GetFocusedRenderWidgetHost(
|
||||
render_widget_host_);
|
||||
}
|
||||
|
||||
if (target_host && target_host->GetView()) {
|
||||
// Direct routing requires that events go directly to the View.
|
||||
render_widget_host_->ForwardKeyboardEventWithLatencyInfo(
|
||||
target_host->ForwardKeyboardEventWithLatencyInfo(
|
||||
event, ui::LatencyInfo(event.GetType() == blink::WebInputEvent::kChar ||
|
||||
event.GetType() ==
|
||||
blink::WebInputEvent::kRawKeyDown
|
||||
@@ -1388,8 +1410,8 @@ void CefRenderWidgetHostViewOSR::UpdateFrameRate() {
|
||||
}
|
||||
|
||||
gfx::Size CefRenderWidgetHostViewOSR::SizeInPixels() {
|
||||
return gfx::ConvertSizeToPixel(current_device_scale_factor_,
|
||||
GetViewBounds().size());
|
||||
return gfx::ScaleToCeiledSize(GetViewBounds().size(),
|
||||
current_device_scale_factor_);
|
||||
}
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
|
@@ -27,6 +27,7 @@ class CefVideoConsumerOSR : public viz::mojom::FrameSinkVideoConsumer {
|
||||
mojo::PendingRemote<viz::mojom::FrameSinkVideoConsumerFrameCallbacks>
|
||||
callbacks) override;
|
||||
void OnStopped() override;
|
||||
void OnLog(const std::string& message) override {}
|
||||
|
||||
CefRenderWidgetHostViewOSR* const view_;
|
||||
std::unique_ptr<viz::ClientFrameSinkVideoCapturer> video_capturer_;
|
||||
|
@@ -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());
|
||||
@@ -200,7 +203,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
|
||||
// From Chrome::RegisterBrowserUserPrefs.
|
||||
registry->RegisterBooleanPref(prefs::kPrintPreviewUseSystemDefaultPrinter,
|
||||
true);
|
||||
false);
|
||||
|
||||
if (command_line->HasSwitch(switches::kEnablePreferenceTesting)) {
|
||||
// Preferences used with unit tests.
|
||||
@@ -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 =
|
||||
|
@@ -116,10 +116,10 @@ void FillInDictionaryFromPdfPrintSettings(
|
||||
print_settings.SetInteger(kSettingMarginsType, margin_type);
|
||||
if (margin_type == CUSTOM_MARGINS) {
|
||||
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
|
||||
dict->SetDouble(kSettingMarginTop, pdf_settings.margin_top);
|
||||
dict->SetDouble(kSettingMarginRight, pdf_settings.margin_right);
|
||||
dict->SetDouble(kSettingMarginBottom, pdf_settings.margin_bottom);
|
||||
dict->SetDouble(kSettingMarginLeft, pdf_settings.margin_left);
|
||||
dict->SetInteger(kSettingMarginTop, pdf_settings.margin_top);
|
||||
dict->SetInteger(kSettingMarginRight, pdf_settings.margin_right);
|
||||
dict->SetInteger(kSettingMarginBottom, pdf_settings.margin_bottom);
|
||||
dict->SetInteger(kSettingMarginLeft, pdf_settings.margin_left);
|
||||
print_settings.Set(kSettingMarginsCustom, std::move(dict));
|
||||
}
|
||||
|
||||
|
@@ -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.
|
||||
|
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "include/cef_stream.h"
|
||||
#include "include/cef_version.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/extensions/pdf_extension_util.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
@@ -30,6 +29,7 @@
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/common/pepper_flash.h"
|
||||
#include "content/public/browser/child_process_security_policy.h"
|
||||
#include "content/public/common/content_constants.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "content/public/common/pepper_plugin_info.h"
|
||||
@@ -292,9 +292,15 @@ void CefContentClient::AddCustomScheme(const SchemeInfo& scheme_info) {
|
||||
DCHECK(!scheme_info_list_locked_);
|
||||
scheme_info_list_.push_back(scheme_info);
|
||||
|
||||
if (CefContentBrowserClient::Get()) {
|
||||
CefContentBrowserClient::Get()->RegisterCustomScheme(
|
||||
scheme_info.scheme_name);
|
||||
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
||||
if (!command_line->HasSwitch(switches::kProcessType)) {
|
||||
// Register as a Web-safe scheme in the browser process so that requests for
|
||||
// the scheme from a render process will be allowed in
|
||||
// resource_dispatcher_host_impl.cc ShouldServiceRequest.
|
||||
content::ChildProcessSecurityPolicy* policy =
|
||||
content::ChildProcessSecurityPolicy::GetInstance();
|
||||
if (!policy->IsWebSafeScheme(scheme_info.scheme_name))
|
||||
policy->RegisterWebSafeScheme(scheme_info.scheme_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -30,6 +30,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"
|
||||
@@ -637,6 +638,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()) {
|
||||
|
@@ -107,8 +107,9 @@ scoped_refptr<net::HttpResponseHeaders> MakeResponseHeaders(
|
||||
// Track the headers that have already been set. Perform all comparisons in
|
||||
// lowercase.
|
||||
std::set<std::string> set_headers_lowercase;
|
||||
|
||||
if (status_code == net::HTTP_OK) {
|
||||
if ((status_code >= 200 && status_code < 300) &&
|
||||
status_code != net::HTTP_NO_CONTENT &&
|
||||
status_code != net::HTTP_RESET_CONTENT) {
|
||||
if (!mime_type.empty()) {
|
||||
headers->AddHeader(MakeHeader(net::HttpRequestHeaders::kContentType,
|
||||
MakeContentTypeValue(mime_type, charset)));
|
||||
|
@@ -27,6 +27,7 @@ bool CefParseURL(const CefString& url, CefURLParts& parts) {
|
||||
CefString(&parts.port).FromString(gurl.port());
|
||||
CefString(&parts.path).FromString(gurl.path());
|
||||
CefString(&parts.query).FromString(gurl.query());
|
||||
CefString(&parts.fragment).FromString(gurl.ref());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -42,6 +43,8 @@ bool CefCreateURL(const CefURLParts& parts, CefString& url) {
|
||||
std::string port = CefString(parts.port.str, parts.port.length, false);
|
||||
std::string path = CefString(parts.path.str, parts.path.length, false);
|
||||
std::string query = CefString(parts.query.str, parts.query.length, false);
|
||||
std::string fragment =
|
||||
CefString(parts.fragment.str, parts.fragment.length, false);
|
||||
|
||||
GURL gurl;
|
||||
if (!spec.empty()) {
|
||||
@@ -62,6 +65,8 @@ bool CefCreateURL(const CefURLParts& parts, CefString& url) {
|
||||
ss << path;
|
||||
if (!query.empty())
|
||||
ss << "?" << query;
|
||||
if (!fragment.empty())
|
||||
ss << "#" << fragment;
|
||||
gurl = GURL(ss.str());
|
||||
}
|
||||
|
||||
|
@@ -55,9 +55,6 @@ bool CefPrintRenderFrameHelperDelegate::IsPrintPreviewEnabled() {
|
||||
|
||||
bool CefPrintRenderFrameHelperDelegate::OverridePrint(
|
||||
blink::WebLocalFrame* frame) {
|
||||
if (!frame->GetDocument().IsPluginDocument())
|
||||
return false;
|
||||
|
||||
auto* post_message_support =
|
||||
extensions::PostMessageSupport::FromWebLocalFrame(frame);
|
||||
if (post_message_support) {
|
||||
|
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_
|
196
libcef_dll/cpptoc/media_sink_cpptoc.cc
Normal file
196
libcef_dll/cpptoc/media_sink_cpptoc.cc
Normal file
@@ -0,0 +1,196 @@
|
||||
// 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=3a295e7d6703e2e8effd94da8e97d8b7f451dc32$
|
||||
//
|
||||
|
||||
#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();
|
||||
}
|
||||
|
||||
cef_media_sink_icon_type_t CEF_CALLBACK
|
||||
media_sink_get_icon_type(struct _cef_media_sink_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return CEF_MSIT_GENERIC;
|
||||
|
||||
// Execute
|
||||
cef_media_sink_icon_type_t _retval =
|
||||
CefMediaSinkCppToC::Get(self)->GetIconType();
|
||||
|
||||
// Return type: simple
|
||||
return _retval;
|
||||
}
|
||||
|
||||
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()->get_icon_type = media_sink_get_icon_type;
|
||||
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_
|
185
libcef_dll/ctocpp/media_sink_ctocpp.cc
Normal file
185
libcef_dll/ctocpp/media_sink_ctocpp.cc
Normal file
@@ -0,0 +1,185 @@
|
||||
// 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=63071af2d949b451ad0e7273ca0f5d7bfec425db$
|
||||
//
|
||||
|
||||
#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")
|
||||
CefMediaSink::IconType CefMediaSinkCToCpp::GetIconType() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_sink_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, get_icon_type))
|
||||
return CEF_MSIT_GENERIC;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_media_sink_icon_type_t _retval = _struct->get_icon_type(_struct);
|
||||
|
||||
// Return type: simple
|
||||
return _retval;
|
||||
}
|
||||
|
||||
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;
|
47
libcef_dll/ctocpp/media_sink_ctocpp.h
Normal file
47
libcef_dll/ctocpp/media_sink_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=c57a82e66fdcd26f70a69fbd92554ca8aa38495c$
|
||||
//
|
||||
|
||||
#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;
|
||||
IconType GetIconType() 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_
|
||||
|
@@ -858,8 +858,8 @@ class CefMessageRouterRendererSideImpl : public CefMessageRouterRendererSide {
|
||||
// if the query is non-persistent. If |removed| is true the caller is
|
||||
// responsible for deleting the returned QueryInfo object.
|
||||
RequestInfo* GetRequestInfo(int browser_id,
|
||||
int request_id,
|
||||
int context_id,
|
||||
int request_id,
|
||||
bool always_remove,
|
||||
bool* removed) {
|
||||
class Visitor : public BrowserRequestInfoMap::Visitor {
|
||||
@@ -884,7 +884,7 @@ class CefMessageRouterRendererSideImpl : public CefMessageRouterRendererSide {
|
||||
|
||||
Visitor visitor(always_remove);
|
||||
RequestInfo* info = browser_request_info_map_.Find(
|
||||
browser_id, std::make_pair(request_id, context_id), &visitor);
|
||||
browser_id, std::make_pair(context_id, request_id), &visitor);
|
||||
if (info)
|
||||
*removed = visitor.removed();
|
||||
return info;
|
||||
|
@@ -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,
|
||||
|
@@ -216,6 +216,12 @@ patches = [
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/2852
|
||||
'name': 'chrome_browser_themes',
|
||||
},
|
||||
{
|
||||
# Fix fatal error: 'components/omnibox/browser/buildflags.h' file not found
|
||||
# From chrome/browser/extensions/api/omnibox/omnibox_api.h via
|
||||
# gen/chrome/browser/extensions/api/generated_api_registration.cc
|
||||
'name': 'chrome_browser_extensions',
|
||||
},
|
||||
{
|
||||
# Make some methods of ProfileManager virtual.
|
||||
#
|
||||
@@ -230,6 +236,11 @@ patches = [
|
||||
# Fix fatal error: 'components/printing/common/print.mojom.h' file not found
|
||||
# From chrome/browser/ui/browser_commands.cc via
|
||||
# chrome/browser/printing/print_view_manager_common.h
|
||||
#
|
||||
# Fix fatal error: 'chrome/browser/performance_manager/persistence/site_data/
|
||||
# site_data.pb.h' file not found
|
||||
# From chrome/browser/ui/webui/discards/discards_ui.cc via
|
||||
# chrome/browser/resource_coordinator/local_site_characteristics_data_impl.h
|
||||
'name': 'chrome_browser_net_export',
|
||||
},
|
||||
{
|
||||
@@ -510,5 +521,11 @@ patches = [
|
||||
# Fix ScreenlockMonitorDeviceSource window creation error.
|
||||
# https://bugs.chromium.org/p/chromium/issues/detail?id=1058556
|
||||
'name': 'win_screenlock_1058556',
|
||||
},
|
||||
{
|
||||
# Allow the loading of non-standard non-local WebSafe custom schemes in
|
||||
# iframes.
|
||||
# https://bugs.chromium.org/p/chromium/issues/detail?id=1081397#c9
|
||||
'name': 'browser_security_policy_1081397',
|
||||
}
|
||||
]
|
||||
|
21
patch/patches/browser_security_policy_1081397.patch
Normal file
21
patch/patches/browser_security_policy_1081397.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
diff --git content/browser/child_process_security_policy_impl.cc content/browser/child_process_security_policy_impl.cc
|
||||
index 2b768dc8f4be..ffe550350212 100644
|
||||
--- content/browser/child_process_security_policy_impl.cc
|
||||
+++ content/browser/child_process_security_policy_impl.cc
|
||||
@@ -1469,6 +1469,16 @@ bool ChildProcessSecurityPolicyImpl::CanAccessDataForOrigin(
|
||||
// DeclarativeApiTest.PersistRules.
|
||||
if (actual_process_lock.SchemeIs(url::kDataScheme))
|
||||
return true;
|
||||
+
|
||||
+ // Allow other schemes that are non-standard, non-local and WebSafe.
|
||||
+ if (actual_process_lock.is_valid() &&
|
||||
+ !actual_process_lock.IsStandard() &&
|
||||
+ !base::Contains(url::GetLocalSchemes(),
|
||||
+ actual_process_lock.scheme_piece()) &&
|
||||
+ base::Contains(schemes_okay_to_request_in_any_process_,
|
||||
+ actual_process_lock.scheme_piece())) {
|
||||
+ return true;
|
||||
+ }
|
||||
}
|
||||
|
||||
failure_reason = "lock_mismatch";
|
@@ -95,7 +95,7 @@ index e0da20cc3bb6..b3f6720dff90 100644
|
||||
base::PostTask(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
diff --git chrome/browser/optimization_guide/optimization_guide_navigation_data.cc chrome/browser/optimization_guide/optimization_guide_navigation_data.cc
|
||||
index b532a58d5db7..e6d30ce29ea1 100644
|
||||
index a0ff050271dd..b9337420565e 100644
|
||||
--- chrome/browser/optimization_guide/optimization_guide_navigation_data.cc
|
||||
+++ chrome/browser/optimization_guide/optimization_guide_navigation_data.cc
|
||||
@@ -8,6 +8,7 @@
|
||||
@@ -106,7 +106,7 @@ index b532a58d5db7..e6d30ce29ea1 100644
|
||||
#include "chrome/browser/optimization_guide/optimization_guide_web_contents_observer.h"
|
||||
#include "components/optimization_guide/hints_processing_util.h"
|
||||
#include "content/public/browser/navigation_handle.h"
|
||||
@@ -16,25 +17,6 @@
|
||||
@@ -17,25 +18,6 @@
|
||||
#include "services/metrics/public/cpp/ukm_source.h"
|
||||
#include "services/metrics/public/cpp/ukm_source_id.h"
|
||||
|
||||
@@ -133,7 +133,7 @@ index b532a58d5db7..e6d30ce29ea1 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 7b7567f55df2..3b204a446187 100644
|
||||
index c4a15ba4540c..947ed8abb02a 100644
|
||||
--- chrome/browser/optimization_guide/prediction/prediction_manager.cc
|
||||
+++ chrome/browser/optimization_guide/prediction/prediction_manager.cc
|
||||
@@ -62,7 +62,9 @@ bool ShouldUseCurrentOptimizationTargetDecision(
|
||||
@@ -160,7 +160,7 @@ index 7b7567f55df2..3b204a446187 100644
|
||||
|
||||
// Util class for recording the state of a prediction model. The result is
|
||||
// recorded when it goes out of scope and its destructor is called.
|
||||
@@ -822,12 +826,12 @@ void PredictionManager::ScheduleModelsAndHostModelFeaturesFetch() {
|
||||
@@ -838,12 +842,12 @@ void PredictionManager::ScheduleModelsAndHostModelFeaturesFetch() {
|
||||
model_and_features_store_->GetHostModelFeaturesUpdateTime() -
|
||||
clock_->Now();
|
||||
const base::TimeDelta time_until_retry =
|
||||
@@ -422,7 +422,7 @@ index 0db088ae7917..d4567efbf0b9 100644
|
||||
callback->sendSuccess();
|
||||
} else {
|
||||
diff --git content/browser/media/capture/frame_sink_video_capture_device.cc content/browser/media/capture/frame_sink_video_capture_device.cc
|
||||
index 2630aae48b16..475dc5572ef7 100644
|
||||
index 3c93ee9dfe60..d59d90a28161 100644
|
||||
--- content/browser/media/capture/frame_sink_video_capture_device.cc
|
||||
+++ content/browser/media/capture/frame_sink_video_capture_device.cc
|
||||
@@ -53,11 +53,13 @@ class ScopedFrameDoneHelper
|
||||
@@ -439,7 +439,7 @@ index 2630aae48b16..475dc5572ef7 100644
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -364,7 +366,7 @@ void FrameSinkVideoCaptureDevice::RequestWakeLock() {
|
||||
@@ -379,7 +381,7 @@ void FrameSinkVideoCaptureDevice::RequestWakeLock() {
|
||||
mojo::Remote<device::mojom::WakeLockProvider> wake_lock_provider;
|
||||
auto receiver = wake_lock_provider.BindNewPipeAndPassReceiver();
|
||||
base::PostTask(FROM_HERE, {BrowserThread::UI},
|
||||
@@ -1725,7 +1725,7 @@ index cb12d36124c2..341845474fc3 100644
|
||||
if (gpu_factories_->IsDecoderConfigSupported(
|
||||
RTCVideoDecoderAdapter::kImplementation, config) ==
|
||||
diff --git third_party/blink/renderer/platform/peerconnection/webrtc_audio_sink.cc third_party/blink/renderer/platform/peerconnection/webrtc_audio_sink.cc
|
||||
index 7d747bc50090..59a6c42e3281 100644
|
||||
index 1d07732a1f08..9b44c8e2e96d 100644
|
||||
--- third_party/blink/renderer/platform/peerconnection/webrtc_audio_sink.cc
|
||||
+++ third_party/blink/renderer/platform/peerconnection/webrtc_audio_sink.cc
|
||||
@@ -19,9 +19,11 @@
|
||||
@@ -1816,15 +1816,6 @@ index 7d747bc50090..59a6c42e3281 100644
|
||||
base::StringPrintf("Adapter::RemoveSink([label=%s])", label_.c_str()));
|
||||
base::AutoLock auto_lock(lock_);
|
||||
const auto it = std::find(sinks_.begin(), sinks_.end(), sink);
|
||||
@@ -230,7 +232,7 @@ bool WebRtcAudioSink::Adapter::GetSignalLevel(int* level) {
|
||||
// Convert from float in range [0.0,1.0] to an int in range [0,32767].
|
||||
*level = static_cast<int>(signal_level * std::numeric_limits<int16_t>::max() +
|
||||
0.5f /* rounding to nearest int */);
|
||||
- SendLogMessage(
|
||||
+ j::SendLogMessage(
|
||||
base::StringPrintf("Adapter::GetSignalLevel([label=%s]) => (level=%d)",
|
||||
label_.c_str(), *level));
|
||||
return true;
|
||||
diff --git ui/base/x/x11_drag_context.cc ui/base/x/x11_drag_context.cc
|
||||
index 3ed9e98b2a20..8ada19c7afd9 100644
|
||||
--- ui/base/x/x11_drag_context.cc
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git chrome/browser/BUILD.gn chrome/browser/BUILD.gn
|
||||
index 477e30a34cd2..7a24ff410e7e 100644
|
||||
index 6f768f7848a3..363718020f94 100644
|
||||
--- chrome/browser/BUILD.gn
|
||||
+++ chrome/browser/BUILD.gn
|
||||
@@ -11,6 +11,7 @@ import("//build/config/features.gni")
|
||||
@@ -10,7 +10,7 @@ index 477e30a34cd2..7a24ff410e7e 100644
|
||||
import("//chrome/browser/buildflags.gni")
|
||||
import("//chrome/common/features.gni")
|
||||
import("//components/captive_portal/core/features.gni")
|
||||
@@ -1956,6 +1957,7 @@ jumbo_static_library("browser") {
|
||||
@@ -1958,6 +1959,7 @@ jumbo_static_library("browser") {
|
||||
"//base/util/values:values_util",
|
||||
"//build:branding_buildflags",
|
||||
"//cc",
|
||||
@@ -18,7 +18,7 @@ index 477e30a34cd2..7a24ff410e7e 100644
|
||||
"//chrome:extra_resources",
|
||||
"//chrome:resources",
|
||||
"//chrome:strings",
|
||||
@@ -2275,6 +2277,10 @@ jumbo_static_library("browser") {
|
||||
@@ -2277,6 +2279,10 @@ jumbo_static_library("browser") {
|
||||
]
|
||||
}
|
||||
|
||||
|
12
patch/patches/chrome_browser_extensions.patch
Normal file
12
patch/patches/chrome_browser_extensions.patch
Normal file
@@ -0,0 +1,12 @@
|
||||
diff --git chrome/browser/extensions/api/BUILD.gn chrome/browser/extensions/api/BUILD.gn
|
||||
index 82da6124bc6f..0e20d4191ec4 100644
|
||||
--- chrome/browser/extensions/api/BUILD.gn
|
||||
+++ chrome/browser/extensions/api/BUILD.gn
|
||||
@@ -22,6 +22,7 @@ function_registration("api_registration") {
|
||||
deps = [
|
||||
# Different APIs include headers from these targets.
|
||||
"//chrome/common:mojo_bindings",
|
||||
+ "//components/omnibox/browser",
|
||||
"//components/zoom",
|
||||
"//content/public/browser",
|
||||
"//extensions/browser",
|
@@ -1,5 +1,5 @@
|
||||
diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn
|
||||
index c820df8447f0..58cb1279b7bf 100644
|
||||
index efacc93f730f..39d0eaaad66a 100644
|
||||
--- chrome/browser/ui/BUILD.gn
|
||||
+++ chrome/browser/ui/BUILD.gn
|
||||
@@ -9,6 +9,7 @@ import("//build/config/features.gni")
|
||||
@@ -29,7 +29,7 @@ index c820df8447f0..58cb1279b7bf 100644
|
||||
"//chrome:extra_resources",
|
||||
"//chrome:resources",
|
||||
"//chrome:strings",
|
||||
@@ -1438,6 +1444,7 @@ jumbo_static_library("ui") {
|
||||
@@ -1437,6 +1443,7 @@ jumbo_static_library("ui") {
|
||||
"//components/keep_alive_registry",
|
||||
"//components/network_session_configurator/common",
|
||||
"//components/page_load_metrics/browser",
|
||||
@@ -37,6 +37,18 @@ index c820df8447f0..58cb1279b7bf 100644
|
||||
"//components/profile_metrics",
|
||||
"//components/ui_metrics",
|
||||
"//components/url_formatter",
|
||||
@@ -2142,7 +2149,10 @@ jumbo_static_library("ui") {
|
||||
"webui/signin/sync_confirmation_ui.cc",
|
||||
"webui/signin/sync_confirmation_ui.h",
|
||||
]
|
||||
- deps += [ "//ui/webui" ]
|
||||
+ deps += [
|
||||
+ "//chrome/browser/performance_manager:site_data_proto",
|
||||
+ "//ui/webui"
|
||||
+ ]
|
||||
}
|
||||
|
||||
if (is_win || is_mac || is_desktop_linux) {
|
||||
diff --git chrome/browser/ui/webui/net_export_ui.cc chrome/browser/ui/webui/net_export_ui.cc
|
||||
index 93bfc84f49a1..eeee229e943f 100644
|
||||
--- chrome/browser/ui/webui/net_export_ui.cc
|
||||
|
@@ -1,8 +1,8 @@
|
||||
diff --git chrome/browser/chrome_content_browser_client.cc chrome/browser/chrome_content_browser_client.cc
|
||||
index 6cdca1affb9f..f875ba1a5d75 100644
|
||||
index 5e8bad123d80..d75bef09361d 100644
|
||||
--- chrome/browser/chrome_content_browser_client.cc
|
||||
+++ chrome/browser/chrome_content_browser_client.cc
|
||||
@@ -1027,10 +1027,6 @@ void LaunchURL(const GURL& url,
|
||||
@@ -1028,10 +1028,6 @@ void LaunchURL(const GURL& url,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ index 6cdca1affb9f..f875ba1a5d75 100644
|
||||
void MaybeAppendSecureOriginsAllowlistSwitch(base::CommandLine* cmdline) {
|
||||
// |allowlist| combines pref/policy + cmdline switch in the browser process.
|
||||
// For renderer and utility (e.g. NetworkService) processes the switch is the
|
||||
@@ -1125,6 +1121,14 @@ void MaybeRecordSameSiteCookieEngagementHistogram(
|
||||
@@ -1126,6 +1122,14 @@ void MaybeRecordSameSiteCookieEngagementHistogram(
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@@ -165,15 +165,16 @@ index 4e64db143b8a..71322b0261a1 100644
|
||||
Profile* profile = Profile::FromBrowserContext(browser_context);
|
||||
std::vector<std::string> whitelist = MimeTypesHandler::GetMIMETypeWhitelist();
|
||||
diff --git chrome/common/google_url_loader_throttle.cc chrome/common/google_url_loader_throttle.cc
|
||||
index a7e5caea5add..f9d11b317946 100644
|
||||
index cce1eac38785..9343ff520a87 100644
|
||||
--- chrome/common/google_url_loader_throttle.cc
|
||||
+++ chrome/common/google_url_loader_throttle.cc
|
||||
@@ -4,10 +4,15 @@
|
||||
|
||||
@@ -5,11 +5,16 @@
|
||||
#include "chrome/common/google_url_loader_throttle.h"
|
||||
|
||||
#include "build/build_config.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
#include "chrome/common/net/safe_search_util.h"
|
||||
#include "components/google/core/common/google_util.h"
|
||||
#include "components/variations/net/variations_http_headers.h"
|
||||
#include "services/network/public/mojom/url_response_head.mojom.h"
|
||||
|
||||
@@ -184,7 +185,7 @@ index a7e5caea5add..f9d11b317946 100644
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
#include "extensions/common/extension_urls.h"
|
||||
#endif
|
||||
@@ -96,6 +101,11 @@ void GoogleURLLoaderThrottle::WillProcessResponse(
|
||||
@@ -127,6 +132,11 @@ void GoogleURLLoaderThrottle::WillProcessResponse(
|
||||
const GURL& response_url,
|
||||
network::mojom::URLResponseHead* response_head,
|
||||
bool* defer) {
|
||||
|
@@ -224,10 +224,10 @@ index 632ae86c6fd6..55b749ec1242 100644
|
||||
const std::vector<WebPluginInfo>& all_plugins);
|
||||
|
||||
diff --git content/common/frame_messages.h content/common/frame_messages.h
|
||||
index 4370f99c9a51..8dc0736e2b59 100644
|
||||
index 4a4085021a61..d822c9c99e06 100644
|
||||
--- content/common/frame_messages.h
|
||||
+++ content/common/frame_messages.h
|
||||
@@ -826,9 +826,10 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperStopsPlayback,
|
||||
@@ -825,9 +825,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.
|
||||
@@ -327,10 +327,10 @@ index 87df60c52d1e..c3841a7845dd 100644
|
||||
// started.
|
||||
virtual void SetRuntimeFeaturesDefaultsBeforeBlinkInitialization() {}
|
||||
diff --git content/renderer/render_frame_impl.cc content/renderer/render_frame_impl.cc
|
||||
index 00bbbdc9b82d..a3c923fcc442 100644
|
||||
index 3f3f5da903d4..00af07f80d4c 100644
|
||||
--- content/renderer/render_frame_impl.cc
|
||||
+++ content/renderer/render_frame_impl.cc
|
||||
@@ -3796,7 +3796,8 @@ blink::WebPlugin* RenderFrameImpl::CreatePlugin(
|
||||
@@ -3798,7 +3798,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 7d23fc08f7ea..24a41cf936da 100644
|
||||
index 021f7ad27b92..4c42a1a5fc5b 100644
|
||||
--- chrome/test/BUILD.gn
|
||||
+++ chrome/test/BUILD.gn
|
||||
@@ -4852,7 +4852,7 @@ test("unit_tests") {
|
||||
@@ -4858,7 +4858,7 @@ test("unit_tests") {
|
||||
if (use_gio) {
|
||||
configs += [ "//build/linux:gio_config" ]
|
||||
}
|
||||
@@ -11,7 +11,7 @@ index 7d23fc08f7ea..24a41cf936da 100644
|
||||
deps += [ "//chrome/browser/ui/gtk" ]
|
||||
}
|
||||
|
||||
@@ -5833,7 +5833,7 @@ if (!is_android) {
|
||||
@@ -5839,7 +5839,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 954011b5d562..da67cd106cec 100644
|
||||
index 545277f7ec1b..ad1128f48d98 100644
|
||||
--- content/browser/renderer_host/render_widget_host_impl.cc
|
||||
+++ content/browser/renderer_host/render_widget_host_impl.cc
|
||||
@@ -2606,6 +2606,11 @@ void RenderWidgetHostImpl::DidStartScrollingViewport() {
|
||||
@@ -2595,6 +2595,11 @@ void RenderWidgetHostImpl::DidStartScrollingViewport() {
|
||||
view_->set_is_currently_scrolling_viewport(true);
|
||||
}
|
||||
|
||||
@@ -57,10 +57,10 @@ index 954011b5d562..da67cd106cec 100644
|
||||
const WebInputEvent& event) {
|
||||
if ((base::FeatureList::IsEnabled(
|
||||
diff --git content/browser/renderer_host/render_widget_host_impl.h content/browser/renderer_host/render_widget_host_impl.h
|
||||
index 9faf49a3fd83..26c6845c53c3 100644
|
||||
index b94e1b22a72f..2cc7bde0adcc 100644
|
||||
--- content/browser/renderer_host/render_widget_host_impl.h
|
||||
+++ content/browser/renderer_host/render_widget_host_impl.h
|
||||
@@ -701,6 +701,7 @@ class CONTENT_EXPORT RenderWidgetHostImpl
|
||||
@@ -691,6 +691,7 @@ class CONTENT_EXPORT RenderWidgetHostImpl
|
||||
|
||||
void ProgressFlingIfNeeded(base::TimeTicks current_time);
|
||||
void StopFling();
|
||||
|
@@ -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 bd44565e78aa..dcb7bbd6d875 100644
|
||||
index f93c2cb36a58..f6a33d46e3ea 100644
|
||||
--- content/renderer/render_view_impl.cc
|
||||
+++ content/renderer/render_view_impl.cc
|
||||
@@ -968,6 +968,8 @@ void RenderView::ApplyWebPreferences(const WebPreferences& prefs,
|
||||
|
@@ -139,10 +139,10 @@ index 5dbc9d2dfcfb..1c31d97825c2 100644
|
||||
|
||||
void CookieManager::SetForceKeepSessionState() {
|
||||
diff --git services/network/network_context.cc services/network/network_context.cc
|
||||
index e5dfb9c6fd20..07578a987dd9 100644
|
||||
index dbac9a64fe49..ff55f0795664 100644
|
||||
--- services/network/network_context.cc
|
||||
+++ services/network/network_context.cc
|
||||
@@ -1765,6 +1765,7 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
|
||||
@@ -1747,6 +1747,7 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext() {
|
||||
}
|
||||
|
||||
scoped_refptr<SessionCleanupCookieStore> session_cleanup_cookie_store;
|
||||
@@ -150,7 +150,7 @@ index e5dfb9c6fd20..07578a987dd9 100644
|
||||
if (params_->cookie_path) {
|
||||
scoped_refptr<base::SequencedTaskRunner> client_task_runner =
|
||||
base::ThreadTaskRunnerHandle::Get();
|
||||
@@ -1792,18 +1793,27 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
|
||||
@@ -1774,18 +1775,27 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext() {
|
||||
session_cleanup_cookie_store =
|
||||
base::MakeRefCounted<SessionCleanupCookieStore>(sqlite_store);
|
||||
|
||||
|
@@ -80,7 +80,7 @@ index 1026b739d283..fe562ab60ce9 100644
|
||||
private:
|
||||
const HWND hwnd_;
|
||||
diff --git components/viz/service/BUILD.gn components/viz/service/BUILD.gn
|
||||
index 7a1277ad28ed..4a426441e505 100644
|
||||
index 5cd92d7a38ee..77ea93a1a98e 100644
|
||||
--- components/viz/service/BUILD.gn
|
||||
+++ components/viz/service/BUILD.gn
|
||||
@@ -13,7 +13,10 @@ config("viz_service_implementation") {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user