diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-05-24 11:40:17 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-05-24 12:42:11 +0000 |
commit | 5d87695f37678f96492b258bbab36486c59866b4 (patch) | |
tree | be9783bbaf04fb930c4d74ca9c00b5e7954c8bc6 /chromium/third_party/blink/public | |
parent | 6c11fb357ec39bf087b8b632e2b1e375aef1b38b (diff) | |
download | qtwebengine-chromium-5d87695f37678f96492b258bbab36486c59866b4.tar.gz |
BASELINE: Update Chromium to 75.0.3770.56
Change-Id: I86d2007fd27a45d5797eee06f4c9369b8b50ac4f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/third_party/blink/public')
235 files changed, 3922 insertions, 1231 deletions
diff --git a/chromium/third_party/blink/public/BUILD.gn b/chromium/third_party/blink/public/BUILD.gn index bd7fb4a2a6f..0c0cf1e5a90 100644 --- a/chromium/third_party/blink/public/BUILD.gn +++ b/chromium/third_party/blink/public/BUILD.gn @@ -7,10 +7,12 @@ import("//mojo/public/tools/bindings/mojom.gni") import("//third_party/blink/public/public_features.gni") import("//third_party/blink/renderer/config.gni") import("//third_party/blink/renderer/core/core.gni") +import("//third_party/webrtc/webrtc.gni") import("//tools/grit/grit_rule.gni") import("//tools/grit/repack.gni") if (is_android) { + import("//build/config/android/config.gni") import("//build/config/android/rules.gni") } @@ -89,7 +91,7 @@ if (is_android) { android_library("blink_headers_java") { deps = [ "//services/network/public/mojom:mojom_java", - "//third_party/android_deps:android_support_annotations_java", + "//third_party/android_deps:com_android_support_support_annotations_java", ] srcjar_deps = [ ":blink_headers_java_enums_srcjar" ] } @@ -140,6 +142,7 @@ source_set("blink_headers") { "platform/modules/media_capabilities/web_media_decoding_configuration.h", "platform/modules/media_capabilities/web_video_configuration.h", "platform/modules/mediastream/media_stream_audio_deliverer.h", + "platform/modules/mediastream/media_stream_audio_processor_options.h", "platform/modules/mediastream/media_stream_audio_source.h", "platform/modules/mediastream/media_stream_audio_track.h", "platform/modules/mediastream/media_stream_types.h", @@ -206,7 +209,6 @@ source_set("blink_headers") { "platform/web_canvas_capture_handler.h", "platform/web_client_hints_type.h", "platform/web_coalesced_input_event.h", - "platform/web_color_scheme.h", "platform/web_common.h", "platform/web_computed_ax_tree.h", "platform/web_connection_type.h", @@ -366,6 +368,7 @@ source_set("blink_headers") { "platform/web_touch_action.h", "platform/web_touch_event.h", "platform/web_touch_point.h", + "platform/web_transmission_encoding_info_handler.h", "platform/web_url.h", "platform/web_url_error.h", "platform/web_url_load_timing.h", @@ -385,7 +388,15 @@ source_set("blink_headers") { "web/mac/web_substring_util.h", "web/mac/web_substring_util.h", "web/modules/autofill/web_form_element_observer.h", - "web/modules/autofill/web_form_element_observer_callback.h", + "web/modules/mediastream/media_stream_constraints_util.h", + "web/modules/mediastream/media_stream_constraints_util_sets.h", + "web/modules/mediastream/media_stream_constraints_util_video_device.h", + "web/modules/mediastream/media_stream_video_capturer_source.h", + "web/modules/mediastream/media_stream_video_sink.h", + "web/modules/mediastream/media_stream_video_source.h", + "web/modules/mediastream/media_stream_video_track.h", + "web/modules/mediastream/video_track_adapter_settings.h", + "web/modules/mediastream/web_media_stream_utils.h", "web/modules/service_worker/web_service_worker_context_client.h", "web/modules/service_worker/web_service_worker_context_proxy.h", "web/web_active_fling_parameters.h", @@ -407,7 +418,6 @@ source_set("blink_headers") { "web/web_context_features.h", "web/web_context_menu_data.h", "web/web_crypto_normalize.h", - "web/web_css_parser.h", "web/web_custom_element.h", "web/web_date_time_chooser_completion.h", "web/web_date_time_chooser_params.h", @@ -438,7 +448,6 @@ source_set("blink_headers") { "web/web_frame_serializer.h", "web/web_frame_serializer_client.h", "web/web_frame_widget.h", - "web/web_global_object_reuse_policy.h", "web/web_heap.h", "web/web_history_commit_type.h", "web/web_history_item.h", @@ -452,6 +461,8 @@ source_set("blink_headers") { "web/web_language_detection_details.h", "web/web_local_frame.h", "web/web_local_frame_client.h", + "web/web_manifest_fetcher.h", + "web/web_manifest_parser.h", "web/web_meaningful_layout.h", "web/web_media_player_action.h", "web/web_memory_statistics.h", @@ -531,12 +542,10 @@ source_set("blink_headers") { public_deps = [ "//net", "//services/service_manager/public/cpp", - "//services/ws/public/mojom/ime", "//skia", "//third_party/blink/public/common", - "//third_party/webrtc/api:libjingle_peerconnection_api", - "//third_party/webrtc/rtc_base:rtc_base", "//ui/accessibility:ax_enums_mojo", + "//ui/base/ime/mojo", "//url", ] @@ -548,11 +557,20 @@ source_set("blink_headers") { "//cc/paint:paint", "//components/viz/common", "//media/capture:capture_base", + "//media/capture:capture_lib", "//mojo/public/cpp/bindings:bindings", "//mojo/public/cpp/system:system", "//services/device/public/mojom:mojom_shared_cpp_sources", "//services/network/public/cpp:cpp", "//services/network/public/mojom", + "//third_party/webrtc/api:libjingle_peerconnection_api", + "//third_party/webrtc/api:rtc_stats_api", + "//third_party/webrtc/media:rtc_media_base", + "//third_party/webrtc/modules/audio_processing:api", + "//third_party/webrtc/rtc_base:rtc_base", + "//third_party/webrtc/rtc_base:rtc_task_queue", + "//third_party/webrtc_overrides:init_webrtc", + "//ui/base:base", "//v8:v8_headers", ] } @@ -584,6 +602,9 @@ grit("resources") { "grit/blink_resources.h", "blink_resources.pak", ] + if (is_android) { + defines = [ "notouch_build=$notouch_build" ] + } html_min_css = "$blink_core_output_dir/html.css" grit_flags = [ "-E", @@ -609,6 +630,10 @@ group("scaled_resources") { ":image_resources", "//third_party/blink/renderer/modules/media_controls:media_controls_resources", ] + + if (is_android && notouch_build) { + public_deps += [ "//third_party/blink/renderer/modules/media_controls:media_controls_touchless_resources" ] + } } repack("scaled_resources_100_percent") { @@ -617,6 +642,9 @@ repack("scaled_resources_100_percent") { "$root_gen_dir/third_party/blink/public/resources/blink_image_resources_100_percent.pak", "$root_gen_dir/third_party/blink/renderer/modules/media_controls/resources/media_controls_resources_100_percent.pak", ] + if (is_android && notouch_build) { + sources += [ "$root_gen_dir/third_party/blink/renderer/modules/media_controls/touchless/resources/media_controls_touchless_resources.pak" ] + } deps = [ ":scaled_resources", ] @@ -628,6 +656,9 @@ repack("scaled_resources_200_percent") { "$root_gen_dir/third_party/blink/public/resources/blink_image_resources_200_percent.pak", "$root_gen_dir/third_party/blink/renderer/modules/media_controls/resources/media_controls_resources_200_percent.pak", ] + if (is_android && notouch_build) { + sources += [ "$root_gen_dir/third_party/blink/renderer/modules/media_controls/touchless/resources/media_controls_touchless_resources.pak" ] + } deps = [ ":scaled_resources", ] @@ -642,28 +673,9 @@ mojom("mojo_bindings") { visibility_blink = [ "//third_party/blink/renderer/platform:blink_platform_public_deps" ] sources = [ - "platform/modules/background_sync/background_sync.mojom", - "platform/modules/badging/badging.mojom", "platform/modules/bluetooth/web_bluetooth.mojom", - "platform/modules/credentialmanager/credential_manager.mojom", - "platform/modules/geolocation/geolocation_service.mojom", - "platform/modules/hyphenation/hyphenation.mojom", - "platform/modules/idle/idle_manager.mojom", - "platform/modules/insecure_input/insecure_input_service.mojom", - "platform/modules/keyboard_lock/keyboard_lock.mojom", - "platform/modules/locks/lock_manager.mojom", - "platform/modules/notifications/notification_service.mojom", - "platform/modules/permissions/permission.mojom", - "platform/modules/permissions/permission_status.mojom", - "platform/modules/webdatabase/web_database.mojom", - "web/commit_result.mojom", - "web/devtools_frontend.mojom", - "web/selection_menu_behavior.mojom", - "web/window_features.mojom", ] public_deps = [ - ":android_mojo_bindings", - ":authenticator_test_mojo_bindings", "//components/services/font/public/interfaces", "//device/bluetooth/public/mojom", "//mojo/public/mojom/base", @@ -696,101 +708,6 @@ mojom("mojo_bindings") { export_header_blink = "third_party/blink/public/platform/web_common.h" } -mojom("android_mojo_bindings") { - visibility = [ - ":mojo_bindings", - ":authenticator_test_mojo_bindings", - ] - visibility_blink = [ - ":mojo_bindings_blink", - ":authenticator_test_mojo_bindings_blink", - ] - sources = [ - "platform/modules/document_metadata/copyless_paste.mojom", - "platform/modules/font_unique_name_lookup/font_unique_name_lookup.mojom", - "platform/modules/installation/installation.mojom", - "platform/modules/installedapp/installed_app_provider.mojom", - "platform/modules/installedapp/related_application.mojom", - "platform/modules/mediasession/media_session.mojom", - "platform/modules/webauthn/authenticator.mojom", - "platform/modules/webshare/webshare.mojom", - "web/remote_objects.mojom", - ] - public_deps = [ - "//mojo/public/mojom/base", - "//services/media_session/public/mojom", - "//ui/gfx/geometry/mojo", - "//url/mojom:url_mojom_gurl", - ] - - component_output_prefix = "blink_android_mojo_bindings" - - # See comment above. - export_class_attribute = "CONTENT_EXPORT" - export_define = "CONTENT_IMPLEMENTATION=1" - export_header = "content/common/content_export.h" - export_class_attribute_blink = "BLINK_PLATFORM_EXPORT" - export_define_blink = "BLINK_PLATFORM_IMPLEMENTATION=1" - export_header_blink = "third_party/blink/public/platform/web_common.h" - - # Don't scramble message IDs so they are redistributable to external tests. - scramble_message_ids = false -} - -# The embedded_frame_sink_mojo_bindings is separated from the rest of mojom -# files because its deps contain too many files in Chromium that would pollute -# the include paths in generated mojom-blink files for other services. -mojom("embedded_frame_sink_mojo_bindings") { - visibility = [ "//content/*" ] - visibility_blink = [ "//third_party/blink/renderer/platform" ] - sources = [ - "platform/modules/frame_sinks/embedded_frame_sink.mojom", - ] - deps = [ - "//services/viz/public/interfaces", - ] - - component_output_prefix = "blink_embedded_frame_sink_mojo_bindings" - - # See comment above - export_class_attribute = "CONTENT_EXPORT" - export_define = "CONTENT_IMPLEMENTATION=1" - export_header = "content/common/content_export.h" - export_class_attribute_blink = "BLINK_PLATFORM_EXPORT" - export_define_blink = "BLINK_PLATFORM_IMPLEMENTATION=1" - export_header_blink = "third_party/blink/public/platform/web_common.h" -} - -# The core_mojo_bindings is separated from the rest of mojom files to allow its deps -# to depend on types in WebKit/Source/core. -mojom("core_mojo_bindings") { - visibility = [ "//content/*" ] - visibility_blink = [ "//third_party/blink/renderer/core/*" ] - sources = [ - "platform/modules/broadcastchannel/broadcast_channel.mojom", - ] - public_deps = [ - "//third_party/blink/public/mojom:mojom_core", - "//url/mojom:url_mojom_origin", - ] - - overridden_deps = [ "//third_party/blink/public/mojom:mojom_core" ] - component_deps = [ "//third_party/blink/public/common" ] - - component_output_prefix = "blink_core_mojo_bindings" - - # See comment above. - export_class_attribute = "CONTENT_EXPORT" - export_define = "CONTENT_IMPLEMENTATION=1" - export_header = "content/common/content_export.h" - - # Similarly, the blink variant must be linked with the core component - # since it uses types from it in its typemaps. - export_class_attribute_blink = "CORE_EXPORT" - export_define_blink = "BLINK_CORE_IMPLEMENTATION=1" - export_header_blink = "third_party/blink/renderer/core/core_export.h" -} - # Note that this intentionally depends on the generator target of the mojom # target instead of the mojom target itself directly. This is to ensure that the # dependencies are header-only and don't link against any bindings code. @@ -800,25 +717,7 @@ group("generate_mojo_bindings") { # Blink public API exposes a number of Mojo interfaces; omitting it will # cause non-deterministic compile failures for code that uses the regular # variant of the generated files. - ":core_mojo_bindings_blink_headers", - ":core_mojo_bindings_headers", - ":embedded_frame_sink_mojo_bindings_blink_headers", ":mojo_bindings_blink_headers", ":mojo_bindings_headers", ] } - -# This is a separate target because it needs unscrambled message IDs. -mojom("authenticator_test_mojo_bindings") { - sources = [ - "platform/modules/webauthn/virtual_authenticator.mojom", - ] - - public_deps = [ - ":android_mojo_bindings", - "//url/mojom:url_mojom_gurl", - ] - - # Don't scramble message IDs so they are redistributable to external tests. - scramble_message_ids = false -} diff --git a/chromium/third_party/blink/public/OWNERS b/chromium/third_party/blink/public/OWNERS index 499cd80c660..29f47187472 100644 --- a/chromium/third_party/blink/public/OWNERS +++ b/chromium/third_party/blink/public/OWNERS @@ -4,6 +4,7 @@ dgozman@chromium.org foolip@chromium.org haraken@chromium.org japhet@chromium.org +jbroman@chromium.org jochen@chromium.org kinuko@chromium.org mkwst@chromium.org diff --git a/chromium/third_party/blink/public/blink_resources.grd b/chromium/third_party/blink/public/blink_resources.grd index eba70f912a5..375c78cf9cb 100644 --- a/chromium/third_party/blink/public/blink_resources.grd +++ b/chromium/third_party/blink/public/blink_resources.grd @@ -18,6 +18,9 @@ <if expr="is_macosx"> <include name="IDR_UASTYLE_THEME_MAC_CSS" file="../renderer/core/html/resources/mac.css" type="BINDATA" compress="gzip"/> </if> + <if expr="notouch_build"> + <include name="IDR_UASTYLE_THEME_TOUCHLESS_CSS" file="../renderer/core/css/touchless.css" type="BINDATA" compress="gzip"/> + </if> <include name="IDR_UASTYLE_THEME_INPUT_MULTIPLE_FIELDS_CSS" file="../renderer/core/html/resources/input_multiple_fields.css" type="BINDATA" compress="gzip"/> <include name="IDR_UASTYLE_THEME_WIN_CSS" file="../renderer/core/html/resources/win.css" type="BINDATA" compress="gzip"/> <include name="IDR_UASTYLE_THEME_WIN_QUIRKS_CSS" file="../renderer/core/html/resources/win_quirks.css" type="BINDATA" compress="gzip"/> @@ -28,7 +31,13 @@ <include name="IDR_UASTYLE_VIEWPORT_ANDROID_CSS" file="../renderer/core/css/viewportAndroid.css" type="BINDATA" compress="gzip"/> <include name="IDR_UASTYLE_VIEWPORT_TELEVISION_CSS" file="../renderer/core/css/viewportTelevision.css" type="BINDATA" compress="gzip"/> - <include name="IDR_INSPECTOR_OVERLAY_PAGE_HTML" file="../renderer/core/inspector/InspectorOverlayPage.html" type="BINDATA" compress="gzip"/> + <include name="IDR_INSPECT_TOOL_COMMON_JS" file="../renderer/core/inspector/inspect_tool_common.js" type="BINDATA" compress="gzip"/> + <include name="IDR_INSPECT_TOOL_COMMON_CSS" file="../renderer/core/inspector/inspect_tool_common.css" type="BINDATA" compress="gzip"/> + <include name="IDR_INSPECT_TOOL_DISTANCES_HTML" file="../renderer/core/inspector/inspect_tool_distances.html" type="BINDATA" compress="gzip"/> + <include name="IDR_INSPECT_TOOL_HIGHLIGHT_HTML" file="../renderer/core/inspector/inspect_tool_highlight.html" type="BINDATA" compress="gzip"/> + <include name="IDR_INSPECT_TOOL_PAUSED_HTML" file="../renderer/core/inspector/inspect_tool_paused.html" type="BINDATA" compress="gzip"/> + <include name="IDR_INSPECT_TOOL_VIEWPORT_SIZE_HTML" file="../renderer/core/inspector/inspect_tool_viewport_size.html" type="BINDATA" compress="gzip"/> + <include name="IDR_INSPECT_TOOL_SCREENSHOT_HTML" file="../renderer/core/inspector/inspect_tool_screenshot.html" type="BINDATA" compress="gzip"/> <include name="IDR_DOCUMENTXMLTREEVIEWER_CSS" file="../renderer/core/xml/DocumentXMLTreeViewer.css" type="BINDATA" compress="gzip"/> <include name="IDR_DOCUMENTXMLTREEVIEWER_JS" file="../renderer/core/xml/DocumentXMLTreeViewer.js" type="BINDATA" compress="gzip"/> <include name="IDR_VALIDATION_BUBBLE_ICON" file="../renderer/core/html/forms/resources/input_alert.svg" type="BINDATA" compress="gzip"/> diff --git a/chromium/third_party/blink/public/common/BUILD.gn b/chromium/third_party/blink/public/common/BUILD.gn index d45c565fee3..e32e923af96 100644 --- a/chromium/third_party/blink/public/common/BUILD.gn +++ b/chromium/third_party/blink/public/common/BUILD.gn @@ -28,6 +28,7 @@ source_set("headers") { "//content/*", "//third_party/blink/*", "//components/*", + "//services/*", "//storage/*", ":*", ] @@ -39,9 +40,9 @@ source_set("headers") { "cache_storage/cache_storage_utils.h", "client_hints/client_hints.h", "common_export.h", + "css/preferred_color_scheme.h", "device_memory/approximated_device_memory.h", "dom_storage/session_storage_namespace_id.h", - "download/download_stats.h", "experiments/memory_ablation_experiment.h", "feature_policy/feature_policy.h", "feature_policy/policy_value.h", @@ -66,6 +67,7 @@ source_set("headers") { "loader/url_loader_factory_bundle_mojom_traits.h", "manifest/manifest.h", "manifest/manifest_icon_selector.h", + "manifest/manifest_util.h", "manifest/web_display_mode.h", "media/video_capture.h", "mediastream/media_devices.h", @@ -80,6 +82,7 @@ source_set("headers") { "messaging/transferable_message.h", "messaging/transferable_message_struct_traits.h", "mime_util/mime_util.h", + "notifications/notification_constants.h", "notifications/notification_resources.h", "notifications/notification_struct_traits.h", "notifications/platform_notification_data.h", @@ -89,13 +92,17 @@ source_set("headers") { "origin_trials/trial_token.h", "origin_trials/trial_token_validator.h", "page/launching_process_state.h", + "prerender/prerender_rel_type.h", "privacy_preferences.h", + "scheduler/web_scheduler_tracked_feature.h", "screen_orientation/web_screen_orientation_lock_type.h", "screen_orientation/web_screen_orientation_type.h", "service_worker/service_worker_status_code.h", "service_worker/service_worker_type_converters.h", + "service_worker/service_worker_types.h", "service_worker/service_worker_utils.h", "user_agent/user_agent_metadata.h", + "web_package/signed_exchange_consts.h", ] public_deps = [ diff --git a/chromium/third_party/blink/public/common/cache_storage/cache_storage_utils.h b/chromium/third_party/blink/public/common/cache_storage/cache_storage_utils.h index 561b386cd4b..196ed6b33ba 100644 --- a/chromium/third_party/blink/public/common/cache_storage/cache_storage_utils.h +++ b/chromium/third_party/blink/public/common/cache_storage/cache_storage_utils.h @@ -5,18 +5,18 @@ #ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_CACHE_STORAGE_CACHE_STORAGE_UTILS_H_ #define THIRD_PARTY_BLINK_PUBLIC_COMMON_CACHE_STORAGE_CACHE_STORAGE_UTILS_H_ +#include <cstdint> + #include "third_party/blink/public/common/common_export.h" namespace blink { namespace cache_storage { -// Define the base message used when a batch operation, like addAll(), -// has duplicate requests in its argument list. This is populated by -// content on the browser side. The blink code in the renderer looks -// for the message to record a UseCounter event. -// TODO(crbug.com/877737): Remove this once the cache.addAll() -// duplicate rejection finally ships. -BLINK_COMMON_EXPORT extern const char kDuplicateOperationBaseMessage[]; +// Create a trace ID for a cache_storage operation. The ID value is +// guaranteed to be globally unique across all processes and threads. +// It can be used to trace across process boundaries. When passing to +// a TRACE_EVENT* macro it should be wrapped in TRACE_ID_GLOBAL(). +BLINK_COMMON_EXPORT int64_t CreateTraceId(); } // namespace cache_storage } // namespace blink diff --git a/chromium/third_party/blink/public/common/css/OWNERS b/chromium/third_party/blink/public/common/css/OWNERS new file mode 100644 index 00000000000..b5ccf8dc859 --- /dev/null +++ b/chromium/third_party/blink/public/common/css/OWNERS @@ -0,0 +1,4 @@ +file://third_party/blink/renderer/core/css/OWNERS + +# COMPONENT: Blink>CSS + diff --git a/chromium/third_party/blink/public/platform/web_color_scheme.h b/chromium/third_party/blink/public/common/css/preferred_color_scheme.h index f125105d3f7..b86c667e82a 100644 --- a/chromium/third_party/blink/public/platform/web_color_scheme.h +++ b/chromium/third_party/blink/public/common/css/preferred_color_scheme.h @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_COLOR_SCHEME_H_ -#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_COLOR_SCHEME_H_ +#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_CSS_PREFERRED_COLOR_SCHEME_H_ +#define THIRD_PARTY_BLINK_PUBLIC_COMMON_CSS_PREFERRED_COLOR_SCHEME_H_ namespace blink { // Use for passing preferred color scheme from the OS to the renderer. -enum class WebColorScheme { +enum class PreferredColorScheme { kNoPreference, kDark, kLight, diff --git a/chromium/third_party/blink/public/common/download/download_stats.h b/chromium/third_party/blink/public/common/download/download_stats.h deleted file mode 100644 index e11b2b379bc..00000000000 --- a/chromium/third_party/blink/public/common/download/download_stats.h +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2018 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_COMMON_DOWNLOAD_DOWNLOAD_STATS_H_ -#define THIRD_PARTY_BLINK_PUBLIC_COMMON_DOWNLOAD_DOWNLOAD_STATS_H_ - -#include <stdint.h> - -#include "base/macros.h" -#include "third_party/blink/public/common/common_export.h" - -namespace ukm { - -class UkmRecorder; - -typedef int64_t SourceId; - -} // namespace ukm - -namespace blink { - -class BLINK_COMMON_EXPORT DownloadStats { - public: - struct BLINK_COMMON_EXPORT MainFrameDownloadFlags { - bool has_sandbox; - bool has_gesture; - - MainFrameDownloadFlags() = default; - - unsigned ToUmaValue() const; - - private: - DISALLOW_COPY_AND_ASSIGN(MainFrameDownloadFlags); - }; - - struct BLINK_COMMON_EXPORT SubframeDownloadFlags { - bool has_sandbox; - bool is_cross_origin; - bool is_ad_frame; - bool has_gesture; - - SubframeDownloadFlags() = default; - - unsigned ToUmaValue() const; - - private: - DISALLOW_COPY_AND_ASSIGN(SubframeDownloadFlags); - }; - - // Log the bits in |flags| for a main frame download to UMA and UKM. - static void RecordMainFrameDownloadFlags(const MainFrameDownloadFlags& flags, - ukm::SourceId source_id, - ukm::UkmRecorder* ukm_recorder); - - // Log the bits in |flags| for a subframe download to UMA and UKM. - static void RecordSubframeDownloadFlags(const SubframeDownloadFlags& flags, - ukm::SourceId source_id, - ukm::UkmRecorder* ukm_recorder); - - private: - DISALLOW_IMPLICIT_CONSTRUCTORS(DownloadStats); - - // These values are used to construct an enum in UMA. They should never be - // changed. - static constexpr unsigned kSubframeGestureBit = 0x1 << 0; - static constexpr unsigned kSubframeAdBit = 0x1 << 1; - static constexpr unsigned kSubframeCrossOriginBit = 0x1 << 2; - static constexpr unsigned kSubframeSandboxBit = 0x1 << 3; - static constexpr unsigned kCountSandboxOriginAdGesture = 16; - - // These values are used to construct an enum in UMA. They should never be - // changed. - static constexpr unsigned kMainFrameGestureBit = 0x1 << 0; - static constexpr unsigned kMainFrameSandboxBit = 0x1 << 1; - static constexpr unsigned kCountSandboxGesture = 4; -}; - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_DOWNLOAD_DOWNLOAD_STATS_H_ diff --git a/chromium/third_party/blink/public/common/features.h b/chromium/third_party/blink/public/common/features.h index 0efd6b31a4c..d3479fc1eff 100644 --- a/chromium/third_party/blink/public/common/features.h +++ b/chromium/third_party/blink/public/common/features.h @@ -11,14 +11,19 @@ namespace blink { namespace features { +BLINK_COMMON_EXPORT extern const base::Feature + kBlockingDownloadsInAdFrameWithoutUserActivation; BLINK_COMMON_EXPORT extern const base::Feature kAvoidFlashBetweenNavigation; BLINK_COMMON_EXPORT extern const base::Feature kEagerCacheStorageSetupForServiceWorkers; BLINK_COMMON_EXPORT extern const base::Feature kEnableGpuRasterizationViewportRestriction; BLINK_COMMON_EXPORT extern const base::Feature kScriptStreaming; +BLINK_COMMON_EXPORT extern const base::Feature kUserLevelMemoryPressureSignal; BLINK_COMMON_EXPORT extern const base::Feature kFirstContentfulPaintPlusPlus; +BLINK_COMMON_EXPORT extern const base::Feature kFreezePurgeMemoryAllPagesFrozen; BLINK_COMMON_EXPORT extern const base::Feature kImplicitRootScroller; +BLINK_COMMON_EXPORT extern const base::Feature kInvalidateFontCacheOnPurge; BLINK_COMMON_EXPORT extern const base::Feature kJankTrackingSweepLine; BLINK_COMMON_EXPORT extern const base::Feature kBlinkGenPropertyTrees; BLINK_COMMON_EXPORT extern const base::Feature kLayoutNG; @@ -37,18 +42,23 @@ BLINK_COMMON_EXPORT extern const base::Feature kPortals; BLINK_COMMON_EXPORT extern const base::Feature kPreviewsResourceLoadingHintsSpecificResourceTypes; BLINK_COMMON_EXPORT extern const base::Feature - kPurgeMemoryOnlyForBackgroundedProcesses; + kPurgeRendererMemoryWhenBackgrounded; BLINK_COMMON_EXPORT extern const base::Feature kRTCGetDisplayMedia; BLINK_COMMON_EXPORT extern const base::Feature kRTCUnifiedPlanByDefault; BLINK_COMMON_EXPORT extern const base::Feature kRTCOfferExtmapAllowMixed; BLINK_COMMON_EXPORT extern const base::Feature kResourceLoadViaDataPipe; BLINK_COMMON_EXPORT extern const base::Feature + kServiceWorkerIsolateInForeground; +BLINK_COMMON_EXPORT extern const base::Feature kServiceWorkerImportedScriptUpdateCheck; BLINK_COMMON_EXPORT extern const base::Feature kServiceWorkerParallelSideDataReading; BLINK_COMMON_EXPORT extern const base::Feature kServiceWorkerAggressiveCodeCache; +BLINK_COMMON_EXPORT extern const base::Feature kServiceWorkerUpdateDelay; BLINK_COMMON_EXPORT extern const base::Feature kStopInBackground; +BLINK_COMMON_EXPORT extern const base::Feature + kFreezeBackgroundTabOnNetworkIdle; BLINK_COMMON_EXPORT extern const base::Feature kStopNonTimersInBackground; BLINK_COMMON_EXPORT extern const base::Feature kTextFragmentAnchor; BLINK_COMMON_EXPORT extern const base::Feature kWasmCodeCache; @@ -67,6 +77,8 @@ BLINK_COMMON_EXPORT extern const base::Feature kAlwaysAccelerateCanvas; BLINK_COMMON_EXPORT extern const base::Feature kWebFontsCacheAwareTimeoutAdaption; +BLINK_COMMON_EXPORT extern const base::Feature + kBlockingFocusWithoutUserActivation; // Returns true when off-the-main-thread shared worker script fetch is enabled. BLINK_COMMON_EXPORT bool IsOffMainThreadSharedWorkerScriptFetchEnabled(); diff --git a/chromium/third_party/blink/public/common/frame/frame_policy.h b/chromium/third_party/blink/public/common/frame/frame_policy.h index 85e5a462961..a604241ba45 100644 --- a/chromium/third_party/blink/public/common/frame/frame_policy.h +++ b/chromium/third_party/blink/public/common/frame/frame_policy.h @@ -25,12 +25,21 @@ namespace blink { struct BLINK_COMMON_EXPORT FramePolicy { FramePolicy(); FramePolicy(WebSandboxFlags sandbox_flags, - const ParsedFeaturePolicy& container_policy); + const ParsedFeaturePolicy& container_policy, + bool allowed_to_download_without_user_activation = true); FramePolicy(const FramePolicy& lhs); ~FramePolicy(); WebSandboxFlags sandbox_flags; ParsedFeaturePolicy container_policy; + // With FeaturePolicyForSandbox, as a policy affecting the document, + // "downloads-without-user-activation" is included in |container_policy|. + // However, in certain cases where the initiator of the navigation is not the + // document itself (e.g., a parent document), the FrameOwner element should be + // checked for "downloads" flag. If this boolean is false then navigations + // leading to downloads should be blocked unless they have user gesture. Note: + // this flag is currently only set if the frame is sandboxed for downloads. + bool allowed_to_download_without_user_activation; }; } // namespace blink diff --git a/chromium/third_party/blink/public/common/frame/occlusion_state.h b/chromium/third_party/blink/public/common/frame/occlusion_state.h index b6ca00008fa..1faa8d421c5 100644 --- a/chromium/third_party/blink/public/common/frame/occlusion_state.h +++ b/chromium/third_party/blink/public/common/frame/occlusion_state.h @@ -11,14 +11,14 @@ namespace blink { // Indicates whether a child frame is occluded or visually altered by content // or styles in the parent frame. -enum FrameOcclusionState { +enum class FrameOcclusionState { // No occlusion determination was made. - kUnknownOcclusionState = 0, + kUnknown = 0, // The frame *may* be occluded or visually altered. kPossiblyOccluded = 1, // The frame is definitely not occluded or visually altered. kGuaranteedNotOccluded = 2, - kMaxOcclusionState = kGuaranteedNotOccluded + kMaxValue = kGuaranteedNotOccluded, }; } // namespace blink diff --git a/chromium/third_party/blink/public/common/frame/sandbox_flags.h b/chromium/third_party/blink/public/common/frame/sandbox_flags.h index 4555905f0af..19925ce6f40 100644 --- a/chromium/third_party/blink/public/common/frame/sandbox_flags.h +++ b/chromium/third_party/blink/public/common/frame/sandbox_flags.h @@ -10,8 +10,7 @@ namespace blink { // See http://www.whatwg.org/specs/web-apps/current-work/#attr-iframe-sandbox -// for a list of the sandbox flags. This enum should be kept in sync with -// Source/core/frame/SandboxFlags.h, as enforced in SandboxFlags.cpp. +// for a list of the sandbox flags. enum class WebSandboxFlags : int { kNone = 0, kNavigation = 1, @@ -20,17 +19,24 @@ enum class WebSandboxFlags : int { kForms = 1 << 3, kScripts = 1 << 4, kTopNavigation = 1 << 5, + // See https://www.w3.org/Bugs/Public/show_bug.cgi?id=12393 kPopups = 1 << 6, kAutomaticFeatures = 1 << 7, kPointerLock = 1 << 8, kDocumentDomain = 1 << 9, + // See + // https://w3c.github.io/screen-orientation/#dfn-sandboxed-orientation-lock-browsing-context-flag. kOrientationLock = 1 << 10, kPropagatesToAuxiliaryBrowsingContexts = 1 << 11, kModals = 1 << 12, + // See + // https://w3c.github.io/presentation-api/#sandboxing-and-the-allow-presentation-keyword kPresentationController = 1 << 13, + // See https://github.com/WICG/interventions/issues/42. kTopNavigationByUserActivation = 1 << 14, + // See https://crbug.com/539938 kDownloads = 1 << 15, - kAll = -1 + kAll = -1 // Mask with all bits set to 1. }; inline constexpr WebSandboxFlags operator&(WebSandboxFlags a, diff --git a/chromium/third_party/blink/public/common/frame/user_activation_state.h b/chromium/third_party/blink/public/common/frame/user_activation_state.h index 6d0558e1b50..cf1f6dc933f 100644 --- a/chromium/third_party/blink/public/common/frame/user_activation_state.h +++ b/chromium/third_party/blink/public/common/frame/user_activation_state.h @@ -12,11 +12,79 @@ namespace blink { // This class represents the user activation state of a frame. It maintains two // bits of information: whether this frame has ever seen an activation in its -// lifetime, and whether this frame has a current activation that was neither -// expired nor consumed. +// lifetime (the sticky bit), and whether this frame has a current activation +// that is neither expired nor consumed (the transient bit). See User +// Activation v2 (UAv2) links below for more info. // -// This provides a simple alternative to current user gesture tracking code -// based on UserGestureIndicator and UserGestureToken. +// +// Tracking User Activation across the Frame Tree +// ============================================== +// +// This state changes in three ways: activation (of both bits) through user +// input notifications, and deactivation (of transient bit only) through expiry +// and consumption. +// +// - A notification update at a frame activates all ancestor frames (sets both +// bits to true). Also see "Same-origin Visibility" below. +// +// - A consumption call deactivates the transient bits in the whole frame tree. +// This exhaustive consumption guarantees that a malicious subframe can't embed +// sub-subframes in a way that could allow multiple consumptions per user +// activation. +// +// - After a certain time limit (few seconds), the transient bit is deactivated. +// (Internally, the class doens't store the transient bit, but stores the bit's +// expiry time instead.) +// +// +// Same-origin Visibility of User Activation +// ========================================= +// +// We launched UAv2 with a relaxed visibility model that a user activation is +// visible to all same-origin frames (w.r.t. the originally-activated frame), in +// addition to the ancestor frames as per UAv2. We will remove this relaxation +// after implementing a mechanism for activation transfer +// (https://crbug.com/928838). +// +// Details: Before UAv2, user activation was visible to all same-process frames +// and no cross-process frames (undocumented). The ancestor-only restriction +// with UAv2 caused a few breakages because of reliance on the old assumption, +// see the Type=Bug-Regression bugs blocking the above bug. Once we have a +// workaround for those broken cases (most likely through a postMessage +// transfer), we will go back to the ancestor-only visibility model. +// +// +// State Replication in Browser and Renderers +// ========================================== +// +// The user activation state is replicated in the browser process (in +// |FrameTreeNode|) and in the renderer processes (in |LocalFrame| and +// |RemoteFrame|). The replicated states across the browser and renderer +// processes are kept in sync as follows: +// +// [A] Consumption of activation state for popups starts in the frame tree of +// the browser process and propagate to the renderer trees through direct IPCs +// (one IPC sent to each renderer). +// +// [B] Consumption calls from JS/blink side (e.g. video picture-in-picture) +// update the originating renderer's local frame tree and send an IPC to the +// browser; the browser updates its frame tree and sends IPCs to all other +// renderers each of which then updates its local frame tree. +// +// [B'] Notification updates on user inputs is like [B] (renderer first). These +// should really be like [A] (browser first), see https://crbug.com/848778. +// +// [C] Expiration of an active state is tracked independently in each process. +// +// +// More Info +// ========= +// +// - UAv2 explainer: https://mustaqahmed.github.io/user-activation-v2 +// - Main design: +// https://docs.google.com/a/chromium.org/document/d/1erpl1yqJlc1pH0QvVVmi1s3WzqQLsEXTLLh6VuYp228 +// - Browser-side replication for OOPIFs: +// https://docs.google.com/document/d/1XL3vCedkqL65ueaGVD-kfB5RnnrnTaxLc7kmU91oerg class BLINK_COMMON_EXPORT UserActivationState { public: void Activate(); @@ -28,16 +96,25 @@ class BLINK_COMMON_EXPORT UserActivationState { // Returns the transient activation state, which is |true| if the frame has // recently been activated and the transient state hasn't been consumed yet. - bool IsActive(); + bool IsActive() const; // Consumes the transient activation state if available, and returns |true| if // successfully consumed. bool ConsumeIfActive(); + // Transfers user activation state from |other| into |this|: + // - The sticky bit in |this| gets set if the bit in |other| is set. + // - The transient expiry time in |this| becomes the max of the expiry times + // in |this| and |other|. + // - The state in |other| is cleared. + void TransferFrom(UserActivationState& other); + private: + void ActivateTransientState(); + void DeactivateTransientState(); + bool has_been_active_ = false; - bool is_active_ = false; - base::TimeTicks activation_timestamp_; + base::TimeTicks transient_state_expiry_time_; }; } // namespace blink diff --git a/chromium/third_party/blink/public/common/manifest/manifest.h b/chromium/third_party/blink/public/common/manifest/manifest.h index 2203a9b4fec..1d202f2d82a 100644 --- a/chromium/third_party/blink/public/common/manifest/manifest.h +++ b/chromium/third_party/blink/public/common/manifest/manifest.h @@ -195,10 +195,19 @@ struct BLINK_COMMON_EXPORT Manifest { // Null if parsing failed or the field was not present. base::NullableString16 gcm_sender_id; - // Empty if the parsing failed or the field was not present. + // Empty if the parsing failed. Otherwise defaults to the start URL (or + // document URL if start URL isn't present) with filename, query, and fragment + // removed. GURL scope; }; +struct BLINK_COMMON_EXPORT ManifestError { + std::string message; + bool critical; + uint32_t line; + uint32_t column; +}; + } // namespace blink #endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_MANIFEST_MANIFEST_H_ diff --git a/chromium/third_party/blink/public/common/manifest/manifest_icon_selector.h b/chromium/third_party/blink/public/common/manifest/manifest_icon_selector.h index 569b06ca089..3af62176f4d 100644 --- a/chromium/third_party/blink/public/common/manifest/manifest_icon_selector.h +++ b/chromium/third_party/blink/public/common/manifest/manifest_icon_selector.h @@ -11,8 +11,8 @@ namespace blink { -// Selects the square icon with the supported image MIME types and the specified -// icon purpose that most closely matches the size constraints. +// Selects the landscape or square icon with the supported image MIME types and +// the specified icon purpose that most closely matches the size constraints. // This follows very basic heuristics -- improvements are welcome. class BLINK_COMMON_EXPORT ManifestIconSelector { public: @@ -25,12 +25,21 @@ class BLINK_COMMON_EXPORT ManifestIconSelector { // |purpose|. // // Returns the icon url if a suitable icon is found. An empty URL otherwise. - static GURL FindBestMatchingIcon( + static GURL FindBestMatchingSquareIcon( const std::vector<blink::Manifest::ImageResource>& icons, int ideal_icon_size_in_px, int minimum_icon_size_in_px, blink::Manifest::ImageResource::Purpose purpose); + // Identical to FindBestMatchingSquareIcon, but finds landscape icons as well + // as square icons. + static GURL FindBestMatchingIcon( + const std::vector<blink::Manifest::ImageResource>& icons, + int ideal_icon_height_in_px, + int minimum_icon_height_in_px, + float max_width_to_height_ratio, + blink::Manifest::ImageResource::Purpose purpose); + private: DISALLOW_IMPLICIT_CONSTRUCTORS(ManifestIconSelector); }; diff --git a/chromium/third_party/blink/public/common/manifest/manifest_util.h b/chromium/third_party/blink/public/common/manifest/manifest_util.h new file mode 100644 index 00000000000..2a2bd8f8334 --- /dev/null +++ b/chromium/third_party/blink/public/common/manifest/manifest_util.h @@ -0,0 +1,47 @@ +// Copyright 2016 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_COMMON_MANIFEST_MANIFEST_UTIL_H_ +#define THIRD_PARTY_BLINK_PUBLIC_COMMON_MANIFEST_MANIFEST_UTIL_H_ + +#include <string> + +#include "third_party/blink/public/common/common_export.h" +#include "third_party/blink/public/common/manifest/web_display_mode.h" +#include "third_party/blink/public/common/screen_orientation/web_screen_orientation_lock_type.h" + +namespace blink { + +// Converts a blink::WebDisplayMode to a string. Returns one of +// https://www.w3.org/TR/appmanifest/#dfn-display-modes-values. Return values +// are lowercase. Returns an empty string for blink::WebDisplayModeUndefined. +BLINK_COMMON_EXPORT std::string WebDisplayModeToString( + blink::WebDisplayMode display); + +// Returns the blink::WebDisplayMode which matches |display|. +// |display| should be one of +// https://www.w3.org/TR/appmanifest/#dfn-display-modes-values. |display| is +// case insensitive. Returns blink::WebDisplayModeUndefined if there is no +// match. +BLINK_COMMON_EXPORT blink::WebDisplayMode WebDisplayModeFromString( + const std::string& display); + +// Converts a blink::WebScreenOrientationLockType to a string. Returns one of +// https://www.w3.org/TR/screen-orientation/#orientationlocktype-enum. Return +// values are lowercase. Returns an empty string for +// blink::WebScreenOrientationLockDefault. +BLINK_COMMON_EXPORT std::string WebScreenOrientationLockTypeToString( + blink::WebScreenOrientationLockType); + +// Returns the blink::WebScreenOrientationLockType which matches +// |orientation|. |orientation| should be one of +// https://www.w3.org/TR/screen-orientation/#orientationlocktype-enum. +// |orientation| is case insensitive. Returns +// blink::WebScreenOrientationLockDefault if there is no match. +BLINK_COMMON_EXPORT blink::WebScreenOrientationLockType +WebScreenOrientationLockTypeFromString(const std::string& orientation); + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_MANIFEST_MANIFEST_UTIL_H_ diff --git a/chromium/third_party/blink/public/common/mediastream/OWNERS b/chromium/third_party/blink/public/common/mediastream/OWNERS index 155e1a8b7ca..f247c7f2b01 100644 --- a/chromium/third_party/blink/public/common/mediastream/OWNERS +++ b/chromium/third_party/blink/public/common/mediastream/OWNERS @@ -6,5 +6,5 @@ per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS per-file *.typemap=set noparent per-file *.typemap=file://ipc/SECURITY_OWNERS -# TEAM: media-capture-and-streams@grotations.appspotmail.com +# TEAM: webrtc-dev@chromium.org # COMPONENT: Blink>GetUserMedia diff --git a/chromium/third_party/blink/public/common/mediastream/media_stream_mojom_traits.h b/chromium/third_party/blink/public/common/mediastream/media_stream_mojom_traits.h index 044a8083382..f7a5c6b7985 100644 --- a/chromium/third_party/blink/public/common/mediastream/media_stream_mojom_traits.h +++ b/chromium/third_party/blink/public/common/mediastream/media_stream_mojom_traits.h @@ -69,12 +69,6 @@ struct StructTraits<blink::mojom::MediaStreamDeviceDataView, return device.session_id; } - static const base::Optional< - media::VideoCaptureDeviceDescriptor::CameraCalibration>& - camera_calibration(const blink::MediaStreamDevice& device) { - return device.camera_calibration; - } - static const base::Optional<media::mojom::DisplayMediaInformationPtr>& display_media_info(const blink::MediaStreamDevice& device) { return device.display_media_info; diff --git a/chromium/third_party/blink/public/common/mediastream/media_stream_request.h b/chromium/third_party/blink/public/common/mediastream/media_stream_request.h index c00f03823d0..c062c41025f 100644 --- a/chromium/third_party/blink/public/common/mediastream/media_stream_request.h +++ b/chromium/third_party/blink/public/common/mediastream/media_stream_request.h @@ -79,9 +79,6 @@ enum MediaStreamRequestResult { NUM_MEDIA_REQUEST_RESULTS }; -using CameraCalibration = - media::VideoCaptureDeviceDescriptor::CameraCalibration; - // Convenience predicates to determine whether the given type represents some // audio or some video device. BLINK_COMMON_EXPORT bool IsAudioInputMediaType(MediaStreamType type); @@ -154,9 +151,6 @@ struct BLINK_COMMON_EXPORT MediaStreamDevice { // Id for this capture session. Unique for all sessions of the same type. int session_id = kNoId; - // This field is optional and available only for some camera models. - base::Optional<CameraCalibration> camera_calibration; - // This field is optional and available only for display media devices. base::Optional<media::mojom::DisplayMediaInformationPtr> display_media_info; }; diff --git a/chromium/third_party/blink/public/common/messaging/transferable_message.h b/chromium/third_party/blink/public/common/messaging/transferable_message.h index 5b68cc6e938..e532eadbd81 100644 --- a/chromium/third_party/blink/public/common/messaging/transferable_message.h +++ b/chromium/third_party/blink/public/common/messaging/transferable_message.h @@ -12,7 +12,7 @@ #include "third_party/blink/public/common/common_export.h" #include "third_party/blink/public/common/messaging/cloneable_message.h" #include "third_party/blink/public/common/messaging/message_port_channel.h" -#include "third_party/blink/public/mojom/array_buffer/array_buffer_contents.mojom-forward.h" +#include "third_party/blink/public/mojom/array_buffer/array_buffer_contents.mojom.h" #include "third_party/blink/public/mojom/messaging/user_activation_snapshot.mojom.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -37,12 +37,16 @@ struct BLINK_COMMON_EXPORT TransferableMessage : public CloneableMessage { std::vector<SkBitmap> image_bitmap_contents_array; // Whether the recipient should have a user gesture when it processes this - // message. + // message. This is a legacy bit used only without User Activation v2. bool has_user_gesture = false; // The state of user activation. mojom::UserActivationSnapshotPtr user_activation; + // Whether the state of user activation should be transferred to the + // destination frame. + bool transfer_user_activation = false; + private: DISALLOW_COPY_AND_ASSIGN(TransferableMessage); }; diff --git a/chromium/third_party/blink/public/common/messaging/transferable_message_struct_traits.h b/chromium/third_party/blink/public/common/messaging/transferable_message_struct_traits.h index a6ad220d377..0fd52135a21 100644 --- a/chromium/third_party/blink/public/common/messaging/transferable_message_struct_traits.h +++ b/chromium/third_party/blink/public/common/messaging/transferable_message_struct_traits.h @@ -50,6 +50,10 @@ struct BLINK_COMMON_EXPORT return input.user_activation; } + static bool transfer_user_activation(blink::TransferableMessage& input) { + return input.transfer_user_activation; + } + static bool Read(blink::mojom::TransferableMessage::DataView data, blink::TransferableMessage* out); }; diff --git a/chromium/third_party/blink/public/common/notifications/notification_constants.h b/chromium/third_party/blink/public/common/notifications/notification_constants.h new file mode 100644 index 00000000000..c88e3b7ab85 --- /dev/null +++ b/chromium/third_party/blink/public/common/notifications/notification_constants.h @@ -0,0 +1,19 @@ +// Copyright 2019 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_COMMON_NOTIFICATIONS_NOTIFICATION_CONSTANTS_H_ +#define THIRD_PARTY_BLINK_PUBLIC_COMMON_NOTIFICATIONS_NOTIFICATION_CONSTANTS_H_ + +#include "base/time/time.h" + +namespace blink { + +// Maximum allowed time delta into the future for show triggers. Allow a bit +// more than a year to account for leap years and seconds. +constexpr base::TimeDelta kMaxNotificationShowTriggerDelay = + base::TimeDelta::FromDays(367); + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_NOTIFICATIONS_NOTIFICATION_CONSTANTS_H_ diff --git a/chromium/third_party/blink/public/common/origin_policy/origin_policy.h b/chromium/third_party/blink/public/common/origin_policy/origin_policy.h index 5c4583fb10e..b4ee5956a43 100644 --- a/chromium/third_party/blink/public/common/origin_policy/origin_policy.h +++ b/chromium/third_party/blink/public/common/origin_policy/origin_policy.h @@ -6,10 +6,13 @@ #define THIRD_PARTY_BLINK_PUBLIC_COMMON_ORIGIN_POLICY_ORIGIN_POLICY_H_ #include <memory> +#include <set> #include <string> +#include <vector> #include "base/strings/string_piece.h" #include "third_party/blink/public/common/common_export.h" +#include "url/origin.h" namespace blink { @@ -32,6 +35,10 @@ class BLINK_COMMON_EXPORT OriginPolicy { return features_; } + const std::set<url::Origin>& GetFirstPartySet() const { + return first_party_set_; + } + private: friend class OriginPolicyParser; @@ -39,6 +46,7 @@ class BLINK_COMMON_EXPORT OriginPolicy { std::vector<CSP> csp_; std::vector<std::string> features_; + std::set<url::Origin> first_party_set_; }; } // namespace blink diff --git a/chromium/third_party/blink/public/common/prerender/OWNERS b/chromium/third_party/blink/public/common/prerender/OWNERS new file mode 100644 index 00000000000..c71af0e773c --- /dev/null +++ b/chromium/third_party/blink/public/common/prerender/OWNERS @@ -0,0 +1,3 @@ +file://chrome/browser/prerender/OWNERS + +# COMPONENT: Internals>Preload diff --git a/chromium/third_party/blink/public/common/prerender/prerender_rel_type.h b/chromium/third_party/blink/public/common/prerender/prerender_rel_type.h new file mode 100644 index 00000000000..e0450ac8f8a --- /dev/null +++ b/chromium/third_party/blink/public/common/prerender/prerender_rel_type.h @@ -0,0 +1,19 @@ +// Copyright 2019 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_COMMON_PRERENDER_PRERENDER_REL_TYPE_H_ +#define THIRD_PARTY_BLINK_PUBLIC_COMMON_PRERENDER_PRERENDER_REL_TYPE_H_ + +namespace blink { + +// WebPrerenderRelType is a bitfield since multiple rel attributes can be set on +// the same prerender. +enum WebPrerenderRelType { + kPrerenderRelTypePrerender = 0x1, + kPrerenderRelTypeNext = 0x2, +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_PRERENDER_PRERENDER_REL_TYPE_H_ diff --git a/chromium/third_party/blink/public/common/scheduler/OWNERS b/chromium/third_party/blink/public/common/scheduler/OWNERS new file mode 100644 index 00000000000..6f83df0f877 --- /dev/null +++ b/chromium/third_party/blink/public/common/scheduler/OWNERS @@ -0,0 +1 @@ +file://third_party/blink/renderer/platform/scheduler/OWNERS diff --git a/chromium/third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h b/chromium/third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h new file mode 100644 index 00000000000..c88a10c9cd0 --- /dev/null +++ b/chromium/third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h @@ -0,0 +1,53 @@ +// Copyright 2019 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_COMMON_SCHEDULER_WEB_SCHEDULER_TRACKED_FEATURE_H_ +#define THIRD_PARTY_BLINK_PUBLIC_COMMON_SCHEDULER_WEB_SCHEDULER_TRACKED_FEATURE_H_ + +namespace blink { +namespace scheduler { + +// A list of features which influence scheduling behaviour (throttling / +// freezing / back-forward cache) and which might be sent to the browser process +// for metrics-related purposes. +enum class WebSchedulerTrackedFeature { + kWebSocket = 0, + kWebRTC = 1, + + kMainResourceHasCacheControlNoCache = 2, + kMainResourceHasCacheControlNoStore = 3, + kSubresourceHasCacheControlNoCache = 4, + kSubresourceHasCacheControlNoStore = 5, + + kPageShowEventListener = 6, + kPageHideEventListener = 7, + kBeforeUnloadEventListener = 8, + kUnloadEventListener = 9, + kFreezeEventListener = 10, + kResumeEventListener = 11, + + kContainsPlugins = 12, + kDocumentLoaded = 13, + kDedicatedWorkerOrWorklet = 14, + kOutstandingNetworkRequest = 15, + // TODO(altimin): This doesn't include service worker-controlled origins. + // We need to track them too. + kServiceWorkerControlledPage = 16, + + kOutstandingIndexedDBTransaction = 17, + + // Whether there are other pages which can potentially synchronously script + // the current one (e.g. due to window.open being used). + // This is a conservative estimation which doesn't take into account the + // origin, so it may be true if the related page is cross-origin. + // Recorded only for the main frame. + kHasScriptableFramesInMultipleTabs = 18, + + kMaxValue = kHasScriptableFramesInMultipleTabs +}; + +} // namespace scheduler +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_SCHEDULER_WEB_SCHEDULER_TRACKED_FEATURE_H_ diff --git a/chromium/third_party/blink/public/common/screen_orientation/screen_orientation_lock_types.typemap b/chromium/third_party/blink/public/common/screen_orientation/screen_orientation_lock_types.typemap index a262ea5fc6c..bc2dcf7fd3b 100644 --- a/chromium/third_party/blink/public/common/screen_orientation/screen_orientation_lock_types.typemap +++ b/chromium/third_party/blink/public/common/screen_orientation/screen_orientation_lock_types.typemap @@ -6,3 +6,6 @@ mojom = "//services/device/public/mojom/screen_orientation_lock_types.mojom" public_headers = [ "//third_party/blink/public/common/screen_orientation/web_screen_orientation_lock_type.h" ] traits_headers = [ "//third_party/blink/public/common/screen_orientation/web_screen_orientation_mojom_traits.h" ] type_mappings = [ "device.mojom.ScreenOrientationLockType=::blink::WebScreenOrientationLockType" ] +deps = [ + "//third_party/blink/public/common:headers", +] diff --git a/chromium/third_party/blink/public/common/service_worker/service_worker_types.h b/chromium/third_party/blink/public/common/service_worker/service_worker_types.h new file mode 100644 index 00000000000..13ee9645ef0 --- /dev/null +++ b/chromium/third_party/blink/public/common/service_worker/service_worker_types.h @@ -0,0 +1,15 @@ +// Copyright 2019 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_COMMON_SERVICE_WORKER_SERVICE_WORKER_TYPES_H_ +#define THIRD_PARTY_BLINK_PUBLIC_COMMON_SERVICE_WORKER_SERVICE_WORKER_TYPES_H_ + +namespace blink { + +// Constants for invalid identifiers. +static const int kInvalidServiceWorkerProviderId = -1; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_SERVICE_WORKER_SERVICE_WORKER_TYPES_H_ diff --git a/chromium/third_party/blink/public/common/service_worker/service_worker_utils.h b/chromium/third_party/blink/public/common/service_worker/service_worker_utils.h index 90238bc6da4..007ead86991 100644 --- a/chromium/third_party/blink/public/common/service_worker/service_worker_utils.h +++ b/chromium/third_party/blink/public/common/service_worker/service_worker_utils.h @@ -38,11 +38,6 @@ BLINK_COMMON_EXPORT extern const char kServiceWorkerEagerCodeCacheStrategy[]; class ServiceWorkerUtils { public: - // Whether the new service worker glue for NetworkService is enabled. Always - // returns true as the glue is always enabled now. - // TODO(crbug.com/715640): Remove this after non-NetS13nSW is removed. - static bool BLINK_COMMON_EXPORT IsServicificationEnabled(); - static bool BLINK_COMMON_EXPORT IsImportedScriptUpdateCheckEnabled(); static EagerCodeCacheStrategy BLINK_COMMON_EXPORT GetEagerCodeCacheStrategy(); diff --git a/chromium/third_party/blink/public/common/web_package/signed_exchange_consts.h b/chromium/third_party/blink/public/common/web_package/signed_exchange_consts.h new file mode 100644 index 00000000000..d9c67d9571d --- /dev/null +++ b/chromium/third_party/blink/public/common/web_package/signed_exchange_consts.h @@ -0,0 +1,21 @@ +// Copyright 2019 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_COMMON_WEB_PACKAGE_SIGNED_EXCHANGE_CONSTS_H_ +#define THIRD_PARTY_BLINK_PUBLIC_COMMON_WEB_PACKAGE_SIGNED_EXCHANGE_CONSTS_H_ + +#include <stddef.h> +#include <string> + +#include "third_party/blink/public/common/common_export.h" + +namespace blink { + +BLINK_COMMON_EXPORT extern const char kSignedExchangeVariantsHeader[]; +BLINK_COMMON_EXPORT extern const char kSignedExchangeVariantKeyHeader[]; +BLINK_COMMON_EXPORT extern const char kSignedExchangeMimeType[]; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_WEB_PACKAGE_SIGNED_EXCHANGE_CONSTS_H_ diff --git a/chromium/third_party/blink/public/mojom/BUILD.gn b/chromium/third_party/blink/public/mojom/BUILD.gn index 8b37469abb3..181640e2492 100644 --- a/chromium/third_party/blink/public/mojom/BUILD.gn +++ b/chromium/third_party/blink/public/mojom/BUILD.gn @@ -5,6 +5,10 @@ import("//mojo/public/tools/bindings/mojom.gni") import("//third_party/blink/public/public_features.gni") +if (is_android) { + import("//build/config/android/config.gni") +} + # This target includes all mojom interfaces which can be used from # renderer/platform. In particular these mojom interfaces can't use types that # are typemapped to a type in renderer/core. @@ -18,21 +22,21 @@ mojom("mojom_platform") { "associated_interfaces/associated_interfaces.mojom", "autoplay/autoplay.mojom", "background_fetch/background_fetch.mojom", - "blob/blob.mojom", - "blob/blob_registry.mojom", - "blob/blob_url_store.mojom", - "blob/data_element.mojom", - "blob/serialized_blob.mojom", + "background_sync/background_sync.mojom", + "badging/badging.mojom", "cache_storage/cache_storage.mojom", "choosers/color_chooser.mojom", "choosers/file_chooser.mojom", "clipboard/clipboard.mojom", + "commit_result/commit_result.mojom", "contacts/contacts_manager.mojom", "cookie_store/cookie_store.mojom", "crash/crash_memory_metrics_reporter.mojom", + "credentialmanager/credential_manager.mojom", "csp/content_security_policy.mojom", "devtools/console_message.mojom", "devtools/devtools_agent.mojom", + "devtools/devtools_frontend.mojom", "dom_storage/session_storage_namespace.mojom", "dom_storage/storage_area.mojom", "dom_storage/storage_partition_service.mojom", @@ -47,12 +51,18 @@ mojom("mojom_platform") { "frame/frame_host_test_interface.mojom", "frame/lifecycle.mojom", "frame/navigation_initiator.mojom", + "geolocation/geolocation_service.mojom", + "hyphenation/hyphenation.mojom", + "idle/idle_manager.mojom", + "insecure_input/insecure_input_service.mojom", + "keyboard_lock/keyboard_lock.mojom", "leak_detector/leak_detector.mojom", "loader/code_cache.mojom", "loader/navigation_predictor.mojom", "loader/pause_subresource_loading_handle.mojom", "loader/previews_resource_loading_hints.mojom", "loader/url_loader_factory_bundle.mojom", + "locks/lock_manager.mojom", "manifest/display_mode.mojom", "manifest/manifest.mojom", "manifest/manifest_manager.mojom", @@ -61,9 +71,13 @@ mojom("mojom_platform") { "mime/mime_registry.mojom", "net/ip_address_space.mojom", "notifications/notification.mojom", + "notifications/notification_service.mojom", "oom_intervention/oom_intervention.mojom", "page/display_cutout.mojom", + "page/spatial_navigation.mojom", "payments/payment_app.mojom", + "permissions/permission.mojom", + "permissions/permission_status.mojom", "picture_in_picture/picture_in_picture.mojom", "plugins/plugin_registry.mojom", "presentation/presentation.mojom", @@ -74,7 +88,8 @@ mojom("mojom_platform") { "renderer_preferences.mojom", "reporting/reporting.mojom", "script/script_type.mojom", - "serial/serial.mojom", + "selection_menu/selection_menu_behavior.mojom", + "service_worker/controller_service_worker_mode.mojom", "service_worker/dispatch_fetch_event_params.mojom", "service_worker/navigation_preload_state.mojom", "service_worker/service_worker_client.mojom", @@ -87,6 +102,7 @@ mojom("mojom_platform") { "service_worker/service_worker_stream_handle.mojom", "site_engagement/site_engagement.mojom", "speech/speech_recognition_error.mojom", + "speech/speech_recognition_error_code.mojom", "speech/speech_recognition_grammar.mojom", "speech/speech_recognition_result.mojom", "speech/speech_recognizer.mojom", @@ -96,6 +112,8 @@ mojom("mojom_platform") { "v8_cache_options.mojom", "wake_lock/wake_lock.mojom", "webaudio/audio_context_manager.mojom", + "webdatabase/web_database.mojom", + "window_features/window_features.mojom", "worker/shared_worker.mojom", "worker/shared_worker_client.mojom", "worker/shared_worker_connector.mojom", @@ -106,14 +124,18 @@ mojom("mojom_platform") { "worker/worker_main_script_load_params.mojom", ] + if (!is_android) { + sources += [ "serial/serial.mojom" ] + } + if (is_win) { sources += [ "dwrite_font_proxy/dwrite_font_proxy.mojom" ] } public_deps = [ ":android_mojo_bindings", + ":authenticator_test_mojo_bindings", ":mojom_mhtml_load_result", - ":speech_recognition_error_code", ":web_client_hints_types_mojo_bindings", ":web_feature_mojo_bindings", "//components/payments/mojom", @@ -152,18 +174,39 @@ mojom("mojom_platform") { export_header_blink = "third_party/blink/renderer/platform/platform_export.h" } -# Kept separate from "mojom_platform" because the Java bindings are specifically -# needed by Android's implementation of payments -# (in components/payments/content/android and chrome/android/) -# and input (in android_webview/ and content/browser/android/). +# Kept separate from "mojom_platform" because the Java bindings are +# needed by Android's implementation (in chrome/android or in android_webview) +# for following mojom files. mojom("android_mojo_bindings") { sources = [ + "blob/blob.mojom", + "blob/blob_registry.mojom", + "blob/blob_url_store.mojom", + "blob/data_element.mojom", + "blob/serialized_blob.mojom", + "document_metadata/copyless_paste.mojom", + "font_unique_name_lookup/font_unique_name_lookup.mojom", "input/input_host.mojom", "input/input_messages.mojom", + "installation/installation.mojom", + "installedapp/installed_app_provider.mojom", + "installedapp/related_application.mojom", + "mediasession/media_session.mojom", "payments/payment_request.mojom", + "remote_objects/remote_objects.mojom", + "webauthn/authenticator.mojom", + "webshare/webshare.mojom", ] + if (is_android && notouch_build) { + sources += [ "media_controls/touchless/media_controls.mojom" ] + } public_deps = [ "//components/payments/mojom", + "//mojo/public/mojom/base", + "//services/media_session/public/mojom", + "//services/network/public/mojom", + "//url/mojom:url_mojom_gurl", + "//url/mojom:url_mojom_origin", ] # This Android unhandled-tap feature uses another mojo source, add it in. @@ -179,17 +222,9 @@ mojom("android_mojo_bindings") { export_class_attribute_blink = "PLATFORM_EXPORT" export_define_blink = "BLINK_PLATFORM_IMPLEMENTATION=1" export_header_blink = "third_party/blink/renderer/platform/platform_export.h" -} - -# Kept separate from "mojom_platform" because the Java bindings are needed by -# Android's implementation of speech recognition. -mojom_component("speech_recognition_error_code") { - sources = [ - "speech/speech_recognition_error_code.mojom", - ] - macro_prefix = "SPEECH_RECOGNITION_ERROR_CODE_MOJOM" - output_prefix = "speech_recognition_error_code_mojom" + # Don't scramble message IDs so they are redistributable to external tests. + scramble_message_ids = false } # This target can include mojom interfaces which do use types that are @@ -225,6 +260,7 @@ mojom("mojom_core") { ] public_deps = [ + ":android_mojo_bindings", ":mojom_platform", ":web_feature_mojo_bindings", "//components/payments/mojom", @@ -237,6 +273,7 @@ mojom("mojom_core") { ] overridden_deps_blink = [ + ":android_mojo_bindings", ":mojom_platform", "//services/network/public/mojom", ] @@ -260,20 +297,14 @@ mojom("mojom_modules") { ] public_deps = [ + ":android_mojo_bindings", ":mojom_core", - - # TODO(https://crbug.com/822804): Remove when mojom bindings deps checks - # get fixed. - ":mojom_platform", "//mojo/public/mojom/base", - "//skia/public/interfaces", - "//url/mojom:url_mojom_gurl", - "//url/mojom:url_mojom_origin", ] overridden_deps_blink = [ + ":android_mojo_bindings", ":mojom_core", - ":mojom_platform", ] component_deps_blink = [ "//third_party/blink/renderer/core" ] @@ -286,6 +317,36 @@ mojom("mojom_modules") { export_header_blink = "third_party/blink/renderer/modules/modules_export.h" } +# The mojom_broadcastchannel_bindings is separated from the rest of mojom files +# to allow blink/renderer/core to depend on this. +mojom("mojom_broadcastchannel_bindings") { + visibility = [ "//content/*" ] + visibility_blink = [ "//third_party/blink/renderer/core/*" ] + sources = [ + "broadcastchannel/broadcast_channel.mojom", + ] + public_deps = [ + ":mojom_core", + "//url/mojom:url_mojom_origin", + ] + + overridden_deps = [ ":mojom_core" ] + component_deps = [ "//third_party/blink/public/common" ] + + component_output_prefix = "blink_mojom_broadcastchannel_bindings" + + # See comment above. + export_class_attribute = "CONTENT_EXPORT" + export_define = "CONTENT_IMPLEMENTATION=1" + export_header = "content/common/content_export.h" + + # Similarly, the blink variant must be linked with the core component + # since it uses types from it in its typemaps. + export_class_attribute_blink = "CORE_EXPORT" + export_define_blink = "BLINK_CORE_IMPLEMENTATION=1" + export_header_blink = "third_party/blink/renderer/core/core_export.h" +} + mojom("mojom_mhtml_load_result") { sources = [ "loader/mhtml_load_result.mojom", @@ -316,3 +377,51 @@ mojom("web_client_hints_types_mojo_bindings") { "web_client_hints/web_client_hints_types.mojom", ] } + +# The embedded_frame_sink_mojo_bindings is separated from the rest of mojom +# files because its deps contain too many files in Chromium that would pollute +# the include paths in generated mojom-blink files for other services. +mojom("embedded_frame_sink_mojo_bindings") { + visibility = [ "//content/*" ] + visibility_blink = [ "//third_party/blink/renderer/platform" ] + sources = [ + "frame_sinks/embedded_frame_sink.mojom", + ] + deps = [ + "//services/viz/public/interfaces", + ] + + component_output_prefix = "blink_embedded_frame_sink_mojo_bindings" + + # The chromium variant must be linked with content and use the same export + # settings in component build. + export_class_attribute = "CONTENT_EXPORT" + export_define = "CONTENT_IMPLEMENTATION=1" + export_header = "content/common/content_export.h" + export_class_attribute_blink = "BLINK_PLATFORM_EXPORT" + export_define_blink = "BLINK_PLATFORM_IMPLEMENTATION=1" + export_header_blink = "third_party/blink/public/platform/web_common.h" +} + +# This is a separate target because it needs unscrambled message IDs. +mojom("authenticator_test_mojo_bindings") { + sources = [ + "webauthn/virtual_authenticator.mojom", + ] + + public_deps = [ + ":android_mojo_bindings", + "//url/mojom:url_mojom_gurl", + ] + + export_class_attribute = "BLINK_COMMON_EXPORT" + export_define = "BLINK_COMMON_IMPLEMENTATION=1" + export_header = "third_party/blink/public/common/common_export.h" + + export_class_attribute_blink = "PLATFORM_EXPORT" + export_define_blink = "BLINK_PLATFORM_IMPLEMENTATION=1" + export_header_blink = "third_party/blink/renderer/platform/platform_export.h" + + # Don't scramble message IDs so they are redistributable to external tests. + scramble_message_ids = false +} diff --git a/chromium/third_party/blink/public/mojom/appcache/appcache.mojom b/chromium/third_party/blink/public/mojom/appcache/appcache.mojom index 33c3e9eecda..d900153f479 100644 --- a/chromium/third_party/blink/public/mojom/appcache/appcache.mojom +++ b/chromium/third_party/blink/public/mojom/appcache/appcache.mojom @@ -33,9 +33,15 @@ enum AppCacheErrorReason { APPCACHE_UNKNOWN_ERROR, }; +// Per-resource information displayed in DevTools. struct AppCacheResourceInfo { url.mojom.Url url; - int64 size; + // Disk space consumed by this resource. + int64 response_size; + // Padding added when the Quota API counts this resource. + // + // Non-zero only for opaque responses. + int64 padding_size; bool is_master; bool is_manifest; bool is_intercept; diff --git a/chromium/third_party/blink/public/mojom/appcache/appcache_info.mojom b/chromium/third_party/blink/public/mojom/appcache/appcache_info.mojom index 8f17fd2dc73..bd2315229a4 100644 --- a/chromium/third_party/blink/public/mojom/appcache/appcache_info.mojom +++ b/chromium/third_party/blink/public/mojom/appcache/appcache_info.mojom @@ -21,6 +21,7 @@ enum AppCacheStatus { APPCACHE_STATUS_OBSOLETE = 5, }; +// Cache-wide information displayed in DevTools. struct AppCacheInfo { url.mojom.Url manifest_url; mojo_base.mojom.Time creation_time; @@ -29,6 +30,9 @@ struct AppCacheInfo { int64 cache_id; int64 group_id; AppCacheStatus status; - int64 size; + // Sums up the sizes of all the responses in this cache. + int64 response_sizes; + // Sums up the padding sizes for all opaque responses in the cache. + int64 padding_sizes; bool is_complete; }; diff --git a/chromium/third_party/blink/public/mojom/background_fetch/background_fetch.mojom b/chromium/third_party/blink/public/mojom/background_fetch/background_fetch.mojom index 942ef219b7f..5cefb926abb 100644 --- a/chromium/third_party/blink/public/mojom/background_fetch/background_fetch.mojom +++ b/chromium/third_party/blink/public/mojom/background_fetch/background_fetch.mojom @@ -71,14 +71,10 @@ struct BackgroundFetchOptions { // Represents the information associated with a Background Fetch registration. // Analogous to the following structure in the spec: // https://wicg.github.io/background-fetch/#background-fetch-registration -struct BackgroundFetchRegistration { +struct BackgroundFetchRegistrationData { // Corresponds to IDL 'id' attribute. Not unique - an active registration can // have the same |developer_id| as one or more inactive registrations. string developer_id; - // Globally unique ID for the registration, generated in content/. Used to - // distinguish registrations in case a developer re-uses |developer_id|s. Not - // exposed to JavaScript. - string unique_id; uint64 upload_total; uint64 uploaded; @@ -89,6 +85,12 @@ struct BackgroundFetchRegistration { BackgroundFetchFailureReason.NONE; }; +// The registration data and interface to make per registration calls. +struct BackgroundFetchRegistration { + BackgroundFetchRegistrationData registration_data; + BackgroundFetchRegistrationService registration_interface; +}; + // This contains the data we need to record UKM metrics, that isn't needed for // the background fetch itself. struct BackgroundFetchUkmData { @@ -134,23 +136,6 @@ interface BackgroundFetchService { => (BackgroundFetchError error, BackgroundFetchRegistration? registration); - // Updates the user interface for the Background Fetch registration identified - // by |service_worker_registration_id|, |developer_id|, and |unique_id|. - UpdateUI(int64 service_worker_registration_id, - string developer_id, - string unique_id, - string? title, - skia.mojom.Bitmap? icon) - => (BackgroundFetchError error); - - // Aborts the Background Fetch registration identified by |unique_id| and - // the developer's |developer_id|. Fails if the registration had already - // completed/failed/aborted. - Abort(int64 service_worker_registration_id, - string developer_id, - string unique_id) - => (BackgroundFetchError error); - // Gets the active Background Fetch registration identified by |developer_id|. GetRegistration(int64 service_worker_registration_id, string developer_id) @@ -166,21 +151,24 @@ interface BackgroundFetchService { // Gets size of the icon to display with the Background Fetch UI. GetIconDisplaySize() => (gfx.mojom.Size icon_size_pixels); +}; + +// Interface for tasks that are linked to a registration. +interface BackgroundFetchRegistrationService { + // Updates the user interface for the Background Fetch registration. + UpdateUI(string? title, + skia.mojom.Bitmap? icon) + => (BackgroundFetchError error); + + // Aborts the Background Fetch registration. + // Fails if the registration had already completed/failed/aborted. + Abort() => (BackgroundFetchError error); - // Gets matching {request, response} pairs for the completed fetches associated - // with |service_worker_registration_id|, |developer_id|, and |unique_id|. - // TODO(crbug.com/866874): Create a mojo interface for - // BackgroundFetchRegistrationId, so we can avoid having to pass the first - // three arguments in multiple methods. - MatchRequests(int64 service_worker_registration_id, - string developer_id, - string unique_id, - FetchAPIRequest? request_to_match, + // Gets matching {request, response} pairs for the completed fetches. + MatchRequests(FetchAPIRequest? request_to_match, CacheQueryOptions? cache_query_options, bool match_all) => (array<BackgroundFetchSettledFetch> fetches); - // Registers the |observer| to receive events for the given registration - // that is identified by the |unique_id|. - AddRegistrationObserver(string unique_id, - BackgroundFetchRegistrationObserver observer); + // Registers the |observer| to receive events for the given registration. + AddRegistrationObserver(BackgroundFetchRegistrationObserver observer); }; diff --git a/chromium/third_party/blink/public/platform/modules/background_sync/OWNERS b/chromium/third_party/blink/public/mojom/background_sync/OWNERS index 4340bc40037..4340bc40037 100644 --- a/chromium/third_party/blink/public/platform/modules/background_sync/OWNERS +++ b/chromium/third_party/blink/public/mojom/background_sync/OWNERS diff --git a/chromium/third_party/blink/public/platform/modules/background_sync/background_sync.mojom b/chromium/third_party/blink/public/mojom/background_sync/background_sync.mojom index 8ec2bb4cc9b..47cab2298f0 100644 --- a/chromium/third_party/blink/public/platform/modules/background_sync/background_sync.mojom +++ b/chromium/third_party/blink/public/mojom/background_sync/background_sync.mojom @@ -6,6 +6,10 @@ module blink.mojom; struct SyncRegistrationOptions { string tag = ""; + // Minimum interval guaranteed between two Periodic Background Sync events, + // in ms. This must be -1 for One-Shot Sync registrations, and must be >=0 + // for Periodic Sync registrations. + int64 min_interval = -1; }; enum BackgroundSyncError { @@ -15,7 +19,7 @@ enum BackgroundSyncError { NO_SERVICE_WORKER, NOT_ALLOWED, PERMISSION_DENIED, - MAX=PERMISSION_DENIED + MAX=PERMISSION_DENIED, }; enum BackgroundSyncState { @@ -26,13 +30,30 @@ enum BackgroundSyncState { enum BackgroundSyncEventLastChance { IS_NOT_LAST_CHANCE, - IS_LAST_CHANCE + IS_LAST_CHANCE, +}; + +enum BackgroundSyncType { + ONE_SHOT, + PERIODIC, +}; + +// Minimum information required to uniquely identify a Background Sync +// registration. +struct BackgroundSyncRegistrationInfo { + // To be kept in sync with blink.mojom.kInvalidServiceWorkerRegistrationId. + int64 service_worker_registration_id = -1; + + // The descriptive 'tag' for the sync registration. It is provided with the + // Register() method by the developer. + string tag; + BackgroundSyncType sync_type; }; interface BackgroundSyncService { Register(SyncRegistrationOptions options, int64 service_worker_registration_id) => (BackgroundSyncError err, SyncRegistrationOptions options); - DidResolveRegistration(int64 service_worker_registration_id, string tag); + DidResolveRegistration(BackgroundSyncRegistrationInfo registration_info); GetRegistrations(int64 service_worker_registration_id) => (BackgroundSyncError err, array<SyncRegistrationOptions> registrations); }; diff --git a/chromium/third_party/blink/public/platform/modules/badging/OWNERS b/chromium/third_party/blink/public/mojom/badging/OWNERS index 558d843fdf3..558d843fdf3 100644 --- a/chromium/third_party/blink/public/platform/modules/badging/OWNERS +++ b/chromium/third_party/blink/public/mojom/badging/OWNERS diff --git a/chromium/third_party/blink/public/platform/modules/badging/badging.mojom b/chromium/third_party/blink/public/mojom/badging/badging.mojom index c230f143b71..c230f143b71 100644 --- a/chromium/third_party/blink/public/platform/modules/badging/badging.mojom +++ b/chromium/third_party/blink/public/mojom/badging/badging.mojom diff --git a/chromium/third_party/blink/public/platform/modules/broadcastchannel/OWNERS b/chromium/third_party/blink/public/mojom/broadcastchannel/OWNERS index 08850f42120..08850f42120 100644 --- a/chromium/third_party/blink/public/platform/modules/broadcastchannel/OWNERS +++ b/chromium/third_party/blink/public/mojom/broadcastchannel/OWNERS diff --git a/chromium/third_party/blink/public/platform/modules/broadcastchannel/broadcast_channel.mojom b/chromium/third_party/blink/public/mojom/broadcastchannel/broadcast_channel.mojom index 740aa5000c1..740aa5000c1 100644 --- a/chromium/third_party/blink/public/platform/modules/broadcastchannel/broadcast_channel.mojom +++ b/chromium/third_party/blink/public/mojom/broadcastchannel/broadcast_channel.mojom diff --git a/chromium/third_party/blink/public/mojom/cache_storage/cache_storage.mojom b/chromium/third_party/blink/public/mojom/cache_storage/cache_storage.mojom index a9775d9e67a..5e00b504031 100644 --- a/chromium/third_party/blink/public/mojom/cache_storage/cache_storage.mojom +++ b/chromium/third_party/blink/public/mojom/cache_storage/cache_storage.mojom @@ -102,47 +102,47 @@ union CacheKeysResult { interface CacheStorageCache { // Returns the first cached response that matches |request| according to // options specified on |query_options|. - Match(blink.mojom.FetchAPIRequest request, CacheQueryOptions query_options) + Match(blink.mojom.FetchAPIRequest request, CacheQueryOptions query_options, int64 trace_id) => (MatchResult result); // Returns all cached responses that match |request| according to options // specified on |query_options|. - MatchAll(blink.mojom.FetchAPIRequest? request, CacheQueryOptions query_options) + MatchAll(blink.mojom.FetchAPIRequest? request, CacheQueryOptions query_options, int64 trace_id) => (MatchAllResult result); // Returns all keys (which are requests) of matching |request| and // |query_options|. - Keys(blink.mojom.FetchAPIRequest? request, CacheQueryOptions query_options) + Keys(blink.mojom.FetchAPIRequest? request, CacheQueryOptions query_options, int64 trace_id) => (CacheKeysResult result); // Perform a batch of operations, used for PUT and DELETE operations. - Batch(array<BatchOperation> batch_operations, bool fail_on_duplicates) + Batch(array<BatchOperation> batch_operations, int64 trace_id) => (CacheStorageVerboseError result); // Sets |side_data| if there is an entry of which key is |url| and the entry // has the same |response_time|. SetSideData(url.mojom.Url url, mojo_base.mojom.Time response_time, - array<uint8> side_data) => (CacheStorageError result); + array<uint8> side_data, int64 trace_id) => (CacheStorageError result); }; // Handles global CacheStorage methods, directly relates to methods available on // spec: https://w3c.github.io/ServiceWorker/#cachestorage-interface interface CacheStorage { // Returns kSuccess if |cache_name| exists or kErrorNotFound if not. - Has(mojo_base.mojom.String16 cache_name) => (CacheStorageError result); + Has(mojo_base.mojom.String16 cache_name, int64 trace_id) => (CacheStorageError result); // Removes a given cache. - Delete(mojo_base.mojom.String16 cache_name) => (CacheStorageError result); + Delete(mojo_base.mojom.String16 cache_name, int64 trace_id) => (CacheStorageError result); // Returns all cache names managed on this origin. - Keys() => (array<mojo_base.mojom.String16> keys); + Keys(int64 trace_id) => (array<mojo_base.mojom.String16> keys); // Returns the first cached response that matches |request| and // |match_options|. It can search on all caches if |cache_name| isn't provided // on |match_options|. - Match(blink.mojom.FetchAPIRequest request, MultiCacheQueryOptions match_options) + Match(blink.mojom.FetchAPIRequest request, MultiCacheQueryOptions match_options, int64 trace_id) => (MatchResult result); // Opens and returns a mojo interface to a cache, it creates if doesn't exist. - Open(mojo_base.mojom.String16 cache_name) => (OpenResult result); + Open(mojo_base.mojom.String16 cache_name, int64 trace_id) => (OpenResult result); }; diff --git a/chromium/third_party/blink/public/platform/modules/document_metadata/OWNERS b/chromium/third_party/blink/public/mojom/commit_result/OWNERS index 08850f42120..08850f42120 100644 --- a/chromium/third_party/blink/public/platform/modules/document_metadata/OWNERS +++ b/chromium/third_party/blink/public/mojom/commit_result/OWNERS diff --git a/chromium/third_party/blink/public/web/commit_result.mojom b/chromium/third_party/blink/public/mojom/commit_result/commit_result.mojom index d7de8637e88..d7de8637e88 100644 --- a/chromium/third_party/blink/public/web/commit_result.mojom +++ b/chromium/third_party/blink/public/mojom/commit_result/commit_result.mojom diff --git a/chromium/third_party/blink/public/platform/modules/credentialmanager/OWNERS b/chromium/third_party/blink/public/mojom/credentialmanager/OWNERS index cae285e8a07..9e26b668e4f 100644 --- a/chromium/third_party/blink/public/platform/modules/credentialmanager/OWNERS +++ b/chromium/third_party/blink/public/mojom/credentialmanager/OWNERS @@ -1,7 +1,3 @@ -engedy@chromium.org -mkwst@chromium.org -vasilii@chromium.org - per-file *.mojom=set noparent per-file *.mojom=file://ipc/SECURITY_OWNERS diff --git a/chromium/third_party/blink/public/platform/modules/credentialmanager/credential_manager.mojom b/chromium/third_party/blink/public/mojom/credentialmanager/credential_manager.mojom index 405998d1b5c..405998d1b5c 100644 --- a/chromium/third_party/blink/public/platform/modules/credentialmanager/credential_manager.mojom +++ b/chromium/third_party/blink/public/mojom/credentialmanager/credential_manager.mojom diff --git a/chromium/third_party/blink/public/mojom/devtools/console_message.mojom b/chromium/third_party/blink/public/mojom/devtools/console_message.mojom index b0b5c8bfa68..ef936e3fab6 100644 --- a/chromium/third_party/blink/public/mojom/devtools/console_message.mojom +++ b/chromium/third_party/blink/public/mojom/devtools/console_message.mojom @@ -4,11 +4,26 @@ module blink.mojom; -// TODO(leonhsl) We can remove blink::MessageLevel and -// content::ConsoleMessageLevel by using this mojom enum instead. enum ConsoleMessageLevel { kVerbose, kInfo, kWarning, kError }; + +enum ConsoleMessageSource { + kXml, + kJavaScript, + kNetwork, + kConsoleApi, + kStorage, + kAppCache, + kRendering, + kSecurity, + kOther, + kDeprecation, + kWorker, + kViolation, + kIntervention, + kRecommendation +}; diff --git a/chromium/third_party/blink/public/web/devtools_frontend.mojom b/chromium/third_party/blink/public/mojom/devtools/devtools_frontend.mojom index 46f48271967..46f48271967 100644 --- a/chromium/third_party/blink/public/web/devtools_frontend.mojom +++ b/chromium/third_party/blink/public/mojom/devtools/devtools_frontend.mojom diff --git a/chromium/third_party/blink/public/platform/modules/geolocation/OWNERS b/chromium/third_party/blink/public/mojom/document_metadata/OWNERS index 08850f42120..08850f42120 100644 --- a/chromium/third_party/blink/public/platform/modules/geolocation/OWNERS +++ b/chromium/third_party/blink/public/mojom/document_metadata/OWNERS diff --git a/chromium/third_party/blink/public/platform/modules/document_metadata/copyless_paste.mojom b/chromium/third_party/blink/public/mojom/document_metadata/copyless_paste.mojom index 89c7659c591..89c7659c591 100644 --- a/chromium/third_party/blink/public/platform/modules/document_metadata/copyless_paste.mojom +++ b/chromium/third_party/blink/public/mojom/document_metadata/copyless_paste.mojom diff --git a/chromium/third_party/blink/public/mojom/dwrite_font_proxy/dwrite_font_proxy.mojom b/chromium/third_party/blink/public/mojom/dwrite_font_proxy/dwrite_font_proxy.mojom index 172a9e5e742..3d87a6bc653 100644 --- a/chromium/third_party/blink/public/mojom/dwrite_font_proxy/dwrite_font_proxy.mojom +++ b/chromium/third_party/blink/public/mojom/dwrite_font_proxy/dwrite_font_proxy.mojom @@ -28,6 +28,11 @@ struct MapCharactersResult { DWriteFontStyle font_style; }; +enum UniqueFontLookupMode { + kRetrieveTable, + kSingleLookups +}; + interface DWriteFontProxy { // Locates the index of the specified font family within the system // collection. @@ -51,12 +56,43 @@ interface DWriteFontProxy { => (array<mojo_base.mojom.FilePath> file_paths, array<mojo_base.mojom.File> file_handles); - // Returns a protobuf structured lookup list of + // Returns which font unique name matching lookup mode is to be used on the + // current machine. On DirectWrite 10 and above, single lookups can be + // performed directly against DirectWrite API. On older DirectWrite (Windows + // 7-8.1), unique font lookups need to be performed against a shared memory + // region which contains the lookup table. Compare GetUniqueFontLookupTable() + // for lookup mode kRetrieveTable and MatchUniqueFont for + // lookup mode kSingleLookups. + [Sync] + GetUniqueFontLookupMode() => (UniqueFontLookupMode lookup_mode); + + // On supported Windows versions, matches a unique PostScript or full font + // name against the installed fonts using DirectWrite API. Returns a file path + // and ttc_index from which the unique font can be instantiated. Check which + // mode is supported using GetFontUniqueNameLookupMode(). Returns empty path + // and 0 ttc index if no font is found. Must not be called if + // GetUniqueFontLookupMode() returned kRetrieveTable. + [Sync] + MatchUniqueFont(mojo_base.mojom.String16 font_unique_name) + => (mojo_base.mojom.FilePath file_path, uint32 ttc_index); + + // Synchronously returns a protobuf structured lookup list of + // (full_font_name|postscript_name) => (font_file + ttc_index) to the + // renderer process as a ReadOnlySharedMemoryRegion if it is available + // immediately without any blocking operations. Use FontTableMatcher to + // perform searches in it. If it is not available without blocking operations, + // sync_available is false and no shared memory region is provided. + [Sync] + GetUniqueNameLookupTableIfAvailable() + => (bool sync_available, + mojo_base.mojom.ReadOnlySharedMemoryRegion? font_lookup_table); + + // Asynchronously returns a protobuf structured lookup list of // (full_font_name|postscript_name) => (font_file + ttc_index) to the // renderer process as a ReadOnlySharedMemoryRegion. The lookup list is built // on the first renderer call to retrieving this list. Use FontTableMatcher - // to perform searches in it. - [Sync] + // to perform searches in it. Retrieval may take up to several seconds if the + // table needs rebuilding on browser side. GetUniqueNameLookupTable() => (mojo_base.mojom.ReadOnlySharedMemoryRegion font_lookup_table); diff --git a/chromium/third_party/blink/public/mojom/feature_policy/feature_policy.mojom b/chromium/third_party/blink/public/mojom/feature_policy/feature_policy.mojom index 648335d0c86..acb7aab55a5 100644 --- a/chromium/third_party/blink/public/mojom/feature_policy/feature_policy.mojom +++ b/chromium/third_party/blink/public/mojom/feature_policy/feature_policy.mojom @@ -80,10 +80,6 @@ enum FeaturePolicyFeature { // Controls the layout size of intrinsically sized images and videos. When // disabled, default size (300 x 150) is used to prevent relayout. kUnsizedMedia = 21, - // Controls which image formats are allowed to be used in the document. - kLegacyImageFormats = 22, - // When disallowed, requires images to have a reasonable byte-to-pixel ratio. - kUnoptimizedImages = 23, // When disallowed, restricts source image size to be no more 2x larger than // the image's containing block. kOversizedImages = 25, @@ -95,6 +91,7 @@ enum FeaturePolicyFeature { // which interfere with document's input stream (document.write(), // document.close(), etc.). kDocumentWrite = 28, + // TODO(ekaramad): kLazyLoad is deprecated; remove. // Used to enforce lazyloading for a frame and any nested <iframe> or image. kLazyLoad = 29, // Restricts the usage of layout-causing animations in a document. @@ -122,8 +119,25 @@ enum FeaturePolicyFeature { kSerial = 42, // Controls access to WebHID. kHid = 43, + // Controls access to Idle Detection + kIdleDetection = 44, + + // When disallowed, these policies require images to have a reasonable byte-to-pixel ratio. + kUnoptimizedLossyImages = 45, + kUnoptimizedLosslessImages = 46, + kUnoptimizedLosslessImagesStrict = 47, + + // Loading policies. + kLoadingFrameDefaultEager = 48, + + // Implements sandbox flag: allow-downloads-without-user-activation. + kDownloadsWithoutUserActivation = 49, + + // When disallowed, a frame without user activation cannot acquire focus. + kFocusWithoutUserActivation = 52, // Don't change assigned numbers of any item, and don't reuse removed slots. + // Add new features at the end of the enum. // Also, run update_feature_policy_enum.py in // chromium/src/tools/metrics/histograms/ to update the UMA mapping. }; diff --git a/chromium/third_party/blink/public/platform/modules/font_unique_name_lookup/OWNERS b/chromium/third_party/blink/public/mojom/font_unique_name_lookup/OWNERS index 78efc30ac24..78efc30ac24 100644 --- a/chromium/third_party/blink/public/platform/modules/font_unique_name_lookup/OWNERS +++ b/chromium/third_party/blink/public/mojom/font_unique_name_lookup/OWNERS diff --git a/chromium/third_party/blink/public/platform/modules/font_unique_name_lookup/font_unique_name_lookup.mojom b/chromium/third_party/blink/public/mojom/font_unique_name_lookup/font_unique_name_lookup.mojom index e26d2c30a7c..e26d2c30a7c 100644 --- a/chromium/third_party/blink/public/platform/modules/font_unique_name_lookup/font_unique_name_lookup.mojom +++ b/chromium/third_party/blink/public/mojom/font_unique_name_lookup/font_unique_name_lookup.mojom diff --git a/chromium/third_party/blink/public/mojom/frame/document_interface_broker.mojom b/chromium/third_party/blink/public/mojom/frame/document_interface_broker.mojom index 658925e181f..5ce56988a74 100644 --- a/chromium/third_party/blink/public/mojom/frame/document_interface_broker.mojom +++ b/chromium/third_party/blink/public/mojom/frame/document_interface_broker.mojom @@ -4,12 +4,18 @@ module blink.mojom; +import "third_party/blink/public/mojom/credentialmanager/credential_manager.mojom"; import "third_party/blink/public/mojom/frame/frame_host_test_interface.mojom"; import "third_party/blink/public/mojom/webaudio/audio_context_manager.mojom"; +import "third_party/blink/public/mojom/webauthn/authenticator.mojom"; +import "third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom"; // An interface through which the renderer may request document-scoped // interfaces from the browser. interface DocumentInterfaceBroker { - GetFrameHostTestInterface(blink.mojom.FrameHostTestInterface& request); GetAudioContextManager(blink.mojom.AudioContextManager& request); + GetAuthenticator(blink.mojom.Authenticator& request); + GetCredentialManager(blink.mojom.CredentialManager& request); + GetFrameHostTestInterface(blink.mojom.FrameHostTestInterface& request); + GetVirtualAuthenticatorManager(blink.test.mojom.VirtualAuthenticatorManager& request); }; diff --git a/chromium/third_party/blink/public/platform/modules/frame_sinks/OWNERS b/chromium/third_party/blink/public/mojom/frame_sinks/OWNERS index 5e4aaef9535..5e4aaef9535 100644 --- a/chromium/third_party/blink/public/platform/modules/frame_sinks/OWNERS +++ b/chromium/third_party/blink/public/mojom/frame_sinks/OWNERS diff --git a/chromium/third_party/blink/public/platform/modules/frame_sinks/embedded_frame_sink.mojom b/chromium/third_party/blink/public/mojom/frame_sinks/embedded_frame_sink.mojom index ec975114857..ec975114857 100644 --- a/chromium/third_party/blink/public/platform/modules/frame_sinks/embedded_frame_sink.mojom +++ b/chromium/third_party/blink/public/mojom/frame_sinks/embedded_frame_sink.mojom diff --git a/chromium/third_party/blink/public/platform/modules/webdatabase/OWNERS b/chromium/third_party/blink/public/mojom/geolocation/OWNERS index 08850f42120..08850f42120 100644 --- a/chromium/third_party/blink/public/platform/modules/webdatabase/OWNERS +++ b/chromium/third_party/blink/public/mojom/geolocation/OWNERS diff --git a/chromium/third_party/blink/public/platform/modules/geolocation/geolocation_service.mojom b/chromium/third_party/blink/public/mojom/geolocation/geolocation_service.mojom index c42f171a775..7cb6f89a24f 100644 --- a/chromium/third_party/blink/public/platform/modules/geolocation/geolocation_service.mojom +++ b/chromium/third_party/blink/public/mojom/geolocation/geolocation_service.mojom @@ -5,14 +5,17 @@ module blink.mojom; import "services/device/public/mojom/geolocation.mojom"; +import "third_party/blink/public/mojom/permissions/permission_status.mojom"; // GeolocationService provides a Geolocation. It exists in order to examine the // environment (permissions, etc.) before creating a Geolocation. // There should only be one GeolocationService instance that creates many // Geolocation instances. There is one GeolocationService per RenderFrameHost. interface GeolocationService { - // Creates a Geolocation. + // Creates a Geolocation. Returns the status of the geolocation permission + // request (GRANTED or DENIED). // This may not be called a second time until the Geolocation instance has // been created. - CreateGeolocation(device.mojom.Geolocation& request, bool user_gesture); + CreateGeolocation(device.mojom.Geolocation& request, bool user_gesture) + => (PermissionStatus status); }; diff --git a/chromium/third_party/blink/public/platform/modules/hyphenation/OWNERS b/chromium/third_party/blink/public/mojom/hyphenation/OWNERS index aa20b656c0c..aa20b656c0c 100644 --- a/chromium/third_party/blink/public/platform/modules/hyphenation/OWNERS +++ b/chromium/third_party/blink/public/mojom/hyphenation/OWNERS diff --git a/chromium/third_party/blink/public/platform/modules/hyphenation/hyphenation.mojom b/chromium/third_party/blink/public/mojom/hyphenation/hyphenation.mojom index 2b072d2709e..2b072d2709e 100644 --- a/chromium/third_party/blink/public/platform/modules/hyphenation/hyphenation.mojom +++ b/chromium/third_party/blink/public/mojom/hyphenation/hyphenation.mojom diff --git a/chromium/third_party/blink/public/platform/modules/idle/OWNERS b/chromium/third_party/blink/public/mojom/idle/OWNERS index b0db2625573..b0db2625573 100644 --- a/chromium/third_party/blink/public/platform/modules/idle/OWNERS +++ b/chromium/third_party/blink/public/mojom/idle/OWNERS diff --git a/chromium/third_party/blink/public/platform/modules/idle/idle_manager.mojom b/chromium/third_party/blink/public/mojom/idle/idle_manager.mojom index 09118ab006e..09118ab006e 100644 --- a/chromium/third_party/blink/public/platform/modules/idle/idle_manager.mojom +++ b/chromium/third_party/blink/public/mojom/idle/idle_manager.mojom diff --git a/chromium/third_party/blink/public/mojom/indexeddb/indexeddb.mojom b/chromium/third_party/blink/public/mojom/indexeddb/indexeddb.mojom index d1d2317a1e0..e6996e775ab 100644 --- a/chromium/third_party/blink/public/mojom/indexeddb/indexeddb.mojom +++ b/chromium/third_party/blink/public/mojom/indexeddb/indexeddb.mojom @@ -235,14 +235,6 @@ interface IDBCallbacks { // Database::Get / Cursor::Advance SuccessValue(IDBReturnValue? value); - // Cursor::Continue / Advance - SuccessCursorContinue(IDBKey key, IDBKey primary_key, IDBValue? value); - - // Cursor::Prefetch - SuccessCursorPrefetch(array<IDBKey> keys, - array<IDBKey> primary_keys, - array<IDBValue> values); - // Database::GetAll SuccessArray(array<IDBReturnValue> values); @@ -275,43 +267,47 @@ struct IDBError { }; struct IDBCursorValue { - IDBKey key; - IDBKey primary_key; - IDBValue value; + array<IDBKey> keys; + array<IDBKey> primary_keys; + array<IDBValue> values; }; +// Advance(), CursorContinue(), and Prefetch() can call its return callback in +// one of 3 ways: +// * with |error| set and |value| unset, if an error occurs +// * with |error| unset and |value| set, under normal operation +// * with |error| unset and |value| unset, under normal operation when the end +// of the source being iterated is reached interface IDBCursor { - // Advance() can call its return callback in one of 3 ways: - // * with |error| set and |value| unset, if an error occurs - // * with |error| unset and |value| set, under normal operation - // * with |error| unset and |value| unset, under normal operation when the end - // of the source being iterated is reached Advance(uint32 count) => (IDBError? error, IDBCursorValue? value); - - // CursorContinue() can call its return callback in one of 3 ways: - // * with |error| set and |value| unset, if an error occurs - // * with |error| unset and |value| set, under normal operation - // * with |error| unset and |value| unset, under normal operation when the end - // of the source being iterated is reached CursorContinue(IDBKey key, IDBKey primary_key) => (IDBError? error, IDBCursorValue? value); - - Prefetch(int32 count, associated IDBCallbacks callbacks); + Prefetch(int32 count) + => (IDBError? error, IDBCursorValue? value); PrefetchReset(int32 used_prefetches, int32 unused_prefetches); }; -interface IDBDatabase { - CreateObjectStore(int64 transaction_id, - int64 object_store_id, +interface IDBTransaction { + CreateObjectStore(int64 object_store_id, mojo_base.mojom.String16 name, IDBKeyPath key_path, bool auto_increment); - DeleteObjectStore(int64 transaction_id, - int64 object_store_id); + DeleteObjectStore(int64 object_store_id); + Put(int64 object_store_id, + IDBValue value, + IDBKey key, + IDBPutMode mode, + array<IDBIndexKeys> index_keys, + associated IDBCallbacks callbacks); + Commit(int64 num_errors_handled); +}; + +interface IDBDatabase { RenameObjectStore(int64 transaction_id, int64 object_store_id, mojo_base.mojom.String16 new_name); - CreateTransaction(int64 transaction_id, + CreateTransaction(associated IDBTransaction& transaction_request, + int64 transaction_id, array<int64> object_store_ids, IDBTransactionMode mode); Close(); @@ -336,13 +332,6 @@ interface IDBDatabase { bool key_only, int64 max_count, associated IDBCallbacks callbacks); - Put(int64 transaction_id, - int64 object_store_id, - IDBValue value, - IDBKey key, - IDBPutMode mode, - array<IDBIndexKeys> index_keys, - associated IDBCallbacks callbacks); SetIndexKeys(int64 transaction_id, int64 object_store_id, IDBKey primary_key, @@ -391,8 +380,6 @@ interface IDBDatabase { int64 index_id, mojo_base.mojom.String16 new_name); Abort(int64 transaction_id); - Commit(int64 transaction_id, - int64 num_errors_handled); }; interface IDBFactory { @@ -402,6 +389,7 @@ interface IDBFactory { associated IDBDatabaseCallbacks database_callbacks, mojo_base.mojom.String16 name, int64 version, + associated IDBTransaction& version_change_transaction_request, int64 transaction_id); DeleteDatabase(associated IDBCallbacks callbacks, mojo_base.mojom.String16 name, bool force_close); diff --git a/chromium/third_party/blink/public/platform/modules/insecure_input/OWNERS b/chromium/third_party/blink/public/mojom/insecure_input/OWNERS index 61b5e28552a..61b5e28552a 100644 --- a/chromium/third_party/blink/public/platform/modules/insecure_input/OWNERS +++ b/chromium/third_party/blink/public/mojom/insecure_input/OWNERS diff --git a/chromium/third_party/blink/public/platform/modules/insecure_input/insecure_input_service.mojom b/chromium/third_party/blink/public/mojom/insecure_input/insecure_input_service.mojom index 3ee3591c643..3ee3591c643 100644 --- a/chromium/third_party/blink/public/platform/modules/insecure_input/insecure_input_service.mojom +++ b/chromium/third_party/blink/public/mojom/insecure_input/insecure_input_service.mojom diff --git a/chromium/third_party/blink/public/platform/modules/installation/OWNERS b/chromium/third_party/blink/public/mojom/installation/OWNERS index 5e4aaef9535..5e4aaef9535 100644 --- a/chromium/third_party/blink/public/platform/modules/installation/OWNERS +++ b/chromium/third_party/blink/public/mojom/installation/OWNERS diff --git a/chromium/third_party/blink/public/platform/modules/installation/installation.mojom b/chromium/third_party/blink/public/mojom/installation/installation.mojom index f8ee170a2f3..f8ee170a2f3 100644 --- a/chromium/third_party/blink/public/platform/modules/installation/installation.mojom +++ b/chromium/third_party/blink/public/mojom/installation/installation.mojom diff --git a/chromium/third_party/blink/public/mojom/installedapp/OWNERS b/chromium/third_party/blink/public/mojom/installedapp/OWNERS new file mode 100644 index 00000000000..6137d699f9e --- /dev/null +++ b/chromium/third_party/blink/public/mojom/installedapp/OWNERS @@ -0,0 +1,6 @@ +mgiuca@chromium.org + +per-file *.mojom=set noparent +per-file *.mojom=file://ipc/SECURITY_OWNERS + +# COMPONENT: Platform>Apps>AppLauncher>Install diff --git a/chromium/third_party/blink/public/platform/modules/installedapp/installed_app_provider.mojom b/chromium/third_party/blink/public/mojom/installedapp/installed_app_provider.mojom index 300aa59e446..2bcfc0d46ac 100644 --- a/chromium/third_party/blink/public/platform/modules/installedapp/installed_app_provider.mojom +++ b/chromium/third_party/blink/public/mojom/installedapp/installed_app_provider.mojom @@ -5,7 +5,7 @@ [JavaPackage="org.chromium.installedapp.mojom"] module blink.mojom; -import "third_party/blink/public/platform/modules/installedapp/related_application.mojom"; +import "third_party/blink/public/mojom/installedapp/related_application.mojom"; // Mojo service for the getInstalledRelatedApps implementation. interface InstalledAppProvider { diff --git a/chromium/third_party/blink/public/platform/modules/installedapp/related_application.mojom b/chromium/third_party/blink/public/mojom/installedapp/related_application.mojom index be3d390356f..be3d390356f 100644 --- a/chromium/third_party/blink/public/platform/modules/installedapp/related_application.mojom +++ b/chromium/third_party/blink/public/mojom/installedapp/related_application.mojom diff --git a/chromium/third_party/blink/public/platform/modules/keyboard_lock/OWNERS b/chromium/third_party/blink/public/mojom/keyboard_lock/OWNERS index fc86537f9c9..fc86537f9c9 100644 --- a/chromium/third_party/blink/public/platform/modules/keyboard_lock/OWNERS +++ b/chromium/third_party/blink/public/mojom/keyboard_lock/OWNERS diff --git a/chromium/third_party/blink/public/platform/modules/keyboard_lock/keyboard_lock.mojom b/chromium/third_party/blink/public/mojom/keyboard_lock/keyboard_lock.mojom index 826d8f9342f..826d8f9342f 100644 --- a/chromium/third_party/blink/public/platform/modules/keyboard_lock/keyboard_lock.mojom +++ b/chromium/third_party/blink/public/mojom/keyboard_lock/keyboard_lock.mojom diff --git a/chromium/third_party/blink/public/platform/modules/locks/OWNERS b/chromium/third_party/blink/public/mojom/locks/OWNERS index 8b207f17c0a..8b207f17c0a 100644 --- a/chromium/third_party/blink/public/platform/modules/locks/OWNERS +++ b/chromium/third_party/blink/public/mojom/locks/OWNERS diff --git a/chromium/third_party/blink/public/platform/modules/locks/lock_manager.mojom b/chromium/third_party/blink/public/mojom/locks/lock_manager.mojom index 800009a9aa3..800009a9aa3 100644 --- a/chromium/third_party/blink/public/platform/modules/locks/lock_manager.mojom +++ b/chromium/third_party/blink/public/mojom/locks/lock_manager.mojom diff --git a/chromium/third_party/blink/public/mojom/media_controls/touchless/OWNERS b/chromium/third_party/blink/public/mojom/media_controls/touchless/OWNERS new file mode 100644 index 00000000000..a15fabe68d4 --- /dev/null +++ b/chromium/third_party/blink/public/mojom/media_controls/touchless/OWNERS @@ -0,0 +1,5 @@ +mlamouri@chromium.org +steimel@chromium.org + +per-file *.mojom=set noparent +per-file *.mojom=file://ipc/SECURITY_OWNERS diff --git a/chromium/third_party/blink/public/mojom/media_controls/touchless/media_controls.mojom b/chromium/third_party/blink/public/mojom/media_controls/touchless/media_controls.mojom new file mode 100644 index 00000000000..b2442144dfe --- /dev/null +++ b/chromium/third_party/blink/public/mojom/media_controls/touchless/media_controls.mojom @@ -0,0 +1,46 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[JavaPackage="org.chromium.mediacontrols.touchless.mojom"] +module blink.mojom; + +// Represents a Text Track to be shown in the CAPTIONS sub-menu. +struct TextTrackMetadata { + int32 track_index; + string label; +}; + +// Represents the current state of the Video showing controls. +struct VideoState { + bool is_muted; + bool is_fullscreen; +}; + +// The types of menu items that can be shown. +enum MenuItem { + FULLSCREEN, + CAPTIONS, + MUTE, + DOWNLOAD +}; + +// Represents the response from the browser for a menu item click. +struct MenuResponse { + // |clicked| returns the menu item clicked on, CANCEL if the menu was closed + // without an item being clicked. |track_index| is only used when |clicked| + // is CAPTIONS. + MenuItem clicked; + int32 track_index; +}; + +// Mojo service for the browser-drawn media controls. +interface MediaControlsMenuHost { + // Shows the media controls menu with the items specified in |menu_items|. + // |text_tracks| is only used if the CAPTIONS menu item is present. + // |response| will be null if the menu was canceled. + ShowMediaMenu(array<MenuItem> menu_items, VideoState video_state, + array<TextTrackMetadata>? text_tracks) + => (MenuResponse? response); +}; + diff --git a/chromium/third_party/blink/public/platform/modules/mediasession/OWNERS b/chromium/third_party/blink/public/mojom/mediasession/OWNERS index 483e1623dac..483e1623dac 100644 --- a/chromium/third_party/blink/public/platform/modules/mediasession/OWNERS +++ b/chromium/third_party/blink/public/mojom/mediasession/OWNERS diff --git a/chromium/third_party/blink/public/platform/modules/mediasession/media_session.mojom b/chromium/third_party/blink/public/mojom/mediasession/media_session.mojom index cf432444482..cf432444482 100644 --- a/chromium/third_party/blink/public/platform/modules/mediasession/media_session.mojom +++ b/chromium/third_party/blink/public/mojom/mediasession/media_session.mojom diff --git a/chromium/third_party/blink/public/mojom/mediastream/OWNERS b/chromium/third_party/blink/public/mojom/mediastream/OWNERS index ff62c9c4e26..1ec01e1a289 100644 --- a/chromium/third_party/blink/public/mojom/mediastream/OWNERS +++ b/chromium/third_party/blink/public/mojom/mediastream/OWNERS @@ -4,5 +4,5 @@ hbos@chromium.org per-file *.mojom=set noparent per-file *.mojom=file://ipc/SECURITY_OWNERS -# TEAM: media-capture-and-streams@grotations.appspotmail.com +# TEAM: webrtc-dev@chromium.org # COMPONENT: Blink>GetUserMedia diff --git a/chromium/third_party/blink/public/mojom/mediastream/media_devices.mojom b/chromium/third_party/blink/public/mojom/mediastream/media_devices.mojom index 85e82ebbec0..05030e8ad85 100644 --- a/chromium/third_party/blink/public/mojom/mediastream/media_devices.mojom +++ b/chromium/third_party/blink/public/mojom/mediastream/media_devices.mojom @@ -6,6 +6,7 @@ module blink.mojom; import "media/capture/mojom/video_capture_types.mojom"; import "media/mojo/interfaces/audio_parameters.mojom"; +import "mojo/public/mojom/base/time.mojom"; enum MediaDeviceType { MEDIA_AUDIO_INPUT, @@ -37,6 +38,13 @@ struct AudioInputDeviceCapabilities { string device_id; string group_id; media.mojom.AudioParameters parameters; + // Values copied from the device parameters (Blink-use only). + // TODO(crbug.com/787252): remove the copies below in favour of |parameters| + // when it becomes visible in Blink. + bool is_valid; + int32 channels; + int32 sample_rate; + mojo_base.mojom.TimeDelta latency; }; // This object lives in the browser and is responsible for processing device @@ -44,19 +52,23 @@ struct AudioInputDeviceCapabilities { // notifications. interface MediaDevicesDispatcherHost { // Enumerates media devices and capabilities. The reply contains the - // |enumeration| and |video_input_device_capabilities| arrays. The - // |enumeration| array always has NUM_MEDIA_DEVICE_TYPES elements indexed by - // device type as defined in MediaDeviceType. Each element of |enumeration| is - // an array with as many elements as devices of the corresponding type exist - // in the system, or zero if the device types was not requested. Similarly, - // the number of elements in |video_input_device_capabilities| is equal to the - // number of video input devices in the system, or zero if not requested. + // |enumeration|, |video_input_device_capabilities|, and + // |audio_input_device_capabilities| arrays. The |enumeration| array always + // has NUM_MEDIA_DEVICE_TYPES elements indexed by device type as defined in + // MediaDeviceType. Each element of |enumeration| is an array with as many + // elements as devices of the corresponding type exist in the system, or zero + // if the device types was not requested. Similarly, the number of elements in + // |audio_input_device_capabilities| and |video_input_device_capabilities| is + // equal to respectively the number of video and audio input devices in the + // system, or zero if not requested. EnumerateDevices(bool request_audio_input, bool request_video_input, bool request_audio_output, - bool request_video_input_capabilities) + bool request_video_input_capabilities, + bool request_audio_input_capabilities) => (array<array<MediaDeviceInfo>> enumeration, - array<VideoInputDeviceCapabilities> video_input_device_capabilities); + array<VideoInputDeviceCapabilities> video_input_device_capabilities, + array<AudioInputDeviceCapabilities> audio_input_device_capabilities); // Returns a list of video devices and their capabilities. // If there is a user-preferred device, it is the first in the result. diff --git a/chromium/third_party/blink/public/mojom/mediastream/media_stream.mojom b/chromium/third_party/blink/public/mojom/mediastream/media_stream.mojom index 8e6175112e1..c4356b1c525 100644 --- a/chromium/third_party/blink/public/mojom/mediastream/media_stream.mojom +++ b/chromium/third_party/blink/public/mojom/mediastream/media_stream.mojom @@ -52,7 +52,6 @@ struct MediaStreamDevice { string name; media.mojom.AudioParameters input; int32 session_id; - media.mojom.VideoCaptureDeviceDescriptorCameraCalibration? camera_calibration; media.mojom.DisplayMediaInformation? display_media_info; }; diff --git a/chromium/third_party/blink/public/mojom/messaging/transferable_message.mojom b/chromium/third_party/blink/public/mojom/messaging/transferable_message.mojom index e382d4e6d05..5cd699fb569 100644 --- a/chromium/third_party/blink/public/mojom/messaging/transferable_message.mojom +++ b/chromium/third_party/blink/public/mojom/messaging/transferable_message.mojom @@ -35,4 +35,7 @@ struct TransferableMessage { bool has_user_gesture; // The user activation state, null if the frame isn't providing it. UserActivationSnapshot? user_activation; + // Whether the state of user activation should be transferred to the + // destination frame. + bool transfer_user_activation; }; diff --git a/chromium/third_party/blink/public/platform/modules/notifications/notification_service.mojom b/chromium/third_party/blink/public/mojom/notifications/notification_service.mojom index 082cb0e0a37..c4714791a7a 100644 --- a/chromium/third_party/blink/public/platform/modules/notifications/notification_service.mojom +++ b/chromium/third_party/blink/public/mojom/notifications/notification_service.mojom @@ -5,7 +5,7 @@ module blink.mojom; import "third_party/blink/public/mojom/notifications/notification.mojom"; -import "third_party/blink/public/platform/modules/permissions/permission_status.mojom"; +import "third_party/blink/public/mojom/permissions/permission_status.mojom"; // Interface for receiving events relating to non-persistent notifications. interface NonPersistentNotificationListener { diff --git a/chromium/third_party/blink/public/mojom/page/spatial_navigation.mojom b/chromium/third_party/blink/public/mojom/page/spatial_navigation.mojom new file mode 100644 index 00000000000..51538fcc766 --- /dev/null +++ b/chromium/third_party/blink/public/mojom/page/spatial_navigation.mojom @@ -0,0 +1,26 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[JavaPackage="org.chromium.page.mojom"] +module blink.mojom; + +// Represents the current state of Spatial Navigation. +struct SpatialNavigationState { + // True if Spatial Navigation's currently focused target can be unfocused. + bool can_exit_focus; + // True if Spatial Navigation has a target that can be selected. + bool can_select_element; + // True if the currently focused element is a form element, and there is a + // next form element available to move to. + bool has_next_form_element; + // True if the video element has default controls and the element is focused. + bool has_default_video_controls; +}; + +// Mojo service for browser exposing Spatial Navigation state to the browser. +interface SpatialNavigationHost { + // Called when the Spatial Navigation state has changed. Null if Spatial + // Navigation has been disabled. + SpatialNavigationStateChanged(SpatialNavigationState? state); +}; diff --git a/chromium/third_party/blink/public/mojom/payments/payment_request.mojom b/chromium/third_party/blink/public/mojom/payments/payment_request.mojom index 2bb404f5199..367f95305e7 100644 --- a/chromium/third_party/blink/public/mojom/payments/payment_request.mojom +++ b/chromium/third_party/blink/public/mojom/payments/payment_request.mojom @@ -60,7 +60,10 @@ enum HasEnrolledInstrumentQueryResult { WARNING_HAS_NO_ENROLLED_INSTRUMENT, }; +// Implemented in the renderer process. Sandboxed. Deals with untrusted data. +// components/payments/content/payment_request.h interface PaymentRequestClient { + OnPaymentMethodChange(string method_name, string stringified_details); OnShippingAddressChange(PaymentAddress address); OnShippingOptionChange(string shipping_option_id); OnPayerDetailChange(PayerDetail detail); @@ -166,10 +169,14 @@ struct PaymentDetailsModifier { struct PaymentDetails { PaymentItem? total; - array<PaymentItem> display_items; - // Shipping options can be null if updateWith() is called w/o shippingOptions + + // If any of these lists is null, then PaymentRequest.UpdateWith() ignores + // them. If any of these lists are empty, then PaymentRequest.UpdateWith() + // clears the corresponding lists in the browser. + array<PaymentItem>? display_items; array<PaymentShippingOption>? shipping_options; - array<PaymentDetailsModifier> modifiers; + array<PaymentDetailsModifier>? modifiers; + string error = ""; AddressErrors? shipping_address_errors; // Identifier identifying the payment request, to be exposed @@ -199,6 +206,12 @@ enum PaymentComplete { UNKNOWN }; + +// Implemented in the browser process. Not sandboxed. Deals with trusted data. +// Android implementation: +// chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java +// Desktop (Windows, ChromeOS, Linux, MacOS) implementation: +// components/payments/content/payment_request.h interface PaymentRequest { // Instantiates the renderer-browser connection with the information from the // JavaScript constructor of PaymentRequest. @@ -208,7 +221,7 @@ interface PaymentRequest { PaymentOptions options); // Shows the user interface with the payment details. - Show(bool is_user_gesture); + Show(bool is_user_gesture, bool wait_for_updated_details); // Updates the payment details in response to new shipping address or shipping // option. diff --git a/chromium/third_party/blink/public/platform/modules/permissions/OWNERS b/chromium/third_party/blink/public/mojom/permissions/OWNERS index ff69b875b2c..ff69b875b2c 100644 --- a/chromium/third_party/blink/public/platform/modules/permissions/OWNERS +++ b/chromium/third_party/blink/public/mojom/permissions/OWNERS diff --git a/chromium/third_party/blink/public/platform/modules/permissions/permission.mojom b/chromium/third_party/blink/public/mojom/permissions/permission.mojom index 0476935916f..b46e7f9224e 100644 --- a/chromium/third_party/blink/public/platform/modules/permissions/permission.mojom +++ b/chromium/third_party/blink/public/mojom/permissions/permission.mojom @@ -4,7 +4,7 @@ module blink.mojom; -import "third_party/blink/public/platform/modules/permissions/permission_status.mojom"; +import "third_party/blink/public/mojom/permissions/permission_status.mojom"; enum PermissionName { GEOLOCATION, diff --git a/chromium/third_party/blink/public/platform/modules/permissions/permission_status.mojom b/chromium/third_party/blink/public/mojom/permissions/permission_status.mojom index cbc0ffbfc32..cbc0ffbfc32 100644 --- a/chromium/third_party/blink/public/platform/modules/permissions/permission_status.mojom +++ b/chromium/third_party/blink/public/mojom/permissions/permission_status.mojom diff --git a/chromium/third_party/blink/public/mojom/plugins/plugin_registry.mojom b/chromium/third_party/blink/public/mojom/plugins/plugin_registry.mojom index 92e9cb86520..0cc3d5b6c9d 100644 --- a/chromium/third_party/blink/public/mojom/plugins/plugin_registry.mojom +++ b/chromium/third_party/blink/public/mojom/plugins/plugin_registry.mojom @@ -20,6 +20,9 @@ struct PluginInfo { mojo_base.mojom.FilePath filename; uint32 background_color; array<PluginMimeType> mime_types; + // When true, the current plugin maybe implemented using a MimeHandlerView + // extension. + bool may_use_mime_handler_view; }; interface PluginRegistry { diff --git a/chromium/third_party/blink/public/mojom/portal/portal.mojom b/chromium/third_party/blink/public/mojom/portal/portal.mojom index 3902465ab56..4819ef2dcf2 100644 --- a/chromium/third_party/blink/public/mojom/portal/portal.mojom +++ b/chromium/third_party/blink/public/mojom/portal/portal.mojom @@ -5,7 +5,9 @@ module blink.mojom; import "mojo/public/mojom/base/unguessable_token.mojom"; +import "third_party/blink/public/mojom/messaging/transferable_message.mojom"; import "url/mojom/url.mojom"; +import "url/mojom/origin.mojom"; // The Portal interface is used by the renderer to interact with the Portal. interface Portal { @@ -13,5 +15,9 @@ interface Portal { Navigate(url.mojom.Url url); // When a portal is activated, it'll replace the current tab with the portal. - Activate() => (); + Activate(TransferableMessage data) => (bool was_adopted); + + // Sends message to the browser process, where it can be forwarded to the + // portal's main frame. + PostMessage(TransferableMessage message, url.mojom.Origin? target_origin); }; diff --git a/chromium/third_party/blink/public/mojom/remote_objects/OWNERS b/chromium/third_party/blink/public/mojom/remote_objects/OWNERS new file mode 100644 index 00000000000..08850f42120 --- /dev/null +++ b/chromium/third_party/blink/public/mojom/remote_objects/OWNERS @@ -0,0 +1,2 @@ +per-file *.mojom=set noparent +per-file *.mojom=file://ipc/SECURITY_OWNERS diff --git a/chromium/third_party/blink/public/web/remote_objects.mojom b/chromium/third_party/blink/public/mojom/remote_objects/remote_objects.mojom index af42bfaef42..af42bfaef42 100644 --- a/chromium/third_party/blink/public/web/remote_objects.mojom +++ b/chromium/third_party/blink/public/mojom/remote_objects/remote_objects.mojom diff --git a/chromium/third_party/blink/public/mojom/renderer_preferences.mojom b/chromium/third_party/blink/public/mojom/renderer_preferences.mojom index e15295cfcf5..8fcd4502062 100644 --- a/chromium/third_party/blink/public/mojom/renderer_preferences.mojom +++ b/chromium/third_party/blink/public/mojom/renderer_preferences.mojom @@ -40,11 +40,8 @@ struct RendererPreferences { // positions for glyphs. Currently only used by Linux. bool use_subpixel_positioning = false; + // The color of the focus ring. Currently only used on Linux. uint32 focus_ring_color = 0xFFE59700; - [EnableIf=is_android] - float minimum_stroke_width_for_focus_ring = 1.0; - [EnableIf=is_android] - bool is_focus_ring_outset = false; // The colors used in selection text. Currently only used on Linux and Ash. uint32 active_selection_bg_color = 0xFF1E90FF; diff --git a/chromium/third_party/blink/public/mojom/selection_menu/OWNERS b/chromium/third_party/blink/public/mojom/selection_menu/OWNERS new file mode 100644 index 00000000000..08850f42120 --- /dev/null +++ b/chromium/third_party/blink/public/mojom/selection_menu/OWNERS @@ -0,0 +1,2 @@ +per-file *.mojom=set noparent +per-file *.mojom=file://ipc/SECURITY_OWNERS diff --git a/chromium/third_party/blink/public/web/selection_menu_behavior.mojom b/chromium/third_party/blink/public/mojom/selection_menu/selection_menu_behavior.mojom index 4d794df6ab5..4d794df6ab5 100644 --- a/chromium/third_party/blink/public/web/selection_menu_behavior.mojom +++ b/chromium/third_party/blink/public/mojom/selection_menu/selection_menu_behavior.mojom diff --git a/chromium/third_party/blink/public/mojom/serial/serial.mojom b/chromium/third_party/blink/public/mojom/serial/serial.mojom index ee8d9ceade8..34533152fa4 100644 --- a/chromium/third_party/blink/public/mojom/serial/serial.mojom +++ b/chromium/third_party/blink/public/mojom/serial/serial.mojom @@ -5,6 +5,7 @@ module blink.mojom; import "mojo/public/mojom/base/unguessable_token.mojom"; +import "services/device/public/mojom/serial.mojom"; struct SerialPortInfo { // Opaque identifier for this port. @@ -31,4 +32,9 @@ interface SerialService { // Requests permission to access a port. RequestPort(array<SerialPortFilter> filters) => (SerialPortInfo? port); + + // Connects an instance of the SerialPort interface attached to the serial + // port identified by |token|. + GetPort(mojo_base.mojom.UnguessableToken token, + device.mojom.SerialPort& port_request); }; diff --git a/chromium/third_party/blink/public/mojom/service_worker/controller_service_worker.mojom b/chromium/third_party/blink/public/mojom/service_worker/controller_service_worker.mojom index 97f7d703ef7..90c777c5491 100644 --- a/chromium/third_party/blink/public/mojom/service_worker/controller_service_worker.mojom +++ b/chromium/third_party/blink/public/mojom/service_worker/controller_service_worker.mojom @@ -7,12 +7,13 @@ module blink.mojom; import "mojo/public/mojom/base/time.mojom"; import "mojo/public/mojom/base/unguessable_token.mojom"; import "services/network/public/mojom/url_loader.mojom"; +import "third_party/blink/public/mojom/service_worker/controller_service_worker_mode.mojom"; import "third_party/blink/public/mojom/service_worker/dispatch_fetch_event_params.mojom"; import "third_party/blink/public/mojom/service_worker/service_worker_event_status.mojom"; import "third_party/blink/public/mojom/service_worker/service_worker_fetch_response_callback.mojom"; import "third_party/blink/public/mojom/service_worker/service_worker_object.mojom"; +import "third_party/blink/public/mojom/web_feature/web_feature.mojom"; -// S13nServiceWorker: // Represents a service worker that is a 'controller'. // (https://w3c.github.io/ServiceWorker/#navigator-service-worker-controller) // One of its Mojo end points (i.e. the caller end) is passed to the @@ -56,11 +57,9 @@ struct ControllerServiceWorkerInfo { blink.mojom.ControllerServiceWorkerMode mode = blink.mojom.ControllerServiceWorkerMode.kNoController; - // S13nServiceWorker only: // Non-null iff there is a controller and it has a fetch event handler. ControllerServiceWorker? endpoint; - // S13nServiceWorker: // The client being controlled, used for FetchEvent#clientId. The ID is // issued by the browser process for this receiving client, and would // never change thoughout the lifetime of the client. @@ -76,6 +75,9 @@ struct ControllerServiceWorkerInfo { // Represents ServiceWorkerContainer#controller. // Null if there is no controller. blink.mojom.ServiceWorkerObjectInfo? object_info; + + // The set of features the controller has used, for UseCounter purposes. + array<WebFeature> used_features; }; // A renderer-side interface for talking across threads. The main thread diff --git a/chromium/third_party/blink/public/mojom/service_worker/controller_service_worker_mode.mojom b/chromium/third_party/blink/public/mojom/service_worker/controller_service_worker_mode.mojom new file mode 100644 index 00000000000..756800ba18a --- /dev/null +++ b/chromium/third_party/blink/public/mojom/service_worker/controller_service_worker_mode.mojom @@ -0,0 +1,16 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module blink.mojom; + +// Describes whether a controller service worker exists and if it has a fetch +// handler. +enum ControllerServiceWorkerMode { + // No controller exists. + kNoController, + // The controller exists, but it has no fetch event handler. + kNoFetchEventHandler, + // The controller exists and it has a fetch event handler. + kControlled +}; diff --git a/chromium/third_party/blink/public/mojom/service_worker/embedded_worker.mojom b/chromium/third_party/blink/public/mojom/service_worker/embedded_worker.mojom index 1974d75964c..ac10ca22191 100644 --- a/chromium/third_party/blink/public/mojom/service_worker/embedded_worker.mojom +++ b/chromium/third_party/blink/public/mojom/service_worker/embedded_worker.mojom @@ -7,6 +7,7 @@ module blink.mojom; import "mojo/public/mojom/base/string16.mojom"; import "mojo/public/mojom/base/time.mojom"; import "mojo/public/mojom/base/unguessable_token.mojom"; +import "services/network/public/mojom/url_loader_factory.mojom"; import "third_party/blink/public/mojom/devtools/console_message.mojom"; import "third_party/blink/public/mojom/devtools/devtools_agent.mojom"; import "third_party/blink/public/mojom/loader/url_loader_factory_bundle.mojom"; @@ -30,53 +31,71 @@ struct EmbeddedWorkerStartParams { // The id of the service worker being started. This remains fixed even if the // worker is stopped and restarted, or even if the browser restarts. int64 service_worker_version_id; + // This service worker's registration's scope: // https://w3c.github.io/ServiceWorker/#service-worker-registration-scope url.mojom.Url scope; + // This service worker's script url: // https://w3c.github.io/ServiceWorker/#dom-serviceworker-scripturl url.mojom.Url script_url; + // This service worker's script type: // https://w3c.github.io/ServiceWorker/#dfn-type ScriptType script_type; + // The string used for "user-agent" HTTP header. string user_agent; + // The id to talk with the DevTools agent for the worker. int32 worker_devtools_agent_route_id; + // Unique token identifying this worker for DevTools. mojo_base.mojom.UnguessableToken devtools_worker_token; + // When true, worker script evaluation is blocked until // EmbeddedWorkerInstanceClient::ResumeAfterDownload() is called. // This isn't used when off-the-main-thread script fetch is enabled. The // browser process is responsible for delaying execution. bool pause_after_download; + // True if starting the worker should wait until DevTools gets ready. bool wait_for_debugger; + // True if this service worker has been installed. bool is_installed; + // Determines how eagerly V8 creates the code cache. V8CacheOptions v8_cache_options; + // Used to set up fetch requests. RendererPreferences renderer_preferences; // Used to talk to the service worker from the browser process. ServiceWorker& service_worker_request; - // S13nServiceWorker: cloned and passed to each controllee to directly - // dispatch events from the controllees. + + // Cloned and passed to each controllee to directly dispatch events from the + // controllees. ControllerServiceWorker& controller_request; + // Information to transfer installed scripts from the browser to the renderer. ServiceWorkerInstalledScriptsInfo? installed_scripts_info; + // Interface for the renderer to send the status updates to the browser. associated EmbeddedWorkerInstanceHost instance_host; + // Information for creating ServiceWorkerProviderContext on the renderer. ServiceWorkerProviderInfoForStartWorker provider_info; + // Interface for the renderer to query the content settings in the browser. WorkerContentSettingsProxy content_settings_proxy; + // Interface for keeping track of the renderer preferences. RendererPreferenceWatcher& preference_watcher_request; - // S13nServiceWorker: Used to load subresources in the service worker. - // This allows the service worker to load chrome-extension:// URLs which - // the renderer's default loader factory can't load. + + // Used to load subresources in the service worker. This allows the service + // worker to load chrome-extension:// URLs which the renderer's default + // loader factory can't load. URLLoaderFactoryBundle? subresource_loader_factories; }; @@ -113,6 +132,12 @@ interface EmbeddedWorkerInstanceClient { // remote debugging. See DevToolsAgent for details. BindDevToolsAgent(associated DevToolsAgentHost agent_host, associated DevToolsAgent& agent); + // Pushes updated set of subresource URL loader factories to the worker + // (for example, after DevTools network interception has been enabled). + // Note this does not affect the script loader factory, whose + // implementation lives in the browser and may be updated there. + UpdateSubresourceLoaderFactories( + URLLoaderFactoryBundle subresource_loader_factories); }; // EmbeddedWorkerInstanceHost is the browser-side ("Host") of @@ -123,7 +148,6 @@ interface EmbeddedWorkerInstanceClient { // EmbeddedWorkerInstanceClient, so it lives on the same message pipe as // EmbeddedWorkerInstanceClient. interface EmbeddedWorkerInstanceHost { - // S13nServiceWorker: // Called when the worker requests to be terminated. The worker will request // to be terminated when it realizes it has been idle for some time. The // browser doesn't terminate the worker when there are inflight events or @@ -171,7 +195,7 @@ interface EmbeddedWorkerInstanceHost { int32 column_number, url.mojom.Url source_url); // Reports that a console message was emitted to the worker's console. - OnReportConsoleMessage(int32 source_identifier, + OnReportConsoleMessage(ConsoleMessageSource source, ConsoleMessageLevel message_level, mojo_base.mojom.String16 message, int32 line_number, url.mojom.Url source_url); diff --git a/chromium/third_party/blink/public/mojom/service_worker/service_worker.mojom b/chromium/third_party/blink/public/mojom/service_worker/service_worker.mojom index ea0fa99f70f..f6da6ec2b48 100644 --- a/chromium/third_party/blink/public/mojom/service_worker/service_worker.mojom +++ b/chromium/third_party/blink/public/mojom/service_worker/service_worker.mojom @@ -114,6 +114,19 @@ struct ExtendableMessageEvent { ServiceWorkerObjectInfo? source_info_for_service_worker; }; +// Indicates whether a service worker has a fetch event handler. The presence +// of the fetch event handler is determined when the service worker finishes +// installing. +// TODO(crbug.com/945505): Convert enum constants to kUnknown style. +enum FetchHandlerExistence { + // The service worker has not yet finished installing. + UNKNOWN, + // The service worker finished installing and added a fetch event handler. + EXISTS, + // The service worker finished installing without a fetch event handler. + DOES_NOT_EXIST, +}; + // The number of seconds for which a 'push' event should be allowed to run. // This is not in the spec but for a Chrome-specific timeout. Each // event dispatched to service workers has a 5 minute timeout in the Chrome @@ -154,7 +167,8 @@ interface ServiceWorker { // service worker does not start until this message is received. InitializeGlobalScope( associated ServiceWorkerHost service_worker_host, - ServiceWorkerRegistrationObjectInfo registration_info); + ServiceWorkerRegistrationObjectInfo registration_info, + FetchHandlerExistence fetch_handler_existence); DispatchInstallEvent() => (ServiceWorkerEventStatus status, bool has_fetch_handler); @@ -214,9 +228,7 @@ interface ServiceWorker { => (ServiceWorkerEventStatus status); // Arguments are passed to the event handler as parameters of SyncEvent. // Ref: https://wicg.github.io/BackgroundSync/spec/#sync-event - // S13nServiceWorker: |timeout| is the amount of time to allow this event to - // finish. - // Non-S13nServiceWorker: |timeout| is just ignored. + // |timeout| is the amount of time to allow this event to finish. DispatchSyncEvent(string id, bool last_chance, mojo_base.mojom.TimeDelta timeout) @@ -246,7 +258,6 @@ interface ServiceWorker { // worker. Ping() => (); - // S13nServiceWorker: // Lets the idle timer request termination immediately after all inflight // events are handled without delay. SetIdleTimerDelayToZero(); diff --git a/chromium/third_party/blink/public/mojom/service_worker/service_worker_container.mojom b/chromium/third_party/blink/public/mojom/service_worker/service_worker_container.mojom index 9f39311d247..3e73835a980 100644 --- a/chromium/third_party/blink/public/mojom/service_worker/service_worker_container.mojom +++ b/chromium/third_party/blink/public/mojom/service_worker/service_worker_container.mojom @@ -28,15 +28,12 @@ enum ControllerServiceWorkerPurpose { // - For service workers: // Associated with EmbeddedWorkerInstanceClient, which is on a dedicated // message pipe. -// - For shared workers (S13nSW): +// - For shared workers: // Associated with SharedWorkerFactory, which is on a dedicated message // pipe. -// - For shared workers (non-S13nSW): -// Associated with ServiceWorkerDispatcherHost, which is on the -// channel-associated interface to the renderer process. // - For documents: -// Associated with ServiceWorkerDispatcherHost, which is on the -// channel-associated interface to the renderer process. +// Associated with NavigationClient/FrameNavigationControl, which is on +// the channel-associated interface to the renderer process. interface ServiceWorkerContainerHost { // Corresponds to navigator.serviceWorker.register(). // Registers a service worker from |script_url| with |options|. @@ -76,7 +73,6 @@ interface ServiceWorkerContainerHost { GetRegistrationForReady() => (ServiceWorkerRegistrationObjectInfo? registration); - // S13nServiceWorker: // Returns a Mojo end point to the controller ServiceWorker. This may start a // service worker instance in a renderer process if the corresponding // instance is not alive. @@ -89,7 +85,6 @@ interface ServiceWorkerContainerHost { EnsureControllerServiceWorker(ControllerServiceWorker& controller, ControllerServiceWorkerPurpose purpose); - // S13nServiceWorker: // Makes a new endpoint to this ServiceWorkerContainerHost. CloneContainerHost(ServiceWorkerContainerHost& container_host); @@ -98,7 +93,6 @@ interface ServiceWorkerContainerHost { // you know all incoming messages up to the Ping() call have been received. Ping() => (); - // S13nServiceWorker: // Gives a hint to the browser process to update the service worker after a // controlled page load. This message is meant to be sent at a time when page // load is no longer busy, so update doesn't adversely affect performance. @@ -132,12 +126,9 @@ interface ServiceWorkerContainer { // Corresponds to setting ServiceWorkerContainer#controller. // If |controller_info| is invalid (its |object_info| is null), then // ServiceWorkerContainer#controller is cleared. - // If |controller_info| is valid, |used_features| is the set of - // features the controller has used, for UseCounter purposes. // If |should_notify_controllerchange| is true, dispatch a 'controllerchange' // event. SetController(ControllerServiceWorkerInfo controller_info, - array<WebFeature> used_features, bool should_notify_controllerchange); // Corresponds to Client#postMessage(). diff --git a/chromium/third_party/blink/public/mojom/service_worker/service_worker_event_status.mojom b/chromium/third_party/blink/public/mojom/service_worker/service_worker_event_status.mojom index d126f4c747a..83d7855a146 100644 --- a/chromium/third_party/blink/public/mojom/service_worker/service_worker_event_status.mojom +++ b/chromium/third_party/blink/public/mojom/service_worker/service_worker_event_status.mojom @@ -21,15 +21,13 @@ enum ServiceWorkerEventStatus { // to network. REJECTED, - // ABORTED happens in at least two cases: - // - The service worker execution context was destroyed while the event was - // alive. - // - The event timed out. - // - // TODO(falken): It seems useful to add a TIMEOUT status. + // The service worker execution context was destroyed while the event was alive. ABORTED, - MAX=ABORTED + // The event failed to finish within the time limit. + TIMEOUT, + + MAX=TIMEOUT }; // The result of starting a service worker. diff --git a/chromium/third_party/blink/public/mojom/service_worker/service_worker_object.mojom b/chromium/third_party/blink/public/mojom/service_worker/service_worker_object.mojom index 7d2e193b22b..7ef6ab54d9b 100644 --- a/chromium/third_party/blink/public/mojom/service_worker/service_worker_object.mojom +++ b/chromium/third_party/blink/public/mojom/service_worker/service_worker_object.mojom @@ -10,26 +10,6 @@ import "url/mojom/url.mojom"; const int64 kInvalidServiceWorkerVersionId = -1; -// Describes whether a controller service worker exists and if it has a fetch -// handler. -// -// BEWARE: In non-NetS13nServiceWorker, the renderer often does not know which -// controller service worker a request will go to, as skipWaiting() may occur -// in the browser process at the same time the renderer makes a request. -// Therefore, non-NetS13nServiceWorker should usually treat -// kNoFetchEventHandler and kControlled as the same. -// -// TODO(falken): This should be moved to controller_service_worker.mojom once -// it moves to Blink. -enum ControllerServiceWorkerMode { - // No controller exists. - kNoController, - // The controller exists, but it has no fetch event handler. - kNoFetchEventHandler, - // The controller exists and it has a fetch event handler. - kControlled -}; - // Describes a ServiceWorker object: // https://w3c.github.io/ServiceWorker/#serviceworker-interface struct ServiceWorkerObjectInfo { diff --git a/chromium/third_party/blink/public/mojom/service_worker/service_worker_provider.mojom b/chromium/third_party/blink/public/mojom/service_worker/service_worker_provider.mojom index 63d23fd87ec..4f61f7b27ac 100644 --- a/chromium/third_party/blink/public/mojom/service_worker/service_worker_provider.mojom +++ b/chromium/third_party/blink/public/mojom/service_worker/service_worker_provider.mojom @@ -7,6 +7,7 @@ module blink.mojom; import "services/network/public/mojom/url_loader_factory.mojom"; import "services/service_manager/public/mojom/interface_provider.mojom"; import "third_party/blink/public/mojom/cache_storage/cache_storage.mojom"; +import "third_party/blink/public/mojom/service_worker/controller_service_worker_mode.mojom"; import "third_party/blink/public/mojom/service_worker/service_worker_container.mojom"; import "third_party/blink/public/mojom/service_worker/service_worker_object.mojom"; import "third_party/blink/public/mojom/service_worker/service_worker_provider_type.mojom"; @@ -17,12 +18,10 @@ import "third_party/blink/public/mojom/service_worker/service_worker_registratio // and browser. const string kNavigation_ServiceWorkerSpec = "navigation:service_worker"; -// S13nServiceWorker: // Sent from the browser process to the renderer. Contains parameters for the // WebServiceWorkerNetworkProvider used for starting a web worker (dedicated // worker or shared worker). struct ServiceWorkerProviderInfoForWorker { - int32 provider_id; associated ServiceWorkerContainerHost host_ptr_info; associated ServiceWorkerContainer& client_request; }; @@ -30,12 +29,9 @@ struct ServiceWorkerProviderInfoForWorker { // Sent from the browser process to the renderer. Contains parameters for the // WebServiceWorkerNetworkProvider used for starting a service worker. struct ServiceWorkerProviderInfoForStartWorker { - int32 provider_id; - associated ServiceWorkerContainerHost host_ptr_info; associated ServiceWorkerContainer& client_request; - // S13nServiceWorker: // The loader to use for loading the worker's main script and // importScripts(). associated network.mojom.URLLoaderFactory? script_loader_factory_ptr_info; @@ -50,47 +46,14 @@ struct ServiceWorkerProviderInfoForStartWorker { service_manager.mojom.InterfaceProvider interface_provider; }; -// Describes a browser-side provider host. See -// content::ServiceWorkerProviderHost. -struct ServiceWorkerProviderHostInfo { - // |provider_id| may be browser-assigned or renderer-assigned. - // Browser-assigned ids are unique among all providers. Renderer-assigned ids - // are unique among providers in a given renderer process. Most providers have - // browser-assigned ids. The exceptions are about:blank iframes, and shared - // workers (in the non-S13nServiceWorker case). - int32 provider_id; - - // When this provider is created for a document, |route_id| is the frame ID of - // it. Otherwise |route_id| is MSG_ROUTING_NONE. - int32 route_id; - - // This identifies whether this provider is for a service worker or for a - // service worker client (Documents and Shared Workers). - ServiceWorkerProviderType type; - - // |is_parent_frame_secure| is false if the provider is created for a document - // whose parent frame is not secure from the point of view of the document; - // that is, blink::WebFrame::canHaveSecureChild() returns false. This doesn't - // mean the document is necessarily an insecure context, because the document - // may have a URL whose scheme is granted an exception that allows bypassing - // the ancestor secure context check. See the comment in - // blink::Document::isSecureContextImpl for more details. If the provider is - // not created for a document, or the document does not have a parent frame, - // is_parent_frame_secure| is true. - bool is_parent_frame_secure; - - // Mojo endpoint to send a message from the renderer to the browser. This - // will be associated with ServiceWorkerDisptacherHost. |host_request| should - // be valid when ServiceWorkerProviderHostInfo is passed to any Mojo method. - // After used to create the ServiceWorkerProviderHost, this will be invalid. - associated ServiceWorkerContainerHost& host_request; - - // Mojo endpoint to send a message from the browser to the renderer. This - // will be associated with ServiceWorkerDispatcherHost. |client_ptr_info| - // should be valid when ServiceWorkerProviderHostInfo is passed to any Mojo - // method. - // After used to create the ServiceWorkerProviderHost, this will be invalid. - associated ServiceWorkerContainer client_ptr_info; +// Sent from the browser process to the renderer. Contains parameters for the +// WebServiceWorkerNetworkProvider used for a frame navigation. +// TODO(leonhsl): This struct has identical members as +// ServiceWorkerProviderInfoForWorker, we can unify them as a new struct +// ServiceWorkerProviderInfoForClient. +struct ServiceWorkerProviderInfoForWindow { + associated ServiceWorkerContainerHost host_ptr_info; + associated ServiceWorkerContainer& client_request; }; // ServiceWorkerWorkerClient represents a service worker client that is a worker @@ -118,18 +81,3 @@ interface ServiceWorkerWorkerClientRegistry { // Clones this host. CloneWorkerClientRegistry(ServiceWorkerWorkerClientRegistry& host); }; - -// An interface implemented by the browser process, with one implementation per -// renderer process. The renderer uses this interface to tell the browser when -// potential service worker clients are created. -// -// This interface is on the channel-associated interface to the renderer -// process. -interface ServiceWorkerDispatcherHost { - // Creates a content::ServiceWorkerProviderHost on the browser - // process. |provider_info| has Mojo endpoints to connect the container host - // and the container on the renderer together. The lifetime of - // ServiceWorkerProviderHost will be tied to the - // blink::mojom::ServiceWorkerContainerHost interface. - OnProviderCreated(ServiceWorkerProviderHostInfo provider_info); -}; diff --git a/chromium/third_party/blink/public/mojom/web_client_hints/OWNERS b/chromium/third_party/blink/public/mojom/web_client_hints/OWNERS index 08850f42120..c02b6b0fd1f 100644 --- a/chromium/third_party/blink/public/mojom/web_client_hints/OWNERS +++ b/chromium/third_party/blink/public/mojom/web_client_hints/OWNERS @@ -1,2 +1,6 @@ +yoavweiss@chromium.org +tbansal@chromium.org +ryansturm@chromium.org + per-file *.mojom=set noparent per-file *.mojom=file://ipc/SECURITY_OWNERS diff --git a/chromium/third_party/blink/public/mojom/web_feature/web_feature.mojom b/chromium/third_party/blink/public/mojom/web_feature/web_feature.mojom index 5fbcafda0e6..3f7d4bfc50f 100644 --- a/chromium/third_party/blink/public/mojom/web_feature/web_feature.mojom +++ b/chromium/third_party/blink/public/mojom/web_feature/web_feature.mojom @@ -905,7 +905,6 @@ enum WebFeature { kCSSValueAppearanceNotNone = 1352, kCSSValueAppearanceOthers = 1353, kCSSValueAppearanceButton = 1354, - kCSSValueAppearanceCaret = 1355, kCSSValueAppearanceCheckbox = 1356, kCSSValueAppearanceMenulist = 1357, kCSSValueAppearanceMenulistButton = 1358, @@ -1415,10 +1414,6 @@ enum WebFeature { kMediaStreamConstraintsGroupIdAudio = 1936, kMediaStreamConstraintsGroupIdVideo = 1937, kMediaStreamConstraintsVideoKind = 1938, - kMediaStreamConstraintsDepthNear = 1939, - kMediaStreamConstraintsDepthFar = 1940, - kMediaStreamConstraintsFocalLengthX = 1941, - kMediaStreamConstraintsFocalLengthY = 1942, kMediaStreamConstraintsMediaStreamSourceAudio = 1943, kMediaStreamConstraintsMediaStreamSourceVideo = 1944, kMediaStreamConstraintsRenderToAssociatedSink = 1945, @@ -1456,7 +1451,6 @@ enum WebFeature { kCrossOriginPropertyAccess = 1977, kCrossOriginPropertyAccessFromOpener = 1978, kCredentialManagerCreate = 1979, - kWebDatabaseCreateDropFTS3Table = 1980, kFieldEditInSecureContext = 1981, kFieldEditInNonSecureContext = 1982, kCredentialManagerGetMediationRequired = 1984, @@ -1685,8 +1679,6 @@ enum WebFeature { kV8MediaCapabilitiesInfo_Smooth_AttributeGetter = 2242, kV8MediaCapabilitiesInfo_PowerEfficient_AttributeGetter = 2243, kWindowEventInV0ShadowTree = 2244, - kHTMLAnchorElementDownloadInSandboxWithUserGesture = 2245, - kHTMLAnchorElementDownloadInSandboxWithoutUserGesture = 2246, kWindowOpenRealmMismatch = 2247, kGridRowTrackPercentIndefiniteHeight = 2248, kVRGetDisplaysSupportsPresent = 2249, @@ -1809,7 +1801,6 @@ enum WebFeature { kGetComputedStyleWebkitAppearance = 2374, kV8LockManager_Request_Method = 2375, kV8LockManager_Query_Method = 2376, - kUserMediaEnableExperimentalHardwareEchoCancellation = 2377, kV8RTCDTMFSender_Track_AttributeGetter = 2378, kV8RTCDTMFSender_Duration_AttributeGetter = 2379, kV8RTCDTMFSender_InterToneGap_AttributeGetter = 2380, @@ -1963,7 +1954,6 @@ enum WebFeature { kInterventionReport = 2531, kV8WasmSharedMemory = 2532, kV8WasmThreadOpcodes = 2533, - kCacheStorageAddAllSuccessWithDuplicate = 2534, kFeaturePolicyReport = 2536, kV8Window_WebkitRTCPeerConnection_ConstructorGetter = 2537, kV8Window_WebkitMediaStream_ConstructorGetter = 2538, @@ -2062,8 +2052,6 @@ enum WebFeature { kHTMLAnchorElementHrefTranslateAttribute = 2629, kWebKitUserModifyEffective = 2630, kPlainTextEditingEffective = 2631, - kNavigationDownloadInSandboxWithUserGesture = 2632, - kNavigationDownloadInSandboxWithoutUserGesture = 2633, kLegacyTLSVersionInMainFrameResource = 2634, kLegacyTLSVersionInSubresource = 2635, kLegacyTLSVersionInSubframeMainResource = 2636, @@ -2227,22 +2215,6 @@ enum WebFeature { kAnimationFrameCancelledWithinFrame = 2793, kSchedulingIsInputPending = 2794, kV8StringNormalize = 2795, - kCSSValueAppearanceButtonBevel = 2796, - kCSSValueAppearanceListitem = 2797, - kCSSValueAppearanceMediaControlsBackground = 2798, - kCSSValueAppearanceMediaControlsFullscreenBackground = 2799, - kCSSValueAppearanceMediaCurrentTimeDisplay = 2800, - kCSSValueAppearanceMediaEnterFullscreenButton = 2801, - kCSSValueAppearanceMediaExitFullscreenButton = 2802, - kCSSValueAppearanceMediaMuteButton = 2803, - kCSSValueAppearanceMediaOverlayPlayButton = 2804, - kCSSValueAppearanceMediaPlayButton = 2805, - kCSSValueAppearanceMediaTimeRemainingDisplay = 2806, - kCSSValueAppearanceMediaToggleClosedCaptionsButton = 2807, - kCSSValueAppearanceMediaVolumeSliderContainer = 2808, - kCSSValueAppearanceMenulistTextfield = 2809, - kCSSValueAppearanceMenulistText = 2810, - kCSSValueAppearanceProgressBarValue = 2811, kU2FCryptotokenRegister = 2812, kU2FCryptotokenSign = 2813, kCSSValueAppearanceInnerSpinButton = 2814, @@ -2260,6 +2232,57 @@ enum WebFeature { kAdClickNavigation = 2826, kRTCStatsRelativePacketArrivalDelay = 2827, + // The above items are available in M74 branch. + kCSSSelectorHostContextInSnapshotProfile = 2829, + kCSSSelectorHostContextInLiveProfile = 2830, + kImportMap = 2831, + kRefreshHeader = 2832, + kSearchEventFired = 2833, + kIdleDetectionStart = 2834, + kTargetCurrent = 2835, + kSandboxBackForwardStaysWithinSubtree = 2836, + kSandboxBackForwardAffectsFramesOutsideSubtree = 2837, + kDownloadPrePolicyCheck = 2838, + kDownloadPostPolicyCheck = 2839, + kDownloadInSandboxWithoutUserGesture = 2840, + kReadableStreamGetReader = 2841, + kReadableStreamPipeThrough = 2842, + kReadableStreamPipeTo = 2843, + kCSSStyleSheetReplace = 2844, + kCSSStyleSheetReplaceSync = 2845, + kAdoptedStyleSheets = 2846, + kHTMLImportsOnReverseOriginTrials = 2847, + kElementCreateShadowRootOnReverseOriginTrials = 2848, + kDocumentRegisterElementOnReverseOriginTrials = 2849, + kInputTypeRadio = 2850, + kInputTypeCheckbox = 2851, + kInputTypeImage = 2852, + kInputTypeButton = 2853, + kInputTypeHidden = 2854, + kInputTypeReset = 2855, + kSelectElementSingle = 2856, + kSelectElementMultiple = 2857, + kV8Animation_Effect_AttributeGetter = 2858, + kV8Animation_Effect_AttributeSetter = 2859, + kHidDeviceClose = 2860, + kHidDeviceOpen = 2861, + kHidDeviceReceiveFeatureReport = 2862, + kHidDeviceSendFeatureReport = 2863, + kHidDeviceSendReport = 2864, + kHidGetDevices = 2865, + kHidRequestDevice = 2866, + kV8RTCQuicTransport_MaxDatagramLength_AttributeGetter = 2867, + kV8RTCQuicTransport_ReadyToSendDatagram_Method = 2868, + kV8RTCQuicTransport_SendDatagram_Method = 2869, + kV8RTCQuicTransport_ReceiveDatagrams_Method = 2870, + kV8RTCRtpReceiver_JitterBufferDelayHint_AttributeGetter = 2871, + kV8RTCRtpReceiver_JitterBufferDelayHint_AttributeSetter = 2872, + kFocusWithoutUserActivationNotSandboxedNotAdFrame = 2882, + kFocusWithoutUserActivationNotSandboxedAdFrame = 2883, + kFocusWithoutUserActivationSandboxedNotAdFrame = 2884, + kFocusWithoutUserActivationSandboxedAdFrame = 2885, + kMediaCapabilitiesDecodingInfoWithKeySystemConfig = 2888, + // Add new features immediately above this line. Don't change assigned // numbers of any item, and don't reuse removed slots. // Also, run update_use_counter_feature_enum.py in diff --git a/chromium/third_party/blink/public/platform/modules/webauthn/OWNERS b/chromium/third_party/blink/public/mojom/webauthn/OWNERS index dd7ddf4733b..dd7ddf4733b 100644 --- a/chromium/third_party/blink/public/platform/modules/webauthn/OWNERS +++ b/chromium/third_party/blink/public/mojom/webauthn/OWNERS diff --git a/chromium/third_party/blink/public/platform/modules/webauthn/authenticator.mojom b/chromium/third_party/blink/public/mojom/webauthn/authenticator.mojom index 8a35cfa4102..155ff22b915 100644 --- a/chromium/third_party/blink/public/platform/modules/webauthn/authenticator.mojom +++ b/chromium/third_party/blink/public/mojom/webauthn/authenticator.mojom @@ -52,6 +52,18 @@ struct CommonCredentialInfo { array<uint8> client_data_json; }; +// Content of user verification method extension returned by both +// Authenticator::MakeCredential and Authenticator::GetAssertion. +// See https://w3c.github.io/webauthn/#sctn-uvm-extension +// Registry of the available values, see +// https://fidoalliance.org/specs/fido-v2.0-id-20180227/fido-registry-v2.0-id-20180227.html#user-verification-methods +[EnableIf=is_android] +struct UvmEntry { + uint32 user_verification_method; + uint16 key_protection_type; + uint16 matcher_protection_type; +}; + // The public key and attestation returned by Authenticator::MakeCredential. struct MakeCredentialAuthenticatorResponse { CommonCredentialInfo info; @@ -68,6 +80,16 @@ struct MakeCredentialAuthenticatorResponse { // extension output. If so, |hmac_create_secret| contains the actual value. bool echo_hmac_create_secret; bool hmac_create_secret; + + // Only supported by fido2 devices on android, will eventually supported by + // other platform. + // True if getClientExtensionResults() called on the returned + // PublicKeyCredential instance should contain an 'uvm' extension output. + // If so, |user_verification_methods| contains the actual value. + [EnableIf=is_android] + bool echo_user_verification_methods; + [EnableIf=is_android] + array<UvmEntry>? user_verification_methods; }; struct GetAssertionAuthenticatorResponse { @@ -89,6 +111,16 @@ struct GetAssertionAuthenticatorResponse { // If so, |appid_extension| contains the actual value. bool echo_appid_extension; bool appid_extension; + + // Only supported by fido2 devices on android, will eventually supported by + // other platform. + // True if getClientExtensionResults() called on the returned + // PublicKeyCredential instance should contain an 'uvm' extension output. + // If so, |user_verification_methods| contains the actual value. + [EnableIf=is_android] + bool echo_user_verification_methods; + [EnableIf=is_android] + array<UvmEntry>? user_verification_methods; }; // Information about the relying party. These fields take arbitrary input. @@ -193,6 +225,13 @@ struct PublicKeyCredentialRequestOptions { // There may be multiple sets if multiple caBLE credentials have been // registered with the relying party. array<CableAuthentication> cable_authentication_data; + + // Only supported by fido2 devices on android, will eventually supported by + // other platform. + // Whether the user verification method extension is requested by + // the RP. See https://w3c.github.io/webauthn/#sctn-uvm-extension + [EnableIf=is_android] + bool user_verification_methods; }; // See https://w3c.github.io/webauthn/#enumdef-attestationconveyancepreference @@ -267,6 +306,13 @@ struct PublicKeyCredentialCreationOptions { // The contents of the hmacCreateSecret extension, if any. See // https://fidoalliance.org/specs/fido-v2.0-rd-20180702/fido-client-to-authenticator-protocol-v2.0-rd-20180702.html#sctn-hmac-secret-extension bool hmac_create_secret; + + // Only supported by fido2 devices on android, will eventually supported by + // other platform. + // Whether the user verification method extension is requested by + // the RP. See https://w3c.github.io/webauthn/#sctn-uvm-extension + [EnableIf=is_android] + bool user_verification_methods; }; enum PublicKeyCredentialType { diff --git a/chromium/third_party/blink/public/platform/modules/webauthn/virtual_authenticator.mojom b/chromium/third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom index 95f8458d901..0792a3e3aba 100644 --- a/chromium/third_party/blink/public/platform/modules/webauthn/virtual_authenticator.mojom +++ b/chromium/third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom @@ -5,7 +5,7 @@ module blink.test.mojom; import "url/mojom/url.mojom"; -import "third_party/blink/public/platform/modules/webauthn/authenticator.mojom"; +import "third_party/blink/public/mojom/webauthn/authenticator.mojom"; // Application protocol that the virtual authenticator should simulate. enum ClientToAuthenticatorProtocol { diff --git a/chromium/third_party/blink/public/mojom/webdatabase/OWNERS b/chromium/third_party/blink/public/mojom/webdatabase/OWNERS new file mode 100644 index 00000000000..08850f42120 --- /dev/null +++ b/chromium/third_party/blink/public/mojom/webdatabase/OWNERS @@ -0,0 +1,2 @@ +per-file *.mojom=set noparent +per-file *.mojom=file://ipc/SECURITY_OWNERS diff --git a/chromium/third_party/blink/public/platform/modules/webdatabase/web_database.mojom b/chromium/third_party/blink/public/mojom/webdatabase/web_database.mojom index 3d29c15d26e..3d29c15d26e 100644 --- a/chromium/third_party/blink/public/platform/modules/webdatabase/web_database.mojom +++ b/chromium/third_party/blink/public/mojom/webdatabase/web_database.mojom diff --git a/chromium/third_party/blink/public/platform/modules/webshare/OWNERS b/chromium/third_party/blink/public/mojom/webshare/OWNERS index 691beec3ae3..691beec3ae3 100644 --- a/chromium/third_party/blink/public/platform/modules/webshare/OWNERS +++ b/chromium/third_party/blink/public/mojom/webshare/OWNERS diff --git a/chromium/third_party/blink/public/platform/modules/webshare/webshare.mojom b/chromium/third_party/blink/public/mojom/webshare/webshare.mojom index ab7ffab5464..d91af451151 100644 --- a/chromium/third_party/blink/public/platform/modules/webshare/webshare.mojom +++ b/chromium/third_party/blink/public/mojom/webshare/webshare.mojom @@ -5,6 +5,7 @@ [JavaPackage="org.chromium.webshare.mojom"] module blink.mojom; +import "third_party/blink/public/mojom/blob/serialized_blob.mojom"; import "url/mojom/url.mojom"; enum ShareError { @@ -12,11 +13,19 @@ enum ShareError { OK, // Something went wrong in the implementation. INTERNAL_ERROR, + // Potentially dangerous files. + PERMISSION_DENIED, // Share was canceled by user. CANCELED, }; +struct SharedFile { + string name; + SerializedBlob blob; +}; + interface ShareService { // The web contents has requested to send a share text action. - Share(string title, string text, url.mojom.Url url) => (ShareError error); + Share(string title, string text, url.mojom.Url url, array<SharedFile> files) + => (ShareError error); }; diff --git a/chromium/third_party/blink/public/mojom/window_features/OWNERS b/chromium/third_party/blink/public/mojom/window_features/OWNERS new file mode 100644 index 00000000000..08850f42120 --- /dev/null +++ b/chromium/third_party/blink/public/mojom/window_features/OWNERS @@ -0,0 +1,2 @@ +per-file *.mojom=set noparent +per-file *.mojom=file://ipc/SECURITY_OWNERS diff --git a/chromium/third_party/blink/public/web/window_features.mojom b/chromium/third_party/blink/public/mojom/window_features/window_features.mojom index dac13c3861e..dac13c3861e 100644 --- a/chromium/third_party/blink/public/web/window_features.mojom +++ b/chromium/third_party/blink/public/mojom/window_features/window_features.mojom diff --git a/chromium/third_party/blink/public/mojom/worker/shared_worker_factory.mojom b/chromium/third_party/blink/public/mojom/worker/shared_worker_factory.mojom index ce14a5650b4..d254dfb1fc7 100644 --- a/chromium/third_party/blink/public/mojom/worker/shared_worker_factory.mojom +++ b/chromium/third_party/blink/public/mojom/worker/shared_worker_factory.mojom @@ -39,11 +39,9 @@ interface SharedWorkerFactory { RendererPreferenceWatcher& preference_watcher_request, WorkerContentSettingsProxy content_settings, - // S13nServiceWorker: // The info about the service worker host in the browser process that // provides support for this shared worker to be a service worker client. - // Null when S13nServiceWorker is disabled. - ServiceWorkerProviderInfoForWorker? service_worker_provider_info, + ServiceWorkerProviderInfoForWorker service_worker_provider_info, // NetworkService: // The ID of the AppCacheHost in the browser process that serves resources @@ -51,13 +49,12 @@ interface SharedWorkerFactory { // is disabled or AppCache doesn't serve resources for this shared worker. int32 appcache_host_id, - // S13nServiceWorker (non-NetworkService): + // Non-NetworkService: // The URLLoaderFactory to use to request the shared worker's script // (just the main script resource; importScripts() should go through the // usual loader or the controller service worker if appropriate). // - // This is only non-null when S13nServiceWorker is enabled but - // NetworkService is disabled. + // This is only non-null when NetworkService is disabled. // // TODO(leonhsl): It doesn't really need to be associated. Make it // non-associated and update @@ -80,9 +77,9 @@ interface SharedWorkerFactory { // NetworkService (PlzWorker): // Used for setting ServiceWorkerContainer#controller. This is null when - // NetworkService is disabled or there're no controller service worker. + // NetworkService is disabled or there is no controller service worker. // - // In S13nServiceWorker, the controller is sent via + // In non-NetworkService, the controller is sent via // ServiceWorkerContainer.SetController(). ControllerServiceWorkerInfo? controller_info, diff --git a/chromium/third_party/blink/public/mojom/worker/worker_content_settings_proxy.mojom b/chromium/third_party/blink/public/mojom/worker/worker_content_settings_proxy.mojom index 500a16a1e6a..e24f8646162 100644 --- a/chromium/third_party/blink/public/mojom/worker/worker_content_settings_proxy.mojom +++ b/chromium/third_party/blink/public/mojom/worker/worker_content_settings_proxy.mojom @@ -18,6 +18,10 @@ interface WorkerContentSettingsProxy { [Sync] AllowIndexedDB() => (bool result); + // Returns whether the worker is allowed access to CacheStorage. + [Sync] + AllowCacheStorage() => (bool result); + // Returns whether the worker is allowed access to the file system. [Sync] RequestFileSystemAccessSync() => (bool result); diff --git a/chromium/third_party/blink/public/platform/DEPS b/chromium/third_party/blink/public/platform/DEPS index f4dce065d8e..cafa3e7da41 100644 --- a/chromium/third_party/blink/public/platform/DEPS +++ b/chromium/third_party/blink/public/platform/DEPS @@ -34,6 +34,7 @@ include_rules = [ # Enforce to use mojom-shared.h in blink/public so that it can compile # inside and outside Blink. + "+media/mojo/interfaces/display_media_information.mojom-shared.h", "+services/network/public/mojom/cors.mojom-shared.h", "+services/network/public/mojom/fetch_api.mojom-shared.h", "+services/network/public/mojom/request_context_frame_type.mojom-shared.h", @@ -45,6 +46,7 @@ include_rules = [ "-third_party/blink/public/web", "-third_party/blink/renderer/bindings", "+third_party/skia", + "+ui/base/page_transition_types.h", "+ui/gfx", "+url", "-web", diff --git a/chromium/third_party/blink/public/platform/modules/background_fetch/web_background_fetch_registration.h b/chromium/third_party/blink/public/platform/modules/background_fetch/web_background_fetch_registration.h index 2711865a78a..ec1113df583 100644 --- a/chromium/third_party/blink/public/platform/modules/background_fetch/web_background_fetch_registration.h +++ b/chromium/third_party/blink/public/platform/modules/background_fetch/web_background_fetch_registration.h @@ -5,6 +5,7 @@ #ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_BACKGROUND_FETCH_WEB_BACKGROUND_FETCH_REGISTRATION_H_ #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_BACKGROUND_FETCH_WEB_BACKGROUND_FETCH_REGISTRATION_H_ +#include "mojo/public/cpp/system/message_pipe.h" #include "third_party/blink/public/mojom/background_fetch/background_fetch.mojom-shared.h" #include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/public/platform/web_string.h" @@ -14,35 +15,43 @@ namespace blink { // Represents a BackgroundFetchRegistration object, added mainly for layering. // Analogous to the following structure in the spec: // https://wicg.github.io/background-fetch/#background-fetch-registration +// Also contains a message pipe for registration functionality. struct WebBackgroundFetchRegistration { WebBackgroundFetchRegistration( const WebString& developer_id, - const WebString& unique_id, uint64_t upload_total, uint64_t uploaded, uint64_t download_total, uint64_t downloaded, mojom::BackgroundFetchResult result, - mojom::BackgroundFetchFailureReason failure_reason) + mojom::BackgroundFetchFailureReason failure_reason, + mojo::ScopedMessagePipeHandle registration_service_handle, + uint32_t registration_service_version) : developer_id(developer_id), - unique_id(unique_id), upload_total(upload_total), uploaded(uploaded), download_total(download_total), downloaded(downloaded), result(result), - failure_reason(failure_reason) {} + failure_reason(failure_reason), + registration_service_handle(std::move(registration_service_handle)), + registration_service_version(registration_service_version) {} ~WebBackgroundFetchRegistration() = default; + WebBackgroundFetchRegistration(WebBackgroundFetchRegistration&&) = default; WebString developer_id; - WebString unique_id; uint64_t upload_total; uint64_t uploaded; uint64_t download_total; uint64_t downloaded; mojom::BackgroundFetchResult result; mojom::BackgroundFetchFailureReason failure_reason; + + // This should be connected to the BackgroundFetchRegistrationService + // interface. + mojo::ScopedMessagePipeHandle registration_service_handle; + uint32_t registration_service_version; }; } // namespace blink diff --git a/chromium/third_party/blink/public/platform/modules/installedapp/OWNERS b/chromium/third_party/blink/public/platform/modules/installedapp/OWNERS index 6137d699f9e..065b1322ca1 100644 --- a/chromium/third_party/blink/public/platform/modules/installedapp/OWNERS +++ b/chromium/third_party/blink/public/platform/modules/installedapp/OWNERS @@ -1,6 +1,3 @@ mgiuca@chromium.org -per-file *.mojom=set noparent -per-file *.mojom=file://ipc/SECURITY_OWNERS - # COMPONENT: Platform>Apps>AppLauncher>Install diff --git a/chromium/third_party/blink/public/platform/modules/installedapp/web_related_apps_fetcher.h b/chromium/third_party/blink/public/platform/modules/installedapp/web_related_apps_fetcher.h index da6eb9ab848..2f3499840a2 100644 --- a/chromium/third_party/blink/public/platform/modules/installedapp/web_related_apps_fetcher.h +++ b/chromium/third_party/blink/public/platform/modules/installedapp/web_related_apps_fetcher.h @@ -5,8 +5,8 @@ #ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_INSTALLEDAPP_WEB_RELATED_APPS_FETCHER_H_ #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_INSTALLEDAPP_WEB_RELATED_APPS_FETCHER_H_ +#include "base/callback.h" #include "third_party/blink/public/platform/modules/installedapp/web_related_application.h" -#include "third_party/blink/public/platform/web_callbacks.h" #include "third_party/blink/public/platform/web_security_origin.h" #include "third_party/blink/public/platform/web_vector.h" @@ -14,8 +14,8 @@ namespace blink { -using AppInstalledCallbacks = - WebCallbacks<const WebVector<WebRelatedApplication>&, void>; +using GetManifestRelatedApplicationsCallback = + base::OnceCallback<void(const WebVector<WebRelatedApplication>&)>; class WebRelatedAppsFetcher { public: @@ -23,7 +23,7 @@ class WebRelatedAppsFetcher { // Gets the list of related applications from the web frame's manifest. virtual void GetManifestRelatedApplications( - std::unique_ptr<AppInstalledCallbacks>) = 0; + GetManifestRelatedApplicationsCallback) = 0; }; } // namespace blink diff --git a/chromium/third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_callbacks.h b/chromium/third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_callbacks.h index e7b9b57e9b4..21446a9e206 100644 --- a/chromium/third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_callbacks.h +++ b/chromium/third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_callbacks.h @@ -16,9 +16,6 @@ namespace blink { using WebMediaCapabilitiesDecodingInfoCallbacks = WebCallbacks<std::unique_ptr<WebMediaCapabilitiesDecodingInfo>, void>; -using WebMediaCapabilitiesEncodingInfoCallbacks = - WebCallbacks<std::unique_ptr<WebMediaCapabilitiesInfo>, void>; - } // namespace blink #endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_MEDIA_CAPABILITIES_WEB_MEDIA_CAPABILITIES_CALLBACKS_H_ diff --git a/chromium/third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_client.h b/chromium/third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_client.h index 0771c5c8e20..bd6c4e13c5f 100644 --- a/chromium/third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_client.h +++ b/chromium/third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_client.h @@ -20,6 +20,7 @@ class WebMediaCapabilitiesClient { virtual void DecodingInfo( const WebMediaDecodingConfiguration&, + std::unique_ptr<blink::WebContentDecryptionModuleAccess>, std::unique_ptr<WebMediaCapabilitiesDecodingInfoCallbacks>) = 0; }; diff --git a/chromium/third_party/blink/public/platform/modules/mediastream/OWNERS b/chromium/third_party/blink/public/platform/modules/mediastream/OWNERS index c205d4f9190..32889ccc574 100644 --- a/chromium/third_party/blink/public/platform/modules/mediastream/OWNERS +++ b/chromium/third_party/blink/public/platform/modules/mediastream/OWNERS @@ -2,5 +2,5 @@ file://third_party/blink/common/mediastream/OWNERS per-file media_stream_audio_processor*=aluebs@chromium.org -# TEAM: media-capture-and-streams@grotations.appspotmail.com +# TEAM: webrtc-dev@chromium.org # COMPONENT: Blink>GetUserMedia diff --git a/chromium/third_party/blink/public/platform/modules/mediastream/media_stream_audio_processor_options.h b/chromium/third_party/blink/public/platform/modules/mediastream/media_stream_audio_processor_options.h new file mode 100644 index 00000000000..07a69de2c40 --- /dev/null +++ b/chromium/third_party/blink/public/platform/modules/mediastream/media_stream_audio_processor_options.h @@ -0,0 +1,141 @@ +// Copyright 2013 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_MEDIASTREAM_MEDIA_STREAM_AUDIO_PROCESSOR_OPTIONS_H_ +#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_MEDIASTREAM_MEDIA_STREAM_AUDIO_PROCESSOR_OPTIONS_H_ + +#include <string> +#include <vector> + +#include "base/files/file.h" +#include "base/macros.h" +#include "base/optional.h" +#include "base/threading/thread_checker.h" +#include "build/build_config.h" +#include "media/base/audio_point.h" +#include "media/base/audio_processing.h" +#include "third_party/blink/public/common/mediastream/media_stream_request.h" +#include "third_party/blink/public/platform/web_common.h" +#include "third_party/blink/public/platform/web_media_constraints.h" +#include "third_party/webrtc/api/media_stream_interface.h" +#include "third_party/webrtc/media/base/media_channel.h" +#include "third_party/webrtc/modules/audio_processing/include/audio_processing.h" +#include "third_party/webrtc/rtc_base/task_queue.h" + +namespace webrtc { + +class TypingDetection; + +} + +namespace blink { + +using webrtc::AudioProcessing; + +static constexpr int kAudioProcessingSampleRate = +#if defined(OS_ANDROID) + AudioProcessing::kSampleRate16kHz; +#else + AudioProcessing::kSampleRate48kHz; +#endif + +// Simple struct with audio-processing properties. +struct BLINK_PLATFORM_EXPORT AudioProcessingProperties { + enum class EchoCancellationType { + // Echo cancellation disabled. + kEchoCancellationDisabled, + // The WebRTC-provided AEC3 echo canceller. + kEchoCancellationAec3, + // System echo canceller, for example an OS-provided or hardware echo + // canceller. + kEchoCancellationSystem + }; + + // Creates an AudioProcessingProperties object with fields initialized to + // their default values. + AudioProcessingProperties(); + AudioProcessingProperties(const AudioProcessingProperties& other); + AudioProcessingProperties& operator=(const AudioProcessingProperties& other); + + // Disables properties that are enabled by default. + void DisableDefaultProperties(); + + // Returns whether echo cancellation is enabled. + bool EchoCancellationEnabled() const; + + // Returns whether WebRTC-provided echo cancellation is enabled. + bool EchoCancellationIsWebRtcProvided() const; + + // Converts this struct to an equivalent media::AudioProcessingSettings. + // TODO(https://crbug.com/878757): Eliminate this class in favor of the media + // one. + media::AudioProcessingSettings ToAudioProcessingSettings() const; + + EchoCancellationType echo_cancellation_type = + EchoCancellationType::kEchoCancellationAec3; + bool disable_hw_noise_suppression = false; + bool goog_audio_mirroring = false; + bool goog_auto_gain_control = true; + bool goog_experimental_echo_cancellation = +#if defined(OS_ANDROID) + false; +#else + true; +#endif + bool goog_typing_noise_detection = true; + bool goog_noise_suppression = true; + bool goog_experimental_noise_suppression = true; + bool goog_highpass_filter = true; + bool goog_experimental_auto_gain_control = true; +}; + +// Enables the echo cancellation in |audio_processing|. +BLINK_PLATFORM_EXPORT void EnableEchoCancellation( + AudioProcessing* audio_processing); + +// Enables the noise suppression in |audio_processing|. +BLINK_PLATFORM_EXPORT void EnableNoiseSuppression( + AudioProcessing* audio_processing, + webrtc::NoiseSuppression::Level ns_level); + +// Enables the typing detection in |audio_processing|. +BLINK_PLATFORM_EXPORT void EnableTypingDetection( + AudioProcessing* audio_processing, + webrtc::TypingDetection* typing_detector); + +// Starts the echo cancellation dump in +// |audio_processing|. |worker_queue| must be kept alive until either +// |audio_processing| is destroyed, or +// StopEchoCancellationDump(audio_processing) is called. +BLINK_PLATFORM_EXPORT void StartEchoCancellationDump( + AudioProcessing* audio_processing, + base::File aec_dump_file, + rtc::TaskQueue* worker_queue); + +// Stops the echo cancellation dump in |audio_processing|. +// This method has no impact if echo cancellation dump has not been started on +// |audio_processing|. +BLINK_PLATFORM_EXPORT void StopEchoCancellationDump( + AudioProcessing* audio_processing); + +// Loads fixed gains for pre-amplifier and gain control from config JSON string. +BLINK_PLATFORM_EXPORT void GetExtraGainConfig( + const base::Optional<std::string>& audio_processing_platform_config_json, + base::Optional<double>* pre_amplifier_fixed_gain_factor, + base::Optional<double>* gain_control_compression_gain_db); + +// Enables automatic gain control. If optional |fixed_gain| is set, will set the +// gain control mode to use the fixed gain. +BLINK_PLATFORM_EXPORT void EnableAutomaticGainControl( + AudioProcessing* audio_processing, + base::Optional<double> compression_gain_db); + +// Enables pre-amplifier with given gain factor if the optional |factor| is set. +BLINK_PLATFORM_EXPORT void ConfigPreAmplifier( + webrtc::AudioProcessing::Config* apm_config, + base::Optional<double> fixed_gain_factor); + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_MEDIASTREAM_MEDIA_STREAM_AUDIO_PROCESSOR_OPTIONS_H_ diff --git a/chromium/third_party/blink/public/platform/modules/mediastream/media_stream_audio_source.h b/chromium/third_party/blink/public/platform/modules/mediastream/media_stream_audio_source.h index 4cfa28e6e97..11fdce20542 100644 --- a/chromium/third_party/blink/public/platform/modules/mediastream/media_stream_audio_source.h +++ b/chromium/third_party/blink/public/platform/modules/mediastream/media_stream_audio_source.h @@ -41,14 +41,14 @@ class MediaStreamAudioTrack; // needed, and/or calls to DeliverDataToTracks() must be made at very specific // times. // -// An instance of this class is owned by blink::WebMediaStreamSource. +// An instance of this class is owned by WebMediaStreamSource. // // Usage example: // // class MyAudioSource : public MediaStreamAudioSource { ... }; // -// blink::WebMediaStreamSource blink_source = ...; -// blink::WebMediaStreamTrack blink_track = ...; +// WebMediaStreamSource blink_source = ...; +// WebMediaStreamTrack blink_track = ...; // blink_source.setExtraData(new MyAudioSource()); // Takes ownership. // if (MediaStreamAudioSource::From(blink_source) // ->ConnectToTrack(blink_track)) { @@ -60,16 +60,20 @@ class MediaStreamAudioTrack; // // MediaStreamAudioTrack instance created. // CHECK(MediaStreamAudioTrack::From(blink_track)); class BLINK_PLATFORM_EXPORT MediaStreamAudioSource - : public blink::WebPlatformMediaStreamSource { + : public WebPlatformMediaStreamSource { public: - explicit MediaStreamAudioSource(bool is_local_source); - MediaStreamAudioSource(bool is_local_source, bool disable_local_echo); + MediaStreamAudioSource( + scoped_refptr<base::SingleThreadTaskRunner> task_runner, + bool is_local_source); + MediaStreamAudioSource( + scoped_refptr<base::SingleThreadTaskRunner> task_runner, + bool is_local_source, + bool disable_local_echo); ~MediaStreamAudioSource() override; // Returns the MediaStreamAudioSource instance owned by the given blink // |source| or null. - static MediaStreamAudioSource* From( - const blink::WebMediaStreamSource& source); + static MediaStreamAudioSource* From(const WebMediaStreamSource& source); // Provides a weak reference to this MediaStreamAudioSource. The weak pointer // may only be dereferenced on the main thread. @@ -86,7 +90,7 @@ class BLINK_PLATFORM_EXPORT MediaStreamAudioSource // implementation of the content::MediaStreamAudioTrack interface, which // becomes associated with and owned by |track|. Returns true if the source // was successfully started. - bool ConnectToTrack(const blink::WebMediaStreamTrack& track); + bool ConnectToTrack(const WebMediaStreamTrack& track); // Returns the current format of the audio passing through this source to the // sinks. This can return invalid parameters if the source has not yet been @@ -127,7 +131,7 @@ class BLINK_PLATFORM_EXPORT MediaStreamAudioSource // Stops the source and start the |new_device|. // A default no-op implementation is provided in this base class. Subclasses // should override this method. - virtual void ChangeSourceImpl(const blink::MediaStreamDevice& new_device); + virtual void ChangeSourceImpl(const MediaStreamDevice& new_device); // Called by subclasses to update the format of the audio passing through this // source to the sinks. This may be called at any time, before or after @@ -154,7 +158,7 @@ class BLINK_PLATFORM_EXPORT MediaStreamAudioSource private: // MediaStreamSource override. void DoStopSource() final; - void DoChangeSource(const blink::MediaStreamDevice& new_device) final; + void DoChangeSource(const MediaStreamDevice& new_device) final; // Removes |track| from the list of instances that get a copy of the source // audio data. The "stop callback" that was provided to the track calls diff --git a/chromium/third_party/blink/public/platform/modules/mediastream/media_stream_audio_track.h b/chromium/third_party/blink/public/platform/modules/mediastream/media_stream_audio_track.h index 323b29c8802..a9f39cc3ec7 100644 --- a/chromium/third_party/blink/public/platform/modules/mediastream/media_stream_audio_track.h +++ b/chromium/third_party/blink/public/platform/modules/mediastream/media_stream_audio_track.h @@ -24,10 +24,10 @@ class MediaStreamAudioSource; // Provides the part of the audio pipeline delivering audio from a // MediaStreamAudioSource to one or more WebMediaStreamAudioSinks. An instance -// of this class is owned by blink::WebMediaStreamTrack, and clients should use +// of this class is owned by WebMediaStreamTrack, and clients should use // From() to gain access to a MediaStreamAudioTrack. class BLINK_PLATFORM_EXPORT MediaStreamAudioTrack - : public blink::WebPlatformMediaStreamTrack { + : public WebPlatformMediaStreamTrack { public: explicit MediaStreamAudioTrack(bool is_local_track); @@ -35,7 +35,7 @@ class BLINK_PLATFORM_EXPORT MediaStreamAudioTrack // Returns the MediaStreamAudioTrack instance owned by the given blink |track| // or null. - static MediaStreamAudioTrack* From(const blink::WebMediaStreamTrack& track); + static MediaStreamAudioTrack* From(const WebMediaStreamTrack& track); // Provides a weak reference to this MediaStreamAudioTrack which is // invalidated when Stop() is called. The weak pointer may only be @@ -68,7 +68,7 @@ class BLINK_PLATFORM_EXPORT MediaStreamAudioTrack // MediaStreamTrack override. void SetEnabled(bool enabled) override; void SetContentHint( - blink::WebMediaStreamTrack::ContentHintType content_hint) override; + WebMediaStreamTrack::ContentHintType content_hint) override; // Returns a unique class identifier. Some subclasses override and use this // method to provide safe down-casting to their type. diff --git a/chromium/third_party/blink/public/platform/modules/mediastream/web_media_stream_renderer_factory.h b/chromium/third_party/blink/public/platform/modules/mediastream/web_media_stream_renderer_factory.h index 20f6de2a031..fa501f79409 100644 --- a/chromium/third_party/blink/public/platform/modules/mediastream/web_media_stream_renderer_factory.h +++ b/chromium/third_party/blink/public/platform/modules/mediastream/web_media_stream_renderer_factory.h @@ -31,14 +31,14 @@ class WebMediaStreamRendererFactory { // Returns a WebMediaStreamVideoRenderer that uses the given task runners. // |io_task_runner| is used for passing video frames. virtual scoped_refptr<WebMediaStreamVideoRenderer> GetVideoRenderer( - const blink::WebMediaStream& web_stream, + const WebMediaStream& web_stream, const base::Closure& error_cb, const WebMediaStreamVideoRenderer::RepaintCB& repaint_cb, scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, scoped_refptr<base::SingleThreadTaskRunner> main_render_task_runner) = 0; virtual scoped_refptr<WebMediaStreamAudioRenderer> GetAudioRenderer( - const blink::WebMediaStream& web_stream, + const WebMediaStream& web_stream, int render_frame_id, const std::string& device_id) = 0; }; diff --git a/chromium/third_party/blink/public/platform/modules/mediastream/web_media_stream_sink.h b/chromium/third_party/blink/public/platform/modules/mediastream/web_media_stream_sink.h index d7b64758030..3228996069e 100644 --- a/chromium/third_party/blink/public/platform/modules/mediastream/web_media_stream_sink.h +++ b/chromium/third_party/blink/public/platform/modules/mediastream/web_media_stream_sink.h @@ -13,15 +13,14 @@ namespace blink { // MediaStreamSink is the base interface for MediaStreamAudioSink and // MediaStreamVideoSink. It allows an implementation to receive notifications -// about state changes on a blink::WebMediaStreamSource object or such an -// object underlying a blink::WebMediaStreamTrack. +// about state changes on a WebMediaStreamSource object or such an +// object underlying a WebMediaStreamTrack. class BLINK_PLATFORM_EXPORT WebMediaStreamSink { public: - virtual void OnReadyStateChanged( - blink::WebMediaStreamSource::ReadyState state) {} + virtual void OnReadyStateChanged(WebMediaStreamSource::ReadyState state) {} virtual void OnEnabledChanged(bool enabled) {} virtual void OnContentHintChanged( - blink::WebMediaStreamTrack::ContentHintType content_hint) {} + WebMediaStreamTrack::ContentHintType content_hint) {} protected: virtual ~WebMediaStreamSink() {} diff --git a/chromium/third_party/blink/public/platform/modules/mediastream/web_platform_media_stream_source.h b/chromium/third_party/blink/public/platform/modules/mediastream/web_platform_media_stream_source.h index 5dcf0400094..c0ae2411f5f 100644 --- a/chromium/third_party/blink/public/platform/modules/mediastream/web_platform_media_stream_source.h +++ b/chromium/third_party/blink/public/platform/modules/mediastream/web_platform_media_stream_source.h @@ -88,9 +88,9 @@ class BLINK_PLATFORM_EXPORT WebPlatformMediaStreamSource { private: MediaStreamDevice device_; SourceStoppedCallback stop_callback_; - blink::WebPrivatePtr<MediaStreamSource, - kWebPrivatePtrDestructionSameThread, - WebPrivatePtrStrength::kWeak> + WebPrivatePtr<MediaStreamSource, + kWebPrivatePtrDestructionSameThread, + WebPrivatePtrStrength::kWeak> owner_; DISALLOW_COPY_AND_ASSIGN(WebPlatformMediaStreamSource); diff --git a/chromium/third_party/blink/public/platform/modules/mediastream/web_platform_media_stream_track.h b/chromium/third_party/blink/public/platform/modules/mediastream/web_platform_media_stream_track.h index cb89fb10ae1..c74a1ce7612 100644 --- a/chromium/third_party/blink/public/platform/modules/mediastream/web_platform_media_stream_track.h +++ b/chromium/third_party/blink/public/platform/modules/mediastream/web_platform_media_stream_track.h @@ -14,19 +14,19 @@ namespace blink { // WebPlatformMediaStreamTrack is a low-level object backing a -// blink::WebMediaStreamTrack. +// WebMediaStreamTrack. class BLINK_PLATFORM_EXPORT WebPlatformMediaStreamTrack { public: explicit WebPlatformMediaStreamTrack(bool is_local_track); virtual ~WebPlatformMediaStreamTrack(); static WebPlatformMediaStreamTrack* GetTrack( - const blink::WebMediaStreamTrack& track); + const WebMediaStreamTrack& track); virtual void SetEnabled(bool enabled) = 0; virtual void SetContentHint( - blink::WebMediaStreamTrack::ContentHintType content_hint) = 0; + WebMediaStreamTrack::ContentHintType content_hint) = 0; // If |callback| is not null, it is invoked when the track has stopped. virtual void StopAndNotify(base::OnceClosure callback) = 0; @@ -34,7 +34,7 @@ class BLINK_PLATFORM_EXPORT WebPlatformMediaStreamTrack { void Stop() { StopAndNotify(base::OnceClosure()); } // TODO(hta): Make method pure virtual when all tracks have the method. - virtual void GetSettings(blink::WebMediaStreamTrack::Settings& settings) {} + virtual void GetSettings(WebMediaStreamTrack::Settings& settings) {} bool is_local_track() const { return is_local_track_; } diff --git a/chromium/third_party/blink/public/platform/modules/notifications/OWNERS b/chromium/third_party/blink/public/platform/modules/notifications/OWNERS index a6e3ecef43c..2fd0e4bec55 100644 --- a/chromium/third_party/blink/public/platform/modules/notifications/OWNERS +++ b/chromium/third_party/blink/public/platform/modules/notifications/OWNERS @@ -1,10 +1,4 @@ peter@chromium.org -per-file *.mojom=set noparent -per-file *.mojom=file://ipc/SECURITY_OWNERS - -per-file *.typemap=set noparent -per-file *.typemap=file://ipc/SECURITY_OWNERS - # TEAM: platform-capabilities@chromium.org # COMPONENT: UI>Notifications diff --git a/chromium/third_party/blink/public/platform/modules/payments/web_payment_item.h b/chromium/third_party/blink/public/platform/modules/payments/web_payment_item.h index 715e5ab6096..f271eedcfe9 100644 --- a/chromium/third_party/blink/public/platform/modules/payments/web_payment_item.h +++ b/chromium/third_party/blink/public/platform/modules/payments/web_payment_item.h @@ -14,7 +14,7 @@ namespace blink { struct WebPaymentItem { WebString label; WebPaymentCurrencyAmount amount; - bool pending; + bool pending = false; }; } // namespace blink diff --git a/chromium/third_party/blink/public/platform/modules/service_worker/web_service_worker_network_provider.h b/chromium/third_party/blink/public/platform/modules/service_worker/web_service_worker_network_provider.h index 80303edcd46..4a78b8880b0 100644 --- a/chromium/third_party/blink/public/platform/modules/service_worker/web_service_worker_network_provider.h +++ b/chromium/third_party/blink/public/platform/modules/service_worker/web_service_worker_network_provider.h @@ -34,7 +34,7 @@ #include <memory> #include "base/memory/scoped_refptr.h" -#include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom-shared.h" +#include "third_party/blink/public/mojom/service_worker/controller_service_worker_mode.mojom-shared.h" #include "third_party/blink/public/platform/scheduler/web_resource_loading_task_runner_handle.h" #include "third_party/blink/public/platform/web_url_loader.h" @@ -62,7 +62,6 @@ class WebServiceWorkerNetworkProvider { // request made. virtual void WillSendRequest(WebURLRequest&) = 0; - // S13nServiceWorker: // Returns a URLLoader for loading |request|. May return nullptr to fall back // to the default loading behavior. virtual std::unique_ptr<WebURLLoader> CreateURLLoader( diff --git a/chromium/third_party/blink/public/platform/modules/service_worker/web_service_worker_provider.h b/chromium/third_party/blink/public/platform/modules/service_worker/web_service_worker_provider.h index 711006cf109..4be145738c9 100644 --- a/chromium/third_party/blink/public/platform/modules/service_worker/web_service_worker_provider.h +++ b/chromium/third_party/blink/public/platform/modules/service_worker/web_service_worker_provider.h @@ -74,8 +74,8 @@ class WebServiceWorkerProvider { using WebServiceWorkerGetRegistrationsCallbacks = WebCallbacks<WebVector<WebServiceWorkerRegistrationObjectInfo>, const WebServiceWorkerError&>; - using WebServiceWorkerGetRegistrationForReadyCallbacks = - WebCallbacks<WebServiceWorkerRegistrationObjectInfo, void>; + using GetRegistrationForReadyCallback = + base::OnceCallback<void(WebServiceWorkerRegistrationObjectInfo)>; // For ServiceWorkerContainer#register(). Requests the embedder to register a // service worker. @@ -98,8 +98,7 @@ class WebServiceWorkerProvider { std::unique_ptr<WebServiceWorkerGetRegistrationsCallbacks>) {} // For ServiceWorkerContainer#ready. Requests the embedder to return the // ready registration. - virtual void GetRegistrationForReady( - std::unique_ptr<WebServiceWorkerGetRegistrationForReadyCallbacks>) {} + virtual void GetRegistrationForReady(GetRegistrationForReadyCallback) {} // Helper function for checking URLs. The |scope| and |script_url| cannot // include escape sequences for "/" or "\" as per spec, as they would break // would the path restriction. diff --git a/chromium/third_party/blink/public/platform/modules/service_worker/web_service_worker_request.h b/chromium/third_party/blink/public/platform/modules/service_worker/web_service_worker_request.h index 1c8588a0c09..b9fb3646b8e 100644 --- a/chromium/third_party/blink/public/platform/modules/service_worker/web_service_worker_request.h +++ b/chromium/third_party/blink/public/platform/modules/service_worker/web_service_worker_request.h @@ -65,7 +65,7 @@ class BLINK_PLATFORM_EXPORT WebServiceWorkerRequest { // with a comma delimiter between them. void AppendHeader(const WebString& key, const WebString& value); - void VisitHTTPHeaderFields(WebHTTPHeaderVisitor*) const; + void VisitHttpHeaderFields(WebHTTPHeaderVisitor*) const; void SetBody(const WebHTTPBody&); WebHTTPBody Body() const; diff --git a/chromium/third_party/blink/public/platform/modules/service_worker/web_service_worker_response.h b/chromium/third_party/blink/public/platform/modules/service_worker/web_service_worker_response.h index 464a3b57177..43bf1422de3 100644 --- a/chromium/third_party/blink/public/platform/modules/service_worker/web_service_worker_response.h +++ b/chromium/third_party/blink/public/platform/modules/service_worker/web_service_worker_response.h @@ -70,7 +70,7 @@ class BLINK_PLATFORM_EXPORT WebServiceWorkerResponse { WebVector<WebString> GetHeaderKeys() const; WebString GetHeader(const WebString& key) const; - void VisitHTTPHeaderFields(WebHTTPHeaderVisitor*) const; + void VisitHttpHeaderFields(WebHTTPHeaderVisitor*) const; void SetBlob(const WebString& uuid, uint64_t size, diff --git a/chromium/third_party/blink/public/platform/platform.h b/chromium/third_party/blink/public/platform/platform.h index e89fff83c1c..198d6649ef4 100644 --- a/chromium/third_party/blink/public/platform/platform.h +++ b/chromium/third_party/blink/public/platform/platform.h @@ -31,12 +31,9 @@ #ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_PLATFORM_H_ #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_PLATFORM_H_ -#ifdef WIN32 -#include <windows.h> -#endif - #include <memory> +#include "base/files/file.h" #include "base/memory/scoped_refptr.h" #include "base/metrics/user_metrics_action.h" #include "base/strings/string_piece.h" @@ -133,6 +130,7 @@ class WebSpeechSynthesizer; class WebSpeechSynthesizerClient; class WebStorageNamespace; class WebThemeEngine; +class WebTransmissionEncodingInfoHandler; class WebURLLoaderMockFactory; class WebURLResponse; class WebURLResponse; @@ -144,14 +142,6 @@ class WebThreadScheduler; class BLINK_PLATFORM_EXPORT Platform { public: -// HTML5 Database ------------------------------------------------------ - -#ifdef WIN32 - typedef HANDLE FileHandle; -#else - typedef int FileHandle; -#endif - // Initialize platform and wtf. If you need to initialize the entire Blink, // you should use blink::Initialize. WebThreadScheduler must be owned by // the embedder. @@ -229,12 +219,12 @@ class BLINK_PLATFORM_EXPORT Platform { // Must return non-null. virtual WebBlobRegistry* GetBlobRegistry() { return nullptr; } - // Database ------------------------------------------------------------ + // Database (WebSQL) --------------------------------------------------- // Opens a database file. - virtual FileHandle DatabaseOpenFile(const WebString& vfs_file_name, + virtual base::File DatabaseOpenFile(const WebString& vfs_file_name, int desired_flags) { - return FileHandle(); + return base::File(); } // Deletes a database file and returns the error code. @@ -244,24 +234,24 @@ class BLINK_PLATFORM_EXPORT Platform { } // Returns the attributes of the given database file. - virtual long DatabaseGetFileAttributes(const WebString& vfs_file_name) { + virtual int32_t DatabaseGetFileAttributes(const WebString& vfs_file_name) { return 0; } // Returns the size of the given database file. - virtual long long DatabaseGetFileSize(const WebString& vfs_file_name) { + virtual int64_t DatabaseGetFileSize(const WebString& vfs_file_name) { return 0; } // Returns the space available for the given origin. - virtual long long DatabaseGetSpaceAvailableForOrigin( + virtual int64_t DatabaseGetSpaceAvailableForOrigin( const WebSecurityOrigin& origin) { return 0; } // Set the size of the given database file. virtual bool DatabaseSetFileSize(const WebString& vfs_file_name, - long long size) { + int64_t size) { return false; } @@ -296,14 +286,13 @@ class BLINK_PLATFORM_EXPORT Platform { // Returns the hash for the given canonicalized URL for use in visited // link coloring. - virtual unsigned long long VisitedLinkHash(const char* canonical_url, - size_t length) { + virtual uint64_t VisitedLinkHash(const char* canonical_url, size_t length) { return 0; } // Returns whether the given link hash is in the user's history. The // hash must have been generated by calling VisitedLinkHash(). - virtual bool IsLinkVisited(unsigned long long link_hash) { return false; } + virtual bool IsLinkVisited(uint64_t link_hash) { return false; } static const size_t kNoDecodedImageByteLimit = static_cast<size_t>(-1); @@ -538,6 +527,7 @@ class BLINK_PLATFORM_EXPORT Platform { kWebGPUContextType, // WebGPU context }; struct ContextAttributes { + bool prefer_integrated_gpu = false; bool fail_if_major_performance_caveat = false; ContextType context_type = kGLES2ContextType; // Offscreen contexts usually share a surface for the default frame buffer @@ -659,8 +649,10 @@ class BLINK_PLATFORM_EXPORT Platform { WebMediaStream*, WebMediaPlayer*, scoped_refptr<base::SingleThreadTaskRunner>) {} - virtual void CreateHTMLAudioElementCapturer(WebMediaStream*, - WebMediaPlayer*) {} + virtual void CreateHTMLAudioElementCapturer( + WebMediaStream*, + WebMediaPlayer*, + scoped_refptr<base::SingleThreadTaskRunner>) {} // Creates a WebImageCaptureFrameGrabber to take a snapshot of a Video Tracks. // May return null if the functionality is not available. @@ -676,6 +668,10 @@ class BLINK_PLATFORM_EXPORT Platform { virtual void UpdateWebRTCAPICount(WebRTCAPIName api_name) {} + virtual base::Optional<double> GetWebRtcMaxCaptureFrameRate() { + return base::nullopt; + } + // WebWorker ---------------------------------------------------------- virtual std::unique_ptr<WebDedicatedWorkerHostFactoryClient> @@ -717,6 +713,15 @@ class BLINK_PLATFORM_EXPORT Platform { return nullptr; } + virtual WebTransmissionEncodingInfoHandler* + TransmissionEncodingInfoHandler() { + return nullptr; + } + + // Renderer Memory Metrics ---------------------------------------------- + + virtual void RecordMetricsForBackgroundedRendererPurge() {} + // V8 Context Snapshot -------------------------------------------------- // This method returns true only when diff --git a/chromium/third_party/blink/public/platform/scheduler/web_rail_mode_observer.h b/chromium/third_party/blink/public/platform/scheduler/web_rail_mode_observer.h index 0e2012f9677..b7d9cdfd512 100644 --- a/chromium/third_party/blink/public/platform/scheduler/web_rail_mode_observer.h +++ b/chromium/third_party/blink/public/platform/scheduler/web_rail_mode_observer.h @@ -7,18 +7,10 @@ #include "third_party/blink/public/platform/web_common.h" -namespace v8 { -enum RAILMode : unsigned; -} - namespace blink { namespace scheduler { -class BLINK_PLATFORM_EXPORT WebRAILModeObserver { - public: - virtual ~WebRAILModeObserver() = default; - virtual void OnRAILModeChanged(v8::RAILMode rail_mode) = 0; -}; + } // namespace scheduler } // namespace blink diff --git a/chromium/third_party/blink/public/platform/scheduler/web_thread_scheduler.h b/chromium/third_party/blink/public/platform/scheduler/web_thread_scheduler.h index 7043dd4943c..a70c25cf5af 100644 --- a/chromium/third_party/blink/public/platform/scheduler/web_thread_scheduler.h +++ b/chromium/third_party/blink/public/platform/scheduler/web_thread_scheduler.h @@ -84,6 +84,12 @@ class BLINK_PLATFORM_EXPORT WebThreadScheduler { // Returns the cleanup task runner, which is for cleaning up. virtual scoped_refptr<base::SingleThreadTaskRunner> CleanupTaskRunner(); + // Returns a default task runner. This is basically same as the default task + // runner, but is explicitly allowed to run JavaScript. For the detail, see + // the comment at blink::ThreadScheduler::DeprecatedDefaultTaskRunner. + virtual scoped_refptr<base::SingleThreadTaskRunner> + DeprecatedDefaultTaskRunner(); + // Creates a WebThread implementation for the renderer main thread. virtual std::unique_ptr<Thread> CreateMainThread(); @@ -212,13 +218,6 @@ class BLINK_PLATFORM_EXPORT WebThreadScheduler { virtual void SetTopLevelBlameContext( base::trace_event::BlameContext* blame_context); - // The renderer scheduler maintains an estimated RAIL mode[1]. This observer - // can be used to get notified when the mode changes. The observer will be - // called on the main thread and must outlive this class. - // [1] - // https://developers.google.com/web/tools/chrome-devtools/profile/evaluate-performance/rail - virtual void AddRAILModeObserver(WebRAILModeObserver* observer); - // Sets the kind of renderer process. Should be called on the main thread // once. virtual void SetRendererProcessType(WebRendererProcessType type); diff --git a/chromium/third_party/blink/public/platform/task_type.h b/chromium/third_party/blink/public/platform/task_type.h index 4d9e491279e..32333c196d5 100644 --- a/chromium/third_party/blink/public/platform/task_type.h +++ b/chromium/third_party/blink/public/platform/task_type.h @@ -14,7 +14,7 @@ namespace blink { // // When a new task type is created, use kCount value as a new value, // the tools/metrics/histograms/enums.xml shall also be updated. -enum class TaskType : unsigned { +enum class TaskType : unsigned char { /////////////////////////////////////// // Speced tasks should use one of the following task types /////////////////////////////////////// @@ -202,6 +202,9 @@ enum class TaskType : unsigned { // Task used for ContentCapture. kInternalContentCapture = 61, + // Task used for Navigations. + kInternalNavigation = 63, + /////////////////////////////////////// // The following task types are only for thread-local queues. /////////////////////////////////////// @@ -214,13 +217,14 @@ enum class TaskType : unsigned { kMainThreadTaskQueueIPC = 42, kMainThreadTaskQueueControl = 43, kMainThreadTaskQueueCleanup = 52, + kMainThreadTaskQueueMemoryPurge = 62, kCompositorThreadTaskQueueDefault = 45, kCompositorThreadTaskQueueInput = 49, kWorkerThreadTaskQueueDefault = 46, kWorkerThreadTaskQueueV8 = 47, kWorkerThreadTaskQueueCompositor = 48, - kCount = 62, + kCount = 64, }; } // namespace blink diff --git a/chromium/third_party/blink/public/platform/web_application_cache_host.h b/chromium/third_party/blink/public/platform/web_application_cache_host.h index d6aa1da35d9..e9032c152ea 100644 --- a/chromium/third_party/blink/public/platform/web_application_cache_host.h +++ b/chromium/third_party/blink/public/platform/web_application_cache_host.h @@ -83,19 +83,32 @@ class WebApplicationCacheHost { WebURL manifest_url; // Empty if there is no associated cache. double creation_time; double update_time; - long long total_size; - CacheInfo() : creation_time(0), update_time(0), total_size(0) {} + // Sums up the sizes of all the responses in this cache. + int64_t response_sizes; + // Sums up the padding sizes for all opaque responses in the cache. + int64_t padding_sizes; + CacheInfo() + : creation_time(0), + update_time(0), + response_sizes(0), + padding_sizes(0) {} }; struct ResourceInfo { WebURL url; - long long size; + // Disk space consumed by this resource. + int64_t response_size; + // Padding added when the Quota API counts this resource. + // + // Non-zero only for opaque responses. + int64_t padding_size; bool is_master; bool is_manifest; bool is_explicit; bool is_foreign; bool is_fallback; ResourceInfo() - : size(0), + : response_size(0), + padding_size(0), is_master(false), is_manifest(false), is_explicit(false), diff --git a/chromium/third_party/blink/public/platform/web_callbacks.h b/chromium/third_party/blink/public/platform/web_callbacks.h index 0bf35efe6bc..f7e9866c226 100644 --- a/chromium/third_party/blink/public/platform/web_callbacks.h +++ b/chromium/third_party/blink/public/platform/web_callbacks.h @@ -49,14 +49,6 @@ class WebCallbacks { virtual void OnError(T) {} }; -template <typename T> -class WebCallbacks<void, T> { - public: - virtual ~WebCallbacks() = default; - virtual void OnSuccess() {} - virtual void OnError(T) {} -}; - template <typename S> class WebCallbacks<S, void> { public: @@ -65,14 +57,6 @@ class WebCallbacks<S, void> { virtual void OnError() {} }; -template <> -class WebCallbacks<void, void> { - public: - virtual ~WebCallbacks() = default; - virtual void OnSuccess() {} - virtual void OnError() {} -}; - } // namespace blink #endif diff --git a/chromium/third_party/blink/public/platform/web_canonical_cookie.h b/chromium/third_party/blink/public/platform/web_canonical_cookie.h index a19d999936e..a50716c29d2 100644 --- a/chromium/third_party/blink/public/platform/web_canonical_cookie.h +++ b/chromium/third_party/blink/public/platform/web_canonical_cookie.h @@ -59,8 +59,6 @@ class BLINK_PLATFORM_EXPORT WebCanonicalCookie { const WebString& cookie_line, base::Time creation_time); - static constexpr const network::mojom::CookieSameSite kDefaultSameSiteMode = - network::mojom::CookieSameSite::NO_RESTRICTION; static constexpr const network::mojom::CookiePriority kDefaultPriority = network::mojom::CookiePriority::MEDIUM; @@ -88,7 +86,8 @@ class BLINK_PLATFORM_EXPORT WebCanonicalCookie { base::Time last_access_; bool is_secure_ = false; bool is_http_only_ = false; - network::mojom::CookieSameSite same_site_ = kDefaultSameSiteMode; + network::mojom::CookieSameSite same_site_ = + network::mojom::CookieSameSite::NO_RESTRICTION; network::mojom::CookiePriority priority_ = kDefaultPriority; }; diff --git a/chromium/third_party/blink/public/platform/web_content_decryption_module_result.h b/chromium/third_party/blink/public/platform/web_content_decryption_module_result.h index 4af42b1457f..0d65735c72c 100644 --- a/chromium/third_party/blink/public/platform/web_content_decryption_module_result.h +++ b/chromium/third_party/blink/public/platform/web_content_decryption_module_result.h @@ -60,7 +60,7 @@ class WebContentDecryptionModuleResult { // Called when the operation fails. BLINK_PLATFORM_EXPORT void CompleteWithError( WebContentDecryptionModuleException, - unsigned long system_code, + uint32_t system_code, const WebString& message); #if INSIDE_BLINK diff --git a/chromium/third_party/blink/public/platform/web_content_settings_client.h b/chromium/third_party/blink/public/platform/web_content_settings_client.h index d7da22cde33..39d76ac9336 100644 --- a/chromium/third_party/blink/public/platform/web_content_settings_client.h +++ b/chromium/third_party/blink/public/platform/web_content_settings_client.h @@ -45,6 +45,9 @@ class WebContentSettingsClient { // Controls whether access to Indexed DB are allowed for this frame. virtual bool AllowIndexedDB(const WebSecurityOrigin&) { return true; } + // Controls whether access to CacheStorage is allowed for this frame. + virtual bool AllowCacheStorage(const WebSecurityOrigin&) { return true; } + // Controls whether scripts are allowed to execute for this frame. virtual bool AllowScript(bool enabled_per_settings) { return enabled_per_settings; diff --git a/chromium/third_party/blink/public/platform/web_crypto.h b/chromium/third_party/blink/public/platform/web_crypto.h index f2f2dd4eb36..570ebc77e7a 100644 --- a/chromium/third_party/blink/public/platform/web_crypto.h +++ b/chromium/third_party/blink/public/platform/web_crypto.h @@ -109,31 +109,6 @@ class WebCryptoResult { cancel_; }; -class WebCryptoDigestor { - public: - virtual ~WebCryptoDigestor() = default; - - // Consume() will return |true| on the successful addition of data to the - // partially generated digest. It will return |false| when that fails. After - // a return of |false|, Consume() should not be called again (nor should - // Finish() be called). - virtual bool Consume(const unsigned char* data, unsigned data_size) { - return false; - } - - // Finish() will return |true| if the digest has been successfully computed - // and put into the result buffer, otherwise it will return |false|. In - // either case, neither Finish() nor Consume() should be called again after - // a call to Finish(). |result_data| is valid until the WebCrytpoDigestor - // object is destroyed. - virtual bool Finish(unsigned char*& result_data, unsigned& result_data_size) { - return false; - } - - protected: - WebCryptoDigestor() = default; -}; - class WebCrypto { public: // WebCrypto is the interface for starting one-shot cryptographic @@ -308,15 +283,6 @@ class WebCrypto { result.CompleteWithError(kWebCryptoErrorTypeNotSupported, ""); } - // This is the exception to the "Completing the request" guarantees - // outlined above. This is useful for Blink internal crypto and is not part - // of the WebCrypto standard. CreateDigestor must provide the result via - // the WebCryptoDigestor object synchronously. This will never return null. - virtual std::unique_ptr<WebCryptoDigestor> CreateDigestor( - WebCryptoAlgorithmId algorithm_id) { - return nullptr; - } - // ----------------------- // Structured clone // ----------------------- diff --git a/chromium/third_party/blink/public/platform/web_database_observer.h b/chromium/third_party/blink/public/platform/web_database_observer.h index 7bd01496e67..607d6379b2e 100644 --- a/chromium/third_party/blink/public/platform/web_database_observer.h +++ b/chromium/third_party/blink/public/platform/web_database_observer.h @@ -43,7 +43,7 @@ class WebDatabaseObserver { virtual void DatabaseOpened(const WebSecurityOrigin&, const WebString& database_name, const WebString& database_display_name, - unsigned long estimated_size) = 0; + uint32_t estimated_size) = 0; virtual void DatabaseModified(const WebSecurityOrigin&, const WebString& database_name) = 0; virtual void DatabaseClosed(const WebSecurityOrigin&, diff --git a/chromium/third_party/blink/public/platform/web_dedicated_worker_host_factory_client.h b/chromium/third_party/blink/public/platform/web_dedicated_worker_host_factory_client.h index a296155a344..6db8689caec 100644 --- a/chromium/third_party/blink/public/platform/web_dedicated_worker_host_factory_client.h +++ b/chromium/third_party/blink/public/platform/web_dedicated_worker_host_factory_client.h @@ -19,6 +19,11 @@ class WebDedicatedWorkerHostFactoryClient { virtual ~WebDedicatedWorkerHostFactoryClient() = default; // Requests the creation of DedicatedWorkerHost in the browser process. + // For non-PlzDedicatedWorker. This will be removed once PlzDedicatedWorker is + // enabled by default. + virtual void CreateWorkerHostDeprecated( + const blink::WebSecurityOrigin& script_origin) = 0; + // For PlzDedicatedWorker. virtual void CreateWorkerHost( const blink::WebURL& script_url, const blink::WebSecurityOrigin& script_origin, diff --git a/chromium/third_party/blink/public/platform/web_drag_data.h b/chromium/third_party/blink/public/platform/web_drag_data.h index b9002a5eaf8..2b4dcbae081 100644 --- a/chromium/third_party/blink/public/platform/web_drag_data.h +++ b/chromium/third_party/blink/public/platform/web_drag_data.h @@ -86,7 +86,7 @@ class WebDragData { // Only valid when storage_type == kStorageTypeFileSystemFile. WebURL file_system_url; - long long file_system_file_size; + int64_t file_system_file_size; WebString file_system_id; }; diff --git a/chromium/third_party/blink/public/platform/web_encrypted_media_request.h b/chromium/third_party/blink/public/platform/web_encrypted_media_request.h index d50f362d1b2..270567e96d6 100644 --- a/chromium/third_party/blink/public/platform/web_encrypted_media_request.h +++ b/chromium/third_party/blink/public/platform/web_encrypted_media_request.h @@ -6,13 +6,15 @@ #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_ENCRYPTED_MEDIA_REQUEST_H_ #include "third_party/blink/public/platform/web_common.h" +#include "third_party/blink/public/platform/web_content_decryption_module_access.h" #include "third_party/blink/public/platform/web_private_ptr.h" #include "third_party/blink/public/platform/web_string.h" +#include <memory> + namespace blink { class EncryptedMediaRequest; -class WebContentDecryptionModuleAccess; struct WebMediaKeySystemConfiguration; class WebSecurityOrigin; template <typename T> @@ -31,7 +33,7 @@ class WebEncryptedMediaRequest { BLINK_PLATFORM_EXPORT WebSecurityOrigin GetSecurityOrigin() const; BLINK_PLATFORM_EXPORT void RequestSucceeded( - WebContentDecryptionModuleAccess*); + std::unique_ptr<WebContentDecryptionModuleAccess>); BLINK_PLATFORM_EXPORT void RequestNotSupported( const WebString& error_message); diff --git a/chromium/third_party/blink/public/platform/web_focus_type.h b/chromium/third_party/blink/public/platform/web_focus_type.h index 7fe423cb926..69e5fd55011 100644 --- a/chromium/third_party/blink/public/platform/web_focus_type.h +++ b/chromium/third_party/blink/public/platform/web_focus_type.h @@ -46,6 +46,8 @@ enum WebFocusType { kWebFocusTypeSpatialNavigation, // Mouse press kWebFocusTypeMouse, + // Access key + kWebFocusTypeAccessKey, // Re-focus by a page focus kWebFocusTypePage, diff --git a/chromium/third_party/blink/public/platform/web_font_description.h b/chromium/third_party/blink/public/platform/web_font_description.h index cd493dfedad..965d3887a3f 100644 --- a/chromium/third_party/blink/public/platform/web_font_description.h +++ b/chromium/third_party/blink/public/platform/web_font_description.h @@ -48,13 +48,6 @@ struct WebFontDescription { kGenericFamilyFantasy }; - enum Smoothing { - kSmoothingAuto, - kSmoothingNone, - kSmoothingGrayscale, - kSmoothingSubpixel - }; - enum Weight { kWeight100, kWeight200, @@ -75,7 +68,6 @@ struct WebFontDescription { italic(false), small_caps(false), weight(kWeightNormal), - smoothing(kSmoothingAuto), letter_spacing(0), word_spacing(0) {} @@ -85,7 +77,6 @@ struct WebFontDescription { bool italic; bool small_caps; Weight weight; - Smoothing smoothing; int16_t letter_spacing; int16_t word_spacing; diff --git a/chromium/third_party/blink/public/platform/web_gesture_device.h b/chromium/third_party/blink/public/platform/web_gesture_device.h index f958abaf61f..973ebfb4b42 100644 --- a/chromium/third_party/blink/public/platform/web_gesture_device.h +++ b/chromium/third_party/blink/public/platform/web_gesture_device.h @@ -28,13 +28,20 @@ namespace blink { -enum WebGestureDevice { - kWebGestureDeviceUninitialized, - kWebGestureDeviceTouchpad, - kWebGestureDeviceTouchscreen, - kWebGestureDeviceSyntheticAutoscroll, +enum class WebGestureDevice { + kUninitialized, + kTouchpad, + kTouchscreen, + kSyntheticAutoscroll, - kWebGestureDeviceCount, + // This is the device type used when generating synthetic gesture scrolls for + // compositor thread scrollbar scrolling. Please refer to + // ui::InputHandlerProxy::InjectScrollbarGestureScroll to see how this is + // consumed. Explainer: + // https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/master/Scrolling/ImplScrollbars/dev-diagram.md + kScrollbar, + + kMaxValue = kScrollbar, }; } // namespace blink diff --git a/chromium/third_party/blink/public/platform/web_gesture_event.h b/chromium/third_party/blink/public/platform/web_gesture_event.h index 33303f79af7..e705bb74a1f 100644 --- a/chromium/third_party/blink/public/platform/web_gesture_event.h +++ b/chromium/third_party/blink/public/platform/web_gesture_event.h @@ -38,11 +38,11 @@ class WebGestureEvent : public WebInputEvent { WebPointerProperties::PointerType primary_pointer_type = WebPointerProperties::PointerType::kUnknown; - // If the WebGestureEvent has source_device == kWebGestureDeviceTouchscreen, + // If the WebGestureEvent has source_device == WebGestureDevice::kTouchscreen, // this field contains the unique identifier for the touch event that released // this event at TouchDispositionGestureFilter. If the WebGestureEvents was // not released through a touch event (e.g. timer-released gesture events or - // gesture events with source_device != kWebGestureDeviceTouchscreen), the + // gesture events with source_device != WebGestureDevice::kTouchscreen), the // field contains 0. See crbug.com/618738. uint32_t unique_touch_event_id; @@ -112,12 +112,6 @@ class WebGestureEvent : public WebInputEvent { float delta_y; float velocity_x; float velocity_y; - // Whether any previous GestureScrollUpdate in the current scroll - // sequence was suppressed (e.g., the causal touchmove was - // preventDefault'ed). This bit is particularly useful for - // determining whether the observed scroll update sequence captures - // the entirety of the generative motion. - bool previous_update_in_sequence_prevented; InertialPhaseState inertial_phase; // Default initialized to ScrollUnits::PrecisePixels. ScrollUnits delta_units; @@ -200,7 +194,7 @@ class WebGestureEvent : public WebInputEvent { WebGestureEvent(Type type, int modifiers, base::TimeTicks time_stamp, - WebGestureDevice device = kWebGestureDeviceUninitialized) + WebGestureDevice device = WebGestureDevice::kUninitialized) : WebInputEvent(sizeof(WebGestureEvent), type, modifiers, time_stamp), resending_plugin_id(-1), source_device_(device) {} @@ -208,7 +202,7 @@ class WebGestureEvent : public WebInputEvent { WebGestureEvent() : WebInputEvent(sizeof(WebGestureEvent)), resending_plugin_id(-1), - source_device_(kWebGestureDeviceUninitialized) {} + source_device_(WebGestureDevice::kUninitialized) {} const WebFloatPoint& PositionInWidget() const { return position_in_widget_; } const WebFloatPoint& PositionInScreen() const { return position_in_screen_; } @@ -288,7 +282,7 @@ class WebGestureEvent : public WebInputEvent { bool IsTouchpadZoomEvent() const { // Touchpad GestureDoubleTap also causes a page scale change like a touchpad // pinch gesture. - return source_device_ == WebGestureDevice::kWebGestureDeviceTouchpad && + return source_device_ == WebGestureDevice::kTouchpad && (WebInputEvent::IsPinchGestureEventType(type_) || type_ == kGestureDoubleTap); } diff --git a/chromium/third_party/blink/public/platform/web_graphics_context_3d_provider.h b/chromium/third_party/blink/public/platform/web_graphics_context_3d_provider.h index 8e9022bc5ca..14b20a3d6dd 100644 --- a/chromium/third_party/blink/public/platform/web_graphics_context_3d_provider.h +++ b/chromium/third_party/blink/public/platform/web_graphics_context_3d_provider.h @@ -69,7 +69,6 @@ class WebGraphicsContext3DProvider { virtual gpu::webgpu::WebGPUInterface* WebGPUInterface() = 0; virtual bool BindToCurrentThread() = 0; virtual GrContext* GetGrContext() = 0; - virtual gpu::SharedImageInterface* GetSharedImageInterface() const = 0; virtual const gpu::Capabilities& GetCapabilities() const = 0; virtual const gpu::GpuFeatureInfo& GetGpuFeatureInfo() const = 0; // Creates a viz::GLHelper after first call and returns that instance. This diff --git a/chromium/third_party/blink/public/platform/web_http_body.h b/chromium/third_party/blink/public/platform/web_http_body.h index f9bbffea08b..d57d602348d 100644 --- a/chromium/third_party/blink/public/platform/web_http_body.h +++ b/chromium/third_party/blink/public/platform/web_http_body.h @@ -55,8 +55,8 @@ class WebHTTPBody { } type; WebData data; WebString file_path; - long long file_start; - long long file_length; // -1 means to the end of the file. + int64_t file_start; + int64_t file_length; // -1 means to the end of the file. double modification_time; WebString blob_uuid; uint64_t blob_length; @@ -94,8 +94,8 @@ class WebHTTPBody { BLINK_PLATFORM_EXPORT void AppendFile(const WebString&); // Passing -1 to |file_length| means to the end of the file. BLINK_PLATFORM_EXPORT void AppendFileRange(const WebString&, - long long file_start, - long long file_length, + int64_t file_start, + int64_t file_length, double modification_time); BLINK_PLATFORM_EXPORT void AppendBlob(const WebString& uuid); // TODO(shimazu): Remove this once Network Service is enabled. @@ -113,8 +113,8 @@ class WebHTTPBody { // Identifies a particular form submission instance. A value of 0 is // used to indicate an unspecified identifier. - BLINK_PLATFORM_EXPORT long long Identifier() const; - BLINK_PLATFORM_EXPORT void SetIdentifier(long long); + BLINK_PLATFORM_EXPORT int64_t Identifier() const; + BLINK_PLATFORM_EXPORT void SetIdentifier(int64_t); BLINK_PLATFORM_EXPORT bool ContainsPasswordData() const; BLINK_PLATFORM_EXPORT void SetContainsPasswordData(bool); diff --git a/chromium/third_party/blink/public/platform/web_layer_tree_view.h b/chromium/third_party/blink/public/platform/web_layer_tree_view.h index 931b0b52503..38bd2c187db 100644 --- a/chromium/third_party/blink/public/platform/web_layer_tree_view.h +++ b/chromium/third_party/blink/public/platform/web_layer_tree_view.h @@ -29,7 +29,6 @@ #include "base/callback.h" #include "cc/input/browser_controls_state.h" #include "cc/input/event_listener_properties.h" -#include "cc/input/overscroll_behavior.h" #include "cc/layers/layer.h" #include "cc/paint/paint_worklet_layer_painter.h" #include "cc/trees/element_id.h" @@ -41,61 +40,15 @@ #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkRefCnt.h" -class SkBitmap; - -namespace cc { -class PaintImage; -} - -namespace gfx { -class Vector2d; -} // namespace gfx - namespace blink { class WebLayerTreeView { public: - // SwapResult mirrors the values of cc::SwapPromise::DidNotSwapReason, and - // should be kept consistent with it. SwapResult additionally adds a success - // value (kDidSwap). - // These values are written to logs. New enum values can be added, but - // existing enums must never be renumbered, deleted or reused. - enum SwapResult { - kDidSwap = 0, - kDidNotSwapSwapFails = 1, - kDidNotSwapCommitFails = 2, - kDidNotSwapCommitNoUpdate = 3, - kDidNotSwapActivationFails = 4, - kSwapResultMax, - }; - using ReportTimeCallback = - base::OnceCallback<void(SwapResult, base::TimeTicks)>; virtual ~WebLayerTreeView() = default; // View properties --------------------------------------------------- - // Sets the current page scale factor and minimum / maximum limits. Both - // limits are initially 1 (no page scale allowed). - virtual void SetPageScaleFactorAndLimits(float page_scale_factor, - float minimum, - float maximum) {} - - // Starts an animation of the page scale to a target scale factor and scroll - // offset. - // If useAnchor is true, destination is a point on the screen that will remain - // fixed for the duration of the animation. - // If useAnchor is false, destination is the final top-left scroll position. - virtual void StartPageScaleAnimation(const gfx::Vector2d& destination, - bool use_anchor, - float new_page_scale, - double duration_sec) {} - - // Returns true if the page scale animation had started. - virtual bool HasPendingPageScaleAnimation() const { return false; } - - virtual void HeuristicsForGpuRasterizationUpdated(bool) {} - // Sets the amount that the browser controls are showing, from 0 (hidden) to 1 // (fully shown). virtual void SetBrowserControlsShownRatio(float) {} @@ -114,20 +67,8 @@ class WebLayerTreeView { float bottom_height, bool shrink_viewport) {} - // Set the browser's behavior when overscroll happens, e.g. whether to glow - // or navigate. - virtual void SetOverscrollBehavior(const cc::OverscrollBehavior&) {} - // Flow control and scheduling --------------------------------------- - virtual void CompositeAndReadbackAsync( - base::OnceCallback<void(const SkBitmap&)> callback) {} - - // Synchronously performs the complete set of document lifecycle phases, - // including updates to the compositor state, optionally including - // rasterization. - virtual void UpdateAllLifecyclePhasesAndCompositeForTesting(bool do_raster) {} - // Prevents any updates to the input for the layer tree, and the layer tree // itself, and the layer tree from becoming visible. virtual std::unique_ptr<cc::ScopedDeferMainFrameUpdate> @@ -144,13 +85,6 @@ class WebLayerTreeView { // Immediately stop deferring commits. virtual void StopDeferringCommits() {} - // Mutations are plumbed back to the layer tree via the mutator client. - virtual void SetMutatorClient(std::unique_ptr<cc::LayerTreeMutator>) {} - - // Paints are plumbed back to the layer tree via the painter client. - virtual void SetPaintWorkletLayerPainterClient( - std::unique_ptr<cc::PaintWorkletLayerPainter>) {} - // For when the embedder itself change scales on the page (e.g. devtools) // and wants all of the content at the new scale to be crisp. virtual void ForceRecalculateRasterScales() {} @@ -174,19 +108,7 @@ class WebLayerTreeView { virtual int LayerTreeId() const { return 0; } - // ReportTimeCallback is a callback that should be fired when the - // corresponding Swap completes (either with DidSwap or DidNotSwap). - virtual void NotifySwapTime(ReportTimeCallback callback) {} - virtual void RequestBeginMainFrameNotExpected(bool new_state) {} - - virtual void RequestDecode(const cc::PaintImage& image, - base::OnceCallback<void(bool)> callback) {} - - // Runs |callback| after a new frame has been submitted to the display - // compositor, and the display-compositor has displayed it on screen. Forces a - // redraw so that a new frame is submitted. - virtual void RequestPresentationCallback(base::OnceClosure callback) {} }; } // namespace blink diff --git a/chromium/third_party/blink/public/platform/web_loading_behavior_flag.h b/chromium/third_party/blink/public/platform/web_loading_behavior_flag.h index 5c0a225ff4c..b1342dd1bec 100644 --- a/chromium/third_party/blink/public/platform/web_loading_behavior_flag.h +++ b/chromium/third_party/blink/public/platform/web_loading_behavior_flag.h @@ -35,17 +35,8 @@ enum WebLoadingBehaviorFlag { // Indicates that a subresource on the page matched the subresource filtering // rules. kWebLoadingBehaviorSubresourceFilterMatch = 1 << 6, - // Indicates that a subresource on the page was a candidate for stale - // while revalidate and caused a network load. - kStaleWhileRevalidateResourceCandidateNetworkLoad = 1 << 7, - // Indicates that a subresource on the page was a candidate for stale - // while revalidate and caused a stale cache load. - kStaleWhileRevalidateResourceCandidateStaleCacheLoad = 1 << 8, - // Indicates that a subresource on the page was a candidate for stale - // while revalidate and caused a non-stale cache load. - kStaleWhileRevalidateResourceCandidateCacheLoad = 1 << 9, // Indicates that the page is an AMP document, with <html amp> tag. - kWebLoadingBehaviorAmpDocumentLoaded = 1 << 10, + kWebLoadingBehaviorAmpDocumentLoaded = 1 << 7, }; } // namespace blink diff --git a/chromium/third_party/blink/public/platform/web_media_constraints.h b/chromium/third_party/blink/public/platform/web_media_constraints.h index c46d181ddae..b452f43306f 100644 --- a/chromium/third_party/blink/public/platform/web_media_constraints.h +++ b/chromium/third_party/blink/public/platform/web_media_constraints.h @@ -243,10 +243,6 @@ struct WebMediaTrackConstraintSet { StringConstraint group_id; // https://w3c.github.io/mediacapture-depth/#mediatrackconstraints StringConstraint video_kind; - DoubleConstraint depth_near; - DoubleConstraint depth_far; - DoubleConstraint focal_length_x; - DoubleConstraint focal_length_y; // Constraints not exposed in Blink at the moment, only through // the legacy name interface. StringConstraint media_stream_source; // tab, screen, desktop, system diff --git a/chromium/third_party/blink/public/platform/web_media_player.h b/chromium/third_party/blink/public/platform/web_media_player.h index fbbd030dc68..edba9c527cd 100644 --- a/chromium/third_party/blink/public/platform/web_media_player.h +++ b/chromium/third_party/blink/public/platform/web_media_player.h @@ -31,7 +31,6 @@ #ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_MEDIA_PLAYER_H_ #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_MEDIA_PLAYER_H_ -#include "base/optional.h" #include "base/time/time.h" #include "components/viz/common/surfaces/surface_id.h" #include "third_party/blink/public/platform/web_callbacks.h" @@ -165,8 +164,8 @@ class WebMediaPlayer { virtual WebTimeRanges Seekable() const = 0; // Attempts to switch the audio output device. - virtual void SetSinkId(const WebString& sink_id, - std::unique_ptr<WebSetSinkIdCallbacks>) = 0; + virtual void SetSinkId(const WebString& sing_id, + WebSetSinkIdCompleteCallback) = 0; // True if the loaded media has a playable video/audio track. virtual bool HasVideo() const = 0; @@ -326,6 +325,17 @@ class WebMediaPlayer { return false; } + // Share video frame texture to |texture|. If the sharing is impossible or + // fails, it returns false. + virtual bool PrepareVideoFrameForWebGL( + gpu::gles2::GLES2Interface* gl, + unsigned target, + unsigned texture, + int already_uploaded_id = -1, + WebMediaPlayer::VideoFrameUploadMetadata* out_metadata = nullptr) { + return false; + } + virtual WebAudioSourceProvider* GetAudioSourceProvider() { return nullptr; } virtual void SetContentDecryptionModule( diff --git a/chromium/third_party/blink/public/platform/web_media_recorder_handler.h b/chromium/third_party/blink/public/platform/web_media_recorder_handler.h index a918cc3d661..a7f597eddd8 100644 --- a/chromium/third_party/blink/public/platform/web_media_recorder_handler.h +++ b/chromium/third_party/blink/public/platform/web_media_recorder_handler.h @@ -9,7 +9,7 @@ #include "third_party/blink/public/platform/web_common.h" -#include "third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_callbacks.h" +#include "base/callback.h" #include "third_party/blink/public/platform/web_string.h" namespace blink { @@ -17,6 +17,7 @@ namespace blink { class WebMediaRecorderHandlerClient; struct WebMediaConfiguration; class WebMediaStream; +struct WebMediaCapabilitiesInfo; // Platform interface of a MediaRecorder. class BLINK_PLATFORM_EXPORT WebMediaRecorderHandler { @@ -52,9 +53,10 @@ class BLINK_PLATFORM_EXPORT WebMediaRecorderHandler { // Implements WICG Media Capabilities encodingInfo() call for local encoding. // https://wicg.github.io/media-capabilities/#media-capabilities-interface - virtual void EncodingInfo( - const WebMediaConfiguration&, - std::unique_ptr<blink::WebMediaCapabilitiesEncodingInfoCallbacks>) {} + using OnMediaCapabilitiesEncodingInfoCallback = + base::OnceCallback<void(std::unique_ptr<WebMediaCapabilitiesInfo>)>; + virtual void EncodingInfo(const WebMediaConfiguration&, + OnMediaCapabilitiesEncodingInfoCallback) {} }; } // namespace blink diff --git a/chromium/third_party/blink/public/platform/web_media_stream_center.h b/chromium/third_party/blink/public/platform/web_media_stream_center.h index a8cb5d1ded5..571d245b635 100644 --- a/chromium/third_party/blink/public/platform/web_media_stream_center.h +++ b/chromium/third_party/blink/public/platform/web_media_stream_center.h @@ -59,7 +59,8 @@ class WebMediaStreamCenter { // Caller must take the ownership of the returned |WebAudioSourceProvider| // object. virtual WebAudioSourceProvider* CreateWebAudioSourceFromMediaStreamTrack( - const WebMediaStreamTrack&) { + const WebMediaStreamTrack&, + int context_sample_rate) { return nullptr; } }; diff --git a/chromium/third_party/blink/public/platform/web_media_stream_source.h b/chromium/third_party/blink/public/platform/web_media_stream_source.h index 9ebf4aa7adc..31ddba11a5e 100644 --- a/chromium/third_party/blink/public/platform/web_media_stream_source.h +++ b/chromium/third_party/blink/public/platform/web_media_stream_source.h @@ -74,6 +74,9 @@ class WebMediaStreamSource { WebVector<bool> auto_gain_control; WebVector<bool> noise_suppression; WebVector<int32_t> sample_size; + WebVector<int32_t> channel_count; + WebVector<int32_t> sample_rate; + WebVector<double> latency; WebMediaStreamTrack::FacingMode facing_mode = WebMediaStreamTrack::FacingMode::kNone; diff --git a/chromium/third_party/blink/public/platform/web_media_stream_track.h b/chromium/third_party/blink/public/platform/web_media_stream_track.h index 8d134fa9b53..9234b847d6f 100644 --- a/chromium/third_party/blink/public/platform/web_media_stream_track.h +++ b/chromium/third_party/blink/public/platform/web_media_stream_track.h @@ -28,6 +28,7 @@ #include <memory> #include "base/optional.h" +#include "media/mojo/interfaces/display_media_information.mojom-shared.h" #include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/public/platform/web_private_ptr.h" #include "third_party/blink/public/platform/web_string.h" @@ -45,13 +46,6 @@ class WebString; class WebMediaStreamTrack { public: enum class FacingMode { kNone, kUser, kEnvironment, kLeft, kRight }; - enum class DisplayCaptureSurfaceType { - kMonitor, - kWindow, - kApplication, - kBrowser - }; - enum class CursorCaptureType { kNever, kAlways, kMotion }; BLINK_PLATFORM_EXPORT static const char kResizeModeNone[]; BLINK_PLATFORM_EXPORT static const char kResizeModeRescale[]; @@ -68,10 +62,6 @@ class WebMediaStreamTrack { bool HasLatency() const { return latency >= 0; } bool HasVolume() const { return volume >= 0; } bool HasVideoKind() const { return !video_kind.IsNull(); } - bool HasFocalLengthX() const { return focal_length_x >= 0.0; } - bool HasFocalLengthY() const { return focal_length_y >= 0.0; } - bool HasDepthNear() const { return depth_near >= 0.0; } - bool HasDepthFar() const { return depth_far >= 0.0; } // The variables are read from // MediaStreamTrack::GetSettings only. double frame_rate = -1.0; @@ -94,15 +84,11 @@ class WebMediaStreamTrack { // Media Capture Depth Stream Extensions. WebString video_kind; - double focal_length_x = -1.0; - double focal_length_y = -1.0; - double depth_near = -1.0; - double depth_far = -1.0; // Screen Capture extensions - base::Optional<DisplayCaptureSurfaceType> display_surface; + base::Optional<media::mojom::DisplayCaptureSurfaceType> display_surface; base::Optional<bool> logical_surface; - base::Optional<CursorCaptureType> cursor; + base::Optional<media::mojom::CursorCaptureType> cursor; }; enum class ContentHintType { diff --git a/chromium/third_party/blink/public/platform/web_network_state_notifier.h b/chromium/third_party/blink/public/platform/web_network_state_notifier.h index 8b7070dd515..09e1ab743bd 100644 --- a/chromium/third_party/blink/public/platform/web_network_state_notifier.h +++ b/chromium/third_party/blink/public/platform/web_network_state_notifier.h @@ -51,6 +51,7 @@ class WebNetworkStateNotifier { BLINK_PLATFORM_EXPORT static void SetNetworkQualityWebHoldback( WebEffectiveConnectionType); BLINK_PLATFORM_EXPORT static void SetSaveDataEnabled(bool enabled); + BLINK_PLATFORM_EXPORT static bool SaveDataEnabled(); private: WebNetworkStateNotifier() = delete; diff --git a/chromium/third_party/blink/public/platform/web_prerender.h b/chromium/third_party/blink/public/platform/web_prerender.h index 8f7ca350b4c..4a3317ce3d0 100644 --- a/chromium/third_party/blink/public/platform/web_prerender.h +++ b/chromium/third_party/blink/public/platform/web_prerender.h @@ -41,13 +41,6 @@ namespace blink { class Prerender; -// WebPrerenderRelType is a bitfield since multiple rel attributes can be set on -// the same prerender. -enum WebPrerenderRelType { - kPrerenderRelTypePrerender = 0x1, - kPrerenderRelTypeNext = 0x2, -}; - class WebPrerender { public: class ExtraData { diff --git a/chromium/third_party/blink/public/platform/web_resource_timing_info.h b/chromium/third_party/blink/public/platform/web_resource_timing_info.h index 250ae8e7109..02a7c0a0183 100644 --- a/chromium/third_party/blink/public/platform/web_resource_timing_info.h +++ b/chromium/third_party/blink/public/platform/web_resource_timing_info.h @@ -13,9 +13,14 @@ #include "third_party/blink/public/platform/web_url_load_timing.h" #include "third_party/blink/public/platform/web_vector.h" +#if INSIDE_BLINK +#include "third_party/blink/renderer/platform/cross_thread_copier.h" // nogncheck +#endif + namespace blink { // The browser-side equivalent to this struct is content::ServerTimingInfo. +// Note: Please update operator==() whenever a new field is added. // TODO(dcheng): Migrate this struct over to Mojo so it doesn't need to be // duplicated in //content and //third_party/blink. struct WebServerTimingInfo { @@ -24,6 +29,11 @@ struct WebServerTimingInfo { const WebString& description) : name(name), duration(duration), description(description) {} +#if INSIDE_BLINK + bool operator==(const WebServerTimingInfo&) const; + bool operator!=(const WebServerTimingInfo&) const; +#endif + WebString name; double duration; WebString description; @@ -33,9 +43,15 @@ struct WebServerTimingInfo { // to be passed between processes. This is currently used to send timing // information about cross-process iframes for window.performance. The // browser-side equivalent to this struct is content::ResourceTimingInfo. +// Note: Please update operator==() and CrossThreadCopier whenever a new field +// is added. // TODO(dcheng): Migrate this struct over to Mojo so it doesn't need to be // duplicated in //content and //third_party/blink. struct WebResourceTimingInfo { +#if INSIDE_BLINK + PLATFORM_EXPORT bool operator==(const WebResourceTimingInfo&) const; +#endif + // The name to associate with the performance entry. For iframes, this is // typically the initial URL of the iframe resource. WebString name; @@ -76,6 +92,15 @@ struct WebResourceTimingInfo { WebVector<WebServerTimingInfo> server_timing; }; +#if INSIDE_BLINK +template <> +struct CrossThreadCopier<WebResourceTimingInfo> { + STATIC_ONLY(CrossThreadCopier); + typedef WebResourceTimingInfo Type; + PLATFORM_EXPORT static Type Copy(const WebResourceTimingInfo&); +}; +#endif + } // namespace blink #endif diff --git a/chromium/third_party/blink/public/platform/web_rtc_certificate_generator.h b/chromium/third_party/blink/public/platform/web_rtc_certificate_generator.h index 7a9f11124a9..198f4b1c958 100644 --- a/chromium/third_party/blink/public/platform/web_rtc_certificate_generator.h +++ b/chromium/third_party/blink/public/platform/web_rtc_certificate_generator.h @@ -31,13 +31,12 @@ #ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RTC_CERTIFICATE_GENERATOR_H_ #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RTC_CERTIFICATE_GENERATOR_H_ -#include "third_party/blink/public/platform/web_callbacks.h" +#include <memory> + #include "third_party/blink/public/platform/web_rtc_key_params.h" #include "third_party/blink/public/platform/web_string.h" #include "third_party/webrtc/api/peer_connection_interface.h" -#include <memory> - namespace base { class SingleThreadTaskRunner; } @@ -45,7 +44,7 @@ class SingleThreadTaskRunner; namespace blink { using WebRTCCertificateCallback = - WebCallbacks<rtc::scoped_refptr<rtc::RTCCertificate>, void>; + base::OnceCallback<void(rtc::scoped_refptr<rtc::RTCCertificate>)>; // Interface defining a class that can generate WebRTCCertificates // asynchronously. @@ -58,12 +57,12 @@ class WebRTCCertificateGenerator { // completed. virtual void GenerateCertificate( const WebRTCKeyParams&, - std::unique_ptr<WebRTCCertificateCallback> observer, + WebRTCCertificateCallback completion_callback, scoped_refptr<base::SingleThreadTaskRunner>) = 0; virtual void GenerateCertificateWithExpiration( const WebRTCKeyParams&, uint64_t expires_ms, - std::unique_ptr<WebRTCCertificateCallback> observer, + WebRTCCertificateCallback completion_callback, scoped_refptr<base::SingleThreadTaskRunner>) = 0; // Determines if the parameters are supported by |GenerateCertificate|. diff --git a/chromium/third_party/blink/public/platform/web_rtc_dtmf_sender_handler.h b/chromium/third_party/blink/public/platform/web_rtc_dtmf_sender_handler.h index 8457c4201d0..8ace1970bad 100644 --- a/chromium/third_party/blink/public/platform/web_rtc_dtmf_sender_handler.h +++ b/chromium/third_party/blink/public/platform/web_rtc_dtmf_sender_handler.h @@ -43,8 +43,8 @@ class WebRTCDTMFSenderHandler { virtual bool CanInsertDTMF() = 0; virtual bool InsertDTMF(const WebString& tones, - long duration, - long inter_tone_gap) = 0; + int duration, + int inter_tone_gap) = 0; }; } // namespace blink diff --git a/chromium/third_party/blink/public/platform/web_rtc_ice_candidate.h b/chromium/third_party/blink/public/platform/web_rtc_ice_candidate.h index 68d67f9248a..39087b88480 100644 --- a/chromium/third_party/blink/public/platform/web_rtc_ice_candidate.h +++ b/chromium/third_party/blink/public/platform/web_rtc_ice_candidate.h @@ -43,20 +43,26 @@ class BLINK_PLATFORM_EXPORT WebRTCICECandidate final public: REQUIRE_ADOPTION_FOR_REFCOUNTED_TYPE(); - // TODO(guidou): Support setting sdp_m_line_index to -1 to indicate the - // absence of a value for sdp_m_line_index. crbug.com/614958 + // Creates a new WebRTCICECandidate using |candidate|, |sdp_mid| and + // |sdp_m_line_index|. If |sdp_m_line_index| is negative, it is + // considered as having no value. static scoped_refptr<WebRTCICECandidate> Create(WebString candidate, WebString sdp_mid, - uint16_t sdp_m_line_index); + int sdp_m_line_index); - static scoped_refptr<WebRTCICECandidate> Create(WebString candidate, - WebString sdp_mid, - uint16_t sdp_m_line_index, - WebString username_fragment); + // Creates a new WebRTCICECandidate using |candidate|, |sdp_mid|, + // |sdp_m_line_index|, and |username_fragment|. + static scoped_refptr<WebRTCICECandidate> Create( + WebString candidate, + WebString sdp_mid, + base::Optional<uint16_t> sdp_m_line_index, + WebString username_fragment); const WebString& Candidate() const { return candidate_; } const WebString& SdpMid() const { return sdp_mid_; } - uint16_t SdpMLineIndex() const { return sdp_m_line_index_; } + const base::Optional<uint16_t>& SdpMLineIndex() const { + return sdp_m_line_index_; + } const WebString& Foundation() const { return foundation_; } const WebString& Component() const { return component_; } const base::Optional<uint32_t>& Priority() const { return priority_; } @@ -74,11 +80,11 @@ class BLINK_PLATFORM_EXPORT WebRTCICECandidate final WebRTCICECandidate(WebString candidate, WebString sdp_mid, - uint16_t sdp_m_line_index); + base::Optional<uint16_t> sdp_m_line_index); WebRTCICECandidate(WebString candidate, WebString sdp_mid, - uint16_t sdp_m_line_index, + base::Optional<uint16_t> sdp_m_line_index, WebString username_fragment); void PopulateFields(bool use_username_from_candidate); @@ -87,7 +93,7 @@ class BLINK_PLATFORM_EXPORT WebRTCICECandidate final WebString candidate_; WebString sdp_mid_; - uint16_t sdp_m_line_index_; + base::Optional<uint16_t> sdp_m_line_index_; WebString foundation_; WebString component_; base::Optional<uint32_t> priority_; diff --git a/chromium/third_party/blink/public/platform/web_rtc_peer_connection_handler.h b/chromium/third_party/blink/public/platform/web_rtc_peer_connection_handler.h index 24f46a830d9..72ac0f93252 100644 --- a/chromium/third_party/blink/public/platform/web_rtc_peer_connection_handler.h +++ b/chromium/third_party/blink/public/platform/web_rtc_peer_connection_handler.h @@ -42,6 +42,7 @@ #include "third_party/webrtc/api/peer_connection_interface.h" #include "third_party/webrtc/api/rtc_error.h" #include "third_party/webrtc/api/rtp_transceiver_interface.h" +#include "third_party/webrtc/api/stats/rtc_stats.h" namespace webrtc { enum class RTCErrorType; @@ -113,8 +114,8 @@ class WebRTCPeerConnectionHandler { // Gets stats using the new stats collection API, see // third_party/webrtc/api/stats/. These will replace the old stats collection // API when the new API has matured enough. - virtual void GetStats(std::unique_ptr<WebRTCStatsReportCallback>, - RTCStatsFilter) = 0; + virtual void GetStats(WebRTCStatsReportCallback, + const std::vector<webrtc::NonStandardGroupId>&) = 0; virtual scoped_refptr<webrtc::DataChannelInterface> CreateDataChannel( const WebString& label, const WebRTCDataChannelInit&) = 0; diff --git a/chromium/third_party/blink/public/platform/web_rtc_peer_connection_handler_client.h b/chromium/third_party/blink/public/platform/web_rtc_peer_connection_handler_client.h index 34e22644ac7..65bbb1ecd94 100644 --- a/chromium/third_party/blink/public/platform/web_rtc_peer_connection_handler_client.h +++ b/chromium/third_party/blink/public/platform/web_rtc_peer_connection_handler_client.h @@ -37,6 +37,7 @@ #include "base/memory/scoped_refptr.h" #include "third_party/blink/public/platform/web_common.h" #include "third_party/webrtc/api/peer_connection_interface.h" +#include "third_party/webrtc/api/sctp_transport_interface.h" namespace blink { @@ -44,6 +45,14 @@ class WebRTCICECandidate; class WebRTCRtpReceiver; class WebRTCRtpTransceiver; +struct BLINK_PLATFORM_EXPORT WebRTCSctpTransportSnapshot { + rtc::scoped_refptr<webrtc::SctpTransportInterface> transport; + webrtc::SctpTransportInformation sctp_transport_state = + webrtc::SctpTransportInformation(webrtc::SctpTransportState::kNew); + webrtc::DtlsTransportInformation dtls_transport_state = + webrtc::DtlsTransportInformation(webrtc::DtlsTransportState::kNew); +}; + class BLINK_PLATFORM_EXPORT WebRTCPeerConnectionHandlerClient { public: virtual ~WebRTCPeerConnectionHandlerClient(); @@ -63,6 +72,7 @@ class BLINK_PLATFORM_EXPORT WebRTCPeerConnectionHandlerClient { virtual void DidModifyTransceivers( std::vector<std::unique_ptr<WebRTCRtpTransceiver>>, bool is_remote_description) = 0; + virtual void DidModifySctpTransport(WebRTCSctpTransportSnapshot) = 0; virtual void DidAddRemoteDataChannel( scoped_refptr<webrtc::DataChannelInterface>) = 0; virtual void DidNoteInterestingUsage(int usage_pattern) = 0; diff --git a/chromium/third_party/blink/public/platform/web_rtc_rtp_receiver.h b/chromium/third_party/blink/public/platform/web_rtc_rtp_receiver.h index 0307271a6a2..b9deeb2d7af 100644 --- a/chromium/third_party/blink/public/platform/web_rtc_rtp_receiver.h +++ b/chromium/third_party/blink/public/platform/web_rtc_rtp_receiver.h @@ -6,12 +6,16 @@ #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RTC_RTP_RECEIVER_H_ #include <memory> +#include <vector> + +#include "base/optional.h" #include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/public/platform/web_rtc_stats.h" #include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/public/platform/web_vector.h" #include "third_party/webrtc/api/dtls_transport_interface.h" #include "third_party/webrtc/api/rtp_parameters.h" +#include "third_party/webrtc/api/stats/rtc_stats.h" namespace blink { @@ -38,9 +42,11 @@ class BLINK_PLATFORM_EXPORT WebRTCRtpReceiver { virtual const WebMediaStreamTrack& Track() const = 0; virtual WebVector<WebString> StreamIds() const = 0; virtual WebVector<std::unique_ptr<WebRTCRtpSource>> GetSources() = 0; - virtual void GetStats(std::unique_ptr<blink::WebRTCStatsReportCallback>, - RTCStatsFilter) = 0; + virtual void GetStats(blink::WebRTCStatsReportCallback, + const std::vector<webrtc::NonStandardGroupId>&) = 0; virtual std::unique_ptr<webrtc::RtpParameters> GetParameters() const = 0; + virtual void SetJitterBufferMinimumDelay( + base::Optional<double> delay_seconds) = 0; }; } // namespace blink diff --git a/chromium/third_party/blink/public/platform/web_rtc_rtp_sender.h b/chromium/third_party/blink/public/platform/web_rtc_rtp_sender.h index 4b178904f93..b1aa648bf53 100644 --- a/chromium/third_party/blink/public/platform/web_rtc_rtp_sender.h +++ b/chromium/third_party/blink/public/platform/web_rtc_rtp_sender.h @@ -11,6 +11,7 @@ #include "third_party/blink/public/platform/web_string.h" #include "third_party/webrtc/api/dtls_transport_interface.h" #include "third_party/webrtc/api/rtp_parameters.h" +#include "third_party/webrtc/api/stats/rtc_stats.h" namespace blink { @@ -46,8 +47,8 @@ class BLINK_PLATFORM_EXPORT WebRTCRtpSender { virtual void SetParameters(blink::WebVector<webrtc::RtpEncodingParameters>, webrtc::DegradationPreference, WebRTCVoidRequest) = 0; - virtual void GetStats(std::unique_ptr<blink::WebRTCStatsReportCallback>, - RTCStatsFilter) = 0; + virtual void GetStats(blink::WebRTCStatsReportCallback, + const std::vector<webrtc::NonStandardGroupId>&) = 0; }; } // namespace blink diff --git a/chromium/third_party/blink/public/platform/web_rtc_stats.h b/chromium/third_party/blink/public/platform/web_rtc_stats.h index abbd62d706c..1256c817214 100644 --- a/chromium/third_party/blink/public/platform/web_rtc_stats.h +++ b/chromium/third_party/blink/public/platform/web_rtc_stats.h @@ -34,11 +34,6 @@ enum WebRTCStatsMemberType { kWebRTCStatsMemberTypeSequenceString, // WebVector<WebString> }; -enum class RTCStatsFilter { - kIncludeOnlyStandardMembers, - kIncludeNonStandardMembers, -}; - class BLINK_PLATFORM_EXPORT WebRTCStatsReport { public: virtual ~WebRTCStatsReport(); @@ -94,12 +89,8 @@ class BLINK_PLATFORM_EXPORT WebRTCStatsMember { virtual WebVector<WebString> ValueSequenceString() const = 0; }; -class BLINK_PLATFORM_EXPORT WebRTCStatsReportCallback { - public: - virtual ~WebRTCStatsReportCallback(); - - virtual void OnStatsDelivered(std::unique_ptr<WebRTCStatsReport>) = 0; -}; +using WebRTCStatsReportCallback = + base::OnceCallback<void(std::unique_ptr<WebRTCStatsReport>)>; } // namespace blink diff --git a/chromium/third_party/blink/public/platform/web_runtime_features.h b/chromium/third_party/blink/public/platform/web_runtime_features.h index a6be471e501..6c7314c519b 100644 --- a/chromium/third_party/blink/public/platform/web_runtime_features.h +++ b/chromium/third_party/blink/public/platform/web_runtime_features.h @@ -83,11 +83,9 @@ class WebRuntimeFeatures { BLINK_PLATFORM_EXPORT static void EnableAudioOutputDevices(bool); BLINK_PLATFORM_EXPORT static void EnableBackgroundFetch(bool); BLINK_PLATFORM_EXPORT static void EnableBlinkHeapIncrementalMarking(bool); - BLINK_PLATFORM_EXPORT static void EnableBlinkHeapUnifiedGarbageCollection( - bool); - BLINK_PLATFORM_EXPORT static void EnableBlinkHeapCollectLiveNonNodeWrappers( - bool); BLINK_PLATFORM_EXPORT static void EnableBloatedRendererDetection(bool); + BLINK_PLATFORM_EXPORT static void EnableBlockingFocusWithoutUserActivation( + bool); BLINK_PLATFORM_EXPORT static void EnableCacheInlineScriptCode(bool); BLINK_PLATFORM_EXPORT static void EnableIsolatedCodeCache(bool); BLINK_PLATFORM_EXPORT static void EnableWasmCodeCache(bool); @@ -104,6 +102,7 @@ class WebRuntimeFeatures { BLINK_PLATFORM_EXPORT static void EnableFeaturePolicyForSandbox(bool); BLINK_PLATFORM_EXPORT static void EnableFileSystem(bool); BLINK_PLATFORM_EXPORT static void EnableFirstContentfulPaintPlusPlus(bool); + BLINK_PLATFORM_EXPORT static void EnableForceSynchronousHTMLParsing(bool); BLINK_PLATFORM_EXPORT static void EnableForceTallerSelectPopup(bool); BLINK_PLATFORM_EXPORT static void EnableGenericSensor(bool); BLINK_PLATFORM_EXPORT static void EnableGenericSensorExtraClasses(bool); @@ -128,8 +127,10 @@ class WebRuntimeFeatures { BLINK_PLATFORM_EXPORT static void EnableNavigatorContentUtils(bool); BLINK_PLATFORM_EXPORT static void EnableNetInfoDownlinkMax(bool); BLINK_PLATFORM_EXPORT static void EnableNetworkService(bool); - BLINK_PLATFORM_EXPORT static void EnableNoHoverAfterLayoutChange(bool); - BLINK_PLATFORM_EXPORT static void EnableNoHoverDuringScroll(bool); + BLINK_PLATFORM_EXPORT static void + EnableUpdateHoverFromLayoutChangeAtBeginFrame(bool); + BLINK_PLATFORM_EXPORT static void EnableUpdateHoverFromScrollAtBeginFrame( + bool); BLINK_PLATFORM_EXPORT static void EnableNotificationConstructor(bool); BLINK_PLATFORM_EXPORT static void EnableNotificationContentImage(bool); BLINK_PLATFORM_EXPORT static void EnableNotifications(bool); @@ -155,7 +156,6 @@ class WebRuntimeFeatures { BLINK_PLATFORM_EXPORT static void EnablePictureInPictureAPI(bool); BLINK_PLATFORM_EXPORT static void EnablePortals(bool); BLINK_PLATFORM_EXPORT static void EnablePreciseMemoryInfo(bool); - BLINK_PLATFORM_EXPORT static void EnablePreloadImageSrcSetEnabled(bool); BLINK_PLATFORM_EXPORT static void EnablePrintBrowser(bool); BLINK_PLATFORM_EXPORT static void EnablePresentationAPI(bool); BLINK_PLATFORM_EXPORT static void EnablePushMessaging(bool); @@ -173,12 +173,14 @@ class WebRuntimeFeatures { BLINK_PLATFORM_EXPORT static void EnableScriptedSpeechRecognition(bool); BLINK_PLATFORM_EXPORT static void EnableScriptedSpeechSynthesis(bool); BLINK_PLATFORM_EXPORT static void EnableScrollAnchorSerialization(bool); - BLINK_PLATFORM_EXPORT static void EnableSecMetadata(bool); - BLINK_PLATFORM_EXPORT static void EnableSerial(bool); + BLINK_PLATFORM_EXPORT static void EnableFetchMetadata(bool); + BLINK_PLATFORM_EXPORT static void EnableFetchMetadataDestination(bool); BLINK_PLATFORM_EXPORT static void EnableSharedArrayBuffer(bool); BLINK_PLATFORM_EXPORT static void EnableSharedWorker(bool); BLINK_PLATFORM_EXPORT static void EnableTextFragmentAnchor(bool); BLINK_PLATFORM_EXPORT static void EnableTouchEventFeatureDetection(bool); + BLINK_PLATFORM_EXPORT static void EnableUserActivationPostMessageTransfer( + bool); BLINK_PLATFORM_EXPORT static void EnableUserActivationSameOriginVisibility( bool); BLINK_PLATFORM_EXPORT static void EnableUserActivationV2(bool); @@ -192,11 +194,11 @@ class WebRuntimeFeatures { BLINK_PLATFORM_EXPORT static void EnableWebGPU(bool); BLINK_PLATFORM_EXPORT static void EnableWebNfc(bool); BLINK_PLATFORM_EXPORT static void EnableWebShare(bool); + BLINK_PLATFORM_EXPORT static void EnableWebShareV2(bool); BLINK_PLATFORM_EXPORT static void EnableWebUsb(bool); BLINK_PLATFORM_EXPORT static void EnableWebVR(bool); BLINK_PLATFORM_EXPORT static void EnableWebXR(bool); BLINK_PLATFORM_EXPORT static void EnableWebXRHitTest(bool); - BLINK_PLATFORM_EXPORT static void EnableWebXRGamepadSupport(bool); BLINK_PLATFORM_EXPORT static void EnableXSLT(bool); BLINK_PLATFORM_EXPORT static void ForceOverlayFullscreenVideo(bool); BLINK_PLATFORM_EXPORT static void EnableTimerThrottlingForBackgroundTabs( @@ -233,6 +235,11 @@ class WebRuntimeFeatures { BLINK_PLATFORM_EXPORT static void EnableShadowDOMV0(bool); BLINK_PLATFORM_EXPORT static void EnableCustomElementsV0(bool); BLINK_PLATFORM_EXPORT static void EnableHTMLImports(bool); + BLINK_PLATFORM_EXPORT static void EnableSignedExchangeSubresourcePrefetch( + bool); + BLINK_PLATFORM_EXPORT static void EnableIdleDetection(bool); + BLINK_PLATFORM_EXPORT static void EnableStaleWhileRevalidate(bool); + BLINK_PLATFORM_EXPORT static void EnableSkipTouchEventFilter(bool); private: WebRuntimeFeatures(); diff --git a/chromium/third_party/blink/public/platform/web_set_sink_id_callbacks.h b/chromium/third_party/blink/public/platform/web_set_sink_id_callbacks.h index 1d9c9d25291..0707f6821f5 100644 --- a/chromium/third_party/blink/public/platform/web_set_sink_id_callbacks.h +++ b/chromium/third_party/blink/public/platform/web_set_sink_id_callbacks.h @@ -5,7 +5,8 @@ #ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_SET_SINK_ID_CALLBACKS_H_ #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_SET_SINK_ID_CALLBACKS_H_ -#include "third_party/blink/public/platform/web_callbacks.h" +#include "base/callback.h" +#include "base/optional.h" #include "third_party/blink/public/platform/web_string.h" namespace blink { @@ -18,7 +19,8 @@ enum class WebSetSinkIdError { kLast = kNotSupported }; -using WebSetSinkIdCallbacks = WebCallbacks<void, WebSetSinkIdError>; +using WebSetSinkIdCompleteCallback = + base::OnceCallback<void(base::Optional<WebSetSinkIdError> error)>; } // namespace blink diff --git a/chromium/third_party/blink/public/platform/web_speech_synthesizer_client.h b/chromium/third_party/blink/public/platform/web_speech_synthesizer_client.h index b6eb70db772..dcf168d7048 100644 --- a/chromium/third_party/blink/public/platform/web_speech_synthesizer_client.h +++ b/chromium/third_party/blink/public/platform/web_speech_synthesizer_client.h @@ -43,9 +43,11 @@ class WebSpeechSynthesizerClient { virtual void DidFinishSpeaking(const WebSpeechSynthesisUtterance&) = 0; virtual void SpeakingErrorOccurred(const WebSpeechSynthesisUtterance&) = 0; virtual void WordBoundaryEventOccurred(const WebSpeechSynthesisUtterance&, - unsigned char_index) = 0; + unsigned char_index, + unsigned char_length) = 0; virtual void SentenceBoundaryEventOccurred(const WebSpeechSynthesisUtterance&, - unsigned char_index) = 0; + unsigned char_index, + unsigned char_length) = 0; }; } // namespace blink diff --git a/chromium/third_party/blink/public/platform/web_transmission_encoding_info_handler.h b/chromium/third_party/blink/public/platform/web_transmission_encoding_info_handler.h new file mode 100644 index 00000000000..bdae8b206ab --- /dev/null +++ b/chromium/third_party/blink/public/platform/web_transmission_encoding_info_handler.h @@ -0,0 +1,37 @@ +// Copyright 2019 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_TRANSMISSION_ENCODING_INFO_HANDLER_H_ +#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_TRANSMISSION_ENCODING_INFO_HANDLER_H_ + +#include <memory> + +#include "third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_callbacks.h" +#include "third_party/blink/public/platform/web_common.h" + +namespace blink { + +struct WebMediaConfiguration; + +// Platform interface of a TransmissionEncodingInfoHandler. +// It handle MediaCapabilities.encodingInfo() API with +// "transmission" type. +class BLINK_PLATFORM_EXPORT WebTransmissionEncodingInfoHandler { + public: + virtual ~WebTransmissionEncodingInfoHandler() = default; + + // Queries the capabilities of the given encoding configuration and passes + // WebMediaCapabilitiesInfo result via callbacks. + // It implements WICG Media Capabilities encodingInfo() call for transmission + // encoding. + // https://wicg.github.io/media-capabilities/#media-capabilities-interface + using OnMediaCapabilitiesEncodingInfoCallback = + base::OnceCallback<void(std::unique_ptr<WebMediaCapabilitiesInfo>)>; + virtual void EncodingInfo(const WebMediaConfiguration&, + OnMediaCapabilitiesEncodingInfoCallback) const = 0; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_TRANSMISSION_ENCODING_INFO_HANDLER_H_ diff --git a/chromium/third_party/blink/public/platform/web_url_load_timing.h b/chromium/third_party/blink/public/platform/web_url_load_timing.h index 6aca8fa4118..a5ab49721a0 100644 --- a/chromium/third_party/blink/public/platform/web_url_load_timing.h +++ b/chromium/third_party/blink/public/platform/web_url_load_timing.h @@ -37,6 +37,7 @@ #if INSIDE_BLINK #include "base/memory/scoped_refptr.h" +#include "third_party/blink/renderer/platform/cross_thread_copier.h" // nogncheck #endif namespace blink { @@ -119,12 +120,23 @@ class WebURLLoadTiming { BLINK_PLATFORM_EXPORT WebURLLoadTiming& operator=( scoped_refptr<ResourceLoadTiming>); BLINK_PLATFORM_EXPORT operator scoped_refptr<ResourceLoadTiming>() const; + BLINK_PLATFORM_EXPORT WebURLLoadTiming DeepCopy() const; + BLINK_PLATFORM_EXPORT bool operator==(const WebURLLoadTiming&) const; #endif private: WebPrivatePtr<ResourceLoadTiming> private_; }; +#if INSIDE_BLINK +template <> +struct CrossThreadCopier<WebURLLoadTiming> { + STATIC_ONLY(CrossThreadCopier); + typedef WebURLLoadTiming Type; + PLATFORM_EXPORT static Type Copy(const WebURLLoadTiming&); +}; +#endif + } // namespace blink #endif diff --git a/chromium/third_party/blink/public/platform/web_url_loader.h b/chromium/third_party/blink/public/platform/web_url_loader.h index e8ccf8e0963..8c8598565cc 100644 --- a/chromium/third_party/blink/public/platform/web_url_loader.h +++ b/chromium/third_party/blink/public/platform/web_url_loader.h @@ -83,6 +83,9 @@ class WebURLLoader { // priority, but may increase when the resource is needed for rendering. virtual void DidChangePriority(WebURLRequest::Priority new_priority, int intra_priority_value) = 0; + + // Returns the task runner for this request. + virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() = 0; }; } // namespace blink diff --git a/chromium/third_party/blink/public/platform/web_url_request.h b/chromium/third_party/blink/public/platform/web_url_request.h index 3aba02436b4..7d05a3c9097 100644 --- a/chromium/third_party/blink/public/platform/web_url_request.h +++ b/chromium/third_party/blink/public/platform/web_url_request.h @@ -38,6 +38,7 @@ #include "services/network/public/mojom/referrer_policy.mojom-shared.h" #include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-shared.h" #include "third_party/blink/public/platform/web_common.h" +#include "ui/base/page_transition_types.h" namespace network { namespace mojom { @@ -106,12 +107,67 @@ class WebURLRequest { // to a Lite Page server. kLazyImageLoadDeferred = 1 << 10, // Request the placeholder version of an // image that was deferred by lazyload. - kPreviewsStateLast = kLazyImageLoadDeferred + kLazyImageAutoReload = 1 << 11, // Request the full version of an image + // that was previously fetched as a + // placeholder by lazyload. + kPreviewsStateLast = kLazyImageAutoReload }; class ExtraData { public: + void set_is_preprerendering(bool is_prerendering) { + is_prerendering_ = is_prerendering; + } + void set_render_frame_id(int render_frame_id) { + render_frame_id_ = render_frame_id; + } + void set_is_main_frame(bool is_main_frame) { + is_main_frame_ = is_main_frame; + } + void set_allow_download(bool allow_download) { + allow_download_ = allow_download; + } + ui::PageTransition transition_type() const { return transition_type_; } + void set_transition_type(ui::PageTransition transition_type) { + transition_type_ = transition_type; + } + + // The request is for a prefetch-only client (i.e. running NoStatePrefetch) + // and should use LOAD_PREFETCH network flags. + bool is_for_no_state_prefetch() const { return is_for_no_state_prefetch_; } + void set_is_for_no_state_prefetch(bool prefetch) { + is_for_no_state_prefetch_ = prefetch; + } + + // true if the request originated from within a service worker e.g. due to + // a fetch() in the service worker script. + void set_originated_from_service_worker( + bool originated_from_service_worker) { + originated_from_service_worker_ = originated_from_service_worker; + } + void set_initiated_in_secure_context(bool secure) { + initiated_in_secure_context_ = secure; + } + + // Determines whether SameSite cookies will be attached to the request + // even when the request looks cross-site. + bool attach_same_site_cookies() const { return attach_same_site_cookies_; } + void set_attach_same_site_cookies(bool attach) { + attach_same_site_cookies_ = attach; + } + virtual ~ExtraData() = default; + + protected: + bool is_prerendering_ = false; + int render_frame_id_ = MSG_ROUTING_NONE; + bool is_main_frame_ = false; + bool allow_download_ = true; + ui::PageTransition transition_type_ = ui::PAGE_TRANSITION_LINK; + bool is_for_no_state_prefetch_ = false; + bool originated_from_service_worker_ = false; + bool initiated_in_secure_context_ = false; + bool attach_same_site_cookies_ = false; }; BLINK_PLATFORM_EXPORT ~WebURLRequest(); @@ -123,7 +179,7 @@ class WebURLRequest { BLINK_PLATFORM_EXPORT bool IsNull() const; BLINK_PLATFORM_EXPORT WebURL Url() const; - BLINK_PLATFORM_EXPORT void SetURL(const WebURL&); + BLINK_PLATFORM_EXPORT void SetUrl(const WebURL&); // Used to implement third-party cookie blocking. BLINK_PLATFORM_EXPORT WebURL SiteForCookies() const; @@ -148,22 +204,22 @@ class WebURLRequest { BLINK_PLATFORM_EXPORT base::TimeDelta TimeoutInterval() const; BLINK_PLATFORM_EXPORT WebString HttpMethod() const; - BLINK_PLATFORM_EXPORT void SetHTTPMethod(const WebString&); + BLINK_PLATFORM_EXPORT void SetHttpMethod(const WebString&); BLINK_PLATFORM_EXPORT WebString HttpHeaderField(const WebString& name) const; // It's not possible to set the referrer header using this method. Use - // SetHTTPReferrer instead. - BLINK_PLATFORM_EXPORT void SetHTTPHeaderField(const WebString& name, + // SetHttpReferrer instead. + BLINK_PLATFORM_EXPORT void SetHttpHeaderField(const WebString& name, const WebString& value); - BLINK_PLATFORM_EXPORT void SetHTTPReferrer(const WebString& referrer, + BLINK_PLATFORM_EXPORT void SetHttpReferrer(const WebString& referrer, network::mojom::ReferrerPolicy); - BLINK_PLATFORM_EXPORT void AddHTTPHeaderField(const WebString& name, + BLINK_PLATFORM_EXPORT void AddHttpHeaderField(const WebString& name, const WebString& value); - BLINK_PLATFORM_EXPORT void ClearHTTPHeaderField(const WebString& name); - BLINK_PLATFORM_EXPORT void VisitHTTPHeaderFields(WebHTTPHeaderVisitor*) const; + BLINK_PLATFORM_EXPORT void ClearHttpHeaderField(const WebString& name); + BLINK_PLATFORM_EXPORT void VisitHttpHeaderFields(WebHTTPHeaderVisitor*) const; BLINK_PLATFORM_EXPORT WebHTTPBody HttpBody() const; - BLINK_PLATFORM_EXPORT void SetHTTPBody(const WebHTTPBody&); + BLINK_PLATFORM_EXPORT void SetHttpBody(const WebHTTPBody&); BLINK_PLATFORM_EXPORT WebHTTPBody AttachedCredential() const; BLINK_PLATFORM_EXPORT void SetAttachedCredential(const WebHTTPBody&); @@ -181,17 +237,12 @@ class WebURLRequest { BLINK_PLATFORM_EXPORT mojom::RequestContextType GetRequestContext() const; BLINK_PLATFORM_EXPORT void SetRequestContext(mojom::RequestContextType); - BLINK_PLATFORM_EXPORT network::mojom::RequestContextFrameType GetFrameType() - const; - BLINK_PLATFORM_EXPORT void SetFrameType( - network::mojom::RequestContextFrameType); - BLINK_PLATFORM_EXPORT network::mojom::ReferrerPolicy GetReferrerPolicy() const; // Sets an HTTP origin header if it is empty and the HTTP method of the // request requires it. - BLINK_PLATFORM_EXPORT void SetHTTPOriginIfNeeded(const WebSecurityOrigin&); + BLINK_PLATFORM_EXPORT void SetHttpOriginIfNeeded(const WebSecurityOrigin&); // True if the request was user initiated. BLINK_PLATFORM_EXPORT bool HasUserGesture() const; @@ -318,17 +369,20 @@ class WebURLRequest { BLINK_PLATFORM_EXPORT const WebString GetRequestedWithHeader() const; BLINK_PLATFORM_EXPORT void SetRequestedWithHeader(const WebString&); - // Remembers 'X-Client-Data' header value. Blink should not set this header - // value until CORS checks are done to avoid running checks even against - // headers that are internally set. - BLINK_PLATFORM_EXPORT const WebString GetClientDataHeader() const; - BLINK_PLATFORM_EXPORT void SetClientDataHeader(const WebString&); + // Remembers 'Purpose' header value. Blink should not set this header value + // until CORS checks are done to avoid running checks even against headers + // that are internally set. + BLINK_PLATFORM_EXPORT const WebString GetPurposeHeader() const; // https://fetch.spec.whatwg.org/#concept-request-window // See network::ResourceRequest::fetch_window_id for details. BLINK_PLATFORM_EXPORT const base::UnguessableToken& GetFetchWindowId() const; BLINK_PLATFORM_EXPORT void SetFetchWindowId(const base::UnguessableToken&); + BLINK_PLATFORM_EXPORT base::Optional<WebString> GetDevToolsId() const; + + BLINK_PLATFORM_EXPORT int GetLoadFlagsForWebUrlRequest() const; + #if INSIDE_BLINK BLINK_PLATFORM_EXPORT ResourceRequest& ToMutableResourceRequest(); BLINK_PLATFORM_EXPORT const ResourceRequest& ToResourceRequest() const; diff --git a/chromium/third_party/blink/public/platform/web_url_response.h b/chromium/third_party/blink/public/platform/web_url_response.h index cd6279a0fc3..c7609e6691e 100644 --- a/chromium/third_party/blink/public/platform/web_url_response.h +++ b/chromium/third_party/blink/public/platform/web_url_response.h @@ -175,15 +175,15 @@ class WebURLResponse { BLINK_PLATFORM_EXPORT void SetResponseTime(base::Time); BLINK_PLATFORM_EXPORT WebString MimeType() const; - BLINK_PLATFORM_EXPORT void SetMIMEType(const WebString&); + BLINK_PLATFORM_EXPORT void SetMimeType(const WebString&); - BLINK_PLATFORM_EXPORT long long ExpectedContentLength() const; - BLINK_PLATFORM_EXPORT void SetExpectedContentLength(long long); + BLINK_PLATFORM_EXPORT int64_t ExpectedContentLength() const; + BLINK_PLATFORM_EXPORT void SetExpectedContentLength(int64_t); BLINK_PLATFORM_EXPORT void SetTextEncodingName(const WebString&); BLINK_PLATFORM_EXPORT HTTPVersion HttpVersion() const; - BLINK_PLATFORM_EXPORT void SetHTTPVersion(HTTPVersion); + BLINK_PLATFORM_EXPORT void SetHttpVersion(HTTPVersion); BLINK_PLATFORM_EXPORT int RequestId() const; BLINK_PLATFORM_EXPORT void SetRequestId(int); @@ -192,18 +192,18 @@ class WebURLResponse { BLINK_PLATFORM_EXPORT void SetHttpStatusCode(int); BLINK_PLATFORM_EXPORT WebString HttpStatusText() const; - BLINK_PLATFORM_EXPORT void SetHTTPStatusText(const WebString&); + BLINK_PLATFORM_EXPORT void SetHttpStatusText(const WebString&); BLINK_PLATFORM_EXPORT WebString HttpHeaderField(const WebString& name) const; - BLINK_PLATFORM_EXPORT void SetHTTPHeaderField(const WebString& name, + BLINK_PLATFORM_EXPORT void SetHttpHeaderField(const WebString& name, const WebString& value); - BLINK_PLATFORM_EXPORT void AddHTTPHeaderField(const WebString& name, + BLINK_PLATFORM_EXPORT void AddHttpHeaderField(const WebString& name, const WebString& value); - BLINK_PLATFORM_EXPORT void ClearHTTPHeaderField(const WebString& name); - BLINK_PLATFORM_EXPORT void VisitHTTPHeaderFields(WebHTTPHeaderVisitor*) const; + BLINK_PLATFORM_EXPORT void ClearHttpHeaderField(const WebString& name); + BLINK_PLATFORM_EXPORT void VisitHttpHeaderFields(WebHTTPHeaderVisitor*) const; - BLINK_PLATFORM_EXPORT long long AppCacheID() const; - BLINK_PLATFORM_EXPORT void SetAppCacheID(long long); + BLINK_PLATFORM_EXPORT int64_t AppCacheID() const; + BLINK_PLATFORM_EXPORT void SetAppCacheID(int64_t); BLINK_PLATFORM_EXPORT WebURL AppCacheManifestURL() const; BLINK_PLATFORM_EXPORT void SetAppCacheManifestURL(const WebURL&); @@ -232,13 +232,11 @@ class WebURLResponse { BLINK_PLATFORM_EXPORT void SetWasFetchedViaSPDY(bool); // Flag whether this request was loaded via a ServiceWorker. See - // ServiceWorkerResponseInfo::was_fetched_via_service_worker() for details. + // network::ResourceResponseInfo::was_fetched_via_service_worker for details. BLINK_PLATFORM_EXPORT bool WasFetchedViaServiceWorker() const; BLINK_PLATFORM_EXPORT void SetWasFetchedViaServiceWorker(bool); - // Flag whether the fallback request with skip service worker flag was - // required. See ServiceWorkerResponseInfo::was_fallback_required() for - // details. + // See network::ResourceResponseInfo::was_fallback_required_by_service_worker. BLINK_PLATFORM_EXPORT void SetWasFallbackRequiredByServiceWorker(bool); // https://fetch.spec.whatwg.org/#concept-response-type @@ -246,9 +244,9 @@ class WebURLResponse { BLINK_PLATFORM_EXPORT network::mojom::FetchResponseType GetType() const; // The URL list of the Response object the ServiceWorker passed to - // respondWith(). See ServiceWorkerResponseInfo::url_list_via_service_worker() - // for details. - BLINK_PLATFORM_EXPORT void SetURLListViaServiceWorker( + // respondWith(). See + // network::ResourceResponseInfo::url_list_via_service_worker for details. + BLINK_PLATFORM_EXPORT void SetUrlListViaServiceWorker( const WebVector<WebURL>&); // Returns true if the URL list is not empty. BLINK_PLATFORM_EXPORT bool HasUrlListViaServiceWorker() const; @@ -264,8 +262,7 @@ class WebURLResponse { const WebVector<WebString>&); // Whether service worker navigation preload occurred. - // See ServiceWorkerResponseInfo::did_navigation_preload() for - // details. + // See network::ResourceResponseInfo::did_navigation_preload for details. BLINK_PLATFORM_EXPORT void SetDidServiceWorkerNavigationPreload(bool); // Remote IP address of the socket which fetched this resource. @@ -287,7 +284,7 @@ class WebURLResponse { net::HttpResponseInfo::ConnectionInfo); // Original size of the response before decompression. - BLINK_PLATFORM_EXPORT void SetEncodedDataLength(long long); + BLINK_PLATFORM_EXPORT void SetEncodedDataLength(int64_t); BLINK_PLATFORM_EXPORT void SetIsSignedExchangeInnerResponse(bool); diff --git a/chromium/third_party/blink/public/platform/web_worker_fetch_context.h b/chromium/third_party/blink/public/platform/web_worker_fetch_context.h index 96400c2701a..3f0c3d4b6cc 100644 --- a/chromium/third_party/blink/public/platform/web_worker_fetch_context.h +++ b/chromium/third_party/blink/public/platform/web_worker_fetch_context.h @@ -10,7 +10,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_refptr.h" -#include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom-shared.h" +#include "third_party/blink/public/mojom/service_worker/controller_service_worker_mode.mojom-shared.h" #include "third_party/blink/public/platform/code_cache_loader.h" #include "third_party/blink/public/platform/web_application_cache_host.h" #include "third_party/blink/public/platform/web_document_subresource_filter.h" diff --git a/chromium/third_party/blink/public/platform/websocket_handshake_throttle.h b/chromium/third_party/blink/public/platform/websocket_handshake_throttle.h index 52ced236617..ef8c01524bd 100644 --- a/chromium/third_party/blink/public/platform/websocket_handshake_throttle.h +++ b/chromium/third_party/blink/public/platform/websocket_handshake_throttle.h @@ -15,7 +15,8 @@ #ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEBSOCKET_HANDSHAKE_THROTTLE_H_ #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEBSOCKET_HANDSHAKE_THROTTLE_H_ -#include "third_party/blink/public/platform/web_callbacks.h" +#include "base/callback.h" +#include "base/optional.h" namespace blink { @@ -29,14 +30,15 @@ class WebSocketHandshakeThrottle { // should be cleaned up if possible. virtual ~WebSocketHandshakeThrottle() = default; - // The WebCallbacks OnSuccess or OnError should be called asychronously to - // permit Javascript to use the connection or not. OnError should be passed - // a message to be displayed on the console indicating why the handshake was - // blocked. This object will be destroyed synchronously inside the - // callbacks. Callbacks must not be called after this object has been + // The closure callback OnCompletion should be called asynchronously + // to permit Javascript to use the connection or not. On error, a message + // should be passed to be displayed on the console indicating why the + // handshake was blocked. This object will be destroyed synchronously inside + // the callback. Callback must not be called after this object has been // destroyed. - virtual void ThrottleHandshake(const WebURL&, - WebCallbacks<void, const WebString&>*) = 0; + using OnCompletion = + base::OnceCallback<void(const base::Optional<WebString>& error)>; + virtual void ThrottleHandshake(const WebURL&, OnCompletion) = 0; }; } // namespace blink diff --git a/chromium/third_party/blink/public/web/DEPS b/chromium/third_party/blink/public/web/DEPS index 64890488aa0..16d8b884bfc 100644 --- a/chromium/third_party/blink/public/web/DEPS +++ b/chromium/third_party/blink/public/web/DEPS @@ -9,6 +9,7 @@ include_rules = [ "+base/strings", "+base/time/time.h", "+cc/input/browser_controls_state.h", + "+cc/input/overscroll_behavior.h", "+cc/input/layer_selection_bound.h", "+cc/paint/node_holder.h", "+cc/paint/paint_canvas.h", @@ -22,10 +23,10 @@ include_rules = [ "+services/service_manager/public", # Enforce to use mojom-shared.h in blink/public so that it can compile # inside and outside Blink. - "+services/ws/public/mojom/ime/ime.mojom-shared.h", "+third_party/blink/public/platform", "+third_party/blink/public/web", "+ui/accessibility/ax_enums.mojom-shared.h", + "+ui/base/ime/mojo/ime_types.mojom-shared.h", # Allowed only inside INSIDE_BLINK "+third_party/blink/renderer/core", diff --git a/chromium/third_party/blink/public/web/modules/autofill/web_form_element_observer.h b/chromium/third_party/blink/public/web/modules/autofill/web_form_element_observer.h index 495bd6302aa..1030f74993a 100644 --- a/chromium/third_party/blink/public/web/modules/autofill/web_form_element_observer.h +++ b/chromium/third_party/blink/public/web/modules/autofill/web_form_element_observer.h @@ -7,24 +7,21 @@ #include <memory> +#include "base/callback.h" #include "third_party/blink/public/platform/web_common.h" namespace blink { class WebFormControlElement; class WebFormElement; -class WebFormElementObserverCallback; class BLINK_EXPORT WebFormElementObserver { public: // Creates a WebFormElementObserver. Delete this WebFormElementObsrver by // calling WebFormElementObserver::Disconnect. - static WebFormElementObserver* Create( - WebFormElement&, - std::unique_ptr<WebFormElementObserverCallback>); - static WebFormElementObserver* Create( - WebFormControlElement&, - std::unique_ptr<WebFormElementObserverCallback>); + static WebFormElementObserver* Create(WebFormElement&, base::OnceClosure); + static WebFormElementObserver* Create(WebFormControlElement&, + base::OnceClosure); virtual void Disconnect() = 0; diff --git a/chromium/third_party/blink/public/web/modules/autofill/web_form_element_observer_callback.h b/chromium/third_party/blink/public/web/modules/autofill/web_form_element_observer_callback.h deleted file mode 100644 index 43adba09a18..00000000000 --- a/chromium/third_party/blink/public/web/modules/autofill/web_form_element_observer_callback.h +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_AUTOFILL_WEB_FORM_ELEMENT_OBSERVER_CALLBACK_H_ -#define THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_AUTOFILL_WEB_FORM_ELEMENT_OBSERVER_CALLBACK_H_ - -namespace blink { - -class WebFormElementObserverCallback { - public: - virtual ~WebFormElementObserverCallback() = default; - - // Invoked when the observed element was either removed from the DOM or it's - // computed style changed to display: none. - virtual void ElementWasHiddenOrRemoved() = 0; -}; - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_AUTOFILL_WEB_FORM_ELEMENT_OBSERVER_CALLBACK_H_ diff --git a/chromium/third_party/blink/public/web/modules/mediastream/DEPS b/chromium/third_party/blink/public/web/modules/mediastream/DEPS new file mode 100644 index 00000000000..53880d29cfe --- /dev/null +++ b/chromium/third_party/blink/public/web/modules/mediastream/DEPS @@ -0,0 +1,16 @@ +include_rules = [ + # TODO(crbug.com/923394): Remove this dependency once STL types are + # migrated to WTF types in mediastream. + "+base/stl_util.h", + + "+base/compiler_specific.h", + "+base/logging.h", + "+base/gtest_prod_util.h", + "+base/memory/weak_ptr.h", + "+base/sequence_checker.h", + "+base/single_thread_task_runner.h", + "+base/threading/thread_checker.h", + "+media/base", + "+media/capture", + "+ui/gfx/geometry/size.h" +] diff --git a/chromium/third_party/blink/public/web/modules/mediastream/OWNERS b/chromium/third_party/blink/public/web/modules/mediastream/OWNERS new file mode 100644 index 00000000000..9d70184ff03 --- /dev/null +++ b/chromium/third_party/blink/public/web/modules/mediastream/OWNERS @@ -0,0 +1,4 @@ +file://third_party/blink/common/mediastream/OWNERS + +# TEAM: webrtc-dev@chromium.org +# COMPONENT: Blink>GetUserMedia diff --git a/chromium/third_party/blink/public/web/modules/mediastream/media_stream_constraints_util.h b/chromium/third_party/blink/public/web/modules/mediastream/media_stream_constraints_util.h new file mode 100644 index 00000000000..2b517e6efa7 --- /dev/null +++ b/chromium/third_party/blink/public/web/modules/mediastream/media_stream_constraints_util.h @@ -0,0 +1,360 @@ +// Copyright 2014 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_MEDIA_STREAM_CONSTRAINTS_UTIL_H_ +#define THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_MEDIA_STREAM_CONSTRAINTS_UTIL_H_ + +#include <string> + +#include "base/logging.h" +#include "media/base/video_facing.h" +#include "media/capture/video_capture_types.h" +#include "third_party/blink/public/mojom/mediastream/media_devices.mojom-shared.h" +#include "third_party/blink/public/platform/modules/mediastream/media_stream_audio_processor_options.h" +#include "third_party/blink/public/platform/web_common.h" +#include "third_party/blink/public/platform/web_media_constraints.h" +#include "third_party/blink/public/platform/web_media_stream_source.h" +#include "third_party/blink/public/web/modules/mediastream/media_stream_constraints_util_sets.h" +#include "third_party/blink/public/web/modules/mediastream/video_track_adapter_settings.h" + +namespace blink { + +extern const double kMinDeviceCaptureFrameRate; + +// This class represents the output the SelectSettings algorithm for video +// constraints (see https://w3c.github.io/mediacapture-main/#dfn-selectsettings) +// The input to SelectSettings is a user-supplied constraints object, and its +// output is a set of implementation-specific settings that are used to +// configure other Chromium objects such as sources, tracks and sinks so that +// they work in the way indicated by the specification. VideoCaptureSettings may +// also be used to implement other constraints-related functionality, such as +// the getSettings() function. +// The following fields are used to control MediaStreamVideoSource objects: +// * device_id: used for device selection and obtained from the deviceId +// * capture_params: used to initialize video capture. Its values are obtained +// from the width, height, aspectRatio, frame_rate, and googNoiseReduction +// constraints. +// The following fields are used to control MediaStreamVideoTrack objects: +// * track_adapter_settings: All track objects use a VideoTrackAdapter object +// that may perform cropping and frame-rate adjustment. This field contains +// the adapter settings suitable for the track the constraints are being +// to. These settings are derived from the width, height, aspectRatio and +// frameRate constraints. +// Some MediaStreamVideoSink objects (e.g. MediaStreamVideoWebRtcSink) require +// configuration derived from constraints that cannot be obtained from the +// source and track settings indicated above. The following fields are used +// to configure sinks: +// * noise_reduction: used to control noise reduction for a screen-capture +// track sent to a peer connection. Derive from the googNoiseReduction +// constraint. +// * min_frame_rate and max_frame_rate: used to control frame refreshes in +// screen-capture tracks sent to a peer connection. Derived from the +// frameRate constraint. +// If SelectSettings fails, the HasValue() method returns false and +// failed_constraint_name() returns the name of one of the (possibly multiple) +// constraints that could not be satisfied. +class BLINK_EXPORT VideoCaptureSettings { + public: + // Creates an object without value and with an empty failed constraint name. + VideoCaptureSettings(); + + // Creates an object without value and with the given + // |failed_constraint_name|. Does not take ownership of + // |failed_constraint_name|, so it must point to a string that remains + // accessible. |failed_constraint_name| must be non-null. + explicit VideoCaptureSettings(const char* failed_constraint_name); + + // Creates an object with the given values. + VideoCaptureSettings(std::string device_id, + media::VideoCaptureParams capture_params_, + base::Optional<bool> noise_reduction_, + const VideoTrackAdapterSettings& track_adapter_settings, + base::Optional<double> min_frame_rate, + base::Optional<double> max_frame_rate); + + VideoCaptureSettings(const VideoCaptureSettings& other); + VideoCaptureSettings& operator=(const VideoCaptureSettings& other); + VideoCaptureSettings(VideoCaptureSettings&& other); + VideoCaptureSettings& operator=(VideoCaptureSettings&& other); + ~VideoCaptureSettings(); + + bool HasValue() const { return !failed_constraint_name_; } + + // Convenience accessors for fields embedded in |capture_params_|. + const media::VideoCaptureFormat& Format() const { + return capture_params_.requested_format; + } + int Width() const { + DCHECK(HasValue()); + return capture_params_.requested_format.frame_size.width(); + } + int Height() const { + DCHECK(HasValue()); + return capture_params_.requested_format.frame_size.height(); + } + float FrameRate() const { + DCHECK(HasValue()); + return capture_params_.requested_format.frame_rate; + } + media::ResolutionChangePolicy ResolutionChangePolicy() const { + DCHECK(HasValue()); + return capture_params_.resolution_change_policy; + } + + // Other accessors. + const char* failed_constraint_name() const { return failed_constraint_name_; } + + const std::string& device_id() const { + DCHECK(HasValue()); + return device_id_; + } + const media::VideoCaptureParams& capture_params() const { + DCHECK(HasValue()); + return capture_params_; + } + const base::Optional<bool>& noise_reduction() const { + DCHECK(HasValue()); + return noise_reduction_; + } + const VideoTrackAdapterSettings& track_adapter_settings() const { + DCHECK(HasValue()); + return track_adapter_settings_; + } + const base::Optional<double>& min_frame_rate() const { + DCHECK(HasValue()); + return min_frame_rate_; + } + const base::Optional<double>& max_frame_rate() const { + DCHECK(HasValue()); + return max_frame_rate_; + } + + private: + const char* failed_constraint_name_; + std::string device_id_; + media::VideoCaptureParams capture_params_; + base::Optional<bool> noise_reduction_; + VideoTrackAdapterSettings track_adapter_settings_; + base::Optional<double> min_frame_rate_; + base::Optional<double> max_frame_rate_; +}; + +// This class represents the output the SelectSettings algorithm for audio +// constraints (see https://w3c.github.io/mediacapture-main/#dfn-selectsettings) +// The input to SelectSettings is a user-supplied constraints object, and its +// output is a set of implementation-specific settings that are used to +// configure other Chromium objects such as sources, tracks and sinks so that +// they work in the way indicated by the specification. AudioCaptureSettings may +// also be used to implement other constraints-related functionality, such as +// the getSettings() function. +// The following fields are used to control MediaStreamVideoSource objects: +// * device_id: used for device selection and obtained from the deviceId +// * device_parameters: these are the hardware parameters for the device +// selected by SelectSettings. They can be used to verify that the +// parameters with which the audio stream is actually created corresponds +// to what SelectSettings selected. It can also be used to implement +// getSettings() for device-related properties such as sampleRate and +// channelCount. +// The following fields are used to control various audio features: +// * disable_local_echo +// * render_to_associated_sink +// The audio_properties field is used to control the audio-processing module, +// which provides features such as software-based echo cancellation. +// If SelectSettings fails, the HasValue() method returns false and +// failed_constraint_name() returns the name of one of the (possibly multiple) +// constraints that could not be satisfied. +class BLINK_EXPORT AudioCaptureSettings { + public: + enum class ProcessingType { + // System echo cancellation can be enabled, but all other processing is + // disabled. + kUnprocessed, + // System echo cancellation and audio mirroring can be enabled, but all + // other processing is disabled. + kNoApmProcessed, + // Processing is performed through WebRTC. + kApmProcessed + }; + + // Creates an object without value and with an empty failed constraint name. + AudioCaptureSettings(); + + // Creates an object without value and with the given + // |failed_constraint_name|. Does not take ownership of + // |failed_constraint_name|, so it must point to a string that remains + // accessible. |failed_constraint_name| must be non-null. + explicit AudioCaptureSettings(const char* failed_constraint_name); + + // Creates an object with the given values. + explicit AudioCaptureSettings( + std::string device_id, + const base::Optional<int>& requested_buffer_size, + bool disable_local_echo, + bool enable_automatic_output_device_selection, + const AudioProcessingProperties& audio_processing_properties); + AudioCaptureSettings(const AudioCaptureSettings& other); + AudioCaptureSettings& operator=(const AudioCaptureSettings& other); + AudioCaptureSettings(AudioCaptureSettings&& other); + AudioCaptureSettings& operator=(AudioCaptureSettings&& other); + + bool HasValue() const { return !failed_constraint_name_; } + + // Accessors. + const char* failed_constraint_name() const { return failed_constraint_name_; } + const std::string& device_id() const { + DCHECK(HasValue()); + return device_id_; + } + const base::Optional<int>& requested_buffer_size() const { + DCHECK(HasValue()); + return requested_buffer_size_; + } + bool disable_local_echo() const { + DCHECK(HasValue()); + return disable_local_echo_; + } + bool render_to_associated_sink() const { + DCHECK(HasValue()); + return render_to_associated_sink_; + } + AudioProcessingProperties audio_processing_properties() const { + DCHECK(HasValue()); + return audio_processing_properties_; + } + + private: + const char* failed_constraint_name_; + std::string device_id_; + base::Optional<int> requested_buffer_size_; + bool disable_local_echo_; + bool render_to_associated_sink_; + AudioProcessingProperties audio_processing_properties_; +}; + +// Method to get boolean value of constraint with |name| from constraints. +// Returns true if the constraint is specified in either mandatory or optional +// constraints. +BLINK_EXPORT bool GetConstraintValueAsBoolean( + const blink::WebMediaConstraints& constraints, + const blink::BooleanConstraint blink::WebMediaTrackConstraintSet::*picker, + bool* value); + +// Method to get int value of constraint with |name| from constraints. +// Returns true if the constraint is specified in either mandatory or Optional +// constraints. +BLINK_EXPORT bool GetConstraintValueAsInteger( + const blink::WebMediaConstraints& constraints, + const blink::LongConstraint blink::WebMediaTrackConstraintSet::*picker, + int* value); + +BLINK_EXPORT bool GetConstraintMinAsInteger( + const blink::WebMediaConstraints& constraints, + const blink::LongConstraint blink::WebMediaTrackConstraintSet::*picker, + int* value); + +BLINK_EXPORT bool GetConstraintMaxAsInteger( + const blink::WebMediaConstraints& constraints, + const blink::LongConstraint blink::WebMediaTrackConstraintSet::*picker, + int* value); + +// Method to get double precision value of constraint with |name| from +// constraints. Returns true if the constraint is specified in either mandatory +// or Optional constraints. +BLINK_EXPORT bool GetConstraintValueAsDouble( + const blink::WebMediaConstraints& constraints, + const blink::DoubleConstraint blink::WebMediaTrackConstraintSet::*picker, + double* value); + +BLINK_EXPORT bool GetConstraintMinAsDouble( + const blink::WebMediaConstraints& constraints, + const blink::DoubleConstraint blink::WebMediaTrackConstraintSet::*picker, + double* value); + +BLINK_EXPORT bool GetConstraintMaxAsDouble( + const blink::WebMediaConstraints& constraints, + const blink::DoubleConstraint blink::WebMediaTrackConstraintSet::*picker, + double* value); + +// Method to get std::string value of constraint with |name| from constraints. +// Returns true if the constraint is specified in either mandatory or Optional +// constraints. +BLINK_EXPORT bool GetConstraintValueAsString( + const blink::WebMediaConstraints& constraints, + const blink::StringConstraint blink::WebMediaTrackConstraintSet::*picker, + std::string* value); + +// If |value| is outside the range of |constraint|, returns the name of the +// failed constraint. Otherwise, returns nullptr. The return value converts to +// bool in the expected way. +template <typename NumericConstraintType, typename ValueType> +const char* IsOutsideConstraintRange(NumericConstraintType constraint, + ValueType value) { + return (ConstraintHasMin(constraint) && value < ConstraintMin(constraint)) || + (ConstraintHasMax(constraint) && + value > ConstraintMax(constraint)) + ? constraint.GetName() + : nullptr; +} + +BLINK_EXPORT std::string GetMediaStreamSource( + const blink::WebMediaConstraints& constraints); +bool IsDeviceCapture(const blink::WebMediaConstraints& constraints); + +// This function selects track settings from a set of candidate resolutions and +// frame rates, given the source video-capture format and ideal values. +// The output are settings for a VideoTrackAdapter, which can adjust the +// resolution and frame rate of the source, and consist of +// target width, height and frame rate, and minimum and maximum aspect ratio. +// * Minimum and maximum aspect ratios are taken from |resolution_set| and are +// not affected by ideal values. +// * The selected frame rate is always the value within the |frame_rate_set| +// range that is closest to the ideal frame rate (or closest to the source +// frame rate if no ideal is supplied). If the chosen frame rate is greater +// than or equal to the source's frame rate, a value of 0.0 is returned, which +// means that there will be no frame-rate adjustment. +// * If |enable_rescale| is false, no target width and height are computed. +// * If |enable_rescale| is true, the target width and height are selected using +// the ResolutionSet::SelectClosestPointToIdeal function, using ideal values +// for the width, height and aspectRatio properties from +// |basic_constraint_set| and using the source's width and height as the +// default resolution. The width and height returned by +// SelectClosestPointToIdeal are rounded to the nearest int. For more details, +// see the documentation for ResolutionSet::SelectClosestPointToIdeal. +// Note that this function ignores the min/max/exact values from +// |basic_constraint_set|. Only the ideal values for the width, height, +// aspectRatio and frameRate are used. +// This function has undefined behavior if any of |resolution_set| or +// |frame_rate_set| are empty. +BLINK_EXPORT VideoTrackAdapterSettings SelectVideoTrackAdapterSettings( + const blink::WebMediaTrackConstraintSet& basic_constraint_set, + const media_constraints::ResolutionSet& resolution_set, + const media_constraints::NumericRangeSet<double>& frame_rate_set, + const media::VideoCaptureFormat& source_format, + bool enable_rescale); + +// Generic distance function between two values for numeric constraints. Based +// on the fitness-distance function described in +// https://w3c.github.io/mediacapture-main/#dfn-fitness-distance +BLINK_EXPORT double NumericConstraintFitnessDistance(double value1, + double value2); + +// Fitness distance between |value| and |constraint|. +// Based on https://w3c.github.io/mediacapture-main/#dfn-fitness-distance. +double StringConstraintFitnessDistance( + const blink::WebString& value, + const blink::StringConstraint& constraint); + +// This method computes capabilities for a video source based on the given +// |formats|. |facing_mode| is valid only in case of video device capture. +BLINK_EXPORT blink::WebMediaStreamSource::Capabilities +ComputeCapabilitiesForVideoSource( + const blink::WebString& device_id, + const media::VideoCaptureFormats& formats, + media::VideoFacingMode facing_mode, + bool is_device_capture, + const base::Optional<std::string>& group_id = base::nullopt); + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_MEDIA_STREAM_CONSTRAINTS_UTIL_H_ diff --git a/chromium/third_party/blink/public/web/modules/mediastream/media_stream_constraints_util_sets.h b/chromium/third_party/blink/public/web/modules/mediastream/media_stream_constraints_util_sets.h new file mode 100644 index 00000000000..5bbd5676337 --- /dev/null +++ b/chromium/third_party/blink/public/web/modules/mediastream/media_stream_constraints_util_sets.h @@ -0,0 +1,456 @@ +// Copyright 2017 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_MEDIA_STREAM_CONSTRAINTS_UTIL_SETS_H_ +#define THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_MEDIA_STREAM_CONSTRAINTS_UTIL_SETS_H_ + +#include <algorithm> +#include <limits> +#include <string> +#include <utility> +#include <vector> + +#include "base/gtest_prod_util.h" +#include "base/logging.h" +#include "base/optional.h" +#include "base/stl_util.h" +#include "third_party/blink/public/platform/web_common.h" +#include "third_party/blink/public/platform/web_media_constraints.h" + +namespace blink { + +struct WebMediaTrackConstraintSet; + +template <typename ConstraintType> +bool ConstraintHasMax(const ConstraintType& constraint) { + return constraint.HasMax() || constraint.HasExact(); +} + +template <typename ConstraintType> +bool ConstraintHasMin(const ConstraintType& constraint) { + return constraint.HasMin() || constraint.HasExact(); +} + +template <typename ConstraintType> +auto ConstraintMax(const ConstraintType& constraint) + -> decltype(constraint.Max()) { + DCHECK(ConstraintHasMax(constraint)); + return constraint.HasExact() ? constraint.Exact() : constraint.Max(); +} + +template <typename ConstraintType> +auto ConstraintMin(const ConstraintType& constraint) + -> decltype(constraint.Min()) { + DCHECK(ConstraintHasMin(constraint)); + return constraint.HasExact() ? constraint.Exact() : constraint.Min(); +} + +namespace media_constraints { + +// This class template represents a set of candidates suitable for a numeric +// range-based constraint. +template <typename T> +class NumericRangeSet { + public: + NumericRangeSet() = default; + NumericRangeSet(base::Optional<T> min, base::Optional<T> max) + : min_(std::move(min)), max_(std::move(max)) {} + NumericRangeSet(const NumericRangeSet& other) = default; + NumericRangeSet& operator=(const NumericRangeSet& other) = default; + ~NumericRangeSet() = default; + + const base::Optional<T>& Min() const { return min_; } + const base::Optional<T>& Max() const { return max_; } + bool IsEmpty() const { return max_ && min_ && *max_ < *min_; } + + NumericRangeSet Intersection(const NumericRangeSet& other) const { + base::Optional<T> min = min_; + if (other.Min()) + min = min ? std::max(*min, *other.Min()) : other.Min(); + + base::Optional<T> max = max_; + if (other.Max()) + max = max ? std::min(*max, *other.Max()) : other.Max(); + + return NumericRangeSet(min, max); + } + + bool Contains(T value) const { + return (!Min() || value >= *Min()) && (!Max() || value <= *Max()); + } + + // Creates a NumericRangeSet based on the minimum and maximum values of + // |constraint| and a client-provided range of valid values. + // If the range given in |constraint| has empty intersection with the range + // [|lower_bound|, |upper_bound|], an empty NumericRangeSet is returned. + // Otherwise, if the minimum or maximum value of |constraint| is outside + // [|lower_bound|, |upper_bound|], the value is ignored. + template <typename ConstraintType> + static NumericRangeSet<T> FromConstraint(ConstraintType constraint, + T lower_bound, + T upper_bound) { + DCHECK_LE(lower_bound, upper_bound); + // Return an empty set if the constraint range does not overlap with the + // valid range. + if ((ConstraintHasMax(constraint) && + ConstraintMax(constraint) < lower_bound) || + (ConstraintHasMin(constraint) && + ConstraintMin(constraint) > upper_bound)) { + return NumericRangeSet<decltype(constraint.Min())>(1, 0); + } + + return NumericRangeSet<T>( + ConstraintHasMin(constraint) && ConstraintMin(constraint) >= lower_bound + ? ConstraintMin(constraint) + : base::Optional<T>(), + ConstraintHasMax(constraint) && ConstraintMax(constraint) <= upper_bound + ? ConstraintMax(constraint) + : base::Optional<T>()); + } + + // Creates a NumericRangeSet based on the minimum and maximum values of + // |constraint| and a client-provided range of valid values. + template <typename ConstraintType> + static NumericRangeSet<T> FromConstraint(ConstraintType constraint) { + return NumericRangeSet<T>( + ConstraintHasMin(constraint) ? ConstraintMin(constraint) + : base::Optional<T>(), + ConstraintHasMax(constraint) ? ConstraintMax(constraint) + : base::Optional<T>()); + } + + // Creates a NumericRangeSet based on a single value representing both the + // minimum and the maximum values for this range. + static NumericRangeSet<T> FromValue(T value) { + return NumericRangeSet<T>(value, value); + } + + static NumericRangeSet<T> EmptySet() { return NumericRangeSet(1, 0); } + + private: + base::Optional<T> min_; + base::Optional<T> max_; +}; + +// This class defines a set of discrete elements suitable for resolving +// constraints with a countable number of choices not suitable to be constrained +// by range. Examples are strings, booleans and certain constraints of type +// long. A DiscreteSet can be empty, have their elements explicitly stated, or +// be the universal set. The universal set is a set that contains all possible +// elements. The specific definition of what elements are in the universal set +// is application defined (e.g., it could be all possible boolean values, all +// possible strings of length N, or anything that suits a particular +// application). +// TODO(guidou): Rename this class. https://crbug.com/731166 +template <typename T> +class DiscreteSet { + public: + // Creates a universal set. + DiscreteSet() : is_universal_(true) {} + // Creates a set containing the elements in |elements|. + // It is the responsibility of the caller to ensure that |elements| is not + // equivalent to the universal set and that |elements| has no repeated + // values. Takes ownership of |elements|. + explicit DiscreteSet(std::vector<T> elements) + : is_universal_(false), elements_(std::move(elements)) {} + // Creates an empty set; + static DiscreteSet EmptySet() { return DiscreteSet(std::vector<T>()); } + static DiscreteSet UniversalSet() { return DiscreteSet(); } + + DiscreteSet(const DiscreteSet& other) = default; + DiscreteSet& operator=(const DiscreteSet& other) = default; + DiscreteSet(DiscreteSet&& other) = default; + DiscreteSet& operator=(DiscreteSet&& other) = default; + ~DiscreteSet() = default; + + bool Contains(const T& value) const { + return is_universal_ || base::ContainsValue(elements_, value); + } + + bool IsEmpty() const { return !is_universal_ && elements_.empty(); } + + bool HasExplicitElements() const { return !elements_.empty(); } + + DiscreteSet Intersection(const DiscreteSet& other) const { + if (is_universal_) + return other; + if (other.is_universal_) + return *this; + if (IsEmpty() || other.IsEmpty()) + return EmptySet(); + + // Both sets have explicit elements. + std::vector<T> intersection; + for (const auto& entry : elements_) { + if (base::ContainsValue(other.elements_, entry)) + intersection.push_back(entry); + } + return DiscreteSet(std::move(intersection)); + } + + // Returns a copy of the first element in the set. This is useful as a simple + // tie-breaker rule. This applies only to constrained nonempty sets. + // Behavior is undefined if the set is empty or universal. + T FirstElement() const { + DCHECK(HasExplicitElements()); + return elements_[0]; + } + + // Returns a reference to the list of elements in the set. + // Behavior is undefined if the set is universal. + const std::vector<T>& elements() const { + DCHECK(!is_universal_); + return elements_; + } + + bool is_universal() const { return is_universal_; } + + private: + bool is_universal_; + std::vector<T> elements_; +}; + +// Special case for DiscreteSet<bool> where it is easy to produce an explicit +// set that contains all possible elements. +template <> +inline bool DiscreteSet<bool>::is_universal() const { + return Contains(true) && Contains(false); +} + +// TODO(crbug.com/704136): Remove BLINK_EXPORT when this file is moved +// out of blink/public/platform. +BLINK_EXPORT DiscreteSet<std::string> StringSetFromConstraint( + const StringConstraint& constraint); +BLINK_EXPORT DiscreteSet<bool> BoolSetFromConstraint( + const BooleanConstraint& constraint); + +// This class represents a set of (height, width) screen resolution candidates +// determined by width, height and aspect-ratio constraints. +// This class supports widths and heights from 0 to kMaxDimension, both +// inclusive and aspect ratios from 0.0 to positive infinity, both inclusive. +class BLINK_EXPORT ResolutionSet { + public: + static const int kMaxDimension = std::numeric_limits<int>::max(); + + // Helper class that represents (height, width) points on a plane. + // TODO(guidou): Use a generic point/vector class that uses double once it + // becomes available (e.g., a gfx::Vector2dD). + class BLINK_EXPORT Point { + public: + // Creates a (|height|, |width|) point. |height| and |width| must be finite. + Point(double height, double width); + Point(const Point& other); + Point& operator=(const Point& other); + ~Point(); + + // Accessors. + double height() const { return height_; } + double width() const { return width_; } + double AspectRatio() const { return width_ / height_; } + + // Exact equality/inequality operators. + bool operator==(const Point& other) const; + bool operator!=(const Point& other) const; + + // Returns true if the coordinates of this point and |other| are + // approximately equal. + bool IsApproximatelyEqualTo(const Point& other) const; + + // Vector-style addition and subtraction operators. + Point operator+(const Point& other) const; + Point operator-(const Point& other) const; + + // Returns the dot product between |p1| and |p2|. + static double Dot(const Point& p1, const Point& p2); + + // Returns the square Euclidean distance between |p1| and |p2|. + static double SquareEuclideanDistance(const Point& p1, const Point& p2); + + // Returns the point in the line segment determined by |s1| and |s2| that + // is closest to |p|. + static Point ClosestPointInSegment(const Point& p, + const Point& s1, + const Point& s2); + + private: + double height_; + double width_; + }; + + // Creates a set with the maximum supported ranges for width, height and + // aspect ratio. + ResolutionSet(); + ResolutionSet(int min_height, + int max_height, + int min_width, + int max_width, + double min_aspect_ratio, + double max_aspect_ratio); + ResolutionSet(const ResolutionSet& other); + ResolutionSet& operator=(const ResolutionSet& other); + ~ResolutionSet(); + + // Getters. + int min_height() const { return min_height_; } + int max_height() const { return max_height_; } + int min_width() const { return min_width_; } + int max_width() const { return max_width_; } + double min_aspect_ratio() const { return min_aspect_ratio_; } + double max_aspect_ratio() const { return max_aspect_ratio_; } + + // Returns true if this set is empty. + bool IsEmpty() const; + + // These functions return true if a particular variable causes the set to be + // empty. + bool IsHeightEmpty() const; + bool IsWidthEmpty() const; + bool IsAspectRatioEmpty() const; + + // These functions return true if the given point is included in this set. + bool ContainsPoint(const Point& point) const; + bool ContainsPoint(int height, int width) const; + + // Returns a new set with the intersection of |*this| and |other|. + ResolutionSet Intersection(const ResolutionSet& other) const; + + // Returns a point in this (nonempty) set closest to the ideal values for the + // height, width and aspectRatio constraints in |constraint_set|. + // Note that this function ignores all the other data in |constraint_set|. + // Only the ideal height, width and aspect ratio are used, and from now on + // referred to as |ideal_height|, |ideal_width| and |ideal_aspect_ratio| + // respectively. + // + // * If all three ideal values are given, |ideal_aspect_ratio| is ignored and + // the point closest to (|ideal_height|, |ideal_width|) is returned. + // * If two ideal values are given, they are used to determine a single ideal + // point, which can be one of: + // - (|ideal_height|, |ideal_width|), + // - (|ideal_height|, |ideal_height|*|ideal_aspect_ratio|), or + // - (|ideal_width| / |ideal_aspect_ratio|, |ideal_width|). + // The point in the set closest to the ideal point is returned. + // * If a single ideal value is given, a point in the set closest to the line + // defined by the ideal value is returned. If there is more than one point + // closest to the ideal line, the following tie-breaker rules are used: + // - If |ideal_height| is provided, the point closest to + // (|ideal_height|, |ideal_height| * default_aspect_ratio), where + // default_aspect_ratio is the result of the floating-point division + // |default_width|/|default_height|. + // - If |ideal_width| is provided, the point closest to + // (|ideal_width| / default_aspect_ratio, |ideal_width|). + // - If |ideal_aspect_ratio| is provided, the point with largest area among + // the points closest to + // (|default_height|, |default_height| * aspect_ratio) and + // (|default_width| / aspect_ratio, |default_width|), + // where aspect_ratio is |ideal_aspect_ratio| if the ideal line intersects + // the set, and the closest aspect ratio to |ideal_aspect_ratio| among the + // points in the set if no point in the set has an aspect ratio equal to + // |ideal_aspect_ratio|. + // * If no ideal value is given, proceed as if only |ideal_aspect_ratio| was + // provided with a value of default_aspect_ratio. + // + // This is intended to support the implementation of the spec algorithm for + // selection of track settings, as defined in + // https://w3c.github.io/mediacapture-main/#dfn-selectsettings. + // + // The main difference between this algorithm and the spec is that when ideal + // values are provided, the spec mandates finding a point that minimizes the + // sum of custom relative distances for each provided ideal value, while this + // algorithm minimizes either the Euclidean distance (sum of square distances) + // on a height-width plane for the cases where two or three ideal values are + // provided, or the absolute distance for the case with one ideal value. + // Also, in the case with three ideal values, this algorithm ignores the + // distance to the ideal aspect ratio. + // In most cases the difference in the final result should be negligible. + // The reason to follow this approach is that optimization in the worst case + // is reduced to projection of a point on line segment, which is a simple + // operation that provides exact results. Using the distance function of the + // spec, which is not continuous, would require complex optimization methods + // that do not necessarily guarantee finding the real optimal value. + // + // This function has undefined behavior if this set is empty. + Point SelectClosestPointToIdeal( + const WebMediaTrackConstraintSet& constraint_set, + int default_height, + int default_width) const; + + // Utilities that return ResolutionSets constrained on a specific variable. + static ResolutionSet FromHeight(int min, int max); + static ResolutionSet FromExactHeight(int value); + static ResolutionSet FromWidth(int min, int max); + static ResolutionSet FromExactWidth(int value); + static ResolutionSet FromAspectRatio(double min, double max); + static ResolutionSet FromExactAspectRatio(double value); + + // Returns a ResolutionSet containing only the specified width and height. + static ResolutionSet FromExactResolution(int width, int height); + + // Returns a ResolutionCandidateSet initialized with |constraint_set|'s + // width, height and aspectRatio constraints. + static ResolutionSet FromConstraintSet( + const WebMediaTrackConstraintSet& constraint_set); + + // Returns the closest point in this set to |point|. If |point| is included in + // this set, Point is returned. If this set is empty, behavior is undefined. + // TODO(crbug.com/704136): Make this method private once dependent tests are + // moved to Blink. + Point ClosestPointTo(const Point& point) const; + + // Returns a list of the vertices defined by the constraints on a height-width + // Cartesian plane. + // If the list is empty, the set is empty. + // If the list contains a single point, the set contains a single point. + // If the list contains two points, the set is composed of points on a line + // segment. + // If the list contains three to six points, they are the vertices of a + // convex polygon containing all valid points in the set. Each pair of + // consecutive vertices (modulo the size of the list) corresponds to a side of + // the polygon, with the vertices given in counterclockwise order. + // The list cannot contain more than six points. + // TODO(crbug.com/704136): Make this method private once dependent tests are + // moved to Blink. + std::vector<Point> ComputeVertices() const; + + private: + // Implements SelectClosestPointToIdeal() for the case when only the ideal + // aspect ratio is provided. + Point SelectClosestPointToIdealAspectRatio(double ideal_aspect_ratio, + int default_height, + int default_width) const; + + // Returns the vertices of the set that have the property accessed + // by |accessor| closest to |value|. The returned vector always has one or two + // elements. Behavior is undefined if the set is empty. + std::vector<Point> GetClosestVertices(double (Point::*accessor)() const, + double value) const; + + // Adds |point| to |vertices| if |point| is included in this candidate set. + void TryAddVertex(std::vector<ResolutionSet::Point>* vertices, + const ResolutionSet::Point& point) const; + + int min_height_; + int max_height_; + int min_width_; + int max_width_; + double min_aspect_ratio_; + double max_aspect_ratio_; +}; + +// Scalar multiplication for Points. +BLINK_EXPORT ResolutionSet::Point operator*(double d, + const ResolutionSet::Point& p); + +// This function returns a set of bools from a resizeMode StringConstraint. +// If |resize_mode_constraint| includes +// WebMediaStreamTrack::kResizeModeNone, false is included in the +// returned value. If |resize_mode_constraint| includes +// WebMediaStreamTrack::kResizeModeRescale, true is included in the +// returned value. +BLINK_EXPORT DiscreteSet<bool> RescaleSetFromConstraint( + const StringConstraint& resize_mode_constraint); + +} // namespace media_constraints +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_MEDIA_STREAM_CONSTRAINTS_UTIL_SETS_H_ diff --git a/chromium/third_party/blink/public/web/modules/mediastream/media_stream_constraints_util_video_device.h b/chromium/third_party/blink/public/web/modules/mediastream/media_stream_constraints_util_video_device.h new file mode 100644 index 00000000000..803fa9fbd43 --- /dev/null +++ b/chromium/third_party/blink/public/web/modules/mediastream/media_stream_constraints_util_video_device.h @@ -0,0 +1,137 @@ +// Copyright 2017 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_MEDIA_STREAM_CONSTRAINTS_UTIL_VIDEO_DEVICE_H_ +#define THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_MEDIA_STREAM_CONSTRAINTS_UTIL_VIDEO_DEVICE_H_ + +#include <string> +#include <vector> + +#include "base/optional.h" +#include "media/capture/video_capture_types.h" +#include "third_party/blink/public/platform/web_common.h" +#include "third_party/blink/public/web/modules/mediastream/media_stream_constraints_util.h" + +namespace blink { +class WebString; +class WebMediaConstraints; +} // namespace blink + +namespace blink { + +// Calculates and returns videoKind value for |format|. +// See https://w3c.github.io/mediacapture-depth. +BLINK_EXPORT WebString +GetVideoKindForFormat(const media::VideoCaptureFormat& format); + +BLINK_EXPORT WebMediaStreamTrack::FacingMode ToWebFacingMode( + media::VideoFacingMode video_facing); + +// This is a temporary struct to bridge blink and content mojo types. +// TODO(crbug.com/704136): Replace references to this type with the blink mojo +// type once all dependent types are migrated to Blink. +struct BLINK_EXPORT VideoInputDeviceCapabilities { + VideoInputDeviceCapabilities(std::string device_id, + std::string group_id, + std::vector<media::VideoCaptureFormat> formats, + media::VideoFacingMode facing_mode); + VideoInputDeviceCapabilities(); + VideoInputDeviceCapabilities(VideoInputDeviceCapabilities&& other); + VideoInputDeviceCapabilities& operator=(VideoInputDeviceCapabilities&& other); + ~VideoInputDeviceCapabilities(); + + std::string device_id; + std::string group_id; + std::vector<media::VideoCaptureFormat> formats; + media::VideoFacingMode facing_mode; +}; + +struct BLINK_EXPORT VideoDeviceCaptureCapabilities { + VideoDeviceCaptureCapabilities(); + VideoDeviceCaptureCapabilities(VideoDeviceCaptureCapabilities&& other); + ~VideoDeviceCaptureCapabilities(); + VideoDeviceCaptureCapabilities& operator=( + VideoDeviceCaptureCapabilities&& other); + + // Each capabilities field is independent of each other. + // TODO(crbug.com/704136): Replace VideoInputDeviceCapabilities in the + // |device_capabilities| definition with the Blink mojo + // VideoInputDeviceCapabilitiesPtr type once dependent types are migrated to + // Blink. + std::vector<VideoInputDeviceCapabilities> device_capabilities; + std::vector<base::Optional<bool>> noise_reduction_capabilities; +}; + +// This function performs source, source-settings and track-settings selection +// based on the given |capabilities| and |constraints|. +// Chromium performs constraint resolution in two steps. First, a source and its +// settings are selected, then track settings are selected based on the source +// settings. This function implements both steps. Sources are not a user-visible +// concept, so the spec only specifies an algorithm for track settings. +// The algorithm for sources is compatible with the spec algorithm for tracks, +// as defined in https://w3c.github.io/mediacapture-main/#dfn-selectsettings, +// but it is customized to account for differences between sources and tracks, +// and to break ties when multiple source settings are equally good according to +// the spec algorithm. +// In this algorithm, a candidate source is defined as a specific video input +// device opened with a specific resolution and frame rate, together with a +// specific noise-reduction setting. +// The main difference between a source and a track with regards to the spec +// algorithm is that a candidate source can support a range of values for some +// properties while a candidate track supports a single value. For example, +// cropping and rescaling allows a source with native resolution AxB to support +// the range of resolutions from 1x1 to AxB. +// Only candidates that satisfy the basic constraint set are valid. If no +// candidate can satisfy the basic constraint set, this function returns +// a result without value and with the name of a failed constraint accessible +// via the failed_constraint_name() method. If at least one candidate that +// satisfies the basic constraint set can be found, this function returns a +// result with a valid value. +// If there are no candidates at all, this function returns a result without +// value and an empty failed constraint name. +// The criteria to decide if a valid candidate source (i.e., one that satisfies +// the basic constraint set) is better than another one are as follows: 1. Given +// advanced constraint sets A[0],A[1]...,A[n], candidate C1 is better +// than candidate C2 if C1 supports the first advanced set for which C1's +// support is different than C2's support. +// Examples: +// * One advanced set, C1 supports it, and C2 does not. C1 is better. +// * Two sets, C1 supports both, C2 supports only the first. C1 is better. +// * Three sets, C1 supports the first and second set, C2 supports the first +// and third set. C1 is better. +// 2. C1 is better than C2 if C1 has a smaller fitness distance than C2. The +// fitness distance depends on the ability of the candidate to support ideal +// values in the basic constraint set. This is the final criterion defined in +// the spec. According to spec, all candidates that share the same fitness +// distance are equally acceptable, but this implementation has additional +// criteria to break ties. +// 3. C1 is better than C2 if C1 has a lower Chromium-specific custom distance +// from the basic constraint set that penalizes the amount of resolution and +// frame-rate adjustment required to satisfy the range and ideal value +// specified by width, height and frameRate constraints. +// For example, if constraints specify a resolution of exactly 1000x1000 for +// a track, then a candidate with a native resolution of 1200x1200 +// is better than a candidate with a native resolution of 2000x2000. Both +// settings satisfy the constraint set because rescaling can be used to +// produce the track setting of 1000x1000, but 1200x1200 is considered better +// because it has lower resource usage. +// 4. C1 is better than C2 if its settings are closer to certain default +// settings that include the device ID, noise reduction, resolution, +// and frame rate, in that order. Note that there is no default facing mode +// or aspect ratio. +// This function uses the SelectVideoTrackAdapterSettings function to compute +// some track-specific settings. These are available in the returned value via +// the track_adapter_settings() accessor. For more details about the algorithm +// for track adapter settings, see the SelectVideoTrackAdapterSettings +// documentation. +VideoCaptureSettings BLINK_EXPORT SelectSettingsVideoDeviceCapture( + const VideoDeviceCaptureCapabilities& capabilities, + const WebMediaConstraints& constraints, + int default_width, + int default_height, + double default_frame_rate); + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_MEDIA_STREAM_CONSTRAINTS_UTIL_VIDEO_DEVICE_H_ diff --git a/chromium/third_party/blink/public/web/modules/mediastream/media_stream_video_capturer_source.h b/chromium/third_party/blink/public/web/modules/mediastream/media_stream_video_capturer_source.h new file mode 100644 index 00000000000..3a20f77194f --- /dev/null +++ b/chromium/third_party/blink/public/web/modules/mediastream/media_stream_video_capturer_source.h @@ -0,0 +1,112 @@ +// Copyright 2014 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_MEDIA_STREAM_VIDEO_CAPTURER_SOURCE_H_ +#define THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_MEDIA_STREAM_VIDEO_CAPTURER_SOURCE_H_ + +#include <memory> +#include <string> + +#include "base/callback.h" +#include "base/macros.h" +#include "base/memory/weak_ptr.h" +#include "base/threading/thread_checker.h" +#include "media/capture/video_capture_types.h" +#include "third_party/blink/public/common/media/video_capture.h" +#include "third_party/blink/public/platform/web_common.h" +#include "third_party/blink/public/web/modules/mediastream/media_stream_video_source.h" + +namespace media { +class VideoCapturerSource; +} // namespace media + +namespace blink { + +class WebLocalFrame; + +// Representation of a video stream coming from a camera, owned by Blink as +// WebMediaStreamSource. Objects of this class are created and live on main +// Render thread. Objects can be constructed either by indicating a |device| to +// look for, or by plugging in a |source| constructed elsewhere. +class BLINK_EXPORT MediaStreamVideoCapturerSource + : public MediaStreamVideoSource { + public: + using DeviceCapturerFactoryCallback = + base::RepeatingCallback<std::unique_ptr<media::VideoCapturerSource>( + int session_id)>; + MediaStreamVideoCapturerSource( + const SourceStoppedCallback& stop_callback, + std::unique_ptr<media::VideoCapturerSource> source); + MediaStreamVideoCapturerSource( + WebLocalFrame* web_frame, + const SourceStoppedCallback& stop_callback, + const MediaStreamDevice& device, + const media::VideoCaptureParams& capture_params, + DeviceCapturerFactoryCallback device_capturer_factory_callback); + ~MediaStreamVideoCapturerSource() override; + + void SetDeviceCapturerFactoryCallbackForTesting( + DeviceCapturerFactoryCallback testing_factory_callback); + + // TODO(crbug.com/704136) Use a mojom::blink::MediaStreamDispatcherHostPtr + // once this header file moves to blink/renderer. + void SetMediaStreamDispatcherHostForTesting(void* dispatcher_host); + + media::VideoCapturerSource* GetSourceForTesting(); + + private: + friend class MediaStreamVideoCapturerSourceTest; + FRIEND_TEST_ALL_PREFIXES(MediaStreamVideoCapturerSourceTest, StartAndStop); + FRIEND_TEST_ALL_PREFIXES(MediaStreamVideoCapturerSourceTest, + CaptureTimeAndMetadataPlumbing); + FRIEND_TEST_ALL_PREFIXES(MediaStreamVideoCapturerSourceTest, ChangeSource); + + // MediaStreamVideoSource overrides. + void RequestRefreshFrame() override; + void OnFrameDropped(media::VideoCaptureFrameDropReason reason) override; + void OnLog(const std::string& message) override; + void OnHasConsumers(bool has_consumers) override; + void OnCapturingLinkSecured(bool is_secure) override; + void StartSourceImpl( + const VideoCaptureDeliverFrameCB& frame_callback) override; + void StopSourceImpl() override; + void StopSourceForRestartImpl() override; + void RestartSourceImpl(const media::VideoCaptureFormat& new_format) override; + base::Optional<media::VideoCaptureFormat> GetCurrentFormat() const override; + base::Optional<media::VideoCaptureParams> GetCurrentCaptureParams() + const override; + void ChangeSourceImpl(const MediaStreamDevice& new_device) override; + + // Method to bind as RunningCallback in VideoCapturerSource::StartCapture(). + void OnRunStateChanged(const media::VideoCaptureParams& new_capture_params, + bool is_running); + + // TODO(crbug.com/704136): Replace |internal_state_| with regular fields once + // this header file moves to blink/renderer. + class InternalState; + std::unique_ptr<InternalState> internal_state_; + + // The source that provides video frames. + std::unique_ptr<media::VideoCapturerSource> source_; + + enum State { + STARTING, + STARTED, + STOPPING_FOR_RESTART, + STOPPING_FOR_CHANGE_SOURCE, + RESTARTING, + STOPPED + }; + State state_ = STOPPED; + + media::VideoCaptureParams capture_params_; + VideoCaptureDeliverFrameCB frame_callback_; + DeviceCapturerFactoryCallback device_capturer_factory_callback_; + + DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoCapturerSource); +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_MEDIA_STREAM_VIDEO_CAPTURER_SOURCE_H_ diff --git a/chromium/third_party/blink/public/web/modules/mediastream/media_stream_video_sink.h b/chromium/third_party/blink/public/web/modules/mediastream/media_stream_video_sink.h new file mode 100644 index 00000000000..389fee88b11 --- /dev/null +++ b/chromium/third_party/blink/public/web/modules/mediastream/media_stream_video_sink.h @@ -0,0 +1,63 @@ +// Copyright 2013 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_MEDIA_STREAM_VIDEO_SINK_H_ +#define THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_MEDIA_STREAM_VIDEO_SINK_H_ + +#include "media/capture/video_capture_types.h" +#include "third_party/blink/public/common/media/video_capture.h" +#include "third_party/blink/public/platform/modules/mediastream/web_media_stream_sink.h" +#include "third_party/blink/public/platform/web_common.h" +#include "third_party/blink/public/platform/web_media_stream_track.h" + +namespace blink { + +// MediaStreamVideoSink is a base class that contains implementation commonly +// useful for implementations of WebMediaStreamSink which +// connect/disconnect the sink implementation to a track to start/stop the flow +// of video frames. +// +// http://dev.w3.org/2011/webrtc/editor/getusermedia.html +// All methods calls must be made from the main render thread. +class BLINK_EXPORT MediaStreamVideoSink : public WebMediaStreamSink { + public: + void OnFrameDropped(media::VideoCaptureFrameDropReason reason); + + protected: + MediaStreamVideoSink(); + ~MediaStreamVideoSink() override; + + // A subclass should call ConnectToTrack when it is ready to receive data from + // a video track. Before destruction, DisconnectFromTrack must be called. + // This base class holds a reference to the WebMediaStreamTrack until + // DisconnectFromTrack is called. + // + // Calls to these methods must be done on the main render thread. + // Note that |callback| for frame delivery happens on the IO thread. + // + // Warning: Calling DisconnectFromTrack does not immediately stop frame + // delivery through the |callback|, since frames are being delivered on a + // different thread. + // + // |is_sink_secure| indicates if this MediaStreamVideoSink is secure (i.e. + // meets output protection requirement). Generally, this should be false + // unless you know what you are doing. + void ConnectToTrack(const WebMediaStreamTrack& track, + const VideoCaptureDeliverFrameCB& callback, + bool is_sink_secure); + void DisconnectFromTrack(); + + // Returns the currently-connected track, or a null instance otherwise. + const WebMediaStreamTrack& connected_track() const { + return connected_track_; + } + + private: + // Set by ConnectToTrack() and cleared by DisconnectFromTrack(). + WebMediaStreamTrack connected_track_; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_MEDIA_STREAM_VIDEO_SINK_H_ diff --git a/chromium/third_party/blink/public/web/modules/mediastream/media_stream_video_source.h b/chromium/third_party/blink/public/web/modules/mediastream/media_stream_video_source.h new file mode 100644 index 00000000000..b7c6b3397a4 --- /dev/null +++ b/chromium/third_party/blink/public/web/modules/mediastream/media_stream_video_source.h @@ -0,0 +1,332 @@ +// Copyright 2014 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_MEDIA_STREAM_VIDEO_SOURCE_H_ +#define THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_MEDIA_STREAM_VIDEO_SOURCE_H_ + +#include <memory> +#include <string> +#include <vector> + +#include "base/compiler_specific.h" +#include "base/macros.h" +#include "base/memory/weak_ptr.h" +#include "base/optional.h" +#include "base/sequence_checker.h" +#include "media/base/video_frame.h" +#include "media/capture/video_capture_types.h" +#include "third_party/blink/public/common/media/video_capture.h" +#include "third_party/blink/public/platform/modules/mediastream/media_stream_types.h" +#include "third_party/blink/public/platform/modules/mediastream/secure_display_link_tracker.h" +#include "third_party/blink/public/platform/modules/mediastream/web_platform_media_stream_source.h" +#include "third_party/blink/public/platform/web_common.h" +#include "third_party/blink/public/platform/web_media_constraints.h" +#include "third_party/blink/public/platform/web_media_stream_source.h" +#include "third_party/blink/public/platform/web_media_stream_track.h" + +namespace base { +class SingleThreadTaskRunner; +} + +namespace blink { + +class MediaStreamVideoTrack; +class VideoTrackAdapter; +class VideoTrackAdapterSettings; + +// MediaStreamVideoSource is an interface used for sending video frames to a +// MediaStreamVideoTrack. +// https://dev.w3.org/2011/webrtc/editor/getusermedia.html +// The purpose of this base class is to be able to implement different +// MediaStreamVideoSources such as local video capture, video sources received +// on a PeerConnection or a source created in NaCl. +// All methods calls will be done from the main render thread. +class BLINK_EXPORT MediaStreamVideoSource + : public WebPlatformMediaStreamSource { + public: + enum { + // Default resolution. If no constraints are specified and the delegate + // support it, this is the resolution that will be used. + kDefaultWidth = 640, + kDefaultHeight = 480, + + kDefaultFrameRate = 30, + kUnknownFrameRate = 0, + }; + + enum class RestartResult { IS_RUNNING, IS_STOPPED, INVALID_STATE }; + // RestartCallback is used for both the StopForRestart and Restart operations. + using RestartCallback = base::OnceCallback<void(RestartResult)>; + + MediaStreamVideoSource(); + ~MediaStreamVideoSource() override; + + // Returns the MediaStreamVideoSource object owned by |source|. + static MediaStreamVideoSource* GetVideoSource( + const WebMediaStreamSource& source); + + // Puts |track| in the registered tracks list. + void AddTrack(MediaStreamVideoTrack* track, + const VideoTrackAdapterSettings& track_adapter_settings, + const VideoCaptureDeliverFrameCB& frame_callback, + const VideoTrackSettingsCallback& settings_callback, + const VideoTrackFormatCallback& format_callback, + const ConstraintsCallback& callback); + void RemoveTrack(MediaStreamVideoTrack* track, base::OnceClosure callback); + + // Reconfigures this MediaStreamVideoSource to use |adapter_settings| on + // |track|, as long as |track| is connected to this source. + // Do not invoke if |track| is connected to a different source, as the + // internal state of |track| might become inconsistent with that of its + // source. + void ReconfigureTrack(MediaStreamVideoTrack* track, + const VideoTrackAdapterSettings& adapter_settings); + + // Tries to temporarily stop this source so that it can be later restarted + // with a different video format. Unlike MediaStreamVideoSource::StopSource(), + // a temporary stop for restart does not change the ready state of the source. + // Once the attempt to temporarily stop the source is completed, |callback| + // is invoked with IS_STOPPED if the source actually stopped, or IS_RUNNING + // if the source did not stop and is still running. + // This method can only be called after a source has started. This can be + // verified by checking that the IsRunning() method returns true. + // Any attempt to invoke StopForRestart() before the source has started + // results in no action and |callback| invoked with INVALID_STATE. + void StopForRestart(RestartCallback callback); + + // Tries to restart a source that was previously temporarily stopped using the + // supplied |new_format|. This method can be invoked only after a successful + // call to StopForRestart(). + // Once the attempt to restart the source is completed, |callback| is invoked + // with IS_RUNNING if the source restarted and IS_STOPPED if the source + // remained stopped. Note that it is not guaranteed that the source actually + // restarts using |new_format| as its configuration. After a successful + // restart, the actual configured format for the source (if available) can be + // obtained with a call to GetCurrentFormat(). + // Note also that, since frames are delivered on a different thread, it is + // possible that frames using the old format are delivered for a while after + // a successful restart. Code relying on Restart() cannot assume that new + // frames are guaranteed to arrive in the new format until the first frame in + // the new format is received. + // This method can only be called after a successful stop for restart (i.e., + // after the callback passed to StopForRestart() is invoked with a value of + // IS_STOPPED). Any attempt to invoke Restart() when the source is not in this + // state results in no action and |callback| invoked with INVALID_STATE. + void Restart(const media::VideoCaptureFormat& new_format, + RestartCallback callback); + + // Called by |track| to notify the source whether it has any paths to a + // consuming endpoint. + void UpdateHasConsumers(MediaStreamVideoTrack* track, bool has_consumers); + + void UpdateCapturingLinkSecure(MediaStreamVideoTrack* track, bool is_secure); + + // Request underlying source to capture a new frame. + virtual void RequestRefreshFrame() {} + + // Optionally overridden by subclasses to implement handling frame drop + // events. + virtual void OnFrameDropped(media::VideoCaptureFrameDropReason reason) {} + + // Optionally overridden by subclasses to implement handling log messages. + virtual void OnLog(const std::string& message) {} + + // Enables or disables an heuristic to detect frames from rotated devices. + void SetDeviceRotationDetection(bool enabled); + + // Returns the task runner where video frames will be delivered on. + base::SingleThreadTaskRunner* io_task_runner() const; + + // Implementations must return the capture format if available. + // Implementations supporting devices of type MEDIA_DEVICE_VIDEO_CAPTURE + // must return a value. + virtual base::Optional<media::VideoCaptureFormat> GetCurrentFormat() const; + + // Implementations must return the capture parameters if available. + // Implementations supporting devices of type MEDIA_DEVICE_VIDEO_CAPTURE + // must return a value. The format in the returned VideoCaptureParams must + // coincide with the value returned by GetCurrentFormat(). + virtual base::Optional<media::VideoCaptureParams> GetCurrentCaptureParams() + const; + + bool IsRunning() const { return state_ == STARTED; } + + size_t NumTracks() const { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + return tracks_.size(); + } + + base::WeakPtr<MediaStreamVideoSource> GetWeakPtr() { + return weak_factory_.GetWeakPtr(); + } + + protected: + // MediaStreamSource implementation. + void DoChangeSource(const MediaStreamDevice& new_device) override; + void DoStopSource() override; + + // Sets ready state and notifies the ready state to all registered tracks. + virtual void SetReadyState(WebMediaStreamSource::ReadyState state); + + // Sets muted state and notifies it to all registered tracks. + virtual void SetMutedState(bool state); + + // An implementation must start capturing frames after this method is called. + // When the source has started or failed to start OnStartDone must be called. + // An implementation must call |frame_callback| on the IO thread with the + // captured frames. + virtual void StartSourceImpl( + const VideoCaptureDeliverFrameCB& frame_callback) = 0; + void OnStartDone(MediaStreamRequestResult result); + + // A subclass that supports restart must override this method such that it + // immediately stop producing video frames after this method is called. + // The stop is intended to be temporary and to be followed by a restart. Thus, + // connected tracks should not be disconnected or notified about the source no + // longer producing frames. Once the source is stopped, the implementation + // must invoke OnStopForRestartDone() with true. If the source cannot stop, + // OnStopForRestartDone() must invoked with false. + // It can be assumed that this method is invoked only when the source is + // running. + // Note that if this method is overridden, RestartSourceImpl() must also be + // overridden following the respective contract. Otherwise, behavior is + // undefined. + // The default implementation does not support restart and just calls + // OnStopForRestartDone() with false. + virtual void StopSourceForRestartImpl(); + + // This method should be called by implementations once an attempt to stop + // for restart using StopSourceForRestartImpl() is completed. + // |did_stop_for_restart| must true if the source is stopped and false if + // the source is running. + void OnStopForRestartDone(bool did_stop_for_restart); + + // A subclass that supports restart must override this method such that it + // tries to start producing frames after this method is called. If successful, + // the source should return to the same state as if it was started normally + // and invoke OnRestartDone() with true. The implementation should preferably + // restart to produce frames with the format specified in |new_format|. + // However, if this is not possible, the implementation is allowed to restart + // using a different format. In this case OnRestartDone() should be invoked + // with true as well. If it is impossible to restart the source with any + // format, the source should remain stopped and OnRestartDone() should be + // invoked with false. + // This method can only be invoked when the source is temporarily stopped + // after a successful OnStopForRestartDone(). Otherwise behavior is undefined. + // Note that if this method is overridden, StopSourceForRestartImpl() must + // also be overridden following the respective contract. Otherwise, behavior + // is undefined. + virtual void RestartSourceImpl(const media::VideoCaptureFormat& new_format); + + // This method should be called by implementations once an attempt to restart + // the source completes. |did_restart| must be true if the source is running + // and false if the source is stopped. + void OnRestartDone(bool did_restart); + + // An implementation must immediately stop producing video frames after this + // method has been called. After this method has been called, + // MediaStreamVideoSource may be deleted. + virtual void StopSourceImpl() = 0; + + // Optionally overridden by subclasses to act on whether there are any + // consumers present. When none are present, the source can stop delivering + // frames, giving it the option of running in an "idle" state to minimize + // resource usage. + virtual void OnHasConsumers(bool has_consumers) {} + + // Optionally overridden by subclasses to act on whether the capturing link + // has become secure or insecure. + virtual void OnCapturingLinkSecured(bool is_secure) {} + + // Optionally overridden by subclasses to implement changing source. + virtual void ChangeSourceImpl(const MediaStreamDevice& new_device) {} + + enum State { + NEW, + STARTING, + STOPPING_FOR_RESTART, + STOPPED_FOR_RESTART, + RESTARTING, + STARTED, + ENDED + }; + State state() const { return state_; } + + SEQUENCE_CHECKER(sequence_checker_); + + private: + // Trigger all cached callbacks from AddTrack. AddTrack is successful + // if the capture delegate has started and the constraints provided in + // AddTrack match the format that was used to start the device. + // Note that it must be ok to delete the MediaStreamVideoSource object + // in the context of the callback. If gUM fails, the implementation will + // simply drop the references to the blink source and track which will lead + // to this object being deleted. + void FinalizeAddPendingTracks(); + + // Actually adds |track| to this source, provided the source has started. + void FinalizeAddTrack(MediaStreamVideoTrack* track, + const VideoCaptureDeliverFrameCB& frame_callback, + const VideoTrackAdapterSettings& adapter_settings); + void StartFrameMonitoring(); + void UpdateTrackSettings(MediaStreamVideoTrack* track, + const VideoTrackAdapterSettings& adapter_settings); + void DidStopSource(base::OnceClosure callback, RestartResult result); + + State state_; + + struct PendingTrackInfo { + PendingTrackInfo( + MediaStreamVideoTrack* track, + const VideoCaptureDeliverFrameCB& frame_callback, + const VideoTrackSettingsCallback& settings_callback, + const VideoTrackFormatCallback& format_callback, + std::unique_ptr<VideoTrackAdapterSettings> adapter_settings, + const ConstraintsCallback& callback); + PendingTrackInfo(PendingTrackInfo&& other); + PendingTrackInfo& operator=(PendingTrackInfo&& other); + ~PendingTrackInfo(); + + MediaStreamVideoTrack* track; + VideoCaptureDeliverFrameCB frame_callback; + VideoTrackSettingsCallback settings_callback; + VideoTrackFormatCallback format_callback; + // TODO(guidou): Make |adapter_settings| a regular field instead of a + // unique_ptr. + std::unique_ptr<VideoTrackAdapterSettings> adapter_settings; + ConstraintsCallback callback; + }; + std::vector<PendingTrackInfo> pending_tracks_; + + // |restart_callback_| is used for notifying both StopForRestart and Restart, + // since it is impossible to have a situation where there can be callbacks + // for both at the same time. + RestartCallback restart_callback_; + + // |track_adapter_| delivers video frames to the tracks on the IO-thread. + scoped_refptr<VideoTrackAdapter> track_adapter_; + + // Tracks that currently are connected to this source. + std::vector<MediaStreamVideoTrack*> tracks_; + + // Tracks that have no paths to a consuming endpoint, and so do not need + // frames delivered from the source. This is a subset of |tracks_|. + std::vector<MediaStreamVideoTrack*> suspended_tracks_; + + // This is used for tracking if all connected video sinks are secure. + SecureDisplayLinkTracker<MediaStreamVideoTrack> secure_tracker_; + + // This flag enables a heuristic to detect device rotation based on frame + // size. + bool enable_device_rotation_detection_ = false; + + // NOTE: Weak pointers must be invalidated before all other member variables. + base::WeakPtrFactory<MediaStreamVideoSource> weak_factory_; + + DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoSource); +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_MEDIA_STREAM_VIDEO_SOURCE_H_ diff --git a/chromium/third_party/blink/public/web/modules/mediastream/media_stream_video_track.h b/chromium/third_party/blink/public/web/modules/mediastream/media_stream_video_track.h new file mode 100644 index 00000000000..536bd118141 --- /dev/null +++ b/chromium/third_party/blink/public/web/modules/mediastream/media_stream_video_track.h @@ -0,0 +1,187 @@ +// Copyright 2013 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_MEDIA_STREAM_VIDEO_TRACK_H_ +#define THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_MEDIA_STREAM_VIDEO_TRACK_H_ + +#include <memory> +#include <vector> + +#include "base/compiler_specific.h" +#include "base/gtest_prod_util.h" +#include "base/macros.h" +#include "base/memory/weak_ptr.h" +#include "base/threading/thread_checker.h" +#include "third_party/blink/public/platform/modules/mediastream/secure_display_link_tracker.h" +#include "third_party/blink/public/platform/modules/mediastream/web_media_stream_sink.h" +#include "third_party/blink/public/platform/modules/mediastream/web_platform_media_stream_track.h" +#include "third_party/blink/public/platform/web_common.h" +#include "third_party/blink/public/platform/web_media_stream_track.h" +#include "third_party/blink/public/web/modules/mediastream/media_stream_video_source.h" + +namespace blink { + +class VideoTrackAdapterSettings; + +// MediaStreamVideoTrack is a video specific representation of a +// blink::WebMediaStreamTrack in content. It is owned by the blink object +// and can be retrieved from a blink object using +// WebMediaStreamTrack::getExtraData() or MediaStreamVideoTrack::GetVideoTrack. +class BLINK_EXPORT MediaStreamVideoTrack + : public blink::WebPlatformMediaStreamTrack { + public: + // Help method to create a blink::WebMediaStreamTrack and a + // MediaStreamVideoTrack instance. The MediaStreamVideoTrack object is owned + // by the blink object in its WebMediaStreamTrack::ExtraData member. + // |callback| is triggered if the track is added to the source + // successfully and will receive video frames that match the given settings + // or if the source fails to provide video frames. + // If |enabled| is true, sinks added to the track will + // receive video frames when the source delivers frames to the track. + static blink::WebMediaStreamTrack CreateVideoTrack( + MediaStreamVideoSource* source, + const MediaStreamVideoSource::ConstraintsCallback& callback, + bool enabled); + static blink::WebMediaStreamTrack CreateVideoTrack( + const blink::WebString& id, + MediaStreamVideoSource* source, + const MediaStreamVideoSource::ConstraintsCallback& callback, + bool enabled); + static blink::WebMediaStreamTrack CreateVideoTrack( + MediaStreamVideoSource* source, + const VideoTrackAdapterSettings& adapter_settings, + const base::Optional<bool>& noise_reduction, + bool is_screencast, + const base::Optional<double>& min_frame_rate, + const MediaStreamVideoSource::ConstraintsCallback& callback, + bool enabled); + + static MediaStreamVideoTrack* GetVideoTrack( + const blink::WebMediaStreamTrack& track); + + // Constructors for video tracks. + MediaStreamVideoTrack( + MediaStreamVideoSource* source, + const MediaStreamVideoSource::ConstraintsCallback& callback, + bool enabled); + MediaStreamVideoTrack( + MediaStreamVideoSource* source, + const VideoTrackAdapterSettings& adapter_settings, + const base::Optional<bool>& noise_reduction, + bool is_screen_cast, + const base::Optional<double>& min_frame_rate, + const MediaStreamVideoSource::ConstraintsCallback& callback, + bool enabled); + ~MediaStreamVideoTrack() override; + + // MediaStreamTrack overrides. + void SetEnabled(bool enabled) override; + void SetContentHint( + blink::WebMediaStreamTrack::ContentHintType content_hint) override; + void StopAndNotify(base::OnceClosure callback) override; + void GetSettings(blink::WebMediaStreamTrack::Settings& settings) override; + + // Add |sink| to receive state changes on the main render thread and video + // frames in the |callback| method on the IO-thread. + // |callback| will be reset on the render thread. + void AddSink(blink::WebMediaStreamSink* sink, + const blink::VideoCaptureDeliverFrameCB& callback, + bool is_sink_secure); + void RemoveSink(blink::WebMediaStreamSink* sink); + + void OnReadyStateChanged(blink::WebMediaStreamSource::ReadyState state); + + const base::Optional<bool>& noise_reduction() const { + return noise_reduction_; + } + bool is_screencast() const { return is_screencast_; } + const base::Optional<double>& min_frame_rate() const { + return min_frame_rate_; + } + const base::Optional<double>& max_frame_rate() const { + return max_frame_rate_; + } + const VideoTrackAdapterSettings& adapter_settings() const { + return *adapter_settings_; + } + + // Setting information about the track size. + // Called from MediaStreamVideoSource at track initialization. + void SetTargetSizeAndFrameRate(int width, int height, double frame_rate) { + width_ = width; + height_ = height; + frame_rate_ = frame_rate; + } + + // Setting information about the track size. + // Passed as callback on MediaStreamVideoTrack::AddTrack, and run from + // VideoFrameResolutionAdapter on frame delivery to update track settings. + void SetSizeAndComputedFrameRate(gfx::Size frame_size, double frame_rate) { + width_ = frame_size.width(); + height_ = frame_size.height(); + computed_frame_rate_ = frame_rate; + } + + // Setting information about the source format. The format is computed based + // on incoming frames and it's used for applying constraints for remote video + // tracks. Passed as callback on MediaStreamVideoTrack::AddTrack, and run from + // VideoFrameResolutionAdapter on frame delivery. + void set_computed_source_format(const media::VideoCaptureFormat& format) { + computed_source_format_ = format; + } + + void SetTrackAdapterSettings(const VideoTrackAdapterSettings& settings); + + media::VideoCaptureFormat GetComputedSourceFormat(); + + MediaStreamVideoSource* source() const { return source_.get(); } + + void OnFrameDropped(media::VideoCaptureFrameDropReason reason); + + private: + FRIEND_TEST_ALL_PREFIXES(MediaStreamRemoteVideoSourceTest, StartTrack); + FRIEND_TEST_ALL_PREFIXES(MediaStreamRemoteVideoSourceTest, RemoteTrackStop); + FRIEND_TEST_ALL_PREFIXES(MediaStreamRemoteVideoSourceTest, + PreservesColorSpace); + FRIEND_TEST_ALL_PREFIXES(PepperToVideoTrackAdapterTest, PutFrame); + + // In debug builds, check that all methods that could cause object graph + // or data flow changes are being called on the main thread. + THREAD_CHECKER(main_render_thread_checker_); + + std::vector<blink::WebMediaStreamSink*> sinks_; + + // |FrameDeliverer| is an internal helper object used for delivering video + // frames on the IO-thread using callbacks to all registered tracks. + class FrameDeliverer; + scoped_refptr<FrameDeliverer> frame_deliverer_; + + // TODO(guidou): Make this field a regular field instead of a unique_ptr. + std::unique_ptr<VideoTrackAdapterSettings> adapter_settings_; + base::Optional<bool> noise_reduction_; + bool is_screencast_; + base::Optional<double> min_frame_rate_; + base::Optional<double> max_frame_rate_; + + // Weak ref to the source this tracks is connected to. + base::WeakPtr<MediaStreamVideoSource> source_; + + // This is used for tracking if all connected video sinks are secure. + blink::SecureDisplayLinkTracker<blink::WebMediaStreamSink> secure_tracker_; + + // Remembering our desired video size and frame rate. + int width_ = 0; + int height_ = 0; + double frame_rate_ = 0.0; + base::Optional<double> computed_frame_rate_; + media::VideoCaptureFormat computed_source_format_; + + base::WeakPtrFactory<MediaStreamVideoTrack> weak_factory_; + + DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoTrack); +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_MEDIA_STREAM_VIDEO_TRACK_H_ diff --git a/chromium/third_party/blink/public/web/modules/mediastream/video_track_adapter_settings.h b/chromium/third_party/blink/public/web/modules/mediastream/video_track_adapter_settings.h new file mode 100644 index 00000000000..84cc2f639f0 --- /dev/null +++ b/chromium/third_party/blink/public/web/modules/mediastream/video_track_adapter_settings.h @@ -0,0 +1,77 @@ +// Copyright 2019 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_VIDEO_TRACK_ADAPTER_SETTINGS_H_ +#define THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_VIDEO_TRACK_ADAPTER_SETTINGS_H_ + +#include <stdint.h> + +#include "base/macros.h" +#include "base/optional.h" +#include "third_party/blink/public/platform/web_common.h" +#include "ui/gfx/geometry/size.h" + +namespace blink { + +class BLINK_EXPORT VideoTrackAdapterSettings { + public: + // Creates a VideoTrackAdapterSettings with no target resolution or frame rate + // and without any constraints on the resolution. + VideoTrackAdapterSettings(); + // Creates a VideoTrackAdapterSettings with a given target resolution and + // and frame rate, and without any constraints on the resolution. + VideoTrackAdapterSettings(const gfx::Size& target_size, + double max_frame_rate); + // Creates a VideoTrackAdapterSettings with the specified resolution, frame + // rate and resolution constraints. If |target_size| is null, it means that + // no video processing is desired. + VideoTrackAdapterSettings(base::Optional<gfx::Size> target_size, + double min_aspect_ratio, + double max_aspect_ratio, + double max_frame_rate); + VideoTrackAdapterSettings(const VideoTrackAdapterSettings& other); + VideoTrackAdapterSettings& operator=(const VideoTrackAdapterSettings& other); + bool operator==(const VideoTrackAdapterSettings& other) const; + + const base::Optional<gfx::Size>& target_size() const { return target_size_; } + int target_width() const { + DCHECK(target_size_); + return target_size_->width(); + } + int target_height() const { + DCHECK(target_size_); + return target_size_->height(); + } + double min_aspect_ratio() const { return min_aspect_ratio_; } + double max_aspect_ratio() const { return max_aspect_ratio_; } + double max_frame_rate() const { return max_frame_rate_; } + void set_max_frame_rate(double max_frame_rate) { + max_frame_rate_ = max_frame_rate; + } + + private: + base::Optional<gfx::Size> target_size_; + double min_aspect_ratio_; + double max_aspect_ratio_; + // A |max_frame_rate| of zero is used to signal that no frame-rate + // adjustment is necessary. + // TODO(guidou): Change this to base::Optional. https://crbug.com/734528 + double max_frame_rate_; +}; + +// Exported for testing. +// +// Calculates the desired size of a VideoTrack instance, and returns true if +// |desired_size| is updated successfully, false otherwise. +// |desired_size| is not updated if |settings| has rescaling disabled and +// |input_size| is invalid. +BLINK_EXPORT bool CalculateDesiredVideoTrackSize( + bool is_rotated, + const gfx::Size& input_size, + const VideoTrackAdapterSettings& settings, + gfx::Size* desired_size); + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_VIDEO_TRACK_ADAPTER_SETTINGS_H_ diff --git a/chromium/third_party/blink/public/web/modules/mediastream/web_media_stream_utils.h b/chromium/third_party/blink/public/web/modules/mediastream/web_media_stream_utils.h new file mode 100644 index 00000000000..edf158c9b56 --- /dev/null +++ b/chromium/third_party/blink/public/web/modules/mediastream/web_media_stream_utils.h @@ -0,0 +1,41 @@ +// Copyright 2015 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_WEB_MEDIA_STREAM_UTILS_H_ +#define THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_WEB_MEDIA_STREAM_UTILS_H_ + +#include <memory> + +#include "media/capture/video_capture_types.h" +#include "third_party/blink/public/common/media/video_capture.h" +#include "third_party/blink/public/platform/web_common.h" + +namespace blink { + +class WebMediaStreamSink; +class WebMediaStreamTrack; + +// Requests that a refresh frame be sent "soon" (e.g., to resolve picture loss +// or quality issues). +BLINK_EXPORT void RequestRefreshFrameFromVideoTrack( + const WebMediaStreamTrack& video_track); + +// Calls to these methods must be done on the main render thread. +// Note that |callback| for frame delivery happens on the IO thread. +// Warning: Calling RemoveSinkFromMediaStreamTrack does not immediately stop +// frame delivery through the |callback|, since frames are being delivered on +// a different thread. +// |is_sink_secure| indicates if |sink| meets output protection requirement. +// Generally, this should be false unless you know what you are doing. +BLINK_EXPORT void AddSinkToMediaStreamTrack( + const WebMediaStreamTrack& track, + WebMediaStreamSink* sink, + const VideoCaptureDeliverFrameCB& callback, + bool is_sink_secure); +BLINK_EXPORT void RemoveSinkFromMediaStreamTrack( + const WebMediaStreamTrack& track, + WebMediaStreamSink* sink); +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIASTREAM_WEB_MEDIA_STREAM_UTILS_H_ diff --git a/chromium/third_party/blink/public/web/modules/service_worker/web_service_worker_context_client.h b/chromium/third_party/blink/public/web/modules/service_worker/web_service_worker_context_client.h index 5e4e337851f..9166e68bbab 100644 --- a/chromium/third_party/blink/public/web/modules/service_worker/web_service_worker_context_client.h +++ b/chromium/third_party/blink/public/web/modules/service_worker/web_service_worker_context_client.h @@ -163,7 +163,7 @@ class WebServiceWorkerContextClient { const WebString& source_url) {} // Called when a console message was written. - virtual void ReportConsoleMessage(int source, + virtual void ReportConsoleMessage(blink::mojom::ConsoleMessageSource source, blink::mojom::ConsoleMessageLevel level, const WebString& message, int line_number, diff --git a/chromium/third_party/blink/public/web/modules/service_worker/web_service_worker_context_proxy.h b/chromium/third_party/blink/public/web/modules/service_worker/web_service_worker_context_proxy.h index 2bb2c56fb16..36ce9271d88 100644 --- a/chromium/third_party/blink/public/web/modules/service_worker/web_service_worker_context_proxy.h +++ b/chromium/third_party/blink/public/web/modules/service_worker/web_service_worker_context_proxy.h @@ -35,6 +35,7 @@ #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" #include "third_party/blink/public/common/messaging/transferable_message.h" #include "third_party/blink/public/mojom/background_fetch/background_fetch.mojom-shared.h" +#include "third_party/blink/public/mojom/service_worker/service_worker.mojom-shared.h" #include "third_party/blink/public/platform/modules/background_fetch/web_background_fetch_registration.h" #include "third_party/blink/public/platform/web_canonical_cookie.h" @@ -58,12 +59,16 @@ class WebURLResponse; // All methods of this class must be called on the worker thread. class WebServiceWorkerContextProxy { public: + using FetchHandlerExistence = mojom::FetchHandlerExistence; + virtual ~WebServiceWorkerContextProxy() = default; virtual void BindServiceWorkerHost( mojo::ScopedInterfaceEndpointHandle service_worker_host) = 0; virtual void SetRegistration(WebServiceWorkerRegistrationObjectInfo) = 0; + virtual void SetFetchHandlerExistence( + FetchHandlerExistence fetch_handler_existence) = 0; // Script evaluation does not start until this function is called. virtual void ReadyToEvaluateScript() = 0; @@ -72,16 +77,16 @@ class WebServiceWorkerContextProxy { virtual void DispatchBackgroundFetchAbortEvent( int event_id, - const WebBackgroundFetchRegistration& registration) = 0; + WebBackgroundFetchRegistration registration) = 0; virtual void DispatchBackgroundFetchClickEvent( int event_id, - const WebBackgroundFetchRegistration& registration) = 0; + WebBackgroundFetchRegistration registration) = 0; virtual void DispatchBackgroundFetchFailEvent( int event_id, - const WebBackgroundFetchRegistration& registration) = 0; + WebBackgroundFetchRegistration registration) = 0; virtual void DispatchBackgroundFetchSuccessEvent( int event_id, - const WebBackgroundFetchRegistration& registration) = 0; + WebBackgroundFetchRegistration registration) = 0; virtual void DispatchCookieChangeEvent( int event_id, const WebCanonicalCookie& cookie, diff --git a/chromium/third_party/blink/public/web/web_active_fling_parameters.h b/chromium/third_party/blink/public/web/web_active_fling_parameters.h index 0d7554f149b..ef10666b04d 100644 --- a/chromium/third_party/blink/public/web/web_active_fling_parameters.h +++ b/chromium/third_party/blink/public/web/web_active_fling_parameters.h @@ -45,7 +45,7 @@ struct WebActiveFlingParameters { base::TimeTicks start_time; WebActiveFlingParameters() - : modifiers(0), source_device(kWebGestureDeviceTouchpad) {} + : modifiers(0), source_device(WebGestureDevice::kTouchpad) {} }; } // namespace blink diff --git a/chromium/third_party/blink/public/web/web_ax_object.h b/chromium/third_party/blink/public/web/web_ax_object.h index 7dee9992eb1..13ac49de636 100644 --- a/chromium/third_party/blink/public/web/web_ax_object.h +++ b/chromium/third_party/blink/public/web/web_ax_object.h @@ -79,6 +79,12 @@ class WebAXObject { return *this; } + BLINK_EXPORT bool operator==(const WebAXObject& other) const; + BLINK_EXPORT bool operator!=(const WebAXObject& other) const; + BLINK_EXPORT bool operator<(const WebAXObject& other) const; + BLINK_EXPORT bool operator<=(const WebAXObject& other) const; + BLINK_EXPORT bool operator>(const WebAXObject& other) const; + BLINK_EXPORT bool operator>=(const WebAXObject& other) const; BLINK_EXPORT static WebAXObject FromWebNode(const WebNode&); BLINK_EXPORT static WebAXObject FromWebDocument(const WebDocument&); BLINK_EXPORT static WebAXObject FromWebDocumentByID(const WebDocument&, int); @@ -99,10 +105,10 @@ class WebAXObject { // tree. BLINK_EXPORT int GenerateAXID() const; - // Update layout on the underlying tree, and return true if this object is - // still valid (not detached). Note that calling this method - // can cause other WebAXObjects to become invalid, too, - // so always call isDetached if any other WebCore code has run. + // Update layout if necessary on the underlying tree, and return true if this + // object is still valid (not detached). Note that calling this method can + // cause other WebAXObjects to become invalid, too, so always call isDetached + // if any other blink/renderer/core code has run. BLINK_EXPORT bool UpdateLayoutAndCheckValidity(); BLINK_EXPORT unsigned ChildCount() const; @@ -158,6 +164,7 @@ class WebAXObject { BLINK_EXPORT bool AriaOwns(WebVector<WebAXObject>& owns_elements) const; BLINK_EXPORT WebString FontFamily() const; BLINK_EXPORT float FontSize() const; + BLINK_EXPORT float FontWeight() const; BLINK_EXPORT bool CanvasHasFallbackContent() const; BLINK_EXPORT WebAXObject ErrorMessage() const; // If this is an image, returns the image (scaled to maxSize) as a data url. @@ -177,10 +184,14 @@ class WebAXObject { BLINK_EXPORT WebVector<WebAXObject> RadioButtonsInGroup() const; BLINK_EXPORT ax::mojom::Role Role() const; BLINK_EXPORT WebString StringValue() const; + BLINK_EXPORT ax::mojom::ListStyle GetListStyle() const; BLINK_EXPORT ax::mojom::TextDirection GetTextDirection() const; BLINK_EXPORT ax::mojom::TextPosition GetTextPosition() const; - // Bitmask from ax::mojom::TextStyle. - BLINK_EXPORT int32_t TextStyle() const; + BLINK_EXPORT void GetTextStyleAndTextDecorationStyle( + int32_t* text_style, + ax::mojom::TextDecorationStyle* text_overline_style, + ax::mojom::TextDecorationStyle* text_strikethrough_style, + ax::mojom::TextDecorationStyle* text_underline_style) const; BLINK_EXPORT WebURL Url() const; // Retrieves the accessible name of the object, an enum indicating where the @@ -203,9 +214,28 @@ class WebAXObject { // present and if it wasn't already exposed by one of the two functions above. BLINK_EXPORT WebString Placeholder(ax::mojom::NameFrom) const; + // Takes the result of nameFrom and retrieves the HTML Title of the object, + // if present and if it wasn't already exposed by |GetName| above. + // HTML Title is typically used as a tooltip. + BLINK_EXPORT WebString Title(ax::mojom::NameFrom) const; + // The following selection functions get or set the global document // selection and can be called on any object in the tree. - BLINK_EXPORT void Selection(WebAXObject& anchor_object, + // + // Since we are gradually moving to a new selection codebase, we have two sets + // of functions. The deprecated ones will still be used by Chromium, except in + // Web Tests, which will be using the new ones. + // TODO(nektar): Remove deprecated functions. crbug.com/639340 + + BLINK_EXPORT void SelectionDeprecated( + WebAXObject& anchor_object, + int& anchor_offset, + ax::mojom::TextAffinity& anchor_affinity, + WebAXObject& focus_object, + int& focus_offset, + ax::mojom::TextAffinity& focus_affinity) const; + BLINK_EXPORT void Selection(bool& is_selection_backward, + WebAXObject& anchor_object, int& anchor_offset, ax::mojom::TextAffinity& anchor_affinity, WebAXObject& focus_object, @@ -213,12 +243,18 @@ class WebAXObject { ax::mojom::TextAffinity& focus_affinity) const; // The following selection functions return text offsets calculated starting - // the current object. They only report on a selection that is placed on + // from the current object. They only report on a selection that is placed on // the current object or on any of its descendants. + // + // Since we are gradually moving to a new selection codebase, we have two sets + // of functions. The deprecated ones will still be used by Chromium, except in + // Web Tests, which will be using the new ones. + // TODO(nektar): Remove deprecated functions. crbug.com/639340 + + BLINK_EXPORT unsigned SelectionEndDeprecated() const; BLINK_EXPORT unsigned SelectionEnd() const; - BLINK_EXPORT unsigned SelectionEndLineNumber() const; + BLINK_EXPORT unsigned SelectionStartDeprecated() const; BLINK_EXPORT unsigned SelectionStart() const; - BLINK_EXPORT unsigned SelectionStartLineNumber() const; // 1-based position in set & Size of set. BLINK_EXPORT int PosInSet() const; @@ -247,7 +283,6 @@ class WebAXObject { BLINK_EXPORT bool HasComputedStyle() const; BLINK_EXPORT WebString ComputedStyleDisplay() const; BLINK_EXPORT bool AccessibilityIsIgnored() const; - BLINK_EXPORT bool LineBreaks(WebVector<int>&) const; BLINK_EXPORT void Markers(WebVector<ax::mojom::MarkerType>& types, WebVector<int>& starts, WebVector<int>& ends) const; @@ -261,6 +296,10 @@ class WebAXObject { BLINK_EXPORT bool Focus() const; BLINK_EXPORT bool SetAccessibilityFocus() const; BLINK_EXPORT bool SetSelected(bool) const; + BLINK_EXPORT bool SetSelectionDeprecated(const WebAXObject& anchor_object, + int anchor_offset, + const WebAXObject& focus_object, + int focus_offset) const; BLINK_EXPORT bool SetSelection(const WebAXObject& anchor_object, int anchor_offset, const WebAXObject& focus_object, @@ -341,6 +380,13 @@ class WebAXObject { SkMatrix44& container_transform, bool* clips_children = nullptr) const; + // Exchanges a WebAXObject with another. + BLINK_EXPORT void Swap(WebAXObject& other); + + // Returns a brief description of the object, suitable for debugging. E.g. its + // role and name. + BLINK_EXPORT WebString ToString() const; + #if INSIDE_BLINK BLINK_EXPORT WebAXObject(AXObject*); WebAXObject& operator=(AXObject*); diff --git a/chromium/third_party/blink/public/web/web_css_parser.h b/chromium/third_party/blink/public/web/web_css_parser.h deleted file mode 100644 index 4c23f3b2923..00000000000 --- a/chromium/third_party/blink/public/web/web_css_parser.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_CSS_PARSER_H_ -#define THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_CSS_PARSER_H_ - -#include "third_party/blink/public/platform/web_common.h" -#include "third_party/skia/include/core/SkColor.h" - -namespace blink { - -class WebString; - -class WebCSSParser { - public: - BLINK_EXPORT static bool ParseColor(SkColor*, const WebString&); -}; - -} // namespace blink - -#endif diff --git a/chromium/third_party/blink/public/web/web_document.h b/chromium/third_party/blink/public/web/web_document.h index 815c12fc386..fe2179d64f4 100644 --- a/chromium/third_party/blink/public/web/web_document.h +++ b/chromium/third_party/blink/public/web/web_document.h @@ -74,7 +74,7 @@ class WebDocument : public WebNode { BLINK_EXPORT WebString Encoding() const; BLINK_EXPORT WebString ContentLanguage() const; BLINK_EXPORT WebString GetReferrer() const; - BLINK_EXPORT SkColor ThemeColor() const; + BLINK_EXPORT base::Optional<SkColor> ThemeColor() const; // The url of the OpenSearch Desription Document (if any). BLINK_EXPORT WebURL OpenSearchDescriptionURL() const; @@ -130,6 +130,8 @@ class WebDocument : public WebNode { BLINK_EXPORT WebDistillabilityFeatures DistillabilityFeatures(); + BLINK_EXPORT void SetShowBeforeUnloadDialog(bool show_dialog); + #if INSIDE_BLINK BLINK_EXPORT WebDocument(Document*); BLINK_EXPORT WebDocument& operator=(Document*); diff --git a/chromium/third_party/blink/public/web/web_element.h b/chromium/third_party/blink/public/web/web_element.h index 062c5ff6fbf..44de9e7deea 100644 --- a/chromium/third_party/blink/public/web/web_element.h +++ b/chromium/third_party/blink/public/web/web_element.h @@ -78,9 +78,6 @@ class BLINK_EXPORT WebElement : public WebNode { // element has no ShadowRoot or has a UA ShadowRoot. WebNode ShadowRoot() const; - // If this element takes up space in the layout of the page. - bool HasNonEmptyLayoutSize() const; - // Returns the bounds of the element in Visual Viewport. The bounds // have been adjusted to include any transformations, including page scale. // This function will update the layout if required. diff --git a/chromium/third_party/blink/public/web/web_embedded_worker.h b/chromium/third_party/blink/public/web/web_embedded_worker.h index b91eb48018b..2b23e9619e8 100644 --- a/chromium/third_party/blink/public/web/web_embedded_worker.h +++ b/chromium/third_party/blink/public/web/web_embedded_worker.h @@ -40,7 +40,6 @@ namespace blink { -class WebContentSettingsClient; class WebServiceWorkerContextClient; class WebURL; struct WebConsoleMessage; @@ -61,11 +60,10 @@ struct WebServiceWorkerInstalledScriptsManagerParams { class BLINK_EXPORT WebEmbeddedWorker { public: // Invoked on the main thread to instantiate a WebEmbeddedWorker. - // The given WebWorkerContextClient and WebContentSettingsClient are going to - // be passed on to the worker thread and is held by a newly created - // WorkerGlobalScope. + // WebServiceWorkerContextClient is owned by caller and must survive the + // instance of WebEmbeddedWorker. static std::unique_ptr<WebEmbeddedWorker> Create( - std::unique_ptr<WebServiceWorkerContextClient>, + WebServiceWorkerContextClient*, std::unique_ptr<WebServiceWorkerInstalledScriptsManagerParams>, mojo::ScopedMessagePipeHandle content_settings_handle, mojo::ScopedMessagePipeHandle cache_storage, diff --git a/chromium/third_party/blink/public/web/web_frame.h b/chromium/third_party/blink/public/web/web_frame.h index 188e2075bce..e5dd3dbbb6a 100644 --- a/chromium/third_party/blink/public/web/web_frame.h +++ b/chromium/third_party/blink/public/web/web_frame.h @@ -33,7 +33,6 @@ #include <memory> #include "cc/paint/paint_canvas.h" -#include "third_party/blink/public/common/feature_policy/feature_policy.h" #include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/public/platform/web_insecure_request_policy.h" #include "third_party/blink/public/web/web_frame_load_type.h" @@ -52,6 +51,7 @@ class WebRemoteFrame; class WebSecurityOrigin; class WebView; enum class WebSandboxFlags; +struct FramePolicy; struct WebFrameOwnerProperties; struct WebRect; @@ -104,7 +104,7 @@ class BLINK_EXPORT WebFrame { // parent is in another process and it dynamically updates this frame's // sandbox flags or container policy. The new policy won't take effect until // the next navigation. - void SetFrameOwnerPolicy(WebSandboxFlags, const blink::ParsedFeaturePolicy&); + void SetFrameOwnerPolicy(const FramePolicy&); // The frame's insecure request policy. WebInsecureRequestPolicy GetInsecureRequestPolicy() const; diff --git a/chromium/third_party/blink/public/web/web_frame_serializer.h b/chromium/third_party/blink/public/web/web_frame_serializer.h index 0c1d1c90dfc..385ea1e3cee 100644 --- a/chromium/third_party/blink/public/web/web_frame_serializer.h +++ b/chromium/third_party/blink/public/web/web_frame_serializer.h @@ -121,7 +121,8 @@ class WebFrameSerializer { // the target frame didn't have a valid url). BLINK_EXPORT static bool Serialize(WebLocalFrame*, WebFrameSerializerClient*, - LinkRewritingDelegate*); + LinkRewritingDelegate*, + bool); // FIXME: The following are here for unit testing purposes. Consider // changing the unit tests instead. @@ -131,9 +132,6 @@ class WebFrameSerializer { const WebString& charset); // Generate the MOTW declaration. BLINK_EXPORT static WebString GenerateMarkOfTheWebDeclaration(const WebURL&); - // Generate the default base tag declaration. - BLINK_EXPORT static WebString GenerateBaseTagDeclaration( - const WebString& base_target); }; } // namespace blink diff --git a/chromium/third_party/blink/public/web/web_global_object_reuse_policy.h b/chromium/third_party/blink/public/web/web_global_object_reuse_policy.h deleted file mode 100644 index 83336766b48..00000000000 --- a/chromium/third_party/blink/public/web/web_global_object_reuse_policy.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2017 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_GLOBAL_OBJECT_REUSE_POLICY_H_ -#define THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_GLOBAL_OBJECT_REUSE_POLICY_H_ - -namespace blink { - -// Indicates whether the global object (i.e. Window instance) associated with -// the previous document in a browsing context was replaced or reused for the -// new Document corresponding to the just-committed navigation; effective in the -// main world and all isolated worlds. WindowProxies are not affected. -// -// TODO(dcheng): Investigate removing the need for this by moving the -// InterfaceProvider plumbing from DidCommitProvisionalLoad to -// RenderFrameImpl::CommitNavigation. -enum class WebGlobalObjectReusePolicy { kCreateNew, kUseExisting }; - -} // namespace blink - -#endif diff --git a/chromium/third_party/blink/public/web/web_history_item.h b/chromium/third_party/blink/public/web/web_history_item.h index 5e4652187a1..b581dcc1faf 100644 --- a/chromium/third_party/blink/public/web/web_history_item.h +++ b/chromium/third_party/blink/public/web/web_history_item.h @@ -94,11 +94,11 @@ class WebHistoryItem { BLINK_EXPORT WebVector<WebString> GetDocumentState() const; BLINK_EXPORT void SetDocumentState(const WebVector<WebString>&); - BLINK_EXPORT long long ItemSequenceNumber() const; - BLINK_EXPORT void SetItemSequenceNumber(long long); + BLINK_EXPORT int64_t ItemSequenceNumber() const; + BLINK_EXPORT void SetItemSequenceNumber(int64_t); - BLINK_EXPORT long long DocumentSequenceNumber() const; - BLINK_EXPORT void SetDocumentSequenceNumber(long long); + BLINK_EXPORT int64_t DocumentSequenceNumber() const; + BLINK_EXPORT void SetDocumentSequenceNumber(int64_t); BLINK_EXPORT WebHistoryScrollRestorationType ScrollRestorationType() const; BLINK_EXPORT void SetScrollRestorationType(WebHistoryScrollRestorationType); @@ -110,7 +110,7 @@ class WebHistoryItem { BLINK_EXPORT void SetHTTPContentType(const WebString&); BLINK_EXPORT WebHTTPBody HttpBody() const; - BLINK_EXPORT void SetHTTPBody(const WebHTTPBody&); + BLINK_EXPORT void SetHttpBody(const WebHTTPBody&); BLINK_EXPORT WebVector<WebString> GetReferencedFilePaths() const; diff --git a/chromium/third_party/blink/public/web/web_ime_text_span.h b/chromium/third_party/blink/public/web/web_ime_text_span.h index 94fa241ba58..9fb26aae783 100644 --- a/chromium/third_party/blink/public/web/web_ime_text_span.h +++ b/chromium/third_party/blink/public/web/web_ime_text_span.h @@ -34,8 +34,8 @@ #include <string> #include <vector> -#include "services/ws/public/mojom/ime/ime.mojom-shared.h" #include "third_party/skia/include/core/SkColor.h" +#include "ui/base/ime/mojo/ime_types.mojom-shared.h" namespace blink { @@ -58,7 +58,7 @@ struct WebImeTextSpan { : type(Type::kComposition), start_offset(0), end_offset(0), - thickness(ws::mojom::ImeTextSpanThickness::kThin), + thickness(ui::mojom::ImeTextSpanThickness::kThin), background_color(0), suggestion_highlight_color(0), suggestions(std::vector<std::string>()) {} @@ -67,7 +67,7 @@ struct WebImeTextSpan { Type ty, unsigned s, unsigned e, - ws::mojom::ImeTextSpanThickness th, + ui::mojom::ImeTextSpanThickness th, SkColor bc, SkColor shc = 0, const std::vector<std::string>& su = std::vector<std::string>()) @@ -91,7 +91,7 @@ struct WebImeTextSpan { unsigned start_offset; unsigned end_offset; SkColor underline_color = SK_ColorTRANSPARENT; - ws::mojom::ImeTextSpanThickness thickness; + ui::mojom::ImeTextSpanThickness thickness; SkColor background_color; SkColor suggestion_highlight_color; bool remove_on_finish_composing; diff --git a/chromium/third_party/blink/public/web/web_local_frame.h b/chromium/third_party/blink/public/web/web_local_frame.h index fa0fca68d18..6b1777713b0 100644 --- a/chromium/third_party/blink/public/web/web_local_frame.h +++ b/chromium/third_party/blink/public/web/web_local_frame.h @@ -12,16 +12,17 @@ #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" #include "third_party/blink/public/common/feature_policy/feature_policy.h" #include "third_party/blink/public/common/frame/sandbox_flags.h" +#include "third_party/blink/public/common/messaging/transferable_message.h" #include "third_party/blink/public/mojom/ad_tagging/ad_frame.mojom-shared.h" +#include "third_party/blink/public/mojom/commit_result/commit_result.mojom-shared.h" #include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-shared.h" #include "third_party/blink/public/mojom/frame/lifecycle.mojom-shared.h" +#include "third_party/blink/public/mojom/selection_menu/selection_menu_behavior.mojom-shared.h" #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/public/platform/web_focus_type.h" #include "third_party/blink/public/platform/web_size.h" #include "third_party/blink/public/platform/web_url_error.h" #include "third_party/blink/public/platform/web_url_request.h" -#include "third_party/blink/public/web/commit_result.mojom-shared.h" -#include "third_party/blink/public/web/selection_menu_behavior.mojom-shared.h" #include "third_party/blink/public/web/web_document_loader.h" #include "third_party/blink/public/web/web_frame.h" #include "third_party/blink/public/web/web_frame_load_type.h" @@ -54,6 +55,7 @@ class WebTextCheckClient; class WebURL; class WebView; enum class WebTreeScopeType; +struct TransferableMessage; struct WebAssociatedURLLoaderOptions; struct WebConsoleMessage; struct WebContentSecurityPolicyViolation; @@ -100,7 +102,8 @@ class WebLocalFrame : public WebFrame { // frame pointer, the parent frame's children list will not contain the // provisional frame. Thus, a provisional frame is invisible to the rest of // Blink unless the navigation commits and the provisional frame is fully - // attached to the frame tree by calling Swap(). + // attached to the frame tree by calling Swap(). It swaps with the + // |previous_web_frame|. // // Otherwise, if the load should not commit, call Detach() to discard the // frame. @@ -108,9 +111,8 @@ class WebLocalFrame : public WebFrame { WebLocalFrameClient*, blink::InterfaceRegistry*, mojo::ScopedMessagePipeHandle, - WebRemoteFrame*, - WebSandboxFlags, - ParsedFeaturePolicy); + WebFrame* previous_web_frame, + const FramePolicy&); // Creates a new local child of this frame. Similar to the other methods that // create frames, the returned frame should be freed by calling Close() when @@ -193,6 +195,11 @@ class WebLocalFrame : public WebFrame { // kind of lookup what |window.open(..., name)| would in Javascript. virtual WebFrame* FindFrameByName(const WebString& name) = 0; + // Starts scrolling to a specific offset in a frame. Returns false on failure. + virtual bool ScrollTo(const gfx::Point& scrollPosition, + bool animate, + base::OnceClosure on_finish) = 0; + // Navigation Ping -------------------------------------------------------- virtual void SendPings(const WebURL& destination_url) = 0; @@ -556,9 +563,17 @@ class WebLocalFrame : public WebFrame { // Iframe sandbox --------------------------------------------------------- + // TODO(ekaramad): This method is only exposed for testing for certain tests + // outside of blink/ that are interested in approximate value of the + // FrameReplicationState. This method should be replaced with one in content/ + // where the notion of FrameReplicationState is relevant to. // Returns the effective sandbox flags which are inherited from their parent // frame. - virtual WebSandboxFlags EffectiveSandboxFlags() const = 0; + virtual WebSandboxFlags EffectiveSandboxFlagsForTesting() const = 0; + + // Returns false if this frame, or any parent frame is sandboxed and does not + // have the flag "allow-downloads-without-user-activation" set. + virtual bool IsAllowedToDownloadWithoutUserActivation() const = 0; // Find-in-page ----------------------------------------------------------- @@ -610,8 +625,24 @@ class WebLocalFrame : public WebFrame { // This will be removed following the deprecation. virtual void UsageCountChromeLoadTimes(const WebString& metric) = 0; - // Dispatches an event when a Portal gets activated. - virtual void OnPortalActivated() = 0; + // Portals ------------------------------------------------------------- + + // Dispatches an event when a Portal gets activated. |portal_token| is the + // portal's unique identifier, and the message pipe |portal_pipe| is the + // portal's mojo interface. |data| is an optional message sent together with + // the portal's activation. + using OnPortalActivatedCallback = base::OnceCallback<void(bool)>; + virtual void OnPortalActivated( + const base::UnguessableToken& portal_token, + mojo::ScopedInterfaceEndpointHandle portal_pipe, + TransferableMessage data, + OnPortalActivatedCallback callback) = 0; + + // Forwards message to the PortalHost associated with frame. + virtual void ForwardMessageToPortalHost( + TransferableMessage message, + const WebSecurityOrigin& source_origin, + const base::Optional<WebSecurityOrigin>& target_origin) = 0; // Scheduling --------------------------------------------------------------- diff --git a/chromium/third_party/blink/public/web/web_local_frame_client.h b/chromium/third_party/blink/public/web/web_local_frame_client.h index b16662eda08..6ff56ac1b15 100644 --- a/chromium/third_party/blink/public/web/web_local_frame_client.h +++ b/chromium/third_party/blink/public/web/web_local_frame_client.h @@ -115,6 +115,7 @@ class WebString; class WebURL; class WebURLResponse; class WebUserMediaClient; +struct FramePolicy; struct WebConsoleMessage; struct WebContextMenuData; struct WebFullscreenOptions; @@ -154,6 +155,7 @@ class BLINK_EXPORT WebLocalFrameClient { // May return null. virtual std::unique_ptr<WebApplicationCacheHost> CreateApplicationCacheHost( + WebDocumentLoader*, WebApplicationCacheHostClient*) { return nullptr; } @@ -224,24 +226,26 @@ class BLINK_EXPORT WebLocalFrameClient { // to prevent the new child frame from being attached. Otherwise, embedders // should create a new WebLocalFrame, insert it into the frame tree, and // return the created frame. - virtual WebLocalFrame* CreateChildFrame( - WebLocalFrame* parent, - WebTreeScopeType, - const WebString& name, - const WebString& fallback_name, - WebSandboxFlags sandbox_flags, - const ParsedFeaturePolicy& container_policy, - const WebFrameOwnerProperties&, - FrameOwnerElementType) { + virtual WebLocalFrame* CreateChildFrame(WebLocalFrame* parent, + WebTreeScopeType, + const WebString& name, + const WebString& fallback_name, + const FramePolicy&, + const WebFrameOwnerProperties&, + FrameOwnerElementType) { return nullptr; } // Request the creation of a new portal. virtual std::pair<WebRemoteFrame*, base::UnguessableToken> CreatePortal( - mojo::ScopedMessagePipeHandle pipe) { + mojo::ScopedInterfaceEndpointHandle pipe) { return std::pair<WebRemoteFrame*, base::UnguessableToken>( nullptr, base::UnguessableToken()); } + virtual blink::WebRemoteFrame* AdoptPortal( + const base::UnguessableToken& portal_token) { + return nullptr; + } // Called when Blink cannot find a frame with the given name in the frame's // browsing instance. This gives the embedder a chance to return a frame @@ -278,10 +282,8 @@ class BLINK_EXPORT WebLocalFrameClient { // The sandbox flags or container policy have changed for a child frame of // this frame. - virtual void DidChangeFramePolicy( - WebFrame* child_frame, - WebSandboxFlags flags, - const ParsedFeaturePolicy& container_policy) {} + virtual void DidChangeFramePolicy(WebFrame* child_frame, const FramePolicy&) { + } // Called when a Feature-Policy or Content-Security-Policy HTTP header (for // sandbox flags) is encountered while loading the frame's document. @@ -512,6 +514,12 @@ class BLINK_EXPORT WebLocalFrameClient { // ever having received a user gesture. virtual void DidBlockFramebust(const WebURL&) {} + // Tells the embedder to navigate back or forward in session history by + // the given offset (relative to the current position in session + // history). |has_user_gesture| tells whether or not this is the consequence + // of a user action. + virtual void NavigateBackForwardSoon(int offset, bool has_user_gesture) {} + // Returns token to be used as a frame id in the devtools protocol. // It is derived from the content's devtools_frame_token, is // defined by the browser and passed into Blink upon frame creation. @@ -642,6 +650,10 @@ class BLINK_EXPORT WebLocalFrameClient { // was spent in tasks on the frame. virtual void DidChangeCpuTiming(base::TimeDelta time) {} + // The set of active features affecting scheduling for this frame changed. + virtual void DidChangeActiveSchedulerTrackedFeatures(uint64_t features_mask) { + } + virtual void VisibilityChanged(blink::mojom::FrameVisibility visibility) {} // UseCounter ---------------------------------------------------------- @@ -669,6 +681,22 @@ class BLINK_EXPORT WebLocalFrameClient { // Reports that visible elements in the frame shifted (bit.ly/lsm-explainer). virtual void DidObserveLayoutJank(double jank_fraction) {} + enum class LazyLoadBehavior { + kDeferredImage, // An image is being deferred by the lazy load feature. + kDeferredFrame, // A frame is being deferred by the lazy load feature. + kLazyLoadedImage, // An image that was previously deferred by the lazy load + // feature is being fully loaded. + kLazyLoadedFrame // A frame that was previously deferred by the lazy load + // feature is being fully loaded. + }; + + // Reports lazy loaded behavior when the frame or image is fully deferred or + // if the frame or image is loaded after being deferred. Called every time the + // behavior occurs. This does not apply to images that were loaded as + // placeholders. + virtual void DidObserveLazyLoadBehavior( + WebLocalFrameClient::LazyLoadBehavior lazy_load_behavior) {} + // Script notifications ------------------------------------------------ // Notifies that a new script context has been created for this frame. @@ -788,8 +816,8 @@ class BLINK_EXPORT WebLocalFrameClient { // provided via the callbacks. virtual void CheckIfAudioSinkExistsAndIsAuthorized( const WebString& sink_id, - std::unique_ptr<WebSetSinkIdCallbacks> callbacks) { - callbacks->OnError(WebSetSinkIdError::kNotSupported); + WebSetSinkIdCompleteCallback callback) { + std::move(callback).Run(WebSetSinkIdError::kNotSupported); } // Visibility ---------------------------------------------------------- @@ -821,10 +849,11 @@ class BLINK_EXPORT WebLocalFrameClient { // Returns true when the contents of plugin are handled externally. This means // the plugin element will own a content frame but the frame is than used - // externally to load the required handelrs. - virtual bool IsPluginHandledExternally(const WebElement& plugin_element, - const WebURL& url, - const WebString& suggested_mime_type) { + // externally to load the required handelrs (MimeHandlerView). + virtual bool MaybeCreateMimeHandlerView( + const WebElement& plugin_element, + const WebURL& url, + const WebString& suggested_mime_type) { return false; } diff --git a/chromium/third_party/blink/public/web/web_manifest_fetcher.h b/chromium/third_party/blink/public/web/web_manifest_fetcher.h new file mode 100644 index 00000000000..58bf778eb12 --- /dev/null +++ b/chromium/third_party/blink/public/web/web_manifest_fetcher.h @@ -0,0 +1,48 @@ +// Copyright 2019 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_MANIFEST_FETCHER_H_ +#define THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_MANIFEST_FETCHER_H_ + +#include <memory> +#include "base/callback.h" +#include "third_party/blink/public/platform/web_common.h" +#include "third_party/blink/public/platform/web_private_ptr.h" + +namespace blink { + +class ManifestFetcher; +class WebDocument; +class WebURL; +class WebURLResponse; +class WebString; + +class WebManifestFetcher { + public: + // This will be called asynchronously after the URL has been fetched, + // successfully or not. If there is a failure, response and data will both be + // empty. |response| and |data| are both valid until the ManifestFetcher + // instance is destroyed. + using Callback = + base::OnceCallback<void(const WebURLResponse&, const WebString&)>; + + BLINK_EXPORT explicit WebManifestFetcher(const WebURL& url); + BLINK_EXPORT ~WebManifestFetcher() { Reset(); } + + BLINK_EXPORT void Reset(); + + BLINK_EXPORT void Start(WebDocument* web_document, + bool use_credentials, + Callback callback); + BLINK_EXPORT void Cancel(); + + private: + bool IsNull() const { return private_.IsNull(); } + + WebPrivatePtr<ManifestFetcher> private_; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_MANIFEST_FETCHER_H_ diff --git a/chromium/third_party/blink/public/web/web_manifest_parser.h b/chromium/third_party/blink/public/web/web_manifest_parser.h new file mode 100644 index 00000000000..dbfa43b4b98 --- /dev/null +++ b/chromium/third_party/blink/public/web/web_manifest_parser.h @@ -0,0 +1,30 @@ +// Copyright 2019 The Chromium 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 THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_MANIFEST_PARSER_H_ +#define THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_MANIFEST_PARSER_H_ + +#include "base/strings/string_piece.h" +#include "third_party/blink/public/platform/web_common.h" +#include "third_party/blink/public/platform/web_vector.h" + +namespace blink { + +struct Manifest; +struct ManifestError; +class WebURL; + +class WebManifestParser { + public: + // Updates only Manifest if parsing did not fail. + BLINK_EXPORT static bool ParseManifest(const base::StringPiece&, + const WebURL&, + const WebURL&, + Manifest*, + WebVector<ManifestError>*); +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_MANIFEST_PARSER_H_ diff --git a/chromium/third_party/blink/public/web/web_navigation_params.h b/chromium/third_party/blink/public/web/web_navigation_params.h index 9119816441a..d83236cf29d 100644 --- a/chromium/third_party/blink/public/web/web_navigation_params.h +++ b/chromium/third_party/blink/public/web/web_navigation_params.h @@ -54,6 +54,11 @@ struct BLINK_EXPORT WebNavigationInfo { // The main resource request. WebURLRequest url_request; + // The frame type. This must not be kNone. See RequestContextFrameType. + // TODO(dgozman): enforce this is not kNone. + network::mojom::RequestContextFrameType frame_type = + network::mojom::RequestContextFrameType::kNone; + // The navigation type. See WebNavigationType. WebNavigationType navigation_type = kWebNavigationTypeOther; @@ -74,6 +79,13 @@ struct BLINK_EXPORT WebNavigationInfo { // Whether the navigation is a result of client redirect. bool is_client_redirect = false; + // Whether the navigation initiator frame has the + // |WebSandboxFlags::kDownloads| bit set in its sandbox flags set. + bool initiator_frame_has_download_sandbox_flag = false; + + // Whether the navigation initiator frame is an ad frame. + bool initiator_frame_is_ad = false; + // Whether this is a navigation in the opener frame initiated // by the window.open'd frame. bool is_opener_navigation = false; diff --git a/chromium/third_party/blink/public/web/web_origin_trials.h b/chromium/third_party/blink/public/web/web_origin_trials.h index 2c79a0f3c09..0ab1c700143 100644 --- a/chromium/third_party/blink/public/web/web_origin_trials.h +++ b/chromium/third_party/blink/public/web/web_origin_trials.h @@ -16,6 +16,8 @@ class WebString; // origin trials framework via origin trial tokens. class WebOriginTrials { public: + // This function returns true if the passed trial name is valid and ALL of the + // features with that trial name are enabled. CORE_EXPORT static bool isTrialEnabled(const WebDocument*, const WebString&); }; diff --git a/chromium/third_party/blink/public/web/web_page_popup.h b/chromium/third_party/blink/public/web/web_page_popup.h index ea9a8f7f0a9..2131be0a8a2 100644 --- a/chromium/third_party/blink/public/web/web_page_popup.h +++ b/chromium/third_party/blink/public/web/web_page_popup.h @@ -33,17 +33,30 @@ #include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/public/web/web_widget.h" +#include "third_party/blink/public/web/web_widget_client.h" namespace blink { class WebWidgetClient; +class WebPagePopupClient : public WebWidgetClient { + public: + // Called when the window for this popup widget should be closed. The + // WebWidget will be closed asynchronously as a result of this + // request. + virtual void ClosePopupWidgetSoon() = 0; +}; + class WebPagePopup : public WebWidget { public: // Returns a WebPagePopup which is self-referencing. It's self-reference will // be released when the popup is closed via Close(). - BLINK_EXPORT static WebPagePopup* Create(WebWidgetClient*); + BLINK_EXPORT static WebPagePopup* Create(WebPagePopupClient*); virtual WebPoint PositionRelativeToOwner() = 0; + + // Web tests require access to the client for a WebPagePopup in order + // to synchronously composite. + virtual WebPagePopupClient* GetClientForTesting() const = 0; }; } // namespace blink diff --git a/chromium/third_party/blink/public/web/web_pepper_socket_client.h b/chromium/third_party/blink/public/web/web_pepper_socket_client.h index 614da4418c5..ec826f9eec8 100644 --- a/chromium/third_party/blink/public/web/web_pepper_socket_client.h +++ b/chromium/third_party/blink/public/web/web_pepper_socket_client.h @@ -59,8 +59,8 @@ class WebPepperSocketClient { // FIXME: Deperecate these methods. virtual void DidConnect() {} - virtual void DidUpdateBufferedAmount(unsigned long buffered_amount) {} - virtual void DidClose(unsigned long unhandled_buffered_amount, + virtual void DidUpdateBufferedAmount(uint64_t buffered_amount) {} + virtual void DidClose(uint64_t unhandled_buffered_amount, ClosingHandshakeCompletionStatus, uint16_t code, const WebString& reason) {} diff --git a/chromium/third_party/blink/public/web/web_performance.h b/chromium/third_party/blink/public/web/web_performance.h index bad9b6671d3..e1c84d24ea9 100644 --- a/chromium/third_party/blink/public/web/web_performance.h +++ b/chromium/third_party/blink/public/web/web_performance.h @@ -93,12 +93,8 @@ class WebPerformance { BLINK_EXPORT double FirstMeaningfulPaintCandidate() const; BLINK_EXPORT double LargestImagePaint() const; BLINK_EXPORT uint64_t LargestImagePaintSize() const; - BLINK_EXPORT double LastImagePaint() const; - BLINK_EXPORT uint64_t LastImagePaintSize() const; BLINK_EXPORT double LargestTextPaint() const; BLINK_EXPORT uint64_t LargestTextPaintSize() const; - BLINK_EXPORT double LastTextPaint() const; - BLINK_EXPORT uint64_t LastTextPaintSize() const; BLINK_EXPORT double PageInteractive() const; BLINK_EXPORT double PageInteractiveDetection() const; BLINK_EXPORT double FirstInputInvalidatingInteractive() const; diff --git a/chromium/third_party/blink/public/web/web_plugin_document.h b/chromium/third_party/blink/public/web/web_plugin_document.h index a2b15de011f..4974312e42a 100644 --- a/chromium/third_party/blink/public/web/web_plugin_document.h +++ b/chromium/third_party/blink/public/web/web_plugin_document.h @@ -52,8 +52,6 @@ class WebPluginDocument final : public WebDocument { BLINK_EXPORT WebPlugin* Plugin(); - BLINK_EXPORT void SetShowBeforeUnloadDialog(bool show_dialog); - #if INSIDE_BLINK WebPluginDocument(PluginDocument*); WebPluginDocument& operator=(PluginDocument*); diff --git a/chromium/third_party/blink/public/web/web_remote_frame.h b/chromium/third_party/blink/public/web/web_remote_frame.h index 6a6a04c9435..9894bfa0a27 100644 --- a/chromium/third_party/blink/public/web/web_remote_frame.h +++ b/chromium/third_party/blink/public/web/web_remote_frame.h @@ -52,20 +52,18 @@ class WebRemoteFrame : public WebFrame { // beginning. virtual WebLocalFrame* CreateLocalChild(WebTreeScopeType, const WebString& name, - WebSandboxFlags, + const FramePolicy&, WebLocalFrameClient*, blink::InterfaceRegistry*, mojo::ScopedMessagePipeHandle, WebFrame* previous_sibling, - const ParsedFeaturePolicy&, const WebFrameOwnerProperties&, FrameOwnerElementType, WebFrame* opener) = 0; virtual WebRemoteFrame* CreateRemoteChild(WebTreeScopeType, const WebString& name, - WebSandboxFlags, - const ParsedFeaturePolicy&, + const FramePolicy&, FrameOwnerElementType, WebRemoteFrameClient*, WebFrame* opener) = 0; @@ -133,6 +131,11 @@ class WebRemoteFrame : public WebFrame { // "local" frame tree (ancestors-only vs all-nodes). virtual void UpdateUserActivationState(UserActivationUpdateType) = 0; + // Transfers user activation state from |source_frame| to this frame, which + // must be in the same frame tree as |source_frame|. + virtual void TransferUserActivationFrom( + blink::WebRemoteFrame* source_frame) = 0; + virtual void SetHasReceivedUserGestureBeforeNavigation(bool value) = 0; // Scrolls the given rectangle into view. This kicks off the recursive scroll diff --git a/chromium/third_party/blink/public/web/web_remote_frame_client.h b/chromium/third_party/blink/public/web/web_remote_frame_client.h index fd46b52336b..9104351c444 100644 --- a/chromium/third_party/blink/public/web/web_remote_frame_client.h +++ b/chromium/third_party/blink/public/web/web_remote_frame_client.h @@ -39,11 +39,14 @@ class WebRemoteFrameClient { bool has_user_gesture) {} // A remote frame was asked to start a navigation. - virtual void Navigate(const WebURLRequest& request, - bool should_replace_current_entry, - bool is_opener_navigation, - bool prevent_sandboxed_download, - mojo::ScopedMessagePipeHandle blob_url_token) {} + virtual void Navigate( + const WebURLRequest& request, + bool should_replace_current_entry, + bool is_opener_navigation, + bool has_download_sandbox_flag, + bool blocking_downloads_in_sandbox_without_user_activation_enabled, + bool initiator_frame_is_ad, + mojo::ScopedMessagePipeHandle blob_url_token) {} virtual void FrameRectsChanged(const WebRect& local_frame_rect, const WebRect& screen_space_rect) {} diff --git a/chromium/third_party/blink/public/web/web_render_theme.h b/chromium/third_party/blink/public/web/web_render_theme.h index 210239f06c3..7a1e0af9c25 100644 --- a/chromium/third_party/blink/public/web/web_render_theme.h +++ b/chromium/third_party/blink/public/web/web_render_theme.h @@ -42,10 +42,6 @@ BLINK_EXPORT void SetCaretBlinkInterval(base::TimeDelta); BLINK_EXPORT void SetFocusRingColor(SkColor); -BLINK_EXPORT void SetMinimumStrokeWidthForFocusRing(float); - -BLINK_EXPORT void SetIsFocusRingOutset(bool); - } // namespace blink #endif diff --git a/chromium/third_party/blink/public/web/web_security_policy.h b/chromium/third_party/blink/public/web/web_security_policy.h index d4e69c757a8..02542328948 100644 --- a/chromium/third_party/blink/public/web/web_security_policy.h +++ b/chromium/third_party/blink/public/web/web_security_policy.h @@ -90,14 +90,14 @@ class WebSecurityPolicy { const WebURL& source_origin); BLINK_EXPORT static void ClearOriginAccessList(); - // Support for whitelisting origins or hostname patterns to treat them as - // trustworthy. This method does not do any canonicalization; the caller is - // responsible for canonicalizing them before calling this. - BLINK_EXPORT static void AddOriginTrustworthyWhiteList(const WebString&); - - // Support for whitelisting schemes as bypassing secure context checks. - BLINK_EXPORT static void AddSchemeToBypassSecureContextWhitelist( - const WebString&); + // Adds an origin or hostname pattern that is always considered trustworthy. + // This method does not perform canonicalization; the caller is responsible + // for canonicalizing the input. + BLINK_EXPORT static void AddOriginToTrustworthySafelist(const WebString&); + + // Add a scheme that is always considered a secure context. The caller is + // responsible for canonicalizing the input. + BLINK_EXPORT static void AddSchemeToSecureContextSafelist(const WebString&); // Returns the referrer modified according to the referrer policy for a // navigation to a given URL. If the referrer returned is empty, the diff --git a/chromium/third_party/blink/public/web/web_settings.h b/chromium/third_party/blink/public/web/web_settings.h index b28241e33be..37733ade4c5 100644 --- a/chromium/third_party/blink/public/web/web_settings.h +++ b/chromium/third_party/blink/public/web/web_settings.h @@ -33,6 +33,7 @@ #include <unicode/uscript.h> +#include "third_party/blink/public/common/css/preferred_color_scheme.h" #include "third_party/blink/public/platform/pointer_properties.h" #include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/public/platform/web_effective_connection_type.h" @@ -147,6 +148,7 @@ class WebSettings { void SetDeferred2dCanvasEnabled(bool) {} // temporary stub virtual void SetDeviceScaleAdjustment(float) = 0; virtual void SetDisableReadingFromCanvas(bool) = 0; + virtual void SetDontSendKeyEventsToJavascript(bool) = 0; virtual void SetDoubleTapToZoomEnabled(bool) = 0; virtual void SetDownloadableBinaryFontsEnabled(bool) = 0; virtual void SetEditingBehavior(EditingBehavior) = 0; @@ -288,6 +290,7 @@ class WebSettings { virtual void SetLazyImageLoadingDistanceThresholdPx3G(int) = 0; virtual void SetLazyImageLoadingDistanceThresholdPx4G(int) = 0; virtual void SetForceDarkModeEnabled(bool) = 0; + virtual void SetPreferredColorScheme(PreferredColorScheme) = 0; protected: ~WebSettings() = default; diff --git a/chromium/third_party/blink/public/web/web_shared_worker_client.h b/chromium/third_party/blink/public/web/web_shared_worker_client.h index 1010a68783b..b0f2aaafeea 100644 --- a/chromium/third_party/blink/public/web/web_shared_worker_client.h +++ b/chromium/third_party/blink/public/web/web_shared_worker_client.h @@ -56,7 +56,7 @@ class WebSharedWorkerClient { virtual void WorkerScriptLoaded() = 0; virtual void WorkerScriptLoadFailed() = 0; virtual void WorkerScriptEvaluated(bool success) = 0; - virtual void SelectAppCacheID(long long) = 0; + virtual void SelectAppCacheID(int64_t) = 0; // Called on the main webkit thread in the worker process during // initialization. diff --git a/chromium/third_party/blink/public/web/web_view.h b/chromium/third_party/blink/public/web/web_view.h index 61ea5ce4394..f831c084e1d 100644 --- a/chromium/third_party/blink/public/web/web_view.h +++ b/chromium/third_party/blink/public/web/web_view.h @@ -38,8 +38,13 @@ #include "third_party/blink/public/platform/web_string.h" #include "third_party/skia/include/core/SkColor.h" +namespace cc { +class PaintCanvas; +} + namespace gfx { class Point; +class Rect; } namespace blink { @@ -177,7 +182,7 @@ class WebView { virtual void ClearFocusedElement() = 0; // Smooth scroll the root layer to |targetX|, |targetY| in |durationMs|. - virtual void SmoothScroll(int target_x, int target_y, long duration_ms) {} + virtual void SmoothScroll(int target_x, int target_y, uint64_t duration_ms) {} // Advance the focus of the WebView forward to the next element or to the // previous element in the tab sequence (if reverse is true). @@ -336,7 +341,7 @@ class WebView { // Returns next unused request identifier which is unique within the // parent Page. - virtual unsigned long CreateUniqueIdentifierForRequest() = 0; + virtual uint64_t CreateUniqueIdentifierForRequest() = 0; // Developer tools ----------------------------------------------------- @@ -369,7 +374,7 @@ class WebView { // Tells all WebView instances to update the visited link state for the // specified hash. - BLINK_EXPORT static void UpdateVisitedLinkState(unsigned long long hash); + BLINK_EXPORT static void UpdateVisitedLinkState(uint64_t hash); // Tells all WebView instances to update the visited state for all // their links. Use invalidateVisitedLinkHashes to inform that the visitedlink @@ -457,6 +462,29 @@ class WebView { virtual void ClearAutoplayFlags() = 0; virtual int32_t AutoplayFlagsForTest() = 0; + // Non-composited support ----------------------------------------------- + + // Called to paint the rectangular region within the WebView's main frame + // onto the specified canvas at (viewport.x, viewport.y). This is to provide + // support for non-composited WebViews, and is used to paint into a + // PaintCanvas being supplied by another (composited) WebView. + // + // Before calling PaintContent(), the caller must ensure the lifecycle of the + // widget's frame is clean by calling UpdateLifecycle(LifecycleUpdate::All). + // It is okay to call paint multiple times once the lifecycle is clean, + // assuming no other changes are made to the WebWidget (e.g., once + // events are processed, it should be assumed that another call to + // UpdateLifecycle is warranted before painting again). Paints starting from + // the main LayoutView's property tree state, thus ignoring any transient + // transormations (e.g. pinch-zoom, dev tools emulation, etc.). + // + // The painting will be performed without applying the DevicePixelRatio as + // scaling is expected to already be applied to the PaintCanvas by the + // composited WebView which supplied the PaintCanvas. The canvas state may + // be modified and should be saved before calling this method and restored + // after. + virtual void PaintContent(cc::PaintCanvas*, const gfx::Rect& viewport) = 0; + // Suspend and resume --------------------------------------------------- // TODO(lfg): Remove this once the refactor of WebView/WebWidget is diff --git a/chromium/third_party/blink/public/web/web_view_client.h b/chromium/third_party/blink/public/web/web_view_client.h index e8b86d667ef..6f26f30ce40 100644 --- a/chromium/third_party/blink/public/web/web_view_client.h +++ b/chromium/third_party/blink/public/web/web_view_client.h @@ -65,14 +65,13 @@ class WebViewClient { // The request parameter is only for the client to check if the request // could be fulfilled. The client should not load the request. // The policy parameter indicates how the new view will be displayed in - // WebWidgetClient::show. + // WebWidgetClient::Show. virtual WebView* CreateView( WebLocalFrame* creator, const WebURLRequest& request, const WebWindowFeatures& features, const WebString& name, WebNavigationPolicy policy, - bool suppress_opener, WebSandboxFlags, const FeaturePolicy::FeatureState&, const SessionStorageNamespaceId& session_storage_namespace_id) { @@ -89,6 +88,11 @@ class WebViewClient { // Misc ---------------------------------------------------------------- + // Called when the window for this WebView should be closed. The WebView + // and its frame tree will be closed asynchronously as a result of this + // request. + virtual void CloseWindowSoon() {} + // Called when a region of the WebView needs to be re-painted. This is only // for non-composited WebViews that exist to contribute to a "parent" WebView // painting. Otherwise invalidations are transmitted to the compositor through @@ -171,12 +175,6 @@ class WebViewClient { // Session history ----------------------------------------------------- - // Tells the embedder to navigate back or forward in session history by - // the given offset (relative to the current position in session - // history). |has_user_gesture| tells whether or not this is the consequence - // of a user action. - virtual void NavigateBackForwardSoon(int offset, bool has_user_gesture) {} - // Returns the number of history items before/after the current // history item. virtual int HistoryBackListCount() { return 0; } @@ -197,8 +195,10 @@ class WebViewClient { // the default values. virtual void ZoomLimitsChanged(double minimum_level, double maximum_level) {} - // Informs the browser that the page scale has changed. - virtual void PageScaleFactorChanged() {} + // Informs the browser that the page scale has changed and/or a pinch gesture + // has started or ended. + virtual void PageScaleFactorChanged(float page_scale_factor, + bool is_pinch_gesture_active) {} // Gestures ------------------------------------------------------------- diff --git a/chromium/third_party/blink/public/web/web_widget.h b/chromium/third_party/blink/public/web/web_widget.h index a7da4679c80..d05bcc1fa67 100644 --- a/chromium/third_party/blink/public/web/web_widget.h +++ b/chromium/third_party/blink/public/web/web_widget.h @@ -34,7 +34,6 @@ #include "base/callback.h" #include "base/time/time.h" #include "cc/input/browser_controls_state.h" -#include "cc/paint/paint_canvas.h" #include "cc/trees/element_id.h" #include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/public/platform/web_float_size.h" @@ -49,8 +48,6 @@ #include "third_party/blink/public/web/web_range.h" #include "third_party/blink/public/web/web_text_direction.h" -class SkBitmap; - namespace cc { struct ApplyViewportChangesArgs; class AnimationHost; @@ -122,6 +119,20 @@ class WebWidget { virtual void BeginRafAlignedInput() {} virtual void EndRafAlignedInput() {} + // Methods called to mark the beginning and end of the + // LayerTreeHost::UpdateLayers method. Only called when gathering main frame + // UMA and UKM. That is, when RecordStartOfFrameMetrics has been called, and + // before RecordEndOfFrameMetrics has been called. + virtual void BeginUpdateLayers() {} + virtual void EndUpdateLayers() {} + + // Methods called to mark the beginning and end of a commit to the impl + // thread for a frame. Only called when gathering main frame + // UMA and UKM. That is, when RecordStartOfFrameMetrics has been called, and + // before RecordEndOfFrameMetrics has been called. + virtual void BeginCommitCompositorFrame() {} + virtual void EndCommitCompositorFrame() {} + // Called to run through the entire set of document lifecycle phases needed // to render a frame of the web widget. This MUST be called before Paint, // and it may result in calls to WebViewClient::DidInvalidateRect (for @@ -143,34 +154,6 @@ class WebWidget { virtual void UpdateLifecycle(LifecycleUpdate requested_update, LifecycleUpdateReason reason) {} - // Synchronously performs the complete set of document lifecycle phases, - // including updates to the compositor state, optionally including - // rasterization. - virtual void UpdateAllLifecyclePhasesAndCompositeForTesting(bool do_raster) {} - - // Called to paint the rectangular region within the WebWidget - // onto the specified canvas at (view_port.x, view_port.y). - // - // Before calling PaintContent(), the caller must ensure the lifecycle of the - // widget's frame is clean by calling UpdateLifecycle(LifecycleUpdate::All). - // It is okay to call paint multiple times once the lifecycle is clean, - // assuming no other changes are made to the WebWidget (e.g., once - // events are processed, it should be assumed that another call to - // UpdateLifecycle is warranted before painting again). Paints starting from - // the main LayoutView's property tree state, thus ignoring any transient - // transormations (e.g. pinch-zoom, dev tools emulation, etc.). - virtual void PaintContent(cc::PaintCanvas*, const WebRect& view_port) {} - - // This should only be called when isAcceleratedCompositingActive() is true. - virtual void CompositeAndReadbackAsync( - base::OnceCallback<void(const SkBitmap&)> callback) {} - - // Runs |callback| after a new frame has been submitted to the display - // compositor, and the display-compositor has displayed it on screen. Forces a - // redraw so that a new frame is submitted. - virtual void RequestPresentationCallbackForTesting( - base::OnceClosure callback) {} - // Called to inform the WebWidget of a change in theme. // Implementors that cache rendered copies of widgets need to re-render // on receiving this message @@ -194,6 +177,9 @@ class WebWidget { // Called to inform the WebWidget of the mouse cursor's visibility. virtual void SetCursorVisibilityState(bool is_visible) {} + // Inform WebWidget fallback cursor mode toggled. + virtual void OnFallbackCursorModeToggled(bool is_on) {} + // Applies viewport related properties during a commit from the compositor // thread. virtual void ApplyViewportChanges(const cc::ApplyViewportChangesArgs& args) {} diff --git a/chromium/third_party/blink/public/web/web_widget_client.h b/chromium/third_party/blink/public/web/web_widget_client.h index e2a9eb45b41..4491ab7de72 100644 --- a/chromium/third_party/blink/public/web/web_widget_client.h +++ b/chromium/third_party/blink/public/web/web_widget_client.h @@ -31,7 +31,10 @@ #ifndef THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_WIDGET_CLIENT_H_ #define THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_WIDGET_CLIENT_H_ +#include <memory> + #include "cc/input/layer_selection_bound.h" +#include "cc/input/overscroll_behavior.h" #include "services/network/public/mojom/referrer_policy.mojom-shared.h" #include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/public/platform/web_drag_operation.h" @@ -48,11 +51,13 @@ class SkBitmap; namespace cc { +class PaintImage; struct ViewportLayers; } namespace gfx { class Point; +class Vector2d; } namespace blink { @@ -69,6 +74,17 @@ class WebWidgetClient { public: virtual ~WebWidgetClient() = default; + // Sets an object which the compositor uses to ask blink for mutations on the + // compositor thread, in order to modify compositor state directly, avoiding + // the need to generate and commit main frames, and avoiding the potentially- + // janky main thread. This is used to allow AnimationWorklet to operate in + // sync with composited animations running ahead of the main frame state. + virtual void SetLayerTreeMutator(std::unique_ptr<cc::LayerTreeMutator>) {} + + // Similar to the |SetLayerTreeMutator|, but used by PaintWorklet. + virtual void SetPaintWorkletLayerPainterClient( + std::unique_ptr<cc::PaintWorkletLayerPainter>) {} + // Sets the root layer of the tree in the compositor. It may be null to remove // the root layer in which case nothing would be shown by the compositor. virtual void SetRootLayer(scoped_refptr<cc::Layer>) {} @@ -108,13 +124,6 @@ class WebWidgetClient { virtual void AutoscrollFling(const WebFloatSize& velocity) {} virtual void AutoscrollEnd() {} - // Called when the window for this top-level widget should be closed. - // WebWidget::Close() should be called asynchronously as a result of this - // notification. - // TODO(danakj): Move this to WebView::CloseWindowSoon(), so we can call - // it when the main frame is remote and there is no top-level widget. - virtual void CloseWidgetSoon() {} - // Called to show the widget according to the given policy. virtual void Show(WebNavigationPolicy) {} @@ -155,8 +164,11 @@ class WebWidgetClient { virtual void DidOverscroll(const WebFloatSize& overscroll_delta, const WebFloatSize& accumulated_overscroll, const WebFloatPoint& position_in_viewport, - const WebFloatSize& velocity_in_viewport, - const cc::OverscrollBehavior& behavior) {} + const WebFloatSize& velocity_in_viewport) {} + + // Set the browser's behavior when overscroll happens, e.g. whether to glow + // or navigate. + virtual void SetOverscrollBehavior(const cc::OverscrollBehavior&) {} // Called to update if pointerrawmove events should be sent. virtual void HasPointerRawMoveEventHandlers(bool) {} @@ -219,6 +231,60 @@ class WebWidgetClient { // Used to update the active selection bounds. Pass a default-constructed // LayerSelection to clear it. virtual void RegisterSelection(const cc::LayerSelection&) {} + + // Used to call platform API for FallbackCursorMode. + virtual void FallbackCursorModeLockCursor(bool left, + bool right, + bool up, + bool down) {} + virtual void FallbackCursorModeSetCursorVisibility(bool visible) {} + + // Informs the compositor if gpu raster will be allowed, or it is blocked + // based on heuristics from the content of the page. + virtual void SetAllowGpuRasterization(bool) {} + + // Sets the current page scale factor and minimum / maximum limits. Both + // limits are initially 1 (no page scale allowed). + virtual void SetPageScaleFactorAndLimits(float page_scale_factor, + float minimum, + float maximum) {} + + // Starts an animation of the page scale to a target scale factor and scroll + // offset. + // If use_anchor is true, destination is a point on the screen that will + // remain fixed for the duration of the animation. + // If use_anchor is false, destination is the final top-left scroll position. + virtual void StartPageScaleAnimation(const gfx::Vector2d& destination, + bool use_anchor, + float new_page_scale, + double duration_sec) {} + + // Requests an image decode and will have the |callback| run asynchronously + // when it completes. Forces a new main frame to occur that will trigger + // pushing the decode through the compositor. + virtual void RequestDecode(const cc::PaintImage& image, + base::OnceCallback<void(bool)> callback) {} + + // SwapResult mirrors the values of cc::SwapPromise::DidNotSwapReason, and + // should be kept consistent with it. SwapResult additionally adds a success + // value (kDidSwap). + // These values are written to logs. New enum values can be added, but + // existing enums must never be renumbered, deleted or reused. + enum SwapResult { + kDidSwap = 0, + kDidNotSwapSwapFails = 1, + kDidNotSwapCommitFails = 2, + kDidNotSwapCommitNoUpdate = 3, + kDidNotSwapActivationFails = 4, + kSwapResultMax, + }; + using ReportTimeCallback = + base::OnceCallback<void(SwapResult, base::TimeTicks)>; + + // The |callback| will be fired when the corresponding renderer frame is + // submitted (still called "swapped") to the display compositor (either with + // DidSwap or DidNotSwap). + virtual void NotifySwapTime(ReportTimeCallback callback) {} }; } // namespace blink diff --git a/chromium/third_party/blink/public/web/web_window_features.h b/chromium/third_party/blink/public/web/web_window_features.h index 7aa5be6f750..4f735ad0d97 100644 --- a/chromium/third_party/blink/public/web/web_window_features.h +++ b/chromium/third_party/blink/public/web/web_window_features.h @@ -49,9 +49,15 @@ struct WebWindowFeatures { // string, we don't distinguish between the two. bool tool_bar_visible = true; bool scrollbars_visible = true; + + // The members above this line are transferred through mojo + // in the form of |struct WindowFeatures| defined in window_features.mojom, + // to be used across process boundaries. + // Below members are the ones not transferred through mojo. bool resizable = true; bool noopener = false; + bool noreferrer = false; bool background = false; bool persistent = false; }; |