summaryrefslogtreecommitdiff
path: root/chromium/content/common
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-07-16 11:45:35 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-07-17 08:59:23 +0000
commit552906b0f222c5d5dd11b9fd73829d510980461a (patch)
tree3a11e6ed0538a81dd83b20cf3a4783e297f26d91 /chromium/content/common
parent1b05827804eaf047779b597718c03e7d38344261 (diff)
downloadqtwebengine-chromium-552906b0f222c5d5dd11b9fd73829d510980461a.tar.gz
BASELINE: Update Chromium to 83.0.4103.122
Change-Id: Ie3a82f5bb0076eec2a7c6a6162326b4301ee291e Reviewed-by: Michael Brüning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/content/common')
-rw-r--r--chromium/content/common/BUILD.gn400
-rw-r--r--chromium/content/common/DEPS25
-rw-r--r--chromium/content/common/OWNERS3
-rw-r--r--chromium/content/common/accessibility_messages.h221
-rw-r--r--chromium/content/common/android/java_templates/ContentSwitches.java.tmpl3
-rw-r--r--chromium/content/common/ax_content_node_data.cc93
-rw-r--r--chromium/content/common/ax_content_node_data.h38
-rw-r--r--chromium/content/common/ax_content_node_data.mojom13
-rw-r--r--chromium/content/common/ax_content_node_data_mojom_traits.cc24
-rw-r--r--chromium/content/common/ax_content_node_data_mojom_traits.h30
-rw-r--r--chromium/content/common/ax_content_tree_data.mojom14
-rw-r--r--chromium/content/common/ax_content_tree_data_mojom_traits.cc25
-rw-r--r--chromium/content/common/ax_content_tree_data_mojom_traits.h33
-rw-r--r--chromium/content/common/ax_content_tree_update.mojom19
-rw-r--r--chromium/content/common/ax_content_tree_update_mojom_traits.cc28
-rw-r--r--chromium/content/common/ax_content_tree_update_mojom_traits.h47
-rw-r--r--chromium/content/common/background_fetch/background_fetch_types.cc16
-rw-r--r--chromium/content/common/browser_plugin/browser_plugin_messages.h215
-rw-r--r--chromium/content/common/child_process.mojom11
-rw-r--r--chromium/content/common/child_process_host_impl.cc11
-rw-r--r--chromium/content/common/common_param_traits_macros.h2
-rw-r--r--chromium/content/common/common_param_traits_unittest.cc14
-rw-r--r--chromium/content/common/content_message_generator.h11
-rw-r--r--chromium/content/common/content_navigation_policy.cc98
-rw-r--r--chromium/content/common/content_navigation_policy.h53
-rw-r--r--chromium/content/common/content_param_traits.cc94
-rw-r--r--chromium/content/common/content_param_traits.h17
-rw-r--r--chromium/content/common/content_param_traits_macros.h15
-rw-r--r--chromium/content/common/content_security_policy/OWNERS2
-rw-r--r--chromium/content/common/content_security_policy/content_security_policy.cc258
-rw-r--r--chromium/content/common/content_security_policy/content_security_policy.h61
-rw-r--r--chromium/content/common/content_security_policy/content_security_policy_unittest.cc361
-rw-r--r--chromium/content/common/content_security_policy/csp_context.cc150
-rw-r--r--chromium/content/common/content_security_policy/csp_context.h161
-rw-r--r--chromium/content/common/content_security_policy/csp_context_unittest.cc312
-rw-r--r--chromium/content/common/content_security_policy/csp_directive.cc68
-rw-r--r--chromium/content/common/content_security_policy/csp_directive.h52
-rw-r--r--chromium/content/common/content_security_policy/csp_disposition_enum.h19
-rw-r--r--chromium/content/common/content_security_policy/csp_source.cc257
-rw-r--r--chromium/content/common/content_security_policy/csp_source.h68
-rw-r--r--chromium/content/common/content_security_policy/csp_source_list.cc119
-rw-r--r--chromium/content/common/content_security_policy/csp_source_list.h49
-rw-r--r--chromium/content/common/content_security_policy/csp_source_list_unittest.cc140
-rw-r--r--chromium/content/common/content_security_policy/csp_source_unittest.cc334
-rw-r--r--chromium/content/common/content_security_policy_header.cc21
-rw-r--r--chromium/content/common/content_security_policy_header.h32
-rw-r--r--chromium/content/common/content_to_visible_time_reporter.cc (renamed from chromium/content/common/tab_switch_time_recorder.cc)142
-rw-r--r--chromium/content/common/content_to_visible_time_reporter.h119
-rw-r--r--chromium/content/common/cursors/webcursor.cc40
-rw-r--r--chromium/content/common/cursors/webcursor.h22
-rw-r--r--chromium/content/common/cursors/webcursor_android.cc1
-rw-r--r--chromium/content/common/cursors/webcursor_aura.cc37
-rw-r--r--chromium/content/common/cursors/webcursor_aurawin.cc10
-rw-r--r--chromium/content/common/cursors/webcursor_aurax11.cc7
-rw-r--r--chromium/content/common/cursors/webcursor_mac.mm134
-rw-r--r--chromium/content/common/cursors/webcursor_ozone.cc19
-rw-r--r--chromium/content/common/cursors/webcursor_unittest.cc222
-rw-r--r--chromium/content/common/drag_messages.h5
-rw-r--r--chromium/content/common/fetch/BUILD.gn4
-rw-r--r--chromium/content/common/fetch/fetch_api_request_proto.cc2
-rw-r--r--chromium/content/common/fetch/fetch_request_type_converters.cc4
-rw-r--r--chromium/content/common/font_list.cc10
-rw-r--r--chromium/content/common/font_list_unittest.cc21
-rw-r--r--chromium/content/common/frame.mojom106
-rw-r--r--chromium/content/common/frame_message_structs.cc13
-rw-r--r--chromium/content/common/frame_message_structs.h22
-rw-r--r--chromium/content/common/frame_messages.h625
-rw-r--r--chromium/content/common/frame_messages.typemap8
-rw-r--r--chromium/content/common/frame_owner_properties.cc32
-rw-r--r--chromium/content/common/frame_owner_properties.h47
-rw-r--r--chromium/content/common/frame_proxy.mojom30
-rw-r--r--chromium/content/common/frame_replication_state.cc10
-rw-r--r--chromium/content/common/frame_replication_state.h36
-rw-r--r--chromium/content/common/frame_visual_properties.h34
-rw-r--r--chromium/content/common/input/OWNERS2
-rw-r--r--chromium/content/common/input/actions_parser.cc2
-rw-r--r--chromium/content/common/input/event_with_latency_info.h9
-rw-r--r--chromium/content/common/input/event_with_latency_info_unittest.cc6
-rw-r--r--chromium/content/common/input/gesture_event_stream_validator.cc4
-rw-r--r--chromium/content/common/input/ime_text_span_conversions.cc46
-rw-r--r--chromium/content/common/input/ime_text_span_conversions.h6
-rw-r--r--chromium/content/common/input/input_event.cc3
-rw-r--r--chromium/content/common/input/input_event_ack.h2
-rw-r--r--chromium/content/common/input/input_event_mojom_traits.cc9
-rw-r--r--chromium/content/common/input/input_event_stream_validator.cc4
-rw-r--r--chromium/content/common/input/input_handler.mojom43
-rw-r--r--chromium/content/common/input/sync_compositor_messages.h1
-rw-r--r--chromium/content/common/input/synchronous_compositor.mojom7
-rw-r--r--chromium/content/common/input/synchronous_compositor.typemap16
-rw-r--r--chromium/content/common/input/synthetic_pointer_action_params.h2
-rw-r--r--chromium/content/common/input/synthetic_smooth_scroll_gesture_params.cc2
-rw-r--r--chromium/content/common/input/synthetic_smooth_scroll_gesture_params.h2
-rw-r--r--chromium/content/common/input/synthetic_web_input_event_builders.cc8
-rw-r--r--chromium/content/common/input/synthetic_web_input_event_builders.h40
-rw-r--r--chromium/content/common/input/synthetic_web_input_event_builders_unittest.cc11
-rw-r--r--chromium/content/common/input/touch_event_stream_validator.cc2
-rw-r--r--chromium/content/common/input/touch_event_stream_validator.h2
-rw-r--r--chromium/content/common/input/web_mouse_wheel_event_traits.cc5
-rw-r--r--chromium/content/common/input/web_mouse_wheel_event_traits.h2
-rw-r--r--chromium/content/common/input/web_touch_event_traits.cc2
-rw-r--r--chromium/content/common/input/web_touch_event_traits.h2
-rw-r--r--chromium/content/common/input_messages.h19
-rw-r--r--chromium/content/common/mac/font_loader.h17
-rw-r--r--chromium/content/common/mac/font_loader.mm27
-rw-r--r--chromium/content/common/media/media_log_records.mojom14
-rw-r--r--chromium/content/common/media/media_player_delegate_messages.h17
-rw-r--r--chromium/content/common/native_types.mojom24
-rw-r--r--chromium/content/common/native_types.typemap106
-rw-r--r--chromium/content/common/native_types_mac.typemap36
-rw-r--r--chromium/content/common/navigation_client.mojom2
-rw-r--r--chromium/content/common/navigation_params.cc36
-rw-r--r--chromium/content/common/navigation_params.h72
-rw-r--r--chromium/content/common/navigation_params.mojom83
-rw-r--r--chromium/content/common/navigation_params.typemap29
-rw-r--r--chromium/content/common/net/record_load_histograms.cc14
-rw-r--r--chromium/content/common/net/record_load_histograms.h14
-rw-r--r--chromium/content/common/page_messages.h10
-rw-r--r--chromium/content/common/profiling_utils.cc (renamed from chromium/content/common/coverage_utils.cc)6
-rw-r--r--chromium/content/common/profiling_utils.h (renamed from chromium/content/common/coverage_utils.h)8
-rw-r--r--chromium/content/common/render_accessibility.mojom96
-rw-r--r--chromium/content/common/render_frame_metadata.mojom6
-rw-r--r--chromium/content/common/render_frame_metadata.typemap16
-rw-r--r--chromium/content/common/render_frame_metadata_mojom_traits.cc3
-rw-r--r--chromium/content/common/render_frame_metadata_mojom_traits.h10
-rw-r--r--chromium/content/common/render_message_filter.mojom13
-rw-r--r--chromium/content/common/render_widget_host_ns_view.mojom2
-rw-r--r--chromium/content/common/renderer.mojom38
-rw-r--r--chromium/content/common/renderer_host.mojom3
-rw-r--r--chromium/content/common/renderer_variations_configuration.mojom18
-rw-r--r--chromium/content/common/resource_messages.h2
-rw-r--r--chromium/content/common/resource_timing_info.cc21
-rw-r--r--chromium/content/common/resource_timing_info.h91
-rw-r--r--chromium/content/common/sandbox_init_mac.cc6
-rw-r--r--chromium/content/common/service_manager/service_manager_connection_impl_unittest.cc7
-rw-r--r--chromium/content/common/service_worker/service_worker_loader_helpers.cc82
-rw-r--r--chromium/content/common/service_worker/service_worker_utils.cc15
-rw-r--r--chromium/content/common/service_worker/service_worker_utils.h4
-rw-r--r--chromium/content/common/service_worker/service_worker_utils_unittest.cc8
-rw-r--r--chromium/content/common/swapped_out_messages.cc60
-rw-r--r--chromium/content/common/swapped_out_messages.h22
-rw-r--r--chromium/content/common/tab_switch_time_recorder.h90
-rw-r--r--chromium/content/common/tab_switch_time_recorder_unittest.cc375
-rw-r--r--chromium/content/common/text_input_state.cc2
-rw-r--r--chromium/content/common/text_input_state.h10
-rw-r--r--chromium/content/common/typemaps.gni13
-rw-r--r--chromium/content/common/unfreezable_frame_messages.h6
-rw-r--r--chromium/content/common/url_schemes.cc19
-rw-r--r--chromium/content/common/url_schemes.h15
-rw-r--r--chromium/content/common/user_agent.cc122
-rw-r--r--chromium/content/common/view_messages.h81
-rw-r--r--chromium/content/common/visual_properties.h25
-rw-r--r--chromium/content/common/web_preferences.typemap11
-rw-r--r--chromium/content/common/widget_messages.h59
153 files changed, 2634 insertions, 5290 deletions
diff --git a/chromium/content/common/BUILD.gn b/chromium/content/common/BUILD.gn
index 1364b744014..f22f6c8410d 100644
--- a/chromium/content/common/BUILD.gn
+++ b/chromium/content/common/BUILD.gn
@@ -39,7 +39,6 @@ source_set("common") {
]
sources = [
- "accessibility_messages.h",
"all_messages.h",
"android/gin_java_bridge_errors.cc",
"android/gin_java_bridge_errors.h",
@@ -60,7 +59,6 @@ source_set("common") {
"background_fetch/background_fetch_types.h",
"browser_plugin/browser_plugin_constants.cc",
"browser_plugin/browser_plugin_constants.h",
- "browser_plugin/browser_plugin_messages.h",
"child_process_host_impl.cc",
"child_process_host_impl.h",
"common_param_traits.cc",
@@ -73,25 +71,16 @@ source_set("common") {
"content_ipc_logging.cc",
"content_message_generator.cc",
"content_message_generator.h",
+ "content_navigation_policy.cc",
+ "content_navigation_policy.h",
"content_param_traits.cc",
"content_param_traits.h",
"content_param_traits_macros.h",
"content_paths.cc",
- "content_security_policy/content_security_policy.cc",
- "content_security_policy/content_security_policy.h",
- "content_security_policy/csp_context.cc",
- "content_security_policy/csp_context.h",
- "content_security_policy/csp_directive.cc",
- "content_security_policy/csp_directive.h",
- "content_security_policy/csp_disposition_enum.h",
- "content_security_policy/csp_source.cc",
- "content_security_policy/csp_source.h",
- "content_security_policy/csp_source_list.cc",
- "content_security_policy/csp_source_list.h",
- "content_security_policy_header.cc",
- "content_security_policy_header.h",
"content_switches_internal.cc",
"content_switches_internal.h",
+ "content_to_visible_time_reporter.cc",
+ "content_to_visible_time_reporter.h",
"cursors/webcursor.cc",
"cursors/webcursor.h",
"cursors/webcursor_android.cc",
@@ -116,12 +105,8 @@ source_set("common") {
"font_list_mac.mm",
"font_list_win.cc",
"frame_delete_intention.h",
- "frame_message_structs.cc",
- "frame_message_structs.h",
"frame_messages.h",
"frame_messages_forward.h",
- "frame_owner_properties.cc",
- "frame_owner_properties.h",
"frame_replication_state.cc",
"frame_replication_state.h",
"frame_visual_properties.cc",
@@ -200,8 +185,6 @@ source_set("common") {
"pepper_renderer_instance_data.h",
"process_type.cc",
"resource_messages.h",
- "resource_timing_info.cc",
- "resource_timing_info.h",
"sandbox_init_linux.cc",
"sandbox_init_mac.cc",
"sandbox_init_win.cc",
@@ -214,10 +197,6 @@ source_set("common") {
"service_worker/service_worker_utils.h",
"skia_utils.cc",
"skia_utils.h",
- "swapped_out_messages.cc",
- "swapped_out_messages.h",
- "tab_switch_time_recorder.cc",
- "tab_switch_time_recorder.h",
"text_input_client_messages.h",
"text_input_state.cc",
"text_input_state.h",
@@ -255,6 +234,9 @@ source_set("common") {
"//third_party/blink/public:blink_headers",
"//third_party/blink/public/common",
"//ui/accessibility",
+ "//ui/base/cursor",
+ "//ui/base/mojom:cursor_type",
+ "//ui/events/ipc",
]
deps = [
":buildflags",
@@ -264,10 +246,9 @@ source_set("common") {
"//build/util:webkit_version",
"//components/discardable_memory/common",
"//components/services/filesystem/public/mojom",
- "//components/tracing",
"//components/tracing:startup_tracing",
- "//components/viz/service",
- "//content:resources",
+ "//content:content_resources",
+ "//content:dev_ui_content_resources",
"//content/app/resources",
"//content/common/fetch:fetch_api_request_proto",
"//content/public/common:interfaces",
@@ -426,13 +407,13 @@ source_set("common") {
if (is_fuchsia) {
sources += [ "font_list_fuchsia.cc" ]
- deps += [ "//third_party/fuchsia-sdk/sdk:fdio" ]
+ deps += [ "//third_party/fuchsia-sdk/sdk/pkg/fdio" ]
}
- if (use_clang_coverage) {
+ if (use_clang_profiling_inside_sandbox) {
sources += [
- "coverage_utils.cc",
- "coverage_utils.h",
+ "profiling_utils.cc",
+ "profiling_utils.h",
]
}
}
@@ -441,9 +422,7 @@ source_set("common") {
group("for_content_tests") {
visibility = [ "//content/test/*" ]
if (!is_component_build) {
- public_deps = [
- ":common",
- ]
+ public_deps = [ ":common" ]
}
}
@@ -460,6 +439,9 @@ mojom("mojo_bindings") {
sources = [
"associated_interfaces.mojom",
+ "ax_content_node_data.mojom",
+ "ax_content_tree_data.mojom",
+ "ax_content_tree_update.mojom",
"child_process.mojom",
"document_scoped_interface_bundle.mojom",
"download/mhtml_file_writer.mojom",
@@ -472,6 +454,7 @@ mojom("mojo_bindings") {
"input/input_handler.mojom",
"input/input_injector.mojom",
"input/synchronous_compositor.mojom",
+ "media/media_log_records.mojom",
"media/renderer_audio_input_stream_factory.mojom",
"media/renderer_audio_output_stream_factory.mojom",
"native_types.mojom",
@@ -479,10 +462,12 @@ mojom("mojo_bindings") {
"navigation_params.mojom",
"page_state.mojom",
"prefetched_signed_exchange_info.mojom",
+ "render_accessibility.mojom",
"render_frame_metadata.mojom",
"render_message_filter.mojom",
"renderer.mojom",
"renderer_host.mojom",
+ "renderer_variations_configuration.mojom",
"widget.mojom",
]
@@ -493,17 +478,326 @@ mojom("mojo_bindings") {
if (is_linux || is_chromeos) {
enabled_features += [ "supports_thread_priorities" ]
}
- if (use_clang_coverage) {
- enabled_features += [ "clang_coverage" ]
+ if (use_clang_profiling_inside_sandbox) {
+ enabled_features += [ "clang_profiling_inside_sandbox" ]
}
- import_dirs = [ "//mojo/services" ]
+ cpp_typemaps = [
+ {
+ types = [
+ {
+ mojom = "ax.mojom.AXContentNodeData"
+ cpp = "::content::AXContentNodeData"
+ },
+ ]
+ traits_headers =
+ [ "//content/common/ax_content_node_data_mojom_traits.h" ]
+ traits_sources =
+ [ "//content/common/ax_content_node_data_mojom_traits.cc" ]
+ traits_public_deps = [
+ ":mojo_bindings_shared",
+ "//ui/accessibility",
+ ]
+ traits_deps = [ "//ui/accessibility/mojom" ]
+ },
+ {
+ types = [
+ {
+ mojom = "ax.mojom.AXContentTreeData"
+ cpp = "::content::AXContentTreeData"
+ },
+ ]
+ traits_headers =
+ [ "//content/common/ax_content_tree_data_mojom_traits.h" ]
+ traits_sources =
+ [ "//content/common/ax_content_tree_data_mojom_traits.cc" ]
+ traits_public_deps = [
+ ":mojo_bindings_shared",
+ "//ui/accessibility",
+ ]
+ traits_deps = [ "//ui/accessibility/mojom" ]
+ },
+ {
+ types = [
+ {
+ mojom = "ax.mojom.AXContentTreeUpdate"
+ cpp = "::content::AXContentTreeUpdate"
+ },
+ ]
+ traits_headers =
+ [ "//content/common/ax_content_tree_update_mojom_traits.h" ]
+ traits_sources =
+ [ "//content/common/ax_content_tree_update_mojom_traits.cc" ]
+ traits_public_deps = [
+ ":mojo_bindings_shared",
+ "//ui/accessibility",
+ ]
+ traits_deps = [ "//ui/accessibility/mojom" ]
+ },
+ {
+ types = [
+ {
+ mojom = "content.mojom.DidCommitProvisionalLoadParams"
+ cpp = "::std::unique_ptr<::FrameHostMsg_DidCommitProvisionalLoad_Params>"
+ move_only = true
+ nullable_is_same_type = true
+ },
+ ]
+ traits_headers = [ "//content/common/frame_messages_forward.h" ]
+ traits_private_headers = [ "//content/common/frame_messages.h" ]
+ },
+ {
+ types = [
+ {
+ mojom = "content.mojom.SyncCompositorDemandDrawHwParams"
+ cpp = "::content::SyncCompositorDemandDrawHwParams"
+ },
+ {
+ mojom = "content.mojom.SyncCompositorSetSharedMemoryParams"
+ cpp = "::content::SyncCompositorSetSharedMemoryParams"
+ },
+ {
+ mojom = "content.mojom.SyncCompositorDemandDrawSwParams"
+ cpp = "::content::SyncCompositorDemandDrawSwParams"
+ },
+ {
+ mojom = "content.mojom.SyncCompositorCommonRendererParams"
+ cpp = "::content::SyncCompositorCommonRendererParams"
+ },
+ ]
+ traits_headers = [ "//content/common/input/sync_compositor_messages.h" ]
+ traits_public_deps = [ "//ui/gfx/ipc" ]
+ },
+ {
+ types = [
+ {
+ mojom = "content.mojom.Button"
+ cpp = "::blink::WebPointerProperties::Button"
+ },
+ {
+ mojom = "content.mojom.Cancelability"
+ cpp = "::blink::WebInputEvent::DispatchType"
+ },
+ {
+ mojom = "content.mojom.ContentSecurityPolicy"
+ cpp = "::content::ContentSecurityPolicy"
+ },
+ {
+ mojom = "content.mojom.DidOverscrollParams"
+ cpp = "::ui::DidOverscrollParams"
+ },
+ {
+ mojom = "content.mojom.EditCommand"
+ cpp = "::content::EditCommand"
+ },
+ {
+ mojom = "content.mojom.Event"
+ cpp = "::std::unique_ptr<::content::InputEvent>"
+ move_only = true
+ },
+ {
+ mojom = "content.mojom.EventType"
+ cpp = "::blink::WebInputEvent::Type"
+ },
+ {
+ mojom = "content.mojom.FrameReplicationState"
+ cpp = "::content::FrameReplicationState"
+ },
+ {
+ mojom = "content.mojom.GestureDevice"
+ cpp = "::blink::WebGestureDevice"
+ },
+ {
+ mojom = "content.mojom.InertialPhaseState"
+ cpp = "::blink::WebGestureEvent::InertialPhaseState"
+ },
+ {
+ mojom = "content.mojom.InputEventAckSource"
+ cpp = "::content::InputEventAckSource"
+ },
+ {
+ mojom = "content.mojom.InputEventAckState"
+ cpp = "::content::InputEventAckState"
+ },
+ {
+ mojom = "content.mojom.NetworkConnectionType"
+ cpp = "::net::NetworkChangeNotifier::ConnectionType"
+ },
+ {
+ mojom = "content.mojom.PointerType"
+ cpp = "::blink::WebPointerProperties::PointerType"
+ },
+ {
+ mojom = "content.mojom.ScrollGranularity"
+ cpp = "::ui::ScrollGranularity"
+ },
+ {
+ mojom = "content.mojom.SyntheticPinch"
+ cpp = "::content::SyntheticPinchGestureParams"
+ },
+ {
+ mojom = "content.mojom.SyntheticPointerAction"
+ cpp = "::content::SyntheticPointerActionListParams"
+ },
+ {
+ mojom = "content.mojom.SyntheticSmoothDrag"
+ cpp = "::content::SyntheticSmoothDragGestureParams"
+ },
+ {
+ mojom = "content.mojom.SyntheticSmoothScroll"
+ cpp = "::content::SyntheticSmoothScrollGestureParams"
+ },
+ {
+ mojom = "content.mojom.SyntheticTap"
+ cpp = "::content::SyntheticTapGestureParams"
+ },
+ {
+ mojom = "content.mojom.SystemThemeColor"
+ cpp = "::ui::NativeTheme::SystemThemeColor"
+ },
+ {
+ mojom = "content.mojom.TouchActionOptional"
+ cpp = "::cc::TouchAction"
+ },
+ {
+ mojom = "content.mojom.TouchState"
+ cpp = "::blink::WebTouchPoint::State"
+ },
+ {
+ mojom = "content.mojom.VisualProperties"
+ cpp = "::content::VisualProperties"
+ },
+ {
+ mojom = "content.mojom.WebCursor"
+ cpp = "::content::WebCursor"
+ },
+ {
+ mojom = "content.mojom.WebPopupType"
+ cpp = "::blink::WebPopupType"
+ },
+ ]
+
+ traits_headers = [
+ "//cc/input/touch_action.h",
+ "//content/common/cursors/webcursor.h",
+ "//content/common/edit_command.h",
+ "//content/common/frame_replication_state.h",
+ "//content/common/input/input_event.h",
+ "//content/common/input/synthetic_pinch_gesture_params.h",
+ "//content/common/input/synthetic_pointer_action_list_params.h",
+ "//content/common/input/synthetic_smooth_drag_gesture_params.h",
+ "//content/common/input/synthetic_smooth_scroll_gesture_params.h",
+ "//content/common/input/synthetic_tap_gesture_params.h",
+ "//content/common/visual_properties.h",
+ "//content/public/common/input_event_ack_source.h",
+ "//content/public/common/input_event_ack_state.h",
+ "//content/public/common/web_preferences.h",
+ "//net/base/network_change_notifier.h",
+ "//third_party/blink/public/common/input/web_gesture_device.h",
+ "//third_party/blink/public/common/input/web_gesture_event.h",
+ "//third_party/blink/public/common/input/web_input_event.h",
+ "//third_party/blink/public/common/input/web_mouse_wheel_event.h",
+ "//third_party/blink/public/common/input/web_pointer_properties.h",
+ "//third_party/blink/public/common/input/web_touch_point.h",
+ "//ui/events/blink/did_overscroll_params.h",
+ "//ui/events/blink/web_input_event_traits.h",
+ "//ui/latency/ipc/latency_info_param_traits.h",
+ "//ui/native_theme/native_theme.h",
+ ]
+
+ traits_private_headers = [
+ "//content/common/frame_messages.h",
+ "//content/common/input/input_event_mojom_traits.h",
+ "//content/common/input/touch_action_optional_mojom_traits.h",
+ "//content/common/input_messages.h",
+ "//content/common/view_messages.h",
+ "//content/common/widget_messages.h",
+ "//content/public/common/common_param_traits.h",
+ "//services/network/public/cpp/p2p_param_traits.h",
+ ]
+
+ traits_public_deps = [
+ # NOTE: These dependencies are here to satisfy gn check because
+ # common_param_traits_macros.h and/or view_messages.h include their headers.
+ # Although the mojo bindings target is configured to allow direct circular
+ # includes from //content/common and //content/public/common, this isn't a
+ # transitive allowance, so those targets' own public_deps aren't included in
+ # the set of implied dependencies.
+ "//content/common:buildflags",
+ "//media",
+ "//media/base/ipc",
+ "//net",
+ "//ppapi/buildflags",
+ "//services/network/public/cpp",
+ "//third_party/blink/public/common",
+ "//ui/accessibility",
+ "//ui/base/ime:text_input_types",
+ "//ui/events/blink",
+ "//ui/gfx/ipc",
+ "//ui/gfx/ipc/color",
+ "//ui/gfx/ipc/skia",
+ "//ui/surface",
+ "//url/ipc:url_ipc",
+ ]
+ },
+ {
+ types = [
+ {
+ mojom = "content.mojom.MixedContentContextType"
+ cpp = "::blink::WebMixedContentContextType"
+ },
+ {
+ mojom = "content.mojom.NavigationDownloadPolicy"
+ cpp = "::content::NavigationDownloadPolicy"
+ },
+ {
+ mojom = "content.mojom.PageState"
+ cpp = "::content::PageState"
+ },
+ {
+ mojom = "content.mojom.PageTransition"
+ cpp = "::ui::PageTransition"
+ },
+ {
+ mojom = "content.mojom.SHA256HashValue"
+ cpp = "::net::SHA256HashValue"
+ },
+ ]
+ traits_headers = [
+ "//content/common/content_param_traits.h",
+ "//content/common/navigation_params.h",
+ "//content/public/common/navigation_policy.h",
+ "//content/public/common/page_state.h",
+ "//third_party/blink/public/platform/web_mixed_content_context_type.h",
+ "//ui/base/page_transition_types.h",
+ ]
+ traits_private_headers = [
+ "//content/common/frame_messages.h",
+ "//content/common/resource_messages.h",
+ ]
+ },
+ {
+ types = [
+ {
+ mojom = "content.mojom.RenderFrameMetadata"
+ cpp = "::cc::RenderFrameMetadata"
+ },
+ ]
+ traits_headers =
+ [ "//content/common/render_frame_metadata_mojom_traits.h" ]
+ traits_sources =
+ [ "//content/common/render_frame_metadata_mojom_traits.cc" ]
+ traits_deps = [
+ "//cc",
+ "//ui/gfx/geometry/mojom:mojom_traits",
+ ]
+ },
+ ]
public_deps = [
"//cc/mojom",
- "//components/tracing/common:interfaces",
"//content/public/common:interfaces",
- "//content/public/common:resource_type_bindings",
+ "//content/public/common:web_preferences_mojom",
"//ipc:mojom",
"//ipc:mojom_constants",
"//media/capture/mojom:video_capture",
@@ -512,11 +806,13 @@ mojom("mojo_bindings") {
"//services/audio/public/mojom",
"//services/network/public/mojom",
"//services/service_manager/public/mojom",
+ "//services/tracing/public/mojom",
"//services/video_capture/public/mojom",
"//services/viz/public/mojom",
"//skia/public/mojom",
"//third_party/blink/public/mojom:mojom_core",
"//third_party/blink/public/mojom:web_feature_mojo_bindings",
+ "//ui/accessibility/mojom",
"//ui/base/ime/mojom",
"//ui/base/mojom",
"//ui/events/mojom",
@@ -536,6 +832,26 @@ mojom("mojo_bindings") {
"web_contents_ns_view_bridge.mojom",
]
public_deps += [ "//ui/display/mojom" ]
+ cpp_typemaps += [
+ {
+ types = [
+ {
+ mojom = "content.mojom.EncodedAttributedString"
+ cpp = "::mac::AttributedStringCoder::EncodedString"
+ },
+ {
+ mojom = "content.mojom.ScrollerStyle"
+ cpp = "::blink::ScrollerStyle"
+ },
+ ]
+ traits_headers = [
+ "//content/common/mac/attributed_string_coder.h",
+ "//third_party/blink/public/platform/mac/web_scrollbar_theme.h",
+ ]
+ traits_private_headers = [ "//content/common/view_messages.h" ]
+ traits_public_deps = [ "//third_party/blink/public:blink_headers" ]
+ },
+ ]
}
overridden_deps = [ "//third_party/blink/public/mojom:mojom_core" ]
@@ -573,8 +889,6 @@ if (is_mac) {
write_file(_file, _lines)
- sources = [
- _file,
- ]
+ sources = [ _file ]
}
}
diff --git a/chromium/content/common/DEPS b/chromium/content/common/DEPS
index 9343483ff08..e156af2acdf 100644
--- a/chromium/content/common/DEPS
+++ b/chromium/content/common/DEPS
@@ -6,7 +6,6 @@ include_rules = [
"+components/payments",
"+device/base/synchronization",
"+services/media_session/public/cpp",
- "+services/network/loader_util.h",
"+services/network/public/cpp",
"+services/network/public/mojom",
"+services/resource_coordinator/public/mojom",
@@ -23,51 +22,27 @@ include_rules = [
"+third_party/blink/public/common",
"+third_party/blink/public/mojom",
"+third_party/blink/public/platform/viewport_intersection_state.h",
- "+third_party/blink/public/platform/WebAddressSpace.h",
"+third_party/blink/public/platform/web_content_security_policy.h",
- "+third_party/blink/public/platform/web_cursor_info.h",
"+third_party/blink/public/platform/web_drag_operation.h",
- "+third_party/blink/public/platform/web_float_point.h",
"+third_party/blink/public/platform/web_float_rect.h",
- "+third_party/blink/public/platform/web_focus_type.h",
"+third_party/blink/public/platform/web_fullscreen_video_status.h",
- "+third_party/blink/public/platform/web_gesture_event.h",
"+third_party/blink/public/platform/web_http_body.h",
"+third_party/blink/public/platform/web_history_scroll_restoration_type.h",
- "+third_party/blink/public/platform/web_input_event.h",
- "+third_party/blink/public/platform/web_insecure_request_policy.h",
"+third_party/blink/public/platform/web_intrinsic_sizing_info.h",
- "+third_party/blink/public/platform/web_keyboard_event.h",
"+third_party/blink/public/platform/web_mixed_content_context_type.h",
- "+third_party/blink/public/platform/web_mouse_wheel_event.h",
- "+third_party/blink/public/platform/web_pointer_properties.h",
- "+third_party/blink/public/platform/WebOriginTrialTokenStatus.h",
- "+third_party/blink/public/platform/WebPageVisibilityState.h",
"+third_party/blink/public/platform/web_screen_info.h",
- "+third_party/blink/public/platform/web_scrollbar_buttons_placement.h",
- "+third_party/blink/public/platform/web_scroll_into_view_params.h",
- "+third_party/blink/public/platform/web_scroll_types.h",
"+third_party/blink/public/platform/web_storage_area.h",
"+third_party/blink/public/platform/web_text_autosizer_page_info.h",
- "+third_party/blink/public/platform/web_touch_event.h",
"+third_party/blink/public/platform/linux/web_fallback_font.h",
"+third_party/blink/public/platform/mac/web_scrollbar_theme.h",
- "+third_party/blink/public/platform/modules/device_orientation/WebDeviceMotionData.h",
- "+third_party/blink/public/platform/modules/device_orientation/WebDeviceOrientationData.h",
"+third_party/blink/public/platform/modules/mediastream/media_devices.mojom.h",
"+third_party/blink/public/platform/modules/remoteplayback/web_remote_playback_availability.h",
- "+third_party/blink/public/platform/modules/payments/WebPaymentAppRequest.h",
- "+third_party/blink/public/platform/modules/service_worker/WebServiceWorkerClientType.h",
"+third_party/blink/public/platform/modules/service_worker/web_service_worker_error.h",
"+third_party/blink/public/web/web_ax_enums.h",
"+third_party/blink/public/web/web_device_emulation_params.h",
"+third_party/blink/public/web/web_drag_status.h",
"+third_party/blink/public/web/web_frame_owner_properties.h",
"+third_party/blink/public/web/web_ime_text_span.h",
- "+third_party/blink/public/common/media/media_player_action.h",
- "+third_party/blink/public/web/WebSharedWorkerCreationContextType.h",
- "+third_party/blink/public/web/WebSharedWorkerCreationErrors.h",
- "+third_party/blink/public/web/web_text_direction.h",
"+third_party/blink/public/web/web_tree_scope_type.h",
"+third_party/blink/public/web/win/web_font_rendering.h",
]
diff --git a/chromium/content/common/OWNERS b/chromium/content/common/OWNERS
index 0bb29ef096d..3e054127dcc 100644
--- a/chromium/content/common/OWNERS
+++ b/chromium/content/common/OWNERS
@@ -22,9 +22,6 @@ per-file *_messages*.h=file://ipc/SECURITY_OWNERS
per-file *_messages.cc=set noparent
per-file *_messages.cc=file://ipc/SECURITY_OWNERS
-per-file *.typemap=set noparent
-per-file *.typemap=file://ipc/SECURITY_OWNERS
-
per-file *_param_traits*.*=set noparent
per-file *_param_traits*.*=file://ipc/SECURITY_OWNERS
diff --git a/chromium/content/common/accessibility_messages.h b/chromium/content/common/accessibility_messages.h
deleted file mode 100644
index 68689e70e30..00000000000
--- a/chromium/content/common/accessibility_messages.h
+++ /dev/null
@@ -1,221 +0,0 @@
-// Copyright (c) 2012 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 CONTENT_COMMON_ACCESSIBILITY_MESSAGES_H_
-#define CONTENT_COMMON_ACCESSIBILITY_MESSAGES_H_
-
-// IPC messages for accessibility.
-
-#include "content/common/ax_content_node_data.h"
-#include "content/common/content_export.h"
-#include "content/common/content_param_traits.h"
-#include "ipc/ipc_message_macros.h"
-#include "ipc/ipc_message_utils.h"
-#include "ipc/ipc_param_traits.h"
-#include "ipc/param_traits_macros.h"
-#include "third_party/blink/public/web/web_ax_enums.h"
-#include "ui/accessibility/ax_action_data.h"
-#include "ui/accessibility/ax_event.h"
-#include "ui/accessibility/ax_node_data.h"
-#include "ui/accessibility/ax_relative_bounds.h"
-#include "ui/accessibility/ax_tree_update.h"
-#include "ui/gfx/transform.h"
-
-#undef IPC_MESSAGE_EXPORT
-#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
-
-#define IPC_MESSAGE_START AccessibilityMsgStart
-
-IPC_ENUM_TRAITS_MAX_VALUE(content::AXContentIntAttribute,
- content::AX_CONTENT_INT_ATTRIBUTE_LAST)
-IPC_ENUM_TRAITS_MAX_VALUE(ax::mojom::Action, ax::mojom::Action::kMaxValue)
-
-IPC_ENUM_TRAITS_MAX_VALUE(ax::mojom::ScrollAlignment,
- ax::mojom::ScrollAlignment::kMaxValue)
-
-IPC_ENUM_TRAITS_MAX_VALUE(ax::mojom::ScrollBehavior,
- ax::mojom::ScrollBehavior::kMaxValue)
-
-IPC_STRUCT_TRAITS_BEGIN(ui::AXActionData)
- IPC_STRUCT_TRAITS_MEMBER(action)
- IPC_STRUCT_TRAITS_MEMBER(target_tree_id)
- IPC_STRUCT_TRAITS_MEMBER(source_extension_id)
- IPC_STRUCT_TRAITS_MEMBER(target_node_id)
- IPC_STRUCT_TRAITS_MEMBER(request_id)
- IPC_STRUCT_TRAITS_MEMBER(flags)
- IPC_STRUCT_TRAITS_MEMBER(anchor_node_id)
- IPC_STRUCT_TRAITS_MEMBER(anchor_offset)
- IPC_STRUCT_TRAITS_MEMBER(focus_node_id)
- IPC_STRUCT_TRAITS_MEMBER(focus_offset)
- IPC_STRUCT_TRAITS_MEMBER(custom_action_id)
- IPC_STRUCT_TRAITS_MEMBER(target_rect)
- IPC_STRUCT_TRAITS_MEMBER(target_point)
- IPC_STRUCT_TRAITS_MEMBER(value)
- IPC_STRUCT_TRAITS_MEMBER(hit_test_event_to_fire)
- IPC_STRUCT_TRAITS_MEMBER(horizontal_scroll_alignment)
- IPC_STRUCT_TRAITS_MEMBER(vertical_scroll_alignment)
- IPC_STRUCT_TRAITS_MEMBER(scroll_behavior)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(content::AXContentNodeData)
- IPC_STRUCT_TRAITS_MEMBER(id)
- IPC_STRUCT_TRAITS_MEMBER(role)
- IPC_STRUCT_TRAITS_MEMBER(state)
- IPC_STRUCT_TRAITS_MEMBER(actions)
- IPC_STRUCT_TRAITS_MEMBER(string_attributes)
- IPC_STRUCT_TRAITS_MEMBER(int_attributes)
- IPC_STRUCT_TRAITS_MEMBER(float_attributes)
- IPC_STRUCT_TRAITS_MEMBER(bool_attributes)
- IPC_STRUCT_TRAITS_MEMBER(intlist_attributes)
- IPC_STRUCT_TRAITS_MEMBER(html_attributes)
- IPC_STRUCT_TRAITS_MEMBER(child_ids)
- IPC_STRUCT_TRAITS_MEMBER(content_int_attributes)
- IPC_STRUCT_TRAITS_MEMBER(relative_bounds)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(content::AXContentTreeData)
- IPC_STRUCT_TRAITS_MEMBER(tree_id)
- IPC_STRUCT_TRAITS_MEMBER(parent_tree_id)
- IPC_STRUCT_TRAITS_MEMBER(focused_tree_id)
- IPC_STRUCT_TRAITS_MEMBER(url)
- IPC_STRUCT_TRAITS_MEMBER(title)
- IPC_STRUCT_TRAITS_MEMBER(mimetype)
- IPC_STRUCT_TRAITS_MEMBER(doctype)
- IPC_STRUCT_TRAITS_MEMBER(loaded)
- IPC_STRUCT_TRAITS_MEMBER(loading_progress)
- IPC_STRUCT_TRAITS_MEMBER(focus_id)
- IPC_STRUCT_TRAITS_MEMBER(sel_is_backward)
- IPC_STRUCT_TRAITS_MEMBER(sel_anchor_object_id)
- IPC_STRUCT_TRAITS_MEMBER(sel_anchor_offset)
- IPC_STRUCT_TRAITS_MEMBER(sel_anchor_affinity)
- IPC_STRUCT_TRAITS_MEMBER(sel_focus_object_id)
- IPC_STRUCT_TRAITS_MEMBER(sel_focus_offset)
- IPC_STRUCT_TRAITS_MEMBER(sel_focus_affinity)
- IPC_STRUCT_TRAITS_MEMBER(routing_id)
- IPC_STRUCT_TRAITS_MEMBER(parent_routing_id)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(content::AXContentTreeUpdate)
- IPC_STRUCT_TRAITS_MEMBER(has_tree_data)
- IPC_STRUCT_TRAITS_MEMBER(tree_data)
- IPC_STRUCT_TRAITS_MEMBER(node_id_to_clear)
- IPC_STRUCT_TRAITS_MEMBER(root_id)
- IPC_STRUCT_TRAITS_MEMBER(nodes)
- IPC_STRUCT_TRAITS_MEMBER(event_from)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_BEGIN(AccessibilityHostMsg_EventBundleParams)
- // Zero or more updates to the accessibility tree to apply first.
- IPC_STRUCT_MEMBER(std::vector<content::AXContentTreeUpdate>, updates)
-
- // Zero or more events to fire after the tree updates have been applied.
- IPC_STRUCT_MEMBER(std::vector<ui::AXEvent>, events)
-IPC_STRUCT_END()
-
-IPC_STRUCT_BEGIN(AccessibilityHostMsg_LocationChangeParams)
- // ID of the object whose location is changing.
- IPC_STRUCT_MEMBER(int, id)
-
- // The object's new location info.
- IPC_STRUCT_MEMBER(ui::AXRelativeBounds, new_location)
-IPC_STRUCT_END()
-
-IPC_STRUCT_BEGIN(AccessibilityHostMsg_FindInPageResultParams)
- // The find in page request id.
- IPC_STRUCT_MEMBER(int, request_id)
-
- // The index of the result match.
- IPC_STRUCT_MEMBER(int, match_index)
-
- // The id of the accessibility object for the start of the match range.
- IPC_STRUCT_MEMBER(int, start_id)
-
- // The character offset into the text of the start object.
- IPC_STRUCT_MEMBER(int, start_offset)
-
- // The id of the accessibility object for the end of the match range.
- IPC_STRUCT_MEMBER(int, end_id)
-
- // The character offset into the text of the end object.
- IPC_STRUCT_MEMBER(int, end_offset)
-IPC_STRUCT_END()
-
-// Messages sent from the browser to the renderer.
-
-// Relay a request from assistive technology to perform an action,
-// such as focusing or clicking on a node.
-IPC_MESSAGE_ROUTED1(AccessibilityMsg_PerformAction,
- ui::AXActionData /* action parameters */)
-
-// Tells the render view that a AccessibilityHostMsg_EventBundle
-// message was processed and it can send additional updates. The argument
-// must be the same as the ack_token passed to
-// AccessibilityHostMsg_EventBundle.
-IPC_MESSAGE_ROUTED1(AccessibilityMsg_EventBundle_ACK, int /* ack_token */)
-
-// Tell the renderer to reset and send a new accessibility tree from
-// scratch because the browser is out of sync. It passes a sequential
-// reset token. This should be rare, and if we need reset the same renderer
-// too many times we just kill it. After sending a reset, the browser ignores
-// incoming accessibility IPCs until it receives one with the matching reset
-// token. Conversely, it ignores IPCs with a reset token if it was not
-// expecting a reset.
-IPC_MESSAGE_ROUTED1(AccessibilityMsg_Reset,
- int /* reset token */)
-
-// Kill the renderer because we got a fatal error in the accessibility tree
-// and we've already reset too many times.
-IPC_MESSAGE_ROUTED0(AccessibilityMsg_FatalError)
-
-// Request a one-time snapshot of the accessibility tree without
-// enabling accessibility if it wasn't already enabled. The passed id
-// will be returned in the AccessibilityHostMsg_SnapshotResponse message.
-IPC_MESSAGE_ROUTED2(AccessibilityMsg_SnapshotTree,
- int /* callback id */,
- ui::AXMode /* ax_mode */)
-
-// Messages sent from the renderer to the browser.
-
-// Sent to notify the browser about renderer accessibility events.
-// The browser responds with a AccessibilityMsg_EventBundle_ACK with the same
-// ack_token.
-// The |reset_token| parameter is set if this IPC was sent in response
-// to a reset request from the browser. When the browser requests a reset,
-// it ignores incoming IPCs until it sees one with the correct reset token.
-// Any other time, it ignores IPCs with a reset token.
-IPC_MESSAGE_ROUTED3(AccessibilityHostMsg_EventBundle,
- AccessibilityHostMsg_EventBundleParams /* params */,
- int /* reset_token */,
- int /* ack_token */)
-
-// Sent to update the browser of the location of accessibility objects.
-IPC_MESSAGE_ROUTED1(
- AccessibilityHostMsg_LocationChanges,
- std::vector<AccessibilityHostMsg_LocationChangeParams>)
-
-// Sent to update the browser of Find In Page results.
-IPC_MESSAGE_ROUTED1(
- AccessibilityHostMsg_FindInPageResult,
- AccessibilityHostMsg_FindInPageResultParams)
-
-// Sent when a Find In Page operation is finished and all highlighted results
-// are cleared.
-IPC_MESSAGE_ROUTED0(AccessibilityHostMsg_FindInPageTermination)
-
-// Sent in response to PerformAction with parameter kHitTest.
-IPC_MESSAGE_ROUTED5(AccessibilityHostMsg_ChildFrameHitTestResult,
- int /* action request id of initial caller */,
- gfx::Point /* location tested */,
- int /* routing id of child frame */,
- int /* browser plugin instance id of child frame */,
- ax::mojom::Event /* event to fire */)
-
-// Sent in response to AccessibilityMsg_SnapshotTree. The callback id that was
-// passed to the request will be returned in |callback_id|, along with
-// a standalone snapshot of the accessibility tree.
-IPC_MESSAGE_ROUTED2(AccessibilityHostMsg_SnapshotResponse,
- int /* callback_id */,
- content::AXContentTreeUpdate)
-
-#endif // CONTENT_COMMON_ACCESSIBILITY_MESSAGES_H_
diff --git a/chromium/content/common/android/java_templates/ContentSwitches.java.tmpl b/chromium/content/common/android/java_templates/ContentSwitches.java.tmpl
index 334fad3df90..1da06a1a816 100644
--- a/chromium/content/common/android/java_templates/ContentSwitches.java.tmpl
+++ b/chromium/content/common/android/java_templates/ContentSwitches.java.tmpl
@@ -64,6 +64,9 @@ public final class ContentSwitches {{
// Native switch value kNetworkSandbox
public static final String NETWORK_SANDBOX_TYPE = "network";
+ // Native switch kNoneSandbox, only honored on non-public Chromecast builds.
+ public static final String NONE_SANDBOX_TYPE = "none";
+
{NATIVE_STRINGS}
// Prevent instantiation.
diff --git a/chromium/content/common/ax_content_node_data.cc b/chromium/content/common/ax_content_node_data.cc
index 01166e0535b..69d550e8d23 100644
--- a/chromium/content/common/ax_content_node_data.cc
+++ b/chromium/content/common/ax_content_node_data.cc
@@ -7,107 +7,30 @@
#include <algorithm>
#include "base/strings/string_number_conversions.h"
+#include "content/common/ax_content_node_data.mojom.h"
using base::NumberToString;
namespace content {
-namespace {
-
-// Helper function that finds a key in a vector of pairs by matching on the
-// first value, and returns an iterator.
-template<typename FirstType, typename SecondType>
-typename std::vector<std::pair<FirstType, SecondType>>::const_iterator
- FindInVectorOfPairs(
- FirstType first,
- const std::vector<std::pair<FirstType, SecondType>>& vector) {
- return std::find_if(vector.begin(),
- vector.end(),
- [first](std::pair<FirstType, SecondType> const& p) {
- return p.first == first;
- });
-}
-
-} // namespace
-
-AXContentNodeData::AXContentNodeData() {
-}
-
-AXContentNodeData::AXContentNodeData(const AXContentNodeData& other) = default;
-
-AXContentNodeData::AXContentNodeData(const AXNodeData& other)
- : AXNodeData(other) {
-}
-
-AXContentNodeData::~AXContentNodeData() {
-}
-
-bool AXContentNodeData::HasContentIntAttribute(
- AXContentIntAttribute attribute) const {
- auto iter = FindInVectorOfPairs(attribute, content_int_attributes);
- return iter != content_int_attributes.end();
-}
-
-int AXContentNodeData::GetContentIntAttribute(
- AXContentIntAttribute attribute) const {
- int result;
- if (GetContentIntAttribute(attribute, &result))
- return result;
- return 0;
-}
-
-bool AXContentNodeData::GetContentIntAttribute(
- AXContentIntAttribute attribute, int* value) const {
- auto iter = FindInVectorOfPairs(attribute, content_int_attributes);
- if (iter != content_int_attributes.end()) {
- *value = iter->second;
- return true;
- }
-
- return false;
-}
-
-void AXContentNodeData::AddContentIntAttribute(AXContentIntAttribute attribute,
- int32_t value) {
- content_int_attributes.push_back(std::make_pair(attribute, value));
+AXContentNodeData& AXContentNodeData::operator=(const AXNodeData& other) {
+ *static_cast<AXNodeData*>(this) = other;
+ return *this;
}
std::string AXContentNodeData::ToString() const {
std::string result = AXNodeData::ToString();
-
- for (auto iter : content_int_attributes) {
- std::string value = NumberToString(iter.second);
- switch (iter.first) {
- case AX_CONTENT_ATTR_CHILD_ROUTING_ID:
- result += " child_routing_id=" + value;
- break;
- case AX_CONTENT_ATTR_CHILD_BROWSER_PLUGIN_INSTANCE_ID:
- result += " child_browser_plugin_instance_id=" + value;
- break;
- case AX_CONTENT_INT_ATTRIBUTE_LAST:
- NOTREACHED();
- break;
- }
- }
-
+ if (child_routing_id != MSG_ROUTING_NONE)
+ result += " child_routing_id=" + NumberToString(child_routing_id);
return result;
}
-AXContentTreeData::AXContentTreeData()
- : AXTreeData(),
- routing_id(-1),
- parent_routing_id(-1) {
-}
-
-AXContentTreeData::~AXContentTreeData() {
-}
-
std::string AXContentTreeData::ToString() const {
std::string result = AXTreeData::ToString();
- if (routing_id != -1)
+ if (routing_id != MSG_ROUTING_NONE)
result += " routing_id=" + NumberToString(routing_id);
- if (parent_routing_id != -1)
+ if (parent_routing_id != MSG_ROUTING_NONE)
result += " parent_routing_id=" + NumberToString(parent_routing_id);
return result;
diff --git a/chromium/content/common/ax_content_node_data.h b/chromium/content/common/ax_content_node_data.h
index ae68d4f2a73..ab7d4225665 100644
--- a/chromium/content/common/ax_content_node_data.h
+++ b/chromium/content/common/ax_content_node_data.h
@@ -8,58 +8,42 @@
#include <stdint.h>
#include "content/common/content_export.h"
+#include "ipc/ipc_message.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/accessibility/ax_tree_data.h"
#include "ui/accessibility/ax_tree_update.h"
namespace content {
-enum AXContentIntAttribute {
- // The routing ID of this node's child tree.
- AX_CONTENT_ATTR_CHILD_ROUTING_ID,
-
- // The browser plugin instance ID of this node's child tree.
- AX_CONTENT_ATTR_CHILD_BROWSER_PLUGIN_INSTANCE_ID,
-
- AX_CONTENT_INT_ATTRIBUTE_LAST
-};
-
// A subclass of AXNodeData that contains extra fields for
// content-layer-specific AX attributes.
struct CONTENT_EXPORT AXContentNodeData : public ui::AXNodeData {
- AXContentNodeData();
- AXContentNodeData(const AXNodeData& other);
- AXContentNodeData(const AXContentNodeData& other);
- ~AXContentNodeData() override;
-
- bool HasContentIntAttribute(AXContentIntAttribute attribute) const;
- int GetContentIntAttribute(AXContentIntAttribute attribute) const;
- bool GetContentIntAttribute(AXContentIntAttribute attribute,
- int* value) const;
- void AddContentIntAttribute(AXContentIntAttribute attribute, int value);
+ AXContentNodeData() = default;
+ AXContentNodeData(const AXContentNodeData& other) = default;
+ ~AXContentNodeData() override = default;
+ AXContentNodeData& operator=(const AXNodeData& other);
// Return a string representation of this data, for debugging.
std::string ToString() const override;
- // This is a simple serializable struct. All member variables should be
- // public and copyable.
- std::vector<std::pair<AXContentIntAttribute, int32_t>> content_int_attributes;
+ // The routing ID of this node's child tree.
+ int32_t child_routing_id = MSG_ROUTING_NONE;
};
// A subclass of AXTreeData that contains extra fields for
// content-layer-specific AX attributes.
struct CONTENT_EXPORT AXContentTreeData : public ui::AXTreeData {
- AXContentTreeData();
- ~AXContentTreeData() override;
+ AXContentTreeData() = default;
+ ~AXContentTreeData() override = default;
// Return a string representation of this data, for debugging.
std::string ToString() const override;
// The routing ID of this frame.
- int routing_id;
+ int routing_id = MSG_ROUTING_NONE;
// The routing ID of the parent frame.
- int parent_routing_id;
+ int parent_routing_id = MSG_ROUTING_NONE;
};
typedef ui::AXTreeUpdateBase<content::AXContentNodeData,
diff --git a/chromium/content/common/ax_content_node_data.mojom b/chromium/content/common/ax_content_node_data.mojom
new file mode 100644
index 00000000000..ffc5d33437b
--- /dev/null
+++ b/chromium/content/common/ax_content_node_data.mojom
@@ -0,0 +1,13 @@
+// Copyright 2020 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 ax.mojom;
+
+import "ui/accessibility/mojom/ax_node_data.mojom";
+
+// See content::AXContentNodeData for comments / explanations of these fields.
+struct AXContentNodeData {
+ ax.mojom.AXNodeData node_data;
+ int32 child_routing_id;
+};
diff --git a/chromium/content/common/ax_content_node_data_mojom_traits.cc b/chromium/content/common/ax_content_node_data_mojom_traits.cc
new file mode 100644
index 00000000000..197060a6850
--- /dev/null
+++ b/chromium/content/common/ax_content_node_data_mojom_traits.cc
@@ -0,0 +1,24 @@
+// Copyright 2020 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.
+
+#include "content/common/ax_content_node_data_mojom_traits.h"
+#include "ui/accessibility/ax_node_data.h"
+#include "ui/accessibility/mojom/ax_node_data_mojom_traits.h"
+
+namespace mojo {
+
+// static
+bool StructTraits<
+ ax::mojom::AXContentNodeDataDataView,
+ content::AXContentNodeData>::Read(ax::mojom::AXContentNodeDataDataView data,
+ content::AXContentNodeData* out) {
+ if (!data.ReadNodeData(static_cast<ui::AXNodeData*>(out)))
+ return false;
+
+ out->child_routing_id = data.child_routing_id();
+
+ return true;
+}
+
+} // namespace mojo
diff --git a/chromium/content/common/ax_content_node_data_mojom_traits.h b/chromium/content/common/ax_content_node_data_mojom_traits.h
new file mode 100644
index 00000000000..6b5800f93f6
--- /dev/null
+++ b/chromium/content/common/ax_content_node_data_mojom_traits.h
@@ -0,0 +1,30 @@
+// Copyright 2020 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 CONTENT_COMMON_AX_CONTENT_NODE_DATA_MOJOM_TRAITS_H_
+#define CONTENT_COMMON_AX_CONTENT_NODE_DATA_MOJOM_TRAITS_H_
+
+#include "content/common/ax_content_node_data.h"
+#include "content/common/ax_content_node_data.mojom-shared.h"
+#include "ui/accessibility/ax_node_data.h"
+
+namespace mojo {
+
+template <>
+struct StructTraits<ax::mojom::AXContentNodeDataDataView,
+ content::AXContentNodeData> {
+ static const ui::AXNodeData& node_data(const content::AXContentNodeData& p) {
+ return p;
+ }
+ static int32_t child_routing_id(const content::AXContentNodeData& p) {
+ return p.child_routing_id;
+ }
+
+ static bool Read(ax::mojom::AXContentNodeDataDataView data,
+ content::AXContentNodeData* out);
+};
+
+} // namespace mojo
+
+#endif // CONTENT_COMMON_AX_CONTENT_NODE_DATA_MOJOM_TRAITS_H_
diff --git a/chromium/content/common/ax_content_tree_data.mojom b/chromium/content/common/ax_content_tree_data.mojom
new file mode 100644
index 00000000000..154ea56d5b9
--- /dev/null
+++ b/chromium/content/common/ax_content_tree_data.mojom
@@ -0,0 +1,14 @@
+// Copyright 2020 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 ax.mojom;
+
+import "ui/accessibility/mojom/ax_tree_data.mojom";
+
+// See content::AXContentTreeData for comments / explanations of these fields.
+struct AXContentTreeData {
+ ax.mojom.AXTreeData tree_data;
+ int32 routing_id;
+ int32 parent_routing_id;
+};
diff --git a/chromium/content/common/ax_content_tree_data_mojom_traits.cc b/chromium/content/common/ax_content_tree_data_mojom_traits.cc
new file mode 100644
index 00000000000..af214e24667
--- /dev/null
+++ b/chromium/content/common/ax_content_tree_data_mojom_traits.cc
@@ -0,0 +1,25 @@
+// Copyright 2020 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.
+
+#include "content/common/ax_content_tree_data_mojom_traits.h"
+#include "ui/accessibility/ax_tree_data.h"
+#include "ui/accessibility/mojom/ax_tree_data_mojom_traits.h"
+
+namespace mojo {
+
+// static
+bool StructTraits<
+ ax::mojom::AXContentTreeDataDataView,
+ content::AXContentTreeData>::Read(ax::mojom::AXContentTreeDataDataView data,
+ content::AXContentTreeData* out) {
+ if (!data.ReadTreeData(static_cast<ui::AXTreeData*>(out)))
+ return false;
+
+ out->routing_id = data.routing_id();
+ out->parent_routing_id = data.parent_routing_id();
+
+ return true;
+}
+
+} // namespace mojo
diff --git a/chromium/content/common/ax_content_tree_data_mojom_traits.h b/chromium/content/common/ax_content_tree_data_mojom_traits.h
new file mode 100644
index 00000000000..ef3657ee92b
--- /dev/null
+++ b/chromium/content/common/ax_content_tree_data_mojom_traits.h
@@ -0,0 +1,33 @@
+// Copyright 2020 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 CONTENT_COMMON_AX_CONTENT_TREE_DATA_MOJOM_TRAITS_H_
+#define CONTENT_COMMON_AX_CONTENT_TREE_DATA_MOJOM_TRAITS_H_
+
+#include "content/common/ax_content_node_data.h"
+#include "content/common/ax_content_tree_data.mojom-shared.h"
+#include "ui/accessibility/ax_tree_data.h"
+
+namespace mojo {
+
+template <>
+struct StructTraits<ax::mojom::AXContentTreeDataDataView,
+ content::AXContentTreeData> {
+ static const ui::AXTreeData& tree_data(const content::AXContentTreeData& p) {
+ return p;
+ }
+ static int32_t routing_id(const content::AXContentTreeData& p) {
+ return p.routing_id;
+ }
+ static int32_t parent_routing_id(const content::AXContentTreeData& p) {
+ return p.parent_routing_id;
+ }
+
+ static bool Read(ax::mojom::AXContentTreeDataDataView data,
+ content::AXContentTreeData* out);
+};
+
+} // namespace mojo
+
+#endif // CONTENT_COMMON_AX_CONTENT_TREE_DATA_MOJOM_TRAITS_H_
diff --git a/chromium/content/common/ax_content_tree_update.mojom b/chromium/content/common/ax_content_tree_update.mojom
new file mode 100644
index 00000000000..73730652ecc
--- /dev/null
+++ b/chromium/content/common/ax_content_tree_update.mojom
@@ -0,0 +1,19 @@
+// Copyright 2020 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 ax.mojom;
+
+import "ui/accessibility/ax_enums.mojom";
+import "content/common/ax_content_node_data.mojom";
+import "content/common/ax_content_tree_data.mojom";
+
+// See content::AXContentTreeUpdate for comments / explanations of these fields.
+struct AXContentTreeUpdate {
+ bool has_tree_data;
+ AXContentTreeData tree_data;
+ int32 node_id_to_clear;
+ int32 root_id;
+ array<AXContentNodeData> nodes;
+ ax.mojom.EventFrom event_from;
+};
diff --git a/chromium/content/common/ax_content_tree_update_mojom_traits.cc b/chromium/content/common/ax_content_tree_update_mojom_traits.cc
new file mode 100644
index 00000000000..9793bb2d206
--- /dev/null
+++ b/chromium/content/common/ax_content_tree_update_mojom_traits.cc
@@ -0,0 +1,28 @@
+// Copyright 2020 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.
+
+#include "content/common/ax_content_tree_update_mojom_traits.h"
+
+namespace mojo {
+
+// static
+bool StructTraits<ax::mojom::AXContentTreeUpdateDataView,
+ content::AXContentTreeUpdate>::
+ Read(ax::mojom::AXContentTreeUpdateDataView data,
+ content::AXContentTreeUpdate* out) {
+ if (!data.ReadTreeData(&out->tree_data))
+ return false;
+
+ if (!data.ReadNodes(&out->nodes))
+ return false;
+
+ out->has_tree_data = data.has_tree_data();
+ out->node_id_to_clear = data.node_id_to_clear();
+ out->root_id = data.root_id();
+ out->event_from = data.event_from();
+
+ return true;
+}
+
+} // namespace mojo
diff --git a/chromium/content/common/ax_content_tree_update_mojom_traits.h b/chromium/content/common/ax_content_tree_update_mojom_traits.h
new file mode 100644
index 00000000000..015de489b7d
--- /dev/null
+++ b/chromium/content/common/ax_content_tree_update_mojom_traits.h
@@ -0,0 +1,47 @@
+// Copyright 2020 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 CONTENT_COMMON_AX_CONTENT_TREE_UPDATE_MOJOM_TRAITS_H_
+#define CONTENT_COMMON_AX_CONTENT_TREE_UPDATE_MOJOM_TRAITS_H_
+
+#include "content/common/ax_content_node_data.h"
+#include "content/common/ax_content_node_data_mojom_traits.h"
+#include "content/common/ax_content_tree_data_mojom_traits.h"
+#include "content/common/ax_content_tree_update.mojom-shared.h"
+
+namespace mojo {
+
+template <>
+struct StructTraits<ax::mojom::AXContentTreeUpdateDataView,
+ content::AXContentTreeUpdate> {
+ static bool has_tree_data(const content::AXContentTreeUpdate& p) {
+ return p.has_tree_data;
+ }
+ static const content::AXContentTreeData& tree_data(
+ const content::AXContentTreeUpdate& p) {
+ return p.tree_data;
+ }
+ static int32_t node_id_to_clear(const content::AXContentTreeUpdate& p) {
+ return p.node_id_to_clear;
+ }
+ static int32_t root_id(const content::AXContentTreeUpdate& p) {
+ return p.root_id;
+ }
+ static const std::vector<content::AXContentNodeData>& nodes(
+ const content::AXContentTreeUpdate& p) {
+ return p.nodes;
+ }
+
+ static ax::mojom::EventFrom event_from(
+ const content::AXContentTreeUpdate& p) {
+ return p.event_from;
+ }
+
+ static bool Read(ax::mojom::AXContentTreeUpdateDataView data,
+ content::AXContentTreeUpdate* out);
+};
+
+} // namespace mojo
+
+#endif // CONTENT_COMMON_AX_CONTENT_TREE_UPDATE_MOJOM_TRAITS_H_
diff --git a/chromium/content/common/background_fetch/background_fetch_types.cc b/chromium/content/common/background_fetch/background_fetch_types.cc
index 3521948217c..9222c878d32 100644
--- a/chromium/content/common/background_fetch/background_fetch_types.cc
+++ b/chromium/content/common/background_fetch/background_fetch_types.cc
@@ -37,7 +37,8 @@ blink::mojom::FetchAPIResponsePtr BackgroundFetchSettledFetch::CloneResponse(
response->cors_exposed_header_names,
CloneSerializedBlob(response->side_data_blob),
CloneSerializedBlob(response->side_data_blob_for_cache_put),
- response->content_security_policy.Clone());
+ mojo::Clone(response->content_security_policy),
+ response->loaded_with_credentials);
}
// static
@@ -47,12 +48,13 @@ blink::mojom::FetchAPIRequestPtr BackgroundFetchSettledFetch::CloneRequest(
return nullptr;
return blink::mojom::FetchAPIRequest::New(
request->mode, request->is_main_resource_load,
- request->request_context_type, request->frame_type, request->url,
- request->method, request->headers, CloneSerializedBlob(request->blob),
- request->body, request->referrer.Clone(), request->credentials_mode,
- request->cache_mode, request->redirect_mode, request->integrity,
- request->priority, request->fetch_window_id, request->keepalive,
- request->is_reload, request->is_history_navigation);
+ request->request_context_type, request->destination, request->frame_type,
+ request->url, request->method, request->headers,
+ CloneSerializedBlob(request->blob), request->body,
+ request->referrer.Clone(), request->credentials_mode, request->cache_mode,
+ request->redirect_mode, request->integrity, request->priority,
+ request->fetch_window_id, request->keepalive, request->is_reload,
+ request->is_history_navigation);
}
} // namespace content
diff --git a/chromium/content/common/browser_plugin/browser_plugin_messages.h b/chromium/content/common/browser_plugin/browser_plugin_messages.h
deleted file mode 100644
index cf504e4bf68..00000000000
--- a/chromium/content/common/browser_plugin/browser_plugin_messages.h
+++ /dev/null
@@ -1,215 +0,0 @@
-// Copyright (c) 2012 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 CONTENT_COMMON_BROWSER_PLUGIN_BROWSER_PLUGIN_MESSAGES_H_
-#define CONTENT_COMMON_BROWSER_PLUGIN_BROWSER_PLUGIN_MESSAGES_H_
-
-#include <string>
-
-#include "base/process/process.h"
-#include "base/unguessable_token.h"
-#include "cc/trees/render_frame_metadata.h"
-#include "components/viz/common/surfaces/surface_info.h"
-#include "content/common/content_export.h"
-#include "content/common/content_param_traits.h"
-#include "content/common/cursors/webcursor.h"
-#include "content/common/edit_command.h"
-#include "content/common/frame_visual_properties.h"
-#include "content/public/common/drop_data.h"
-#include "content/public/common/screen_info.h"
-#include "ipc/ipc_channel_handle.h"
-#include "ipc/ipc_message_macros.h"
-#include "ipc/ipc_message_utils.h"
-#include "third_party/blink/public/platform/web_drag_operation.h"
-#include "third_party/blink/public/platform/web_focus_type.h"
-#include "third_party/blink/public/web/web_drag_status.h"
-#include "third_party/blink/public/web/web_ime_text_span.h"
-#include "ui/gfx/geometry/point.h"
-#include "ui/gfx/geometry/rect.h"
-#include "ui/gfx/geometry/size.h"
-#include "ui/gfx/ipc/gfx_param_traits.h"
-#include "ui/gfx/ipc/skia/gfx_skia_param_traits.h"
-#include "ui/gfx/range/range.h"
-
-#undef IPC_MESSAGE_EXPORT
-#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
-
-#define IPC_MESSAGE_START BrowserPluginMsgStart
-
-IPC_ENUM_TRAITS_MAX_VALUE(blink::WebDragStatus, blink::kWebDragStatusLast)
-
-IPC_STRUCT_BEGIN(BrowserPluginHostMsg_Attach_Params)
- IPC_STRUCT_MEMBER(bool, focused)
- IPC_STRUCT_MEMBER(bool, visible)
- // The new size of the guest view.
- IPC_STRUCT_MEMBER(gfx::Rect, frame_rect)
- // Whether the browser plugin is a full page plugin document.
- IPC_STRUCT_MEMBER(bool, is_full_page_plugin)
-IPC_STRUCT_END()
-
-IPC_STRUCT_BEGIN(BrowserPluginHostMsg_SetComposition_Params)
- IPC_STRUCT_MEMBER(base::string16, text)
- IPC_STRUCT_MEMBER(std::vector<blink::WebImeTextSpan>, ime_text_spans)
- IPC_STRUCT_MEMBER(gfx::Range, replacement_range)
- IPC_STRUCT_MEMBER(int, selection_start)
- IPC_STRUCT_MEMBER(int, selection_end)
-IPC_STRUCT_END()
-
-// Browser plugin messages
-
-// -----------------------------------------------------------------------------
-// These messages are from the embedder to the browser process.
-// Most messages from the embedder to the browser process are CONTROL because
-// they are routed to the appropriate BrowserPluginGuest based on the
-// |browser_plugin_instance_id| which is unique per embedder process.
-// |browser_plugin_instance_id| is only used by BrowserPluginMessageFilter to
-// find the right BrowserPluginGuest. It should not be needed by the final IPC
-// handler.
-
-// This message is sent from BrowserPlugin to BrowserPluginGuest to issue an
-// edit command.
-IPC_MESSAGE_CONTROL2(BrowserPluginHostMsg_ExecuteEditCommand,
- int /* browser_plugin_instance_id */,
- std::string /* command */)
-
-// This message must be sent just before sending a key event.
-IPC_MESSAGE_CONTROL2(BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent,
- int /* browser_plugin_instance_id */,
- std::vector<content::EditCommand> /* edit_commands */)
-
-// This message is sent from BrowserPlugin to BrowserPluginGuest whenever IME
-// composition state is updated.
-IPC_MESSAGE_CONTROL2(BrowserPluginHostMsg_ImeSetComposition,
- int /* browser_plugin_instance_id */,
- BrowserPluginHostMsg_SetComposition_Params /* params */)
-
-// This message is sent from BrowserPlugin to BrowserPluginGuest to notify that
-// deleting the current composition and inserting specified text is requested.
-IPC_MESSAGE_CONTROL5(BrowserPluginHostMsg_ImeCommitText,
- int /* browser_plugin_instance_id */,
- base::string16 /* text */,
- std::vector<blink::WebImeTextSpan> /* ime_text_spans */,
- gfx::Range /* replacement_range */,
- int /* relative_cursor_pos */)
-
-// This message is sent from BrowserPlugin to BrowserPluginGuest to notify that
-// inserting the current composition is requested.
-IPC_MESSAGE_CONTROL2(BrowserPluginHostMsg_ImeFinishComposingText,
- int /* browser_plugin_instance_id */,
- bool /* keep selection */)
-
-// Deletes the current selection plus the specified number of characters before
-// and after the selection or caret.
-IPC_MESSAGE_CONTROL3(BrowserPluginHostMsg_ExtendSelectionAndDelete,
- int /* browser_plugin_instance_id */,
- int /* before */,
- int /* after */)
-
-// This message is sent to the browser process to indicate that the
-// BrowserPlugin identified by |browser_plugin_instance_id| is ready to serve
-// as container for a guest. |params| is the state of the BrowserPlugin.
-// This message is routed because we create a BrowserPluginEmbedder object
-// the first time we see this message arrive to a WebContents. We need a routing
-// ID to get this message to a particular WebContents.
-IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_Attach,
- int /* browser_plugin_instance_id */,
- BrowserPluginHostMsg_Attach_Params /* params */)
-
-// This message is sent to the browser process to indicate that the
-// BrowserPlugin identified by |browser_plugin_instance_id| will no longer serve
-// as a container for a guest.
-IPC_MESSAGE_CONTROL1(BrowserPluginHostMsg_Detach,
- int /* browser_plugin_instance_id */)
-
-// Tells the guest to focus or defocus itself.
-IPC_MESSAGE_CONTROL3(BrowserPluginHostMsg_SetFocus,
- int /* browser_plugin_instance_id */,
- bool /* enable */,
- blink::WebFocusType /* focus_type */)
-
-// Tells the guest it has been shown or hidden.
-IPC_MESSAGE_CONTROL2(BrowserPluginHostMsg_SetVisibility,
- int /* browser_plugin_instance_id */,
- bool /* visible */)
-
-// Tells the guest that a drag event happened on the plugin.
-IPC_MESSAGE_CONTROL5(BrowserPluginHostMsg_DragStatusUpdate,
- int /* browser_plugin_instance_id */,
- blink::WebDragStatus /* drag_status */,
- content::DropData /* drop_data */,
- blink::WebDragOperationsMask /* operation_mask */,
- gfx::PointF /* plugin_location */)
-
-// Sends a PointerLock Lock ACK to the BrowserPluginGuest.
-IPC_MESSAGE_CONTROL2(BrowserPluginHostMsg_LockMouse_ACK,
- int /* browser_plugin_instance_id */,
- bool /* succeeded */)
-
-// Sends a PointerLock Unlock ACK to the BrowserPluginGuest.
-IPC_MESSAGE_CONTROL1(BrowserPluginHostMsg_UnlockMouse_ACK,
- int /* browser_plugin_instance_id */)
-
-// Sent when plugin's position has changed.
-IPC_MESSAGE_CONTROL2(BrowserPluginHostMsg_SynchronizeVisualProperties,
- int /* browser_plugin_instance_id */,
- content::FrameVisualProperties /* resize_params */)
-
-// -----------------------------------------------------------------------------
-// These messages are from the browser process to the embedder.
-
-// Indicates that an attach request has completed. The provided
-// |child_local_surface_id| is used as the seed for the
-// ParentLocalSurfaceIdAllocator.
-IPC_MESSAGE_CONTROL1(BrowserPluginMsg_Attach_ACK,
- int /* browser_plugin_instance_id */)
-
-// When the guest crashes, the browser process informs the embedder through this
-// message.
-IPC_MESSAGE_CONTROL1(BrowserPluginMsg_GuestGone,
- int /* browser_plugin_instance_id */)
-
-IPC_MESSAGE_CONTROL2(BrowserPluginMsg_GuestReady,
- int /* browser_plugin_instance_id */,
- viz::FrameSinkId /* frame_sink_id */)
-
-// When the user tabs to the end of the tab stops of a guest, the browser
-// process informs the embedder to tab out of the browser plugin.
-IPC_MESSAGE_CONTROL2(BrowserPluginMsg_AdvanceFocus,
- int /* browser_plugin_instance_id */,
- bool /* reverse */)
-
-// Informs the BrowserPlugin that the guest's visual properties have changed.
-IPC_MESSAGE_CONTROL2(BrowserPluginMsg_DidUpdateVisualProperties,
- int /* browser_plugin_instance_id */,
- cc::RenderFrameMetadata /* metadata */)
-
-// Requests a viz::LocalSurfaceId to enable auto-resize mode from the parent
-// renderer.
-IPC_MESSAGE_CONTROL3(BrowserPluginMsg_EnableAutoResize,
- int /* browser_plugin_instance_id */,
- gfx::Size /* min_size */,
- gfx::Size /* max_size */)
-
-// Requests a viz::LocalSurfaceId to disable auto-resize-mode from the parent
-// renderer.
-IPC_MESSAGE_CONTROL1(BrowserPluginMsg_DisableAutoResize,
- int /* browser_plugin_instance_id */)
-
-// When the guest starts/stops listening to touch events, it needs to notify the
-// plugin in the embedder about it.
-IPC_MESSAGE_CONTROL2(BrowserPluginMsg_ShouldAcceptTouchEvents,
- int /* browser_plugin_instance_id */,
- bool /* accept */)
-
-// Inform the embedder of the cursor the guest wishes to display.
-IPC_MESSAGE_CONTROL2(BrowserPluginMsg_SetCursor,
- int /* browser_plugin_instance_id */,
- content::WebCursor /* cursor */)
-
-// Forwards a PointerLock Unlock request to the BrowserPlugin.
-IPC_MESSAGE_CONTROL2(BrowserPluginMsg_SetMouseLock,
- int /* browser_plugin_instance_id */,
- bool /* enable */)
-
-#endif // CONTENT_COMMON_BROWSER_PLUGIN_BROWSER_PLUGIN_MESSAGES_H_
diff --git a/chromium/content/common/child_process.mojom b/chromium/content/common/child_process.mojom
index 34ab578110c..d85e2810e9d 100644
--- a/chromium/content/common/child_process.mojom
+++ b/chromium/content/common/child_process.mojom
@@ -4,11 +4,11 @@
module content.mojom;
-import "components/tracing/common/background_tracing_agent.mojom";
import "ipc/ipc.mojom";
import "mojo/public/mojom/base/file.mojom";
import "mojo/public/mojom/base/generic_pending_receiver.mojom";
import "services/service_manager/public/mojom/service.mojom";
+import "services/tracing/public/mojom/background_tracing_agent.mojom";
// The primordial interface child processes use to push requests to their
// browser-side host object.
@@ -48,7 +48,7 @@ interface ChildProcess {
// Requests the child process send its Mach task port to the caller.
[EnableIf=is_mac]
- GetTaskPort() => (handle task_port);
+ GetTaskPort() => (handle<platform> task_port);
// Tells the child process to begin or end IPC message logging.
[EnableIf=ipc_logging]
@@ -91,7 +91,8 @@ interface ChildProcess {
// depends on the process type and potentially on the Content embedder.
BindReceiver(mojo_base.mojom.GenericPendingReceiver receiver);
- // Sets the coverage file for the child process.
- [EnableIf=clang_coverage]
- SetCoverageFile(mojo_base.mojom.File file);
+ // Sets the profiling file for the child process.
+ // Used for the coverage builds.
+ [EnableIf=clang_profiling_inside_sandbox]
+ SetProfilingFile(mojo_base.mojom.File file);
};
diff --git a/chromium/content/common/child_process_host_impl.cc b/chromium/content/common/child_process_host_impl.cc
index 5e397c7e21a..06f21f0a752 100644
--- a/chromium/content/common/child_process_host_impl.cc
+++ b/chromium/content/common/child_process_host_impl.cc
@@ -7,12 +7,13 @@
#include <limits>
#include "base/atomic_sequence_num.h"
-#include "base/clang_coverage_buildflags.h"
+#include "base/clang_profiling_buildflags.h"
#include "base/command_line.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/hash/hash.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/numerics/safe_math.h"
#include "base/path_service.h"
@@ -41,8 +42,8 @@
#include "content/common/mac_helpers.h"
#endif // OS_LINUX
-#if BUILDFLAG(CLANG_COVERAGE)
-#include "content/common/coverage_utils.h"
+#if BUILDFLAG(CLANG_PROFILING_INSIDE_SANDBOX)
+#include "content/common/profiling_utils.h"
#endif
namespace {
@@ -206,8 +207,8 @@ bool ChildProcessHostImpl::InitChannel() {
child_process_->SetIPCLoggingEnabled(enabled);
#endif
-#if BUILDFLAG(CLANG_COVERAGE)
- child_process_->SetCoverageFile(OpenCoverageFile());
+#if BUILDFLAG(CLANG_PROFILING_INSIDE_SANDBOX)
+ child_process_->SetProfilingFile(OpenProfilingFile());
#endif
opening_channel_ = true;
diff --git a/chromium/content/common/common_param_traits_macros.h b/chromium/content/common/common_param_traits_macros.h
index 0d2d07e279e..0701e8396a5 100644
--- a/chromium/content/common/common_param_traits_macros.h
+++ b/chromium/content/common/common_param_traits_macros.h
@@ -46,11 +46,11 @@ IPC_STRUCT_TRAITS_BEGIN(content::VisualProperties)
IPC_STRUCT_TRAITS_MEMBER(min_size_for_auto_resize)
IPC_STRUCT_TRAITS_MEMBER(max_size_for_auto_resize)
IPC_STRUCT_TRAITS_MEMBER(new_size)
+ IPC_STRUCT_TRAITS_MEMBER(visible_viewport_size)
IPC_STRUCT_TRAITS_MEMBER(compositor_viewport_pixel_rect)
IPC_STRUCT_TRAITS_MEMBER(browser_controls_params)
IPC_STRUCT_TRAITS_MEMBER(scroll_focused_node_into_view)
IPC_STRUCT_TRAITS_MEMBER(local_surface_id_allocation)
- IPC_STRUCT_TRAITS_MEMBER(visible_viewport_size)
IPC_STRUCT_TRAITS_MEMBER(is_fullscreen_granted)
IPC_STRUCT_TRAITS_MEMBER(display_mode)
IPC_STRUCT_TRAITS_MEMBER(capture_sequence_number)
diff --git a/chromium/content/common/common_param_traits_unittest.cc b/chromium/content/common/common_param_traits_unittest.cc
index b81e0413d7a..0d234b4db12 100644
--- a/chromium/content/common/common_param_traits_unittest.cc
+++ b/chromium/content/common/common_param_traits_unittest.cc
@@ -27,6 +27,8 @@
#include "printing/page_range.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/base/cursor/cursor.h"
+#include "ui/base/mojom/cursor_type.mojom-shared.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/ipc/gfx_param_traits.h"
#include "ui/gfx/ipc/skia/gfx_skia_param_traits.h"
@@ -269,11 +271,13 @@ TEST(IPCMessageTest, SurfaceInfo) {
}
TEST(IPCMessageTest, WebCursor) {
- content::CursorInfo info(ui::CursorType::kCustom);
- info.custom_image.allocN32Pixels(32, 32);
- info.hotspot = gfx::Point(10, 20);
- info.image_scale_factor = 1.5f;
- content::WebCursor input(info);
+ ui::Cursor cursor(ui::mojom::CursorType::kCustom);
+ SkBitmap bitmap;
+ bitmap.allocN32Pixels(32, 32);
+ cursor.set_custom_bitmap(bitmap);
+ cursor.set_custom_hotspot(gfx::Point(10, 20));
+ cursor.set_image_scale_factor(1.5f);
+ content::WebCursor input(cursor);
IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL);
IPC::ParamTraits<content::WebCursor>::Write(&msg, input);
diff --git a/chromium/content/common/content_message_generator.h b/chromium/content/common/content_message_generator.h
index ac92e2df13b..11ed2e9df9b 100644
--- a/chromium/content/common/content_message_generator.h
+++ b/chromium/content/common/content_message_generator.h
@@ -6,17 +6,6 @@
// NOLINT(build/header_guard)
#include "build/build_config.h"
-#undef CONTENT_COMMON_ACCESSIBILITY_MESSAGES_H_
-#include "content/common/accessibility_messages.h"
-#ifndef CONTENT_COMMON_ACCESSIBILITY_MESSAGES_H_
-#error "Failed to include content/common/accessibility_messages.h"
-#endif
-#undef CONTENT_COMMON_BROWSER_PLUGIN_BROWSER_PLUGIN_MESSAGES_H_
-#include "content/common/browser_plugin/browser_plugin_messages.h"
-#ifndef CONTENT_COMMON_BROWSER_PLUGIN_BROWSER_PLUGIN_MESSAGES_H_
-#error \
- "Failed to include content/common/browser_plugin/browser_plugin_messages.h"
-#endif
#undef CONTENT_COMMON_DRAG_MESSAGES_H_
#include "content/common/drag_messages.h"
#ifndef CONTENT_COMMON_DRAG_MESSAGES_H_
diff --git a/chromium/content/common/content_navigation_policy.cc b/chromium/content/common/content_navigation_policy.cc
new file mode 100644
index 00000000000..aa1f35b439b
--- /dev/null
+++ b/chromium/content/common/content_navigation_policy.cc
@@ -0,0 +1,98 @@
+// Copyright (c) 2020 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.
+
+#include "content/common/content_navigation_policy.h"
+
+#include <bitset>
+
+#include "base/metrics/field_trial_params.h"
+#include "base/system/sys_info.h"
+#include "content/public/common/content_features.h"
+
+namespace content {
+
+bool DeviceHasEnoughMemoryForBackForwardCache() {
+ // This method make sure that the physical memory of device is greater than
+ // the allowed threshold and enables back-forward cache if the feature
+ // kBackForwardCacheMemoryControl is enabled.
+ // It is important to check the base::FeatureList to avoid activating any
+ // field trial groups if BFCache is disabled due to memory threshold.
+ if (base::FeatureList::IsEnabled(features::kBackForwardCacheMemoryControl)) {
+ int memory_threshold_mb = base::GetFieldTrialParamByFeatureAsInt(
+ features::kBackForwardCacheMemoryControl,
+ "memory_threshold_for_back_forward_cache_in_mb", 0);
+ return base::SysInfo::AmountOfPhysicalMemoryMB() > memory_threshold_mb;
+ }
+
+ // If the feature kBackForwardCacheMemoryControl is not enabled, all the
+ // devices are included by default.
+ return true;
+}
+
+bool IsBackForwardCacheEnabled() {
+ if (!DeviceHasEnoughMemoryForBackForwardCache())
+ return false;
+ // The feature needs to be checked last, because checking the feature
+ // activates the field trial and assigns the client either to a control or an
+ // experiment group - such assignment should be final.
+ return base::FeatureList::IsEnabled(features::kBackForwardCache);
+}
+
+const char kProactivelySwapBrowsingInstanceLevelParameterName[] = "level";
+
+constexpr base::FeatureParam<ProactivelySwapBrowsingInstanceLevel>::Option
+ proactively_swap_browsing_instance_levels[] = {
+ {ProactivelySwapBrowsingInstanceLevel::kDisabled, "Disabled"},
+ {ProactivelySwapBrowsingInstanceLevel::kCrossSiteSwapProcess,
+ "CrossSiteSwapProcess"},
+ {ProactivelySwapBrowsingInstanceLevel::kCrossSiteReuseProcess,
+ "CrossSiteReuseProcess"}};
+const base::FeatureParam<ProactivelySwapBrowsingInstanceLevel>
+ proactively_swap_browsing_instance_level{
+ &features::kProactivelySwapBrowsingInstance,
+ kProactivelySwapBrowsingInstanceLevelParameterName,
+ ProactivelySwapBrowsingInstanceLevel::kDisabled,
+ &proactively_swap_browsing_instance_levels};
+
+ProactivelySwapBrowsingInstanceLevel GetProactivelySwapBrowsingInstanceLevel() {
+ if (base::FeatureList::IsEnabled(features::kProactivelySwapBrowsingInstance))
+ return proactively_swap_browsing_instance_level.Get();
+ return ProactivelySwapBrowsingInstanceLevel::kDisabled;
+}
+
+bool IsProactivelySwapBrowsingInstanceEnabled() {
+ return GetProactivelySwapBrowsingInstanceLevel() >=
+ ProactivelySwapBrowsingInstanceLevel::kCrossSiteSwapProcess;
+}
+
+bool IsProactivelySwapBrowsingInstanceWithProcessReuseEnabled() {
+ return GetProactivelySwapBrowsingInstanceLevel() >=
+ ProactivelySwapBrowsingInstanceLevel::kCrossSiteReuseProcess;
+}
+const char kRenderDocumentLevelParameterName[] = "level";
+
+constexpr base::FeatureParam<RenderDocumentLevel>::Option
+ render_document_levels[] = {
+ {RenderDocumentLevel::kDisabled, "disabled"},
+ {RenderDocumentLevel::kCrashedFrame, "crashed-frame"},
+ {RenderDocumentLevel::kSubframe, "subframe"}};
+const base::FeatureParam<RenderDocumentLevel> render_document_level{
+ &features::kRenderDocument, kRenderDocumentLevelParameterName,
+ RenderDocumentLevel::kDisabled, &render_document_levels};
+
+RenderDocumentLevel GetRenderDocumentLevel() {
+ if (base::FeatureList::IsEnabled(features::kRenderDocument))
+ return render_document_level.Get();
+ return RenderDocumentLevel::kDisabled;
+}
+
+std::string GetRenderDocumentLevelName(RenderDocumentLevel level) {
+ return render_document_level.GetName(level);
+}
+
+bool CreateNewHostForSameSiteSubframe() {
+ return GetRenderDocumentLevel() >= RenderDocumentLevel::kSubframe;
+}
+
+} // namespace content
diff --git a/chromium/content/common/content_navigation_policy.h b/chromium/content/common/content_navigation_policy.h
new file mode 100644
index 00000000000..3d9abb7db17
--- /dev/null
+++ b/chromium/content/common/content_navigation_policy.h
@@ -0,0 +1,53 @@
+// Copyright (c) 2020 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 CONTENT_COMMON_CONTENT_NAVIGATION_POLICY_H_
+#define CONTENT_COMMON_CONTENT_NAVIGATION_POLICY_H_
+
+#include "content/common/content_export.h"
+
+#include <string>
+
+namespace content {
+
+CONTENT_EXPORT bool IsBackForwardCacheEnabled();
+CONTENT_EXPORT bool DeviceHasEnoughMemoryForBackForwardCache();
+
+// Levels of ProactivelySwapBrowsingInstance support.
+// These are additive; features enabled at lower levels remain enabled at all
+// higher levels.
+enum class ProactivelySwapBrowsingInstanceLevel {
+ kDisabled = 0,
+ // Swap BrowsingInstance and renderer process on cross-site navigations.
+ kCrossSiteSwapProcess = 1,
+ // Swap BrowsingInstance on cross-site navigations, but try to reuse the
+ // current renderer process if possible.
+ kCrossSiteReuseProcess = 2,
+ // TODO(rakina): Add another level for BrowsingInstance swap on same-site
+ // navigations with process reuse.
+};
+CONTENT_EXPORT bool IsProactivelySwapBrowsingInstanceEnabled();
+
+CONTENT_EXPORT bool IsProactivelySwapBrowsingInstanceWithProcessReuseEnabled();
+CONTENT_EXPORT extern const char
+ kProactivelySwapBrowsingInstanceLevelParameterName[];
+
+// Levels of RenderDocument support. These are additive in that features enabled
+// at lower levels remain enabled at all higher levels.
+enum class RenderDocumentLevel {
+ kDisabled = 0,
+ // Do not reused RenderFrameHosts when recovering from crashes.
+ kCrashedFrame = 1,
+ // Also do not reuse RenderFrameHosts when navigating subframes.
+ kSubframe = 2,
+};
+CONTENT_EXPORT bool CreateNewHostForSameSiteSubframe();
+CONTENT_EXPORT RenderDocumentLevel GetRenderDocumentLevel();
+CONTENT_EXPORT std::string GetRenderDocumentLevelName(
+ RenderDocumentLevel level);
+CONTENT_EXPORT extern const char kRenderDocumentLevelParameterName[];
+
+} // namespace content
+
+#endif // CONTENT_COMMON_CONTENT_NAVIGATION_POLICY_H_
diff --git a/chromium/content/common/content_param_traits.cc b/chromium/content/common/content_param_traits.cc
index 2aff14ed122..b0d80ab5640 100644
--- a/chromium/content/common/content_param_traits.cc
+++ b/chromium/content/common/content_param_traits.cc
@@ -13,8 +13,7 @@
#include "components/viz/common/surfaces/local_surface_id_allocation.h"
#include "components/viz/common/surfaces/surface_id.h"
#include "components/viz/common/surfaces/surface_info.h"
-#include "content/common/frame_message_structs.h"
-#include "content/common/tab_switch_time_recorder.h"
+#include "content/common/content_to_visible_time_reporter.h"
#include "ipc/ipc_mojo_message_helper.h"
#include "ipc/ipc_mojo_param_traits.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
@@ -26,35 +25,46 @@
#include "third_party/blink/public/mojom/feature_policy/policy_value.mojom.h"
#include "third_party/blink/public/mojom/messaging/transferable_message.mojom.h"
#include "ui/accessibility/ax_mode.h"
+#include "ui/base/cursor/cursor.h"
+#include "ui/base/mojom/cursor_type.mojom-shared.h"
#include "ui/gfx/ipc/skia/gfx_skia_param_traits.h"
namespace IPC {
void ParamTraits<content::WebCursor>::Write(base::Pickle* m,
const param_type& p) {
- WriteParam(m, p.info().type);
- if (p.info().type == ui::CursorType::kCustom) {
- WriteParam(m, p.info().hotspot);
- WriteParam(m, p.info().image_scale_factor);
- WriteParam(m, p.info().custom_image);
+ WriteParam(m, p.cursor().type());
+ if (p.cursor().type() == ui::mojom::CursorType::kCustom) {
+ WriteParam(m, p.cursor().custom_hotspot());
+ WriteParam(m, p.cursor().image_scale_factor());
+ WriteParam(m, p.cursor().custom_bitmap());
}
}
bool ParamTraits<content::WebCursor>::Read(const base::Pickle* m,
base::PickleIterator* iter,
param_type* r) {
- content::CursorInfo info;
- if (!ReadParam(m, iter, &info.type))
+ ui::mojom::CursorType type;
+ if (!ReadParam(m, iter, &type))
return false;
- if (info.type == ui::CursorType::kCustom &&
- (!ReadParam(m, iter, &info.hotspot) ||
- !ReadParam(m, iter, &info.image_scale_factor) ||
- !ReadParam(m, iter, &info.custom_image))) {
- return false;
+ ui::Cursor cursor(type);
+ if (cursor.type() == ui::mojom::CursorType::kCustom) {
+ gfx::Point hotspot;
+ float image_scale_factor;
+ SkBitmap bitmap;
+ if (!ReadParam(m, iter, &hotspot) ||
+ !ReadParam(m, iter, &image_scale_factor) ||
+ !ReadParam(m, iter, &bitmap)) {
+ return false;
+ }
+
+ cursor.set_custom_hotspot(hotspot);
+ cursor.set_image_scale_factor(image_scale_factor);
+ cursor.set_custom_bitmap(bitmap);
}
- return r->SetInfo(info);
+ return r->SetCursor(cursor);
}
void ParamTraits<content::WebCursor>::Log(const param_type& p, std::string* l) {
@@ -144,35 +154,6 @@ bool ParamTraits<ui::AXMode>::Read(const base::Pickle* m,
void ParamTraits<ui::AXMode>::Log(const param_type& p, std::string* l) {}
-// static
-void ParamTraits<content::FrameMsg_ViewChanged_Params>::Write(
- base::Pickle* m,
- const param_type& p) {
- DCHECK(p.frame_sink_id.is_valid());
- WriteParam(m, p.frame_sink_id);
-}
-
-bool ParamTraits<content::FrameMsg_ViewChanged_Params>::Read(
- const base::Pickle* m,
- base::PickleIterator* iter,
- param_type* r) {
- if (!ReadParam(m, iter, &(r->frame_sink_id)))
- return false;
- if (!r->frame_sink_id.is_valid()) {
- NOTREACHED();
- return false;
- }
- return true;
-}
-
-// static
-void ParamTraits<content::FrameMsg_ViewChanged_Params>::Log(const param_type& p,
- std::string* l) {
- l->append("(");
- LogParam(p.frame_sink_id, l);
- l->append(")");
-}
-
template <>
struct ParamTraits<blink::mojom::SerializedBlobPtr> {
using param_type = blink::mojom::SerializedBlobPtr;
@@ -233,6 +214,7 @@ void ParamTraits<scoped_refptr<base::RefCountedData<
WriteParam(m, p->data.stack_trace_debugger_id_first);
WriteParam(m, p->data.stack_trace_debugger_id_second);
WriteParam(m, p->data.stack_trace_should_pause);
+ WriteParam(m, p->data.locked_agent_cluster_id);
WriteParam(m, p->data.ports);
WriteParam(m, p->data.stream_channels);
WriteParam(m, !!p->data.user_activation);
@@ -268,6 +250,7 @@ bool ParamTraits<
!ReadParam(m, iter, &(*r)->data.stack_trace_debugger_id_first) ||
!ReadParam(m, iter, &(*r)->data.stack_trace_debugger_id_second) ||
!ReadParam(m, iter, &(*r)->data.stack_trace_should_pause) ||
+ !ReadParam(m, iter, &(*r)->data.locked_agent_cluster_id) ||
!ReadParam(m, iter, &(*r)->data.ports) ||
!ReadParam(m, iter, &(*r)->data.stream_channels) ||
!ReadParam(m, iter, &has_activation) ||
@@ -489,30 +472,37 @@ void ParamTraits<net::SHA256HashValue>::Log(const param_type& p,
l->append("<SHA256HashValue>");
}
-void ParamTraits<content::RecordTabSwitchTimeRequest>::Write(
+void ParamTraits<content::RecordContentToVisibleTimeRequest>::Write(
base::Pickle* m,
const param_type& p) {
- WriteParam(m, p.tab_switch_start_time);
+ WriteParam(m, p.event_start_time);
WriteParam(m, p.destination_is_loaded);
WriteParam(m, p.destination_is_frozen);
+ WriteParam(m, p.show_reason_tab_switching);
+ WriteParam(m, p.show_reason_unoccluded);
+ WriteParam(m, p.show_reason_bfcache_restore);
}
-bool ParamTraits<content::RecordTabSwitchTimeRequest>::Read(
+bool ParamTraits<content::RecordContentToVisibleTimeRequest>::Read(
const base::Pickle* m,
base::PickleIterator* iter,
param_type* r) {
- if (!ReadParam(m, iter, &r->tab_switch_start_time) ||
+ if (!ReadParam(m, iter, &r->event_start_time) ||
!ReadParam(m, iter, &r->destination_is_loaded) ||
- !ReadParam(m, iter, &r->destination_is_frozen)) {
+ !ReadParam(m, iter, &r->destination_is_frozen) ||
+ !ReadParam(m, iter, &r->show_reason_tab_switching) ||
+ !ReadParam(m, iter, &r->show_reason_unoccluded) ||
+ !ReadParam(m, iter, &r->show_reason_bfcache_restore)) {
return false;
}
return true;
}
-void ParamTraits<content::RecordTabSwitchTimeRequest>::Log(const param_type& p,
- std::string* l) {
- l->append("<content::RecordTabSwitchTimeRequest>");
+void ParamTraits<content::RecordContentToVisibleTimeRequest>::Log(
+ const param_type& p,
+ std::string* l) {
+ l->append("<content::RecordContentToVisibleTimeRequest>");
}
} // namespace IPC
diff --git a/chromium/content/common/content_param_traits.h b/chromium/content/common/content_param_traits.h
index ad8f5a3f3f2..2e3586210a0 100644
--- a/chromium/content/common/content_param_traits.h
+++ b/chromium/content/common/content_param_traits.h
@@ -29,8 +29,7 @@ struct TransferableMessage;
}
namespace content {
-struct FrameMsg_ViewChanged_Params;
-struct RecordTabSwitchTimeRequest;
+struct RecordContentToVisibleTimeRequest;
}
namespace viz {
@@ -96,16 +95,6 @@ struct CONTENT_EXPORT ParamTraits<
};
template <>
-struct CONTENT_EXPORT ParamTraits<content::FrameMsg_ViewChanged_Params> {
- using param_type = content::FrameMsg_ViewChanged_Params;
- static void Write(base::Pickle* m, const param_type& p);
- static bool Read(const base::Pickle* m,
- base::PickleIterator* iter,
- param_type* p);
- static void Log(const param_type& p, std::string* l);
-};
-
-template <>
struct CONTENT_EXPORT ParamTraits<viz::FrameSinkId> {
typedef viz::FrameSinkId param_type;
static void Write(base::Pickle* m, const param_type& p);
@@ -166,8 +155,8 @@ struct CONTENT_EXPORT ParamTraits<net::SHA256HashValue> {
};
template <>
-struct CONTENT_EXPORT ParamTraits<content::RecordTabSwitchTimeRequest> {
- using param_type = content::RecordTabSwitchTimeRequest;
+struct CONTENT_EXPORT ParamTraits<content::RecordContentToVisibleTimeRequest> {
+ using param_type = content::RecordContentToVisibleTimeRequest;
static void Write(base::Pickle* m, const param_type& p);
static bool Read(const base::Pickle* m,
base::PickleIterator* iter,
diff --git a/chromium/content/common/content_param_traits_macros.h b/chromium/content/common/content_param_traits_macros.h
index 59172ccaeca..0e38351c800 100644
--- a/chromium/content/common/content_param_traits_macros.h
+++ b/chromium/content/common/content_param_traits_macros.h
@@ -13,15 +13,14 @@
#include "content/common/content_param_traits.h"
#include "content/public/common/input_event_ack_state.h"
#include "content/public/common/page_visibility_state.h"
-#include "content/public/common/resource_type.h"
#include "ipc/ipc_message_macros.h"
#include "services/network/public/mojom/content_security_policy.mojom.h"
+#include "third_party/blink/public/common/input/web_input_event.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom.h"
-#include "third_party/blink/public/platform/web_content_security_policy.h"
-#include "third_party/blink/public/platform/web_cursor_info.h"
-#include "third_party/blink/public/platform/web_input_event.h"
+#include "third_party/blink/public/mojom/loader/resource_load_info.mojom.h"
#include "third_party/blink/public/platform/web_text_autosizer_page_info.h"
#include "third_party/blink/public/web/web_ime_text_span.h"
+#include "ui/base/mojom/cursor_type.mojom-shared.h"
#include "ui/gfx/gpu_memory_buffer.h"
#include "ui/gfx/ipc/geometry/gfx_param_traits.h"
#include "ui/gfx/ipc/gfx_param_traits.h"
@@ -33,14 +32,16 @@ IPC_ENUM_TRAITS_MAX_VALUE(content::InputEventAckState,
content::INPUT_EVENT_ACK_STATE_MAX)
IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::RequestContextType,
blink::mojom::RequestContextType::kMaxValue)
-IPC_ENUM_TRAITS_MAX_VALUE(content::ResourceType,
- content::ResourceType::kMaxValue)
+IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::ResourceType,
+ blink::mojom::ResourceType::kMaxValue)
IPC_ENUM_TRAITS_MAX_VALUE(
network::mojom::ContentSecurityPolicySource,
network::mojom::ContentSecurityPolicySource::kMaxValue)
IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::ContentSecurityPolicyType,
network::mojom::ContentSecurityPolicyType::kMaxValue)
-IPC_ENUM_TRAITS_MAX_VALUE(ui::CursorType, ui::CursorType::kMaxValue)
+IPC_ENUM_TRAITS_MIN_MAX_VALUE(ui::mojom::CursorType,
+ ui::mojom::CursorType::kNull,
+ ui::mojom::CursorType::kMaxValue)
IPC_ENUM_TRAITS_MIN_MAX_VALUE(blink::WebInputEvent::Type,
blink::WebInputEvent::kTypeFirst,
blink::WebInputEvent::kTypeLast)
diff --git a/chromium/content/common/content_security_policy/OWNERS b/chromium/content/common/content_security_policy/OWNERS
deleted file mode 100644
index 3b19cb56bad..00000000000
--- a/chromium/content/common/content_security_policy/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-mkwst@chromium.org
-andypaicu@chromium.org
diff --git a/chromium/content/common/content_security_policy/content_security_policy.cc b/chromium/content/common/content_security_policy/content_security_policy.cc
deleted file mode 100644
index 1f2c5dff92f..00000000000
--- a/chromium/content/common/content_security_policy/content_security_policy.cc
+++ /dev/null
@@ -1,258 +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.
-
-#include <sstream>
-#include "base/strings/string_split.h"
-#include "base/strings/string_util.h"
-#include "content/common/content_security_policy/csp_context.h"
-
-namespace content {
-
-namespace {
-
-static CSPDirective::Name CSPFallback(CSPDirective::Name directive) {
- switch (directive) {
- case CSPDirective::DefaultSrc:
- case CSPDirective::FormAction:
- case CSPDirective::UpgradeInsecureRequests:
- case CSPDirective::NavigateTo:
- case CSPDirective::FrameAncestors:
- return CSPDirective::Unknown;
-
- case CSPDirective::FrameSrc:
- return CSPDirective::ChildSrc;
-
- case CSPDirective::ChildSrc:
- return CSPDirective::DefaultSrc;
-
- case CSPDirective::Unknown:
- NOTREACHED();
- return CSPDirective::Unknown;
- }
- NOTREACHED();
- return CSPDirective::Unknown;
-}
-
-// Looks by name for a directive in a list of directives.
-// If it is not found, returns nullptr.
-static const CSPDirective* FindDirective(
- const CSPDirective::Name name,
- const std::vector<CSPDirective>& directives) {
- for (const CSPDirective& directive : directives) {
- if (directive.name == name) {
- return &directive;
- }
- }
- return nullptr;
-}
-
-std::string ElideURLForReportViolation(const GURL& url) {
- // TODO(arthursonzogni): the url length should be limited to 1024 char. Find
- // a function that will not break the utf8 encoding while eliding the string.
- return url.spec();
-}
-
-// Return the error message specific to one CSP |directive|.
-// $1: Blocked URL.
-// $2: Blocking policy.
-const char* ErrorMessage(CSPDirective::Name directive) {
- switch (directive) {
- case CSPDirective::FormAction:
- return "Refused to send form data to '$1' because it violates the "
- "following Content Security Policy directive: \"$2\".";
- case CSPDirective::FrameAncestors:
- return "Refused to frame '$1' because an ancestor violates the following "
- "Content Security Policy directive: \"$2\".";
- case CSPDirective::FrameSrc:
- return "Refused to frame '$1' because it violates the "
- "following Content Security Policy directive: \"$2\".";
- case CSPDirective::NavigateTo:
- return "Refused to navigate to '$1' because it violates the "
- "following Content Security Policy directive: \"$2\".";
-
- case CSPDirective::ChildSrc:
- case CSPDirective::DefaultSrc:
- case CSPDirective::Unknown:
- case CSPDirective::UpgradeInsecureRequests:
- NOTREACHED();
- return nullptr;
- };
-}
-
-void ReportViolation(CSPContext* context,
- const ContentSecurityPolicy& policy,
- const CSPDirective& directive,
- const CSPDirective::Name directive_name,
- const GURL& url,
- bool has_followed_redirect,
- const SourceLocation& source_location) {
- // For security reasons, some urls must not be disclosed. This includes the
- // blocked url and the source location of the error. Care must be taken to
- // ensure that these are not transmitted between different cross-origin
- // renderers.
- GURL blocked_url = (directive_name == CSPDirective::FrameAncestors)
- ? GURL(context->self_source()->ToString())
- : url;
- SourceLocation safe_source_location = source_location;
- context->SanitizeDataForUseInCspViolation(has_followed_redirect,
- directive_name, &blocked_url,
- &safe_source_location);
-
- std::stringstream message;
-
- if (policy.header.type == network::mojom::ContentSecurityPolicyType::kReport)
- message << "[Report Only] ";
-
- message << base::ReplaceStringPlaceholders(
- ErrorMessage(directive_name),
- {ElideURLForReportViolation(blocked_url), directive.ToString()}, nullptr);
-
- if (directive.name != directive_name) {
- message << " Note that '" << CSPDirective::NameToString(directive_name)
- << "' was not explicitly set, so '"
- << CSPDirective::NameToString(directive.name)
- << "' is used as a fallback.";
- }
-
- message << "\n";
-
- context->ReportContentSecurityPolicyViolation(CSPViolationParams(
- CSPDirective::NameToString(directive.name),
- CSPDirective::NameToString(directive_name), message.str(), blocked_url,
- policy.report_endpoints, policy.use_reporting_api,
- policy.header.header_value, policy.header.type, has_followed_redirect,
- safe_source_location));
-}
-
-bool AllowDirective(CSPContext* context,
- const ContentSecurityPolicy& policy,
- const CSPDirective& directive,
- CSPDirective::Name directive_name,
- const GURL& url,
- bool has_followed_redirect,
- bool is_response_check,
- const SourceLocation& source_location) {
- if (CSPSourceList::Allow(directive.source_list, url, context,
- has_followed_redirect, is_response_check)) {
- return true;
- }
-
- ReportViolation(context, policy, directive, directive_name, url,
- has_followed_redirect, source_location);
- return false;
-}
-
-const GURL ExtractInnerURL(const GURL& url) {
- if (const GURL* inner_url = url.inner_url())
- return *inner_url;
- else
- // TODO(arthursonzogni): revisit this once GURL::inner_url support blob-URL.
- return GURL(url.path());
-}
-
-bool ShouldBypassContentSecurityPolicy(CSPContext* context, const GURL& url) {
- if (url.SchemeIsFileSystem() || url.SchemeIsBlob()) {
- return context->SchemeShouldBypassCSP(ExtractInnerURL(url).scheme());
- } else {
- return context->SchemeShouldBypassCSP(url.scheme());
- }
-}
-
-} // namespace
-
-ContentSecurityPolicy::ContentSecurityPolicy() = default;
-
-ContentSecurityPolicy::ContentSecurityPolicy(
- const ContentSecurityPolicyHeader& header,
- const std::vector<CSPDirective>& directives,
- const std::vector<std::string>& report_endpoints,
- bool use_reporting_api)
- : header(header),
- directives(directives),
- report_endpoints(report_endpoints),
- use_reporting_api(use_reporting_api) {}
-
-// TODO(arthursonzogni): Add the |header| to the network ContentSecurityPolicy
-// struct.
-ContentSecurityPolicy::ContentSecurityPolicy(
- network::mojom::ContentSecurityPolicyPtr csp)
- : report_endpoints(std::move(csp->report_endpoints)),
- use_reporting_api(csp->use_reporting_api) {
- for (auto& directive : csp->directives)
- directives.emplace_back(std::move(directive));
-}
-
-ContentSecurityPolicy::ContentSecurityPolicy(
- const ContentSecurityPolicy& other) = default;
-
-ContentSecurityPolicy::~ContentSecurityPolicy() = default;
-
-// static
-bool ContentSecurityPolicy::Allow(const ContentSecurityPolicy& policy,
- CSPDirective::Name directive_name,
- const GURL& url,
- bool has_followed_redirect,
- bool is_response_check,
- CSPContext* context,
- const SourceLocation& source_location,
- bool is_form_submission) {
- if (ShouldBypassContentSecurityPolicy(context, url))
- return true;
-
- // 'navigate-to' has no effect when doing a form submission and a
- // 'form-action' directive is present.
- if (is_form_submission && directive_name == CSPDirective::Name::NavigateTo &&
- FindDirective(CSPDirective::Name::FormAction, policy.directives)) {
- return true;
- }
-
- CSPDirective::Name current_directive_name = directive_name;
- do {
- const CSPDirective* current_directive =
- FindDirective(current_directive_name, policy.directives);
- if (current_directive) {
- bool allowed = AllowDirective(context, policy, *current_directive,
- directive_name, url, has_followed_redirect,
- is_response_check, source_location);
- return allowed || policy.header.type ==
- network::mojom::ContentSecurityPolicyType::kReport;
- }
- current_directive_name = CSPFallback(current_directive_name);
- } while (current_directive_name != CSPDirective::Unknown);
- return true;
-}
-
-std::string ContentSecurityPolicy::ToString() const {
- std::stringstream text;
- bool is_first_policy = true;
- for (const CSPDirective& directive : directives) {
- if (!is_first_policy)
- text << "; ";
- is_first_policy = false;
- text << directive.ToString();
- }
-
- if (!report_endpoints.empty()) {
- if (!is_first_policy)
- text << "; ";
- is_first_policy = false;
- text << "report-uri";
- for (const std::string& endpoint : report_endpoints)
- text << " " << endpoint;
- }
-
- return text.str();
-}
-
-// static
-bool ContentSecurityPolicy::ShouldUpgradeInsecureRequest(
- const ContentSecurityPolicy& policy) {
- for (const CSPDirective& directive : policy.directives) {
- if (directive.name == CSPDirective::UpgradeInsecureRequests)
- return true;
- }
- return false;
-}
-
-} // namespace content
diff --git a/chromium/content/common/content_security_policy/content_security_policy.h b/chromium/content/common/content_security_policy/content_security_policy.h
deleted file mode 100644
index 597d0c921d7..00000000000
--- a/chromium/content/common/content_security_policy/content_security_policy.h
+++ /dev/null
@@ -1,61 +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 CONTENT_COMMON_CONTENT_SECURITY_POLICY_CONTENT_SECURITY_POLICY_H_
-#define CONTENT_COMMON_CONTENT_SECURITY_POLICY_CONTENT_SECURITY_POLICY_H_
-
-#include <memory>
-#include <vector>
-
-#include "content/common/content_export.h"
-#include "content/common/content_security_policy/csp_directive.h"
-#include "content/common/content_security_policy_header.h"
-#include "services/network/public/mojom/content_security_policy.mojom-forward.h"
-#include "url/gurl.h"
-
-namespace content {
-
-class CSPContext;
-struct SourceLocation;
-
-// https://www.w3.org/TR/CSP3/#framework-policy
-//
-// A ContentSecurityPolicy is a collection of CSPDirectives which will be
-// enforced upon requests.
-struct CONTENT_EXPORT ContentSecurityPolicy {
- ContentSecurityPolicy();
- ContentSecurityPolicy(const ContentSecurityPolicyHeader& header,
- const std::vector<CSPDirective>& directives,
- const std::vector<std::string>& report_endpoints,
- bool use_reporting_api);
- explicit ContentSecurityPolicy(network::mojom::ContentSecurityPolicyPtr);
- ContentSecurityPolicy(const ContentSecurityPolicy&);
- ~ContentSecurityPolicy();
-
- ContentSecurityPolicyHeader header;
- std::vector<CSPDirective> directives;
- std::vector<std::string> report_endpoints;
- bool use_reporting_api;
-
- std::string ToString() const;
-
- // Return true when the |policy| allows a request to the |url| in relation to
- // the |directive| for a given |context|.
- // Note: Any policy violation are reported to the |context|.
- static bool Allow(const ContentSecurityPolicy& policy,
- CSPDirective::Name directive,
- const GURL& url,
- bool has_followed_redirect,
- bool is_response_check,
- CSPContext* context,
- const SourceLocation& source_location,
- bool is_form_submission);
-
- // Returns true if |policy| specifies that an insecure HTTP request should be
- // upgraded to HTTPS.
- static bool ShouldUpgradeInsecureRequest(const ContentSecurityPolicy& policy);
-};
-
-} // namespace content
-#endif // CONTENT_COMMON_CONTENT_SECURITY_POLICY_CONTENT_SECURITY_POLICY_H_
diff --git a/chromium/content/common/content_security_policy/content_security_policy_unittest.cc b/chromium/content/common/content_security_policy/content_security_policy_unittest.cc
deleted file mode 100644
index c750527913f..00000000000
--- a/chromium/content/common/content_security_policy/content_security_policy_unittest.cc
+++ /dev/null
@@ -1,361 +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.
-
-#include "base/stl_util.h"
-#include "content/common/content_security_policy/csp_context.h"
-#include "content/common/content_security_policy_header.h"
-#include "content/common/navigation_params.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace content {
-
-namespace {
-class CSPContextTest : public CSPContext {
- public:
- CSPContextTest() : CSPContext() {}
-
- const std::vector<CSPViolationParams>& violations() { return violations_; }
-
- void AddSchemeToBypassCSP(const std::string& scheme) {
- scheme_to_bypass_.push_back(scheme);
- }
-
- bool SchemeShouldBypassCSP(const base::StringPiece& scheme) override {
- return base::Contains(scheme_to_bypass_, scheme);
- }
-
- private:
- void ReportContentSecurityPolicyViolation(
- const CSPViolationParams& violation_params) override {
- violations_.push_back(violation_params);
- }
- std::vector<CSPViolationParams> violations_;
- std::vector<std::string> scheme_to_bypass_;
-
- DISALLOW_COPY_AND_ASSIGN(CSPContextTest);
-};
-
-ContentSecurityPolicyHeader EmptyCspHeader() {
- return ContentSecurityPolicyHeader(
- std::string(), network::mojom::ContentSecurityPolicyType::kEnforce,
- network::mojom::ContentSecurityPolicySource::kHTTP);
-}
-
-} // namespace
-
-TEST(ContentSecurityPolicy, NoDirective) {
- CSPContextTest context;
- std::vector<std::string> report_end_points; // empty
- ContentSecurityPolicy policy(EmptyCspHeader(), std::vector<CSPDirective>(),
- report_end_points, false);
-
- EXPECT_TRUE(ContentSecurityPolicy::Allow(
- policy, CSPDirective::FormAction, GURL("http://www.example.com"), false,
- false, &context, SourceLocation(), true));
- ASSERT_EQ(0u, context.violations().size());
-}
-
-TEST(ContentSecurityPolicy, ReportViolation) {
- CSPContextTest context;
-
- // source = "www.example.com"
- CSPSource source("", "www.example.com", false, url::PORT_UNSPECIFIED, false,
- "");
- CSPSourceList source_list(false, false, false, {source});
- CSPDirective directive(CSPDirective::FormAction, source_list);
- std::vector<std::string> report_end_points; // empty
- ContentSecurityPolicy policy(EmptyCspHeader(), {directive}, report_end_points,
- false);
-
- EXPECT_FALSE(ContentSecurityPolicy::Allow(
- policy, CSPDirective::FormAction, GURL("http://www.not-example.com"),
- false, false, &context, SourceLocation(), true));
-
- ASSERT_EQ(1u, context.violations().size());
- const char console_message[] =
- "Refused to send form data to 'http://www.not-example.com/' because it "
- "violates the following Content Security Policy directive: \"form-action "
- "www.example.com\".\n";
- EXPECT_EQ(console_message, context.violations()[0].console_message);
-}
-
-TEST(ContentSecurityPolicy, DirectiveFallback) {
- CSPSource source_a("http", "a.com", false, url::PORT_UNSPECIFIED, false, "");
- CSPSource source_b("http", "b.com", false, url::PORT_UNSPECIFIED, false, "");
- CSPSourceList source_list_a(false, false, false, {source_a});
- CSPSourceList source_list_b(false, false, false, {source_b});
-
- std::vector<std::string> report_end_points; // Empty.
-
- {
- CSPContextTest context;
- ContentSecurityPolicy policy(
- EmptyCspHeader(),
- {CSPDirective(CSPDirective::DefaultSrc, source_list_a)},
- report_end_points, false);
- EXPECT_FALSE(ContentSecurityPolicy::Allow(
- policy, CSPDirective::FrameSrc, GURL("http://b.com"), false, false,
- &context, SourceLocation(), false));
- ASSERT_EQ(1u, context.violations().size());
- const char console_message[] =
- "Refused to frame 'http://b.com/' because it violates "
- "the following Content Security Policy directive: \"default-src "
- "http://a.com\". Note that 'frame-src' was not explicitly "
- "set, so 'default-src' is used as a fallback.\n";
- EXPECT_EQ(console_message, context.violations()[0].console_message);
- EXPECT_TRUE(ContentSecurityPolicy::Allow(
- policy, CSPDirective::FrameSrc, GURL("http://a.com"), false, false,
- &context, SourceLocation(), false));
- }
- {
- CSPContextTest context;
- ContentSecurityPolicy policy(
- EmptyCspHeader(), {CSPDirective(CSPDirective::ChildSrc, source_list_a)},
- report_end_points, false);
- EXPECT_FALSE(ContentSecurityPolicy::Allow(
- policy, CSPDirective::FrameSrc, GURL("http://b.com"), false, false,
- &context, SourceLocation(), false));
- ASSERT_EQ(1u, context.violations().size());
- const char console_message[] =
- "Refused to frame 'http://b.com/' because it violates "
- "the following Content Security Policy directive: \"child-src "
- "http://a.com\". Note that 'frame-src' was not explicitly "
- "set, so 'child-src' is used as a fallback.\n";
- EXPECT_EQ(console_message, context.violations()[0].console_message);
- EXPECT_TRUE(ContentSecurityPolicy::Allow(
- policy, CSPDirective::FrameSrc, GURL("http://a.com"), false, false,
- &context, SourceLocation(), false));
- }
- {
- CSPContextTest context;
- CSPSourceList source_list(false, false, false, {source_a, source_b});
- ContentSecurityPolicy policy(
- EmptyCspHeader(),
- {CSPDirective(CSPDirective::FrameSrc, {source_list_a}),
- CSPDirective(CSPDirective::ChildSrc, {source_list_b})},
- report_end_points, false);
- EXPECT_TRUE(ContentSecurityPolicy::Allow(
- policy, CSPDirective::FrameSrc, GURL("http://a.com"), false, false,
- &context, SourceLocation(), false));
- EXPECT_FALSE(ContentSecurityPolicy::Allow(
- policy, CSPDirective::FrameSrc, GURL("http://b.com"), false, false,
- &context, SourceLocation(), false));
- ASSERT_EQ(1u, context.violations().size());
- const char console_message[] =
- "Refused to frame 'http://b.com/' because it violates "
- "the following Content Security Policy directive: \"frame-src "
- "http://a.com\".\n";
- EXPECT_EQ(console_message, context.violations()[0].console_message);
- }
-}
-
-TEST(ContentSecurityPolicy, RequestsAllowedWhenBypassingCSP) {
- CSPContextTest context;
- std::vector<std::string> report_end_points; // empty
- CSPSource source("https", "example.com", false, url::PORT_UNSPECIFIED, false,
- "");
- CSPSourceList source_list(false, false, false, {source});
- ContentSecurityPolicy policy(
- EmptyCspHeader(), {CSPDirective(CSPDirective::DefaultSrc, source_list)},
- report_end_points, false);
-
- EXPECT_TRUE(ContentSecurityPolicy::Allow(
- policy, CSPDirective::FrameSrc, GURL("https://example.com/"), false,
- false, &context, SourceLocation(), false));
- EXPECT_FALSE(ContentSecurityPolicy::Allow(
- policy, CSPDirective::FrameSrc, GURL("https://not-example.com/"), false,
- false, &context, SourceLocation(), false));
-
- // Register 'https' as bypassing CSP, which should now bypass it entirely.
- context.AddSchemeToBypassCSP("https");
-
- EXPECT_TRUE(ContentSecurityPolicy::Allow(
- policy, CSPDirective::FrameSrc, GURL("https://example.com/"), false,
- false, &context, SourceLocation(), false));
- EXPECT_TRUE(ContentSecurityPolicy::Allow(
- policy, CSPDirective::FrameSrc, GURL("https://not-example.com/"), false,
- false, &context, SourceLocation(), false));
-}
-
-TEST(ContentSecurityPolicy, RequestsAllowedWhenHostMixedCase) {
- CSPContextTest context;
- std::vector<std::string> report_end_points; // empty
- CSPSource source("https", "ExAmPle.com", false, url::PORT_UNSPECIFIED, false,
- "");
- CSPSourceList source_list(false, false, false, {source});
- ContentSecurityPolicy policy(
- EmptyCspHeader(), {CSPDirective(CSPDirective::DefaultSrc, source_list)},
- report_end_points, false);
-
- EXPECT_TRUE(ContentSecurityPolicy::Allow(
- policy, CSPDirective::FrameSrc, GURL("https://example.com/"), false,
- false, &context, SourceLocation(), false));
- EXPECT_FALSE(ContentSecurityPolicy::Allow(
- policy, CSPDirective::FrameSrc, GURL("https://not-example.com/"), false,
- false, &context, SourceLocation(), false));
-}
-
-TEST(ContentSecurityPolicy, FilesystemAllowedWhenBypassingCSP) {
- CSPContextTest context;
- std::vector<std::string> report_end_points; // empty
- CSPSource source("https", "example.com", false, url::PORT_UNSPECIFIED, false,
- "");
- CSPSourceList source_list(false, false, false, {source});
- ContentSecurityPolicy policy(
- EmptyCspHeader(), {CSPDirective(CSPDirective::DefaultSrc, source_list)},
- report_end_points, false);
-
- EXPECT_FALSE(ContentSecurityPolicy::Allow(
- policy, CSPDirective::FrameSrc,
- GURL("filesystem:https://example.com/file.txt"), false, false, &context,
- SourceLocation(), false));
- EXPECT_FALSE(ContentSecurityPolicy::Allow(
- policy, CSPDirective::FrameSrc,
- GURL("filesystem:https://not-example.com/file.txt"), false, false,
- &context, SourceLocation(), false));
-
- // Register 'https' as bypassing CSP, which should now bypass it entirely.
- context.AddSchemeToBypassCSP("https");
-
- EXPECT_TRUE(ContentSecurityPolicy::Allow(
- policy, CSPDirective::FrameSrc,
- GURL("filesystem:https://example.com/file.txt"), false, false, &context,
- SourceLocation(), false));
- EXPECT_TRUE(ContentSecurityPolicy::Allow(
- policy, CSPDirective::FrameSrc,
- GURL("filesystem:https://not-example.com/file.txt"), false, false,
- &context, SourceLocation(), false));
-}
-
-TEST(ContentSecurityPolicy, BlobAllowedWhenBypassingCSP) {
- CSPContextTest context;
- std::vector<std::string> report_end_points; // empty
- CSPSource source("https", "example.com", false, url::PORT_UNSPECIFIED, false,
- "");
- CSPSourceList source_list(false, false, false, {source});
- ContentSecurityPolicy policy(
- EmptyCspHeader(), {CSPDirective(CSPDirective::DefaultSrc, source_list)},
- report_end_points, false);
-
- EXPECT_FALSE(ContentSecurityPolicy::Allow(
- policy, CSPDirective::FrameSrc, GURL("blob:https://example.com/"), false,
- false, &context, SourceLocation(), false));
- EXPECT_FALSE(ContentSecurityPolicy::Allow(
- policy, CSPDirective::FrameSrc, GURL("blob:https://not-example.com/"),
- false, false, &context, SourceLocation(), false));
-
- // Register 'https' as bypassing CSP, which should now bypass it entirely.
- context.AddSchemeToBypassCSP("https");
-
- EXPECT_TRUE(ContentSecurityPolicy::Allow(
- policy, CSPDirective::FrameSrc, GURL("blob:https://example.com/"), false,
- false, &context, SourceLocation(), false));
- EXPECT_TRUE(ContentSecurityPolicy::Allow(
- policy, CSPDirective::FrameSrc, GURL("blob:https://not-example.com/"),
- false, false, &context, SourceLocation(), false));
-}
-
-TEST(ContentSecurityPolicy, ShouldUpgradeInsecureRequest) {
- std::vector<std::string> report_end_points; // empty
- CSPSource source("https", "example.com", false, url::PORT_UNSPECIFIED, false,
- "");
- CSPSourceList source_list(false, false, false, {source});
- ContentSecurityPolicy policy(
- EmptyCspHeader(), {CSPDirective(CSPDirective::DefaultSrc, source_list)},
- report_end_points, false);
-
- EXPECT_FALSE(ContentSecurityPolicy::ShouldUpgradeInsecureRequest(policy));
-
- policy.directives.push_back(
- CSPDirective(CSPDirective::UpgradeInsecureRequests, CSPSourceList()));
- EXPECT_TRUE(ContentSecurityPolicy::ShouldUpgradeInsecureRequest(policy));
-}
-
-TEST(ContentSecurityPolicy, NavigateToChecks) {
- CSPContextTest context;
- std::vector<std::string> report_end_points; // empty
- CSPSource example("https", "example.test", false, url::PORT_UNSPECIFIED,
- false, "");
- CSPSourceList none_source_list(false, false, false, {});
- CSPSourceList example_source_list(false, false, false, {example});
- CSPSourceList self_source_list(true, false, false, {});
- CSPSourceList redirects_source_list(false, false, true, {});
- CSPSourceList redirects_example_source_list(false, false, true, {example});
- context.SetSelf(example);
-
- struct TestCase {
- const CSPSourceList& navigate_to_list;
- const GURL& url;
- bool is_response_check;
- bool expected;
- bool is_form_submission;
- const CSPSourceList* form_action_list;
- } cases[] = {
- // Basic source matching.
- {none_source_list, GURL("https://example.test"), false, false, false,
- nullptr},
- {example_source_list, GURL("https://example.test"), false, true, false,
- nullptr},
- {example_source_list, GURL("https://not-example.test"), false, false,
- false, nullptr},
- {self_source_list, GURL("https://example.test"), false, true, false,
- nullptr},
-
- // Checking allow_redirect flag interactions.
- {redirects_source_list, GURL("https://example.test"), false, true, false,
- nullptr},
- {redirects_source_list, GURL("https://example.test"), true, false, false,
- nullptr},
- {redirects_example_source_list, GURL("https://example.test"), false, true,
- false, nullptr},
- {redirects_example_source_list, GURL("https://example.test"), true, true,
- false, nullptr},
-
- // Interaction with form-action
-
- // Form submission without form-action present
- {none_source_list, GURL("https://example.test"), false, false, true,
- nullptr},
- {example_source_list, GURL("https://example.test"), false, true, true,
- nullptr},
- {example_source_list, GURL("https://not-example.test"), false, false,
- true, nullptr},
- {self_source_list, GURL("https://example.test"), false, true, true,
- nullptr},
-
- // Form submission with form-action present
- {none_source_list, GURL("https://example.test"), false, true, true,
- &example_source_list},
- {example_source_list, GURL("https://example.test"), false, true, true,
- &example_source_list},
- {example_source_list, GURL("https://not-example.test"), false, true, true,
- &example_source_list},
- {self_source_list, GURL("https://example.test"), false, true, true,
- &example_source_list},
- };
-
- for (const auto& test : cases) {
- std::vector<CSPDirective> directives;
- directives.push_back(
- CSPDirective(CSPDirective::NavigateTo, test.navigate_to_list));
-
- if (test.form_action_list)
- directives.push_back(
- CSPDirective(CSPDirective::FormAction, *(test.form_action_list)));
-
- ContentSecurityPolicy policy(EmptyCspHeader(), directives,
- report_end_points, false);
-
- EXPECT_EQ(test.expected, ContentSecurityPolicy::Allow(
- policy, CSPDirective::NavigateTo, test.url,
- true, test.is_response_check, &context,
- SourceLocation(), test.is_form_submission));
- EXPECT_EQ(test.expected, ContentSecurityPolicy::Allow(
- policy, CSPDirective::NavigateTo, test.url,
- false, test.is_response_check, &context,
- SourceLocation(), test.is_form_submission));
- }
-}
-
-} // namespace content
diff --git a/chromium/content/common/content_security_policy/csp_context.cc b/chromium/content/common/content_security_policy/csp_context.cc
deleted file mode 100644
index 4fbd3a8ec22..00000000000
--- a/chromium/content/common/content_security_policy/csp_context.cc
+++ /dev/null
@@ -1,150 +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.
-
-#include "content/common/content_security_policy/csp_context.h"
-#include "content/public/common/origin_util.h"
-
-namespace content {
-
-namespace {
-
-// Helper function that returns true if |policy| should be checked under
-// |check_csp_disposition|.
-bool ShouldCheckPolicy(const ContentSecurityPolicy& policy,
- CSPContext::CheckCSPDisposition check_csp_disposition) {
- switch (check_csp_disposition) {
- case CSPContext::CHECK_REPORT_ONLY_CSP:
- return policy.header.type ==
- network::mojom::ContentSecurityPolicyType::kReport;
- case CSPContext::CHECK_ENFORCED_CSP:
- return policy.header.type ==
- network::mojom::ContentSecurityPolicyType::kEnforce;
- case CSPContext::CHECK_ALL_CSP:
- return true;
- }
- NOTREACHED();
- return true;
-}
-
-} // namespace
-
-CSPContext::CSPContext() {}
-CSPContext::~CSPContext() {}
-
-bool CSPContext::IsAllowedByCsp(CSPDirective::Name directive_name,
- const GURL& url,
- bool has_followed_redirect,
- bool is_response_check,
- const SourceLocation& source_location,
- CheckCSPDisposition check_csp_disposition,
- bool is_form_submission) {
- if (SchemeShouldBypassCSP(url.scheme_piece()))
- return true;
-
- bool allow = true;
- for (const auto& policy : policies_) {
- if (ShouldCheckPolicy(policy, check_csp_disposition)) {
- allow &= ContentSecurityPolicy::Allow(
- policy, directive_name, url, has_followed_redirect, is_response_check,
- this, source_location, is_form_submission);
- }
- }
-
- DCHECK(allow || check_csp_disposition != CSPContext::CHECK_REPORT_ONLY_CSP);
-
- return allow;
-}
-
-bool CSPContext::ShouldModifyRequestUrlForCsp(
- bool is_subresource_or_form_submission) {
- for (const auto& policy : policies_) {
- if (ContentSecurityPolicy::ShouldUpgradeInsecureRequest(policy) &&
- is_subresource_or_form_submission) {
- return true;
- }
- }
- return false;
-}
-
-void CSPContext::ModifyRequestUrlForCsp(GURL* url) {
- if (url->SchemeIs(url::kHttpScheme) && !IsOriginSecure(*url)) {
- // Updating the URL's scheme also implicitly updates the URL's port from 80
- // to 443 if needed.
- GURL::Replacements replacements;
- replacements.SetSchemeStr(url::kHttpsScheme);
- *url = url->ReplaceComponents(replacements);
- }
-}
-
-void CSPContext::SetSelf(const url::Origin origin) {
- self_source_.reset();
-
- // When the origin is unique, no URL should match with 'self'. That's why
- // |self_source_| stays undefined here.
- if (origin.opaque())
- return;
-
- if (origin.scheme() == url::kFileScheme) {
- self_source_ = CSPSource(url::kFileScheme, "", false, url::PORT_UNSPECIFIED,
- false, "");
- return;
- }
-
- self_source_ = CSPSource(
- origin.scheme(), origin.host(), false,
- origin.port() == 0 ? url::PORT_UNSPECIFIED : origin.port(), false, "");
-
- DCHECK_NE("", self_source_->scheme);
-}
-
-void CSPContext::SetSelf(const CSPSource& self_source) {
- self_source_ = self_source;
-}
-
-bool CSPContext::SchemeShouldBypassCSP(const base::StringPiece& scheme) {
- return false;
-}
-
-void CSPContext::SanitizeDataForUseInCspViolation(
- bool has_followed_redirect,
- CSPDirective::Name directive,
- GURL* blocked_url,
- SourceLocation* source_location) const {
- return;
-}
-
-void CSPContext::ReportContentSecurityPolicyViolation(
- const CSPViolationParams& violation_params) {
- return;
-}
-
-CSPViolationParams::CSPViolationParams() = default;
-
-CSPViolationParams::CSPViolationParams(
- const std::string& directive,
- const std::string& effective_directive,
- const std::string& console_message,
- const GURL& blocked_url,
- const std::vector<std::string>& report_endpoints,
- bool use_reporting_api,
- const std::string& header,
- network::mojom::ContentSecurityPolicyType disposition,
- bool after_redirect,
- const SourceLocation& source_location)
- : directive(directive),
- effective_directive(effective_directive),
- console_message(console_message),
- blocked_url(blocked_url),
- report_endpoints(report_endpoints),
- use_reporting_api(use_reporting_api),
- header(header),
- disposition(disposition),
- after_redirect(after_redirect),
- source_location(source_location) {}
-
-CSPViolationParams::CSPViolationParams(const CSPViolationParams& other) =
- default;
-CSPViolationParams::~CSPViolationParams() {}
-
-} // namespace content
diff --git a/chromium/content/common/content_security_policy/csp_context.h b/chromium/content/common/content_security_policy/csp_context.h
deleted file mode 100644
index 5e92515cfe0..00000000000
--- a/chromium/content/common/content_security_policy/csp_context.h
+++ /dev/null
@@ -1,161 +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 CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_CONTEXT_H_
-#define CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_CONTEXT_H_
-
-#include <vector>
-
-#include "base/optional.h"
-#include "content/common/content_export.h"
-#include "content/common/content_security_policy/content_security_policy.h"
-#include "content/common/content_security_policy_header.h"
-#include "content/common/navigation_params.h"
-#include "services/network/public/mojom/content_security_policy.mojom-forward.h"
-#include "url/gurl.h"
-#include "url/origin.h"
-
-namespace content {
-
-struct CSPViolationParams;
-
-// A CSPContext represents the system on which the Content-Security-Policy are
-// enforced. One must define via its virtual methods how to report violations
-// and what is the set of scheme that bypass the CSP. Its main implementation
-// is in content/browser/frame_host/render_frame_host_impl.h
-class CONTENT_EXPORT CSPContext {
- public:
- // This enum represents what set of policies should be checked by
- // IsAllowedByCsp().
- enum CheckCSPDisposition {
- // Only check report-only policies.
- CHECK_REPORT_ONLY_CSP,
- // Only check enforced policies. (Note that enforced policies can still
- // trigger reports.)
- CHECK_ENFORCED_CSP,
- // Check all policies.
- CHECK_ALL_CSP,
- };
-
- CSPContext();
- virtual ~CSPContext();
-
- // Check if an |url| is allowed by the set of Content-Security-Policy. It will
- // report any violation by:
- // * displaying a console message.
- // * triggering the "SecurityPolicyViolation" javascript event.
- // * sending a JSON report to any uri defined with the "report-uri" directive.
- // Returns true when the request can proceed, false otherwise.
- bool IsAllowedByCsp(CSPDirective::Name directive_name,
- const GURL& url,
- bool has_followed_redirect,
- bool is_response_check,
- const SourceLocation& source_location,
- CheckCSPDisposition check_csp_disposition,
- bool is_form_submission);
-
- // Returns true if the request URL needs to be modified (e.g. upgraded to
- // HTTPS) according to the CSP.
- bool ShouldModifyRequestUrlForCsp(bool is_suresource_or_form_submssion);
-
- // If the scheme of |url| is HTTP, this upgrades it to HTTPS, otherwise it
- // doesn't modify it.
- void ModifyRequestUrlForCsp(GURL* url);
-
- void SetSelf(const url::Origin origin);
- void SetSelf(const CSPSource& self_source);
-
- // When a CSPSourceList contains 'self', the url is allowed when it match the
- // CSPSource returned by this function.
- // Sometimes there is no 'self' source. It means that the current origin is
- // unique and no urls will match 'self' whatever they are.
- // Note: When there is a 'self' source, its scheme is guaranteed to be
- // non-empty.
- const base::Optional<CSPSource>& self_source() { return self_source_; }
-
- virtual void ReportContentSecurityPolicyViolation(
- const CSPViolationParams& violation_params);
-
- void ResetContentSecurityPolicies() { policies_.clear(); }
- void AddContentSecurityPolicy(const ContentSecurityPolicy& policy) {
- policies_.push_back(policy);
- }
-
- virtual bool SchemeShouldBypassCSP(const base::StringPiece& scheme);
-
- // For security reasons, some urls must not be disclosed cross-origin in
- // violation reports. This includes the blocked url and the url of the
- // initiator of the navigation. This information is potentially transmitted
- // between different renderer processes.
- // TODO(arthursonzogni): Stop hiding sensitive parts of URLs in console error
- // messages as soon as there is a way to send them to the devtools process
- // without the round trip in the renderer process.
- // See https://crbug.com/721329
- virtual void SanitizeDataForUseInCspViolation(
- bool has_followed_redirect,
- CSPDirective::Name directive,
- GURL* blocked_url,
- SourceLocation* source_location) const;
-
- private:
- base::Optional<CSPSource> self_source_;
- std::vector<ContentSecurityPolicy> policies_;
-
- DISALLOW_COPY_AND_ASSIGN(CSPContext);
-};
-
-// Used in CSPContext::ReportViolation()
-struct CONTENT_EXPORT CSPViolationParams {
- CSPViolationParams();
- CSPViolationParams(const std::string& directive,
- const std::string& effective_directive,
- const std::string& console_message,
- const GURL& blocked_url,
- const std::vector<std::string>& report_endpoints,
- bool use_reporting_api,
- const std::string& header,
- network::mojom::ContentSecurityPolicyType disposition,
- bool after_redirect,
- const SourceLocation& source_location);
- CSPViolationParams(const CSPViolationParams& other);
- ~CSPViolationParams();
-
- // The name of the directive that violates the policy. |directive| might be a
- // directive that serves as a fallback to the |effective_directive|.
- std::string directive;
-
- // The name the effective directive that was checked against.
- std::string effective_directive;
-
- // The console message to be displayed to the user.
- std::string console_message;
-
- // The URL that was blocked by the policy.
- GURL blocked_url;
-
- // The set of endpoints where a report of the violation should be sent.
- // Based on 'use_reporting_api' it can be either a set of group_names (when
- // 'use_reporting_api' = true) or a set of URLs. This means that it's not
- // possible to use both methods of reporting. This is by design.
- std::vector<std::string> report_endpoints;
-
- // Whether to use the reporting api or not.
- bool use_reporting_api;
-
- // The raw content security policy header that was violated.
- std::string header;
-
- // Each policy has an associated disposition, which is either "enforce" or
- // "report".
- network::mojom::ContentSecurityPolicyType disposition;
-
- // Whether or not the violation happens after a redirect.
- bool after_redirect;
-
- // The source code location that triggered the blocked navigation.
- SourceLocation source_location;
-};
-
-} // namespace content
-#endif // CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_CONTEXT_H_
diff --git a/chromium/content/common/content_security_policy/csp_context_unittest.cc b/chromium/content/common/content_security_policy/csp_context_unittest.cc
deleted file mode 100644
index 50f6346f346..00000000000
--- a/chromium/content/common/content_security_policy/csp_context_unittest.cc
+++ /dev/null
@@ -1,312 +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.
-
-#include <set>
-
-#include "content/common/content_security_policy/csp_context.h"
-#include "content/common/content_security_policy_header.h"
-#include "content/common/navigation_params.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace content {
-
-namespace {
-
-class CSPContextTest : public CSPContext {
- public:
- const std::vector<CSPViolationParams>& violations() { return violations_; }
-
- void AddSchemeToBypassCSP(const std::string& scheme) {
- scheme_to_bypass_.insert(scheme);
- }
-
- bool SchemeShouldBypassCSP(const base::StringPiece& scheme) override {
- return scheme_to_bypass_.count(scheme.as_string());
- }
-
- void ClearViolations() { violations_.clear(); }
-
- void set_sanitize_data_for_use_in_csp_violation(bool value) {
- sanitize_data_for_use_in_csp_violation_ = value;
- }
-
- void SanitizeDataForUseInCspViolation(
- bool is_redirect,
- CSPDirective::Name directive,
- GURL* blocked_url,
- SourceLocation* source_location) const override {
- if (!sanitize_data_for_use_in_csp_violation_)
- return;
- *blocked_url = blocked_url->GetOrigin();
- *source_location =
- SourceLocation(GURL(source_location->url).GetOrigin().spec(), 0u, 0u);
- }
-
- private:
- void ReportContentSecurityPolicyViolation(
- const CSPViolationParams& violation_params) override {
- violations_.push_back(violation_params);
- }
- std::vector<CSPViolationParams> violations_;
- std::set<std::string> scheme_to_bypass_;
- bool sanitize_data_for_use_in_csp_violation_ = false;
-};
-
-// Build a new policy made of only one directive and no report endpoints.
-ContentSecurityPolicy BuildPolicy(CSPDirective::Name directive_name,
- std::vector<CSPSource> sources) {
- return ContentSecurityPolicy(
- ContentSecurityPolicyHeader(
- std::string(), // header
- network::mojom::ContentSecurityPolicyType::kEnforce,
- network::mojom::ContentSecurityPolicySource::kHTTP),
- {CSPDirective(directive_name,
- CSPSourceList(false, false, false, sources))},
- std::vector<std::string>(), false); // report_end_points
-}
-
-} // namespace
-
-TEST(CSPContextTest, SchemeShouldBypassCSP) {
- CSPSource source("", "example.com", false, url::PORT_UNSPECIFIED, false, "");
- CSPContextTest context;
- context.AddContentSecurityPolicy(
- BuildPolicy(CSPDirective::DefaultSrc, {source}));
-
- EXPECT_FALSE(context.IsAllowedByCsp(
- CSPDirective::FrameSrc, GURL("data:text/html,<html></html>"), false,
- false, SourceLocation(), CSPContext::CHECK_ALL_CSP, false));
-
- context.AddSchemeToBypassCSP("data");
-
- EXPECT_TRUE(context.IsAllowedByCsp(
- CSPDirective::FrameSrc, GURL("data:text/html,<html></html>"), false,
- false, SourceLocation(), CSPContext::CHECK_ALL_CSP, false));
-}
-
-TEST(CSPContextTest, MultiplePolicies) {
- CSPContextTest context;
- context.SetSelf(url::Origin::Create(GURL("http://example.com")));
-
- CSPSource source_a("", "a.com", false, url::PORT_UNSPECIFIED, false, "");
- CSPSource source_b("", "b.com", false, url::PORT_UNSPECIFIED, false, "");
- CSPSource source_c("", "c.com", false, url::PORT_UNSPECIFIED, false, "");
-
- context.AddContentSecurityPolicy(
- BuildPolicy(CSPDirective::FrameSrc, {source_a, source_b}));
- context.AddContentSecurityPolicy(
- BuildPolicy(CSPDirective::FrameSrc, {source_a, source_c}));
-
- EXPECT_TRUE(context.IsAllowedByCsp(
- CSPDirective::FrameSrc, GURL("http://a.com"), false, false,
- SourceLocation(), CSPContext::CHECK_ALL_CSP, false));
- EXPECT_FALSE(context.IsAllowedByCsp(
- CSPDirective::FrameSrc, GURL("http://b.com"), false, false,
- SourceLocation(), CSPContext::CHECK_ALL_CSP, false));
- EXPECT_FALSE(context.IsAllowedByCsp(
- CSPDirective::FrameSrc, GURL("http://c.com"), false, false,
- SourceLocation(), CSPContext::CHECK_ALL_CSP, false));
- EXPECT_FALSE(context.IsAllowedByCsp(
- CSPDirective::FrameSrc, GURL("http://d.com"), false, false,
- SourceLocation(), CSPContext::CHECK_ALL_CSP, false));
-}
-
-TEST(CSPContextTest, SanitizeDataForUseInCspViolation) {
- CSPContextTest context;
- context.SetSelf(url::Origin::Create(GURL("http://a.com")));
-
- // Content-Security-Policy: frame-src "a.com/iframe"
- context.AddContentSecurityPolicy(
- BuildPolicy(CSPDirective::FrameSrc,
- {CSPSource("", "a.com", false, url::PORT_UNSPECIFIED, false,
- "/iframe")}));
-
- GURL blocked_url("http://a.com/login?password=1234");
- SourceLocation source_location("http://a.com/login", 10u, 20u);
-
- // When the |blocked_url| and |source_location| aren't sensitive information.
- {
- EXPECT_FALSE(context.IsAllowedByCsp(CSPDirective::FrameSrc, blocked_url,
- false, false, source_location,
- CSPContext::CHECK_ALL_CSP, false));
- ASSERT_EQ(1u, context.violations().size());
- EXPECT_EQ(context.violations()[0].blocked_url, blocked_url);
- EXPECT_EQ(context.violations()[0].source_location.url,
- "http://a.com/login");
- EXPECT_EQ(context.violations()[0].source_location.line_number, 10u);
- EXPECT_EQ(context.violations()[0].source_location.column_number, 20u);
- EXPECT_EQ(context.violations()[0].console_message,
- "Refused to frame 'http://a.com/login?password=1234' because it "
- "violates the following Content Security Policy directive: "
- "\"frame-src a.com/iframe\".\n");
- }
-
- context.set_sanitize_data_for_use_in_csp_violation(true);
-
- // When the |blocked_url| and |source_location| are sensitive information.
- {
- EXPECT_FALSE(context.IsAllowedByCsp(CSPDirective::FrameSrc, blocked_url,
- false, false, source_location,
- CSPContext::CHECK_ALL_CSP, false));
- ASSERT_EQ(2u, context.violations().size());
- EXPECT_EQ(context.violations()[1].blocked_url, blocked_url.GetOrigin());
- EXPECT_EQ(context.violations()[1].source_location.url, "http://a.com/");
- EXPECT_EQ(context.violations()[1].source_location.line_number, 0u);
- EXPECT_EQ(context.violations()[1].source_location.column_number, 0u);
- EXPECT_EQ(context.violations()[1].console_message,
- "Refused to frame 'http://a.com/' because it violates the "
- "following Content Security Policy directive: \"frame-src "
- "a.com/iframe\".\n");
- }
-}
-
-// When several policies are infringed, all of them must be reported.
-TEST(CSPContextTest, MultipleInfringement) {
- CSPContextTest context;
- context.SetSelf(url::Origin::Create(GURL("http://example.com")));
-
- CSPSource source_a("", "a.com", false, url::PORT_UNSPECIFIED, false, "");
- CSPSource source_b("", "b.com", false, url::PORT_UNSPECIFIED, false, "");
- CSPSource source_c("", "c.com", false, url::PORT_UNSPECIFIED, false, "");
-
- context.AddContentSecurityPolicy(
- BuildPolicy(CSPDirective::FrameSrc, {source_a}));
- context.AddContentSecurityPolicy(
- BuildPolicy(CSPDirective::FrameSrc, {source_b}));
- context.AddContentSecurityPolicy(
- BuildPolicy(CSPDirective::FrameSrc, {source_c}));
-
- EXPECT_FALSE(context.IsAllowedByCsp(
- CSPDirective::FrameSrc, GURL("http://c.com"), false, false,
- SourceLocation(), CSPContext::CHECK_ALL_CSP, false));
- ASSERT_EQ(2u, context.violations().size());
- const char console_message_a[] =
- "Refused to frame 'http://c.com/' because it violates the following "
- "Content Security Policy directive: \"frame-src a.com\".\n";
- const char console_message_b[] =
- "Refused to frame 'http://c.com/' because it violates the following "
- "Content Security Policy directive: \"frame-src b.com\".\n";
- EXPECT_EQ(console_message_a, context.violations()[0].console_message);
- EXPECT_EQ(console_message_b, context.violations()[1].console_message);
-}
-
-// Tests that the CheckCSPDisposition parameter is obeyed.
-TEST(CSPContextTest, CheckCSPDisposition) {
- CSPSource source("", "example.com", false, url::PORT_UNSPECIFIED, false, "");
- CSPContextTest context;
-
- // Add an enforced policy.
- context.AddContentSecurityPolicy(
- BuildPolicy(CSPDirective::FrameSrc, {source}));
-
- // Add a report-only policy.
- ContentSecurityPolicy report_only =
- BuildPolicy(CSPDirective::DefaultSrc, {source});
- report_only.header.type = network::mojom::ContentSecurityPolicyType::kReport;
- context.AddContentSecurityPolicy(report_only);
-
- // With CHECK_ALL_CSP, both policies should be checked and violations should
- // be reported.
- EXPECT_FALSE(context.IsAllowedByCsp(
- CSPDirective::FrameSrc, GURL("https://not-example.com"), false, false,
- SourceLocation(), CSPContext::CHECK_ALL_CSP, false));
- ASSERT_EQ(2u, context.violations().size());
- const char console_message_a[] =
- "Refused to frame 'https://not-example.com/' because it violates the "
- "following "
- "Content Security Policy directive: \"frame-src example.com\".\n";
- const char console_message_b[] =
- "[Report Only] Refused to frame 'https://not-example.com/' because it "
- "violates the following "
- "Content Security Policy directive: \"default-src example.com\". Note "
- "that 'frame-src' was not explicitly set, so 'default-src' is used as a "
- "fallback.\n";
- // Both console messages must appear in the reported violations.
- EXPECT_TRUE((console_message_a == context.violations()[0].console_message &&
- console_message_b == context.violations()[1].console_message) ||
- (console_message_a == context.violations()[1].console_message &&
- console_message_b == context.violations()[0].console_message));
-
- // With CHECK_REPORT_ONLY_CSP, the request should be allowed but reported.
- context.ClearViolations();
- EXPECT_TRUE(context.IsAllowedByCsp(
- CSPDirective::FrameSrc, GURL("https://not-example.com"), false, false,
- SourceLocation(), CSPContext::CHECK_REPORT_ONLY_CSP, false));
- ASSERT_EQ(1u, context.violations().size());
- EXPECT_EQ(console_message_b, context.violations()[0].console_message);
-
- // With CHECK_ENFORCED_CSP, the request should be blocked and only the
- // enforced policy violation should be reported.
- context.ClearViolations();
- EXPECT_FALSE(context.IsAllowedByCsp(
- CSPDirective::FrameSrc, GURL("https://not-example.com"), false, false,
- SourceLocation(), CSPContext::CHECK_ENFORCED_CSP, false));
- ASSERT_EQ(1u, context.violations().size());
- EXPECT_EQ(console_message_a, context.violations()[0].console_message);
-}
-
-// Tests HTTP subresources and form submissions have their URLs upgraded when
-// upgrade-insecure-requests is present.
-TEST(CSPContextTest, ShouldModifyRequestUrlForCsp) {
- CSPContextTest context;
- context.AddContentSecurityPolicy(BuildPolicy(
- CSPDirective::UpgradeInsecureRequests, std::vector<CSPSource>()));
- // An HTTP subresource or form submission should be upgraded.
- EXPECT_TRUE(context.ShouldModifyRequestUrlForCsp(true));
-
- // Main-frame navigation requests should not be modified.
- EXPECT_FALSE(context.ShouldModifyRequestUrlForCsp(false));
-}
-
-// Tests that URLs passed to ModifyRequestUrlForCsp are modified according to
-// the spec for upgrades.
-TEST(CSPContextTest, ModifyRequestUrlForCsp) {
- CSPContextTest context;
- GURL test_url;
-
- test_url = GURL("http://example.com");
- context.ModifyRequestUrlForCsp(&test_url);
- EXPECT_EQ(GURL("https://example.com"), test_url);
-
- test_url = GURL("http://example.com:80");
- context.ModifyRequestUrlForCsp(&test_url);
- EXPECT_EQ(GURL("https://example.com:443"), test_url);
-
- // Non-standard ports should not be modified.
- test_url = GURL("http://example-weird-port.com:8088");
- context.ModifyRequestUrlForCsp(&test_url);
- EXPECT_EQ(GURL("https://example-weird-port.com:8088"), test_url);
-
- // Trusted Non-HTTPS URLs don't need to be modified.
- test_url = GURL("http://127.0.0.1");
- context.ModifyRequestUrlForCsp(&test_url);
- EXPECT_EQ(GURL("http://127.0.0.1"), test_url);
-
- test_url = GURL("http://127.0.0.8");
- context.ModifyRequestUrlForCsp(&test_url);
- EXPECT_EQ(GURL("http://127.0.0.8"), test_url);
-
- test_url = GURL("http://localhost");
- context.ModifyRequestUrlForCsp(&test_url);
- EXPECT_EQ(GURL("http://localhost"), test_url);
-
- test_url = GURL("http://sub.localhost");
- context.ModifyRequestUrlForCsp(&test_url);
- EXPECT_EQ(GURL("http://sub.localhost"), test_url);
-
- // Non-HTTP URLs don't need to be modified.
- test_url = GURL("https://example.com");
- context.ModifyRequestUrlForCsp(&test_url);
- EXPECT_EQ(GURL("https://example.com"), test_url);
-
- test_url = GURL("data:text/html,<html></html>");
- context.ModifyRequestUrlForCsp(&test_url);
- EXPECT_EQ(GURL("data:text/html,<html></html>"), test_url);
-
- test_url = GURL("weird-scheme://this.is.a.url");
- context.ModifyRequestUrlForCsp(&test_url);
- EXPECT_EQ(GURL("weird-scheme://this.is.a.url"), test_url);
-}
-
-} // namespace content
diff --git a/chromium/content/common/content_security_policy/csp_directive.cc b/chromium/content/common/content_security_policy/csp_directive.cc
deleted file mode 100644
index 8830ac82f45..00000000000
--- a/chromium/content/common/content_security_policy/csp_directive.cc
+++ /dev/null
@@ -1,68 +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.
-
-#include "content/common/content_security_policy/csp_directive.h"
-#include "services/network/public/mojom/content_security_policy.mojom.h"
-
-namespace content {
-
-CSPDirective::CSPDirective() = default;
-
-CSPDirective::CSPDirective(Name name, const CSPSourceList& source_list)
- : name(name), source_list(source_list) {}
-
-CSPDirective::CSPDirective(const CSPDirective&) = default;
-
-CSPDirective::CSPDirective(network::mojom::CSPDirectivePtr directive)
- : name(static_cast<Name>(directive->name)),
- source_list(std::move(directive->source_list)) {}
-
-std::string CSPDirective::ToString() const {
- return NameToString(name) + " " + source_list.ToString();
-}
-
-// static
-std::string CSPDirective::NameToString(CSPDirective::Name name) {
- switch (name) {
- case DefaultSrc:
- return "default-src";
- case ChildSrc:
- return "child-src";
- case FrameSrc:
- return "frame-src";
- case FormAction:
- return "form-action";
- case UpgradeInsecureRequests:
- return "upgrade-insecure-requests";
- case NavigateTo:
- return "navigate-to";
- case FrameAncestors:
- return "frame-ancestors";
- case Unknown:
- return "";
- }
- NOTREACHED();
- return "";
-}
-
-// static
-CSPDirective::Name CSPDirective::StringToName(const std::string& name) {
- if (name == "default-src")
- return CSPDirective::DefaultSrc;
- if (name == "child-src")
- return CSPDirective::ChildSrc;
- if (name == "frame-src")
- return CSPDirective::FrameSrc;
- if (name == "form-action")
- return CSPDirective::FormAction;
- if (name == "upgrade-insecure-requests")
- return CSPDirective::UpgradeInsecureRequests;
- if (name == "navigate-to")
- return CSPDirective::NavigateTo;
- if (name == "frame-ancestors")
- return CSPDirective::FrameAncestors;
- return CSPDirective::Unknown;
-}
-
-} // namespace content
diff --git a/chromium/content/common/content_security_policy/csp_directive.h b/chromium/content/common/content_security_policy/csp_directive.h
deleted file mode 100644
index e0b31d0be31..00000000000
--- a/chromium/content/common/content_security_policy/csp_directive.h
+++ /dev/null
@@ -1,52 +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 CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_DIRECTIVE_
-#define CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_DIRECTIVE_
-
-#include <string>
-#include "content/common/content_export.h"
-#include "content/common/content_security_policy/csp_source_list.h"
-
-namespace content {
-
-// CSPDirective contains a set of allowed sources for a given Content Security
-// Policy directive.
-//
-// For example, the Content Security Policy `default-src img.cdn.com
-// example.com` would produce a CSPDirective object whose 'name' is
-// 'DefaultSrc', and whose 'source_list' contains two CSPSourceExpressions
-// representing 'img.cdn.com' and 'example.com' respectively.
-//
-// https://w3c.github.io/webappsec-csp/#framework-directives
-struct CONTENT_EXPORT CSPDirective {
- enum Name {
- DefaultSrc,
- ChildSrc,
- FrameSrc,
- FormAction,
- UpgradeInsecureRequests,
- NavigateTo,
- FrameAncestors,
-
- Unknown,
- NameLast = Unknown,
- };
-
- static std::string NameToString(Name name);
- static Name StringToName(const std::string& name);
-
- CSPDirective();
- CSPDirective(Name name, const CSPSourceList& source_list);
- CSPDirective(const CSPDirective&);
- explicit CSPDirective(network::mojom::CSPDirectivePtr directive);
-
- Name name;
- CSPSourceList source_list;
-
- std::string ToString() const;
-};
-
-} // namespace content
-#endif // CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_DIRECTIVE_
diff --git a/chromium/content/common/content_security_policy/csp_disposition_enum.h b/chromium/content/common/content_security_policy/csp_disposition_enum.h
deleted file mode 100644
index 8faf3d9863c..00000000000
--- a/chromium/content/common/content_security_policy/csp_disposition_enum.h
+++ /dev/null
@@ -1,19 +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 CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_DISPOSITION_ENUM_
-#define CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_DISPOSITION_ENUM_
-
-namespace content {
-
-// Whether or not the Content Security Policy should be enforced.
-enum class CSPDisposition {
- DO_NOT_CHECK,
- CHECK,
-
- LAST = CHECK
-};
-
-} // namespace content
-#endif // CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_DISPOSITION_ENUM_
diff --git a/chromium/content/common/content_security_policy/csp_source.cc b/chromium/content/common/content_security_policy/csp_source.cc
deleted file mode 100644
index 0e6dc3fb2e8..00000000000
--- a/chromium/content/common/content_security_policy/csp_source.cc
+++ /dev/null
@@ -1,257 +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.
-
-#include <sstream>
-
-#include "content/common/content_security_policy/csp_source.h"
-
-#include "base/strings/string_util.h"
-#include "base/strings/utf_string_conversions.h"
-#include "content/common/content_security_policy/csp_context.h"
-#include "services/network/public/mojom/content_security_policy.mojom.h"
-#include "url/url_canon.h"
-#include "url/url_util.h"
-
-namespace content {
-
-namespace {
-
-bool DecodePath(const base::StringPiece& path, std::string* output) {
- url::RawCanonOutputT<base::char16> unescaped;
- url::DecodeURLEscapeSequences(path.data(), path.size(),
- url::DecodeURLMode::kUTF8OrIsomorphic,
- &unescaped);
- return base::UTF16ToUTF8(unescaped.data(), unescaped.length(), output);
-}
-
-int DefaultPortForScheme(const std::string& scheme) {
- return url::DefaultPortForScheme(scheme.data(), scheme.size());
-}
-
-// NotMatching is the only negative member, the rest are different types of
-// matches. NotMatching should always be 0 to let if statements work nicely
-enum class PortMatchingResult {
- NotMatching,
- MatchingWildcard,
- MatchingUpgrade,
- MatchingExact
-};
-enum class SchemeMatchingResult { NotMatching, MatchingUpgrade, MatchingExact };
-
-SchemeMatchingResult SourceAllowScheme(const CSPSource& source,
- const GURL& url,
- CSPContext* context) {
- // The source doesn't specify a scheme and the current origin is unique. In
- // this case, the url doesn't match regardless of its scheme.
- if (source.scheme.empty() && !context->self_source())
- return SchemeMatchingResult::NotMatching;
-
- // |allowed_scheme| is guaranteed to be non-empty.
- const std::string& allowed_scheme =
- source.scheme.empty() ? context->self_source()->scheme : source.scheme;
-
- if (url.SchemeIs(allowed_scheme))
- return SchemeMatchingResult::MatchingExact;
-
- // Implicitly allow using a more secure version of a protocol when the
- // non-secure one is allowed.
- if ((allowed_scheme == url::kHttpScheme && url.SchemeIs(url::kHttpsScheme)) ||
- (allowed_scheme == url::kWsScheme && url.SchemeIs(url::kWssScheme))) {
- return SchemeMatchingResult::MatchingUpgrade;
- }
- return SchemeMatchingResult::NotMatching;
-}
-
-bool SourceAllowHost(const CSPSource& source, const GURL& url) {
- if (source.is_host_wildcard) {
- if (source.host.empty())
- return true;
- // TODO(arthursonzogni): Chrome used to, incorrectly, match *.x.y to x.y.
- // The renderer version of this function counts how many times it happens.
- // It might be useful to do it outside of blink too.
- // See third_party/blink/renderer/core/frame/csp/csp_source.cc
- return base::EndsWith(url.host(), '.' + source.host,
- base::CompareCase::INSENSITIVE_ASCII);
- } else {
- return base::EqualsCaseInsensitiveASCII(url.host(), source.host);
- }
-}
-
-PortMatchingResult SourceAllowPort(const CSPSource& source, const GURL& url) {
- int url_port = url.EffectiveIntPort();
-
- if (source.is_port_wildcard)
- return PortMatchingResult::MatchingWildcard;
-
- if (source.port == url_port) {
- if (source.port == url::PORT_UNSPECIFIED)
- return PortMatchingResult::MatchingWildcard;
- return PortMatchingResult::MatchingExact;
- }
-
- if (source.port == url::PORT_UNSPECIFIED) {
- if (DefaultPortForScheme(url.scheme()) == url_port) {
- return PortMatchingResult::MatchingWildcard;
- }
- return PortMatchingResult::NotMatching;
- }
-
- int source_port = source.port;
- if (source_port == url::PORT_UNSPECIFIED)
- source_port = DefaultPortForScheme(source.scheme);
-
- if (source_port == 80 && url_port == 443)
- return PortMatchingResult::MatchingUpgrade;
-
- return PortMatchingResult::NotMatching;
-}
-
-bool SourceAllowPath(const CSPSource& source,
- const GURL& url,
- bool has_followed_redirect) {
- if (has_followed_redirect)
- return true;
-
- if (source.path.empty() || url.path().empty())
- return true;
-
- std::string url_path;
- if (!DecodePath(url.path(), &url_path)) {
- // TODO(arthursonzogni): try to figure out if that could happen and how to
- // handle it.
- return false;
- }
-
- // If the path represents a directory.
- if (base::EndsWith(source.path, "/", base::CompareCase::SENSITIVE))
- return base::StartsWith(url_path, source.path,
- base::CompareCase::SENSITIVE);
-
- // The path represents a file.
- return source.path == url_path;
-}
-
-bool inline requiresUpgrade(const PortMatchingResult result) {
- return result == PortMatchingResult::MatchingUpgrade;
-}
-bool inline requiresUpgrade(const SchemeMatchingResult result) {
- return result == SchemeMatchingResult::MatchingUpgrade;
-}
-bool inline canUpgrade(const PortMatchingResult result) {
- return result == PortMatchingResult::MatchingUpgrade ||
- result == PortMatchingResult::MatchingWildcard;
-}
-bool inline canUpgrade(const SchemeMatchingResult result) {
- return result == SchemeMatchingResult::MatchingUpgrade;
-}
-
-} // namespace
-
-CSPSource::CSPSource()
- : scheme(),
- host(),
- is_host_wildcard(false),
- port(url::PORT_UNSPECIFIED),
- is_port_wildcard(false),
- path() {}
-
-CSPSource::CSPSource(const std::string& scheme,
- const std::string& host,
- bool is_host_wildcard,
- int port,
- bool is_port_wildcard,
- const std::string& path)
- : scheme(scheme),
- host(host),
- is_host_wildcard(is_host_wildcard),
- port(port),
- is_port_wildcard(is_port_wildcard),
- path(path) {
- DCHECK(!HasPort() || HasHost()); // port => host
- DCHECK(!HasPath() || HasHost()); // path => host
- DCHECK(!is_port_wildcard || port == url::PORT_UNSPECIFIED);
-}
-
-CSPSource::CSPSource(network::mojom::CSPSourcePtr csp_source)
- : CSPSource(csp_source->scheme,
- csp_source->host,
- csp_source->is_host_wildcard,
- csp_source->port,
- csp_source->is_port_wildcard,
- csp_source->path) {}
-
-CSPSource::CSPSource(const CSPSource& source) = default;
-CSPSource::~CSPSource() = default;
-
-// static
-bool CSPSource::Allow(const CSPSource& source,
- const GURL& url,
- CSPContext* context,
- bool has_followed_redirect) {
- if (source.IsSchemeOnly())
- return SourceAllowScheme(source, url, context) !=
- SchemeMatchingResult::NotMatching;
-
- PortMatchingResult portResult = SourceAllowPort(source, url);
- SchemeMatchingResult schemeResult = SourceAllowScheme(source, url, context);
-
- if (requiresUpgrade(schemeResult) && !canUpgrade(portResult))
- return false;
- if (requiresUpgrade(portResult) && !canUpgrade(schemeResult))
- return false;
-
- return schemeResult != SchemeMatchingResult::NotMatching &&
- SourceAllowHost(source, url) &&
- portResult != PortMatchingResult::NotMatching &&
- SourceAllowPath(source, url, has_followed_redirect);
-}
-
-std::string CSPSource::ToString() const {
- // scheme
- if (IsSchemeOnly())
- return scheme + ":";
-
- std::stringstream text;
- if (!scheme.empty())
- text << scheme << "://";
-
- // host
- if (is_host_wildcard) {
- if (host.empty())
- text << "*";
- else
- text << "*." << host;
- } else {
- text << host;
- }
-
- // port
- if (is_port_wildcard)
- text << ":*";
- if (port != url::PORT_UNSPECIFIED)
- text << ":" << port;
-
- // path
- text << path;
-
- return text.str();
-}
-
-bool CSPSource::IsSchemeOnly() const {
- return !HasHost();
-}
-
-bool CSPSource::HasPort() const {
- return port != url::PORT_UNSPECIFIED || is_port_wildcard;
-}
-
-bool CSPSource::HasHost() const {
- return !host.empty() || is_host_wildcard;
-}
-
-bool CSPSource::HasPath() const {
- return !path.empty();
-}
-
-} // namespace content
diff --git a/chromium/content/common/content_security_policy/csp_source.h b/chromium/content/common/content_security_policy/csp_source.h
deleted file mode 100644
index 101f808322d..00000000000
--- a/chromium/content/common/content_security_policy/csp_source.h
+++ /dev/null
@@ -1,68 +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 CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_SOURCE_H_
-#define CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_SOURCE_H_
-
-#include <string>
-
-#include "content/common/content_export.h"
-#include "services/network/public/mojom/content_security_policy.mojom-forward.h"
-#include "url/gurl.h"
-
-namespace content {
-
-class CSPContext;
-
-// A CSPSource represents an expression that matches a set of urls.
-// Examples of CSPSource:
-// - domain.example.com
-// - *.example.com
-// - https://cdn.com
-// - data:
-// - 'none'
-// - 'self'
-// - *
-struct CONTENT_EXPORT CSPSource {
- CSPSource();
- CSPSource(const std::string& scheme,
- const std::string& host,
- bool is_host_wildcard,
- int port,
- bool is_port_wildcard,
- const std::string& path);
- explicit CSPSource(network::mojom::CSPSourcePtr csp_source);
- CSPSource(const CSPSource& source);
- ~CSPSource();
-
- // Scheme.
- std::string scheme;
-
- // Host.
- std::string host;
- bool is_host_wildcard;
-
- // port.
- int port;
- bool is_port_wildcard;
-
- // Path.
- std::string path;
-
- std::string ToString() const;
-
- bool IsSchemeOnly() const;
- bool HasPort() const;
- bool HasHost() const;
- bool HasPath() const;
-
- // Returns true if the |source| matches the |url| for a given |context|.
- static bool Allow(const CSPSource& source,
- const GURL& url,
- CSPContext* context,
- bool has_followed_redirect = false);
-};
-
-} // namespace content
-#endif // CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_SOURCE_H_
diff --git a/chromium/content/common/content_security_policy/csp_source_list.cc b/chromium/content/common/content_security_policy/csp_source_list.cc
deleted file mode 100644
index a43d8e50124..00000000000
--- a/chromium/content/common/content_security_policy/csp_source_list.cc
+++ /dev/null
@@ -1,119 +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.
-
-#include "content/common/content_security_policy/csp_context.h"
-
-namespace content {
-
-namespace {
-
-bool AllowFromSources(const GURL& url,
- const std::vector<CSPSource>& sources,
- CSPContext* context,
- bool has_followed_redirect) {
- for (const CSPSource& source : sources) {
- if (CSPSource::Allow(source, url, context, has_followed_redirect))
- return true;
- }
- return false;
-}
-
-} // namespace
-
-CSPSourceList::CSPSourceList()
- : allow_self(false),
- allow_star(false),
- allow_response_redirects(false),
- sources() {}
-
-CSPSourceList::CSPSourceList(bool allow_self,
- bool allow_star,
- bool allow_response_redirects,
- std::vector<CSPSource> sources)
- : allow_self(allow_self),
- allow_star(allow_star),
- allow_response_redirects(allow_response_redirects),
- sources(sources) {}
-
-CSPSourceList::CSPSourceList(network::mojom::CSPSourceListPtr csp_source_list)
- : allow_self(csp_source_list->allow_self),
- allow_star(csp_source_list->allow_star),
- // TODO(arthursonzogni): Add the allow_response_redirect to the network
- // CSPSourceList struct.
- allow_response_redirects(true) {
- for (auto& source : csp_source_list->sources)
- sources.push_back(CSPSource(std::move(source)));
-}
-
-CSPSourceList::CSPSourceList(const CSPSourceList&) = default;
-CSPSourceList::~CSPSourceList() = default;
-
-// static
-bool CSPSourceList::Allow(const CSPSourceList& source_list,
- const GURL& url,
- CSPContext* context,
- bool has_followed_redirect,
- bool is_response_check) {
- // If the source list allows all redirects, the decision can't be made until
- // the response is received.
- if (source_list.allow_response_redirects && !is_response_check)
- return true;
-
- // If the source list does not allow all redirects, the decision has already
- // been made when checking the request.
- if (!source_list.allow_response_redirects && is_response_check)
- return true;
-
- // Wildcards match network schemes ('http', 'https', 'ftp', 'ws', 'wss'), and
- // the scheme of the protected resource:
- // https://w3c.github.io/webappsec-csp/#match-url-to-source-expression. Other
- // schemes, including custom schemes, must be explicitly listed in a source
- // list.
- if (source_list.allow_star) {
- if (url.SchemeIsHTTPOrHTTPS() || url.SchemeIsWSOrWSS() ||
- url.SchemeIs("ftp")) {
- return true;
- }
- if (context->self_source() && url.SchemeIs(context->self_source()->scheme))
- return true;
- }
-
- if (source_list.allow_self && context->self_source() &&
- CSPSource::Allow(context->self_source().value(), url, context,
- has_followed_redirect)) {
- return true;
- }
-
- return AllowFromSources(url, source_list.sources, context,
- has_followed_redirect);
-}
-
-std::string CSPSourceList::ToString() const {
- if (IsNone())
- return "'none'";
- if (allow_star)
- return "*";
-
- bool is_empty = true;
- std::stringstream text;
- if (allow_self) {
- text << "'self'";
- is_empty = false;
- }
-
- for (const auto& source : sources) {
- if (!is_empty)
- text << " ";
- text << source.ToString();
- is_empty = false;
- }
-
- return text.str();
-}
-
-bool CSPSourceList::IsNone() const {
- return !allow_self && !allow_star && sources.empty();
-}
-
-} // namespace content
diff --git a/chromium/content/common/content_security_policy/csp_source_list.h b/chromium/content/common/content_security_policy/csp_source_list.h
deleted file mode 100644
index 47726ad3dcb..00000000000
--- a/chromium/content/common/content_security_policy/csp_source_list.h
+++ /dev/null
@@ -1,49 +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 CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_SOURCE_LIST_H_
-#define CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_SOURCE_LIST_H_
-
-#include <vector>
-
-#include "content/common/content_security_policy/csp_source.h"
-#include "services/network/public/mojom/content_security_policy.mojom-forward.h"
-#include "url/gurl.h"
-
-namespace content {
-
-class CSPContext;
-
-struct CONTENT_EXPORT CSPSourceList {
- CSPSourceList();
- CSPSourceList(bool allow_self,
- bool allow_star,
- bool allow_response_redirects,
- std::vector<CSPSource> source_list);
- explicit CSPSourceList(network::mojom::CSPSourceListPtr csp_source_list);
- CSPSourceList(const CSPSourceList&);
- ~CSPSourceList();
-
- // Wildcard hosts and 'self' aren't stored in source_list, but as attributes
- // on the source list itself.
- bool allow_self;
- bool allow_star;
- bool allow_response_redirects;
- std::vector<CSPSource> sources;
-
- std::string ToString() const;
-
- bool IsNone() const;
-
- // Return true when at least one source in the |source_list| matches the
- // |url| for a given |context|.
- static bool Allow(const CSPSourceList& source_list,
- const GURL& url,
- CSPContext* context,
- bool has_followed_redirect = false,
- bool is_response_check = false);
-};
-
-} // namespace content
-#endif // CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_SOURCE_LIST_H_
diff --git a/chromium/content/common/content_security_policy/csp_source_list_unittest.cc b/chromium/content/common/content_security_policy/csp_source_list_unittest.cc
deleted file mode 100644
index 009e53d0d33..00000000000
--- a/chromium/content/common/content_security_policy/csp_source_list_unittest.cc
+++ /dev/null
@@ -1,140 +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.
-
-#include "content/common/content_security_policy/csp_source_list.h"
-#include "content/common/content_security_policy/csp_context.h"
-#include "content/public/test/test_utils.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace content {
-
-namespace {
-
-// Allow() is an abbreviation of CSPSourceList::Allow(). Useful for writting
-// test expectations on one line.
-bool Allow(const CSPSourceList& source_list,
- const GURL& url,
- CSPContext* context,
- bool is_redirect = false,
- bool is_response_check = false) {
- return CSPSourceList::Allow(source_list, url, context, is_redirect,
- is_response_check);
-}
-
-} // namespace
-
-TEST(CSPSourceList, MultipleSource) {
- CSPContext context;
- context.SetSelf(url::Origin::Create(GURL("http://example.com")));
- CSPSourceList source_list(
- false, // allow_self
- false, // allow_star
- false, // allow_redirects
- {CSPSource("", "a.com", false, url::PORT_UNSPECIFIED, false, ""),
- CSPSource("", "b.com", false, url::PORT_UNSPECIFIED, false, "")});
- EXPECT_TRUE(Allow(source_list, GURL("http://a.com"), &context));
- EXPECT_TRUE(Allow(source_list, GURL("http://b.com"), &context));
- EXPECT_FALSE(Allow(source_list, GURL("http://c.com"), &context));
-}
-
-TEST(CSPSourceList, AllowStar) {
- CSPContext context;
- context.SetSelf(url::Origin::Create(GURL("http://example.com")));
- CSPSourceList source_list(false, // allow_self
- true, // allow_star
- false, // allow_redirects
- std::vector<CSPSource>()); // source_list
- EXPECT_TRUE(Allow(source_list, GURL("http://not-example.com"), &context));
- EXPECT_TRUE(Allow(source_list, GURL("https://not-example.com"), &context));
- EXPECT_TRUE(Allow(source_list, GURL("ws://not-example.com"), &context));
- EXPECT_TRUE(Allow(source_list, GURL("wss://not-example.com"), &context));
- EXPECT_TRUE(Allow(source_list, GURL("ftp://not-example.com"), &context));
-
- EXPECT_FALSE(Allow(source_list, GURL("file://not-example.com"), &context));
- EXPECT_FALSE(Allow(source_list, GURL("applewebdata://a.test"), &context));
-
- // With a protocol of 'file', '*' allow 'file:'
- context.SetSelf(url::Origin::Create(GURL("file://example.com")));
- EXPECT_TRUE(Allow(source_list, GURL("file://not-example.com"), &context));
- EXPECT_FALSE(Allow(source_list, GURL("applewebdata://a.test"), &context));
-}
-
-TEST(CSPSourceList, AllowSelf) {
- CSPContext context;
- context.SetSelf(url::Origin::Create(GURL("http://example.com")));
- CSPSourceList source_list(true, // allow_self
- false, // allow_star
- false, // allow_redirects
- std::vector<CSPSource>()); // source_list
- EXPECT_TRUE(Allow(source_list, GURL("http://example.com"), &context));
- EXPECT_FALSE(Allow(source_list, GURL("http://not-example.com"), &context));
- EXPECT_TRUE(Allow(source_list, GURL("https://example.com"), &context));
- EXPECT_FALSE(Allow(source_list, GURL("ws://example.com"), &context));
-}
-
-TEST(CSPSourceList, AllowStarAndSelf) {
- CSPContext context;
- context.SetSelf(url::Origin::Create(GURL("https://a.com")));
- CSPSourceList source_list(false, // allow_self
- false, // allow_star
- false, // allow_redirects
- std::vector<CSPSource>());
-
- // If the request is allowed by {*} and not by {'self'} then it should be
- // allowed by the union {*,'self'}.
- source_list.allow_self = true;
- source_list.allow_star = false;
- EXPECT_FALSE(Allow(source_list, GURL("http://b.com"), &context));
- source_list.allow_self = false;
- source_list.allow_star = true;
- EXPECT_TRUE(Allow(source_list, GURL("http://b.com"), &context));
- source_list.allow_self = true;
- source_list.allow_star = true;
- EXPECT_TRUE(Allow(source_list, GURL("http://b.com"), &context));
-}
-
-TEST(CSPSourceList, AllowSelfWithUnspecifiedPort) {
- CSPContext context;
- context.SetSelf(url::Origin::Create(GetWebUIURL("print")));
- CSPSourceList source_list(true, // allow_self
- false, // allow_star
- false, // allow_redirects
- std::vector<CSPSource>()); // source_list
-
- EXPECT_TRUE(Allow(source_list,
- GURL(GetWebUIURLString("print/pdf/index.html?") +
- GetWebUIURLString("print/1/0/print.pdf")),
- &context));
-}
-
-TEST(CSPSourceList, AllowNone) {
- CSPContext context;
- context.SetSelf(url::Origin::Create(GURL("http://example.com")));
- CSPSourceList source_list(false, // allow_self
- false, // allow_star
- false, // allow_redirects
- std::vector<CSPSource>()); // source_list
- EXPECT_FALSE(Allow(source_list, GURL("http://example.com"), &context));
- EXPECT_FALSE(Allow(source_list, GURL("https://example.test/"), &context));
-}
-
-TEST(CSPSourceTest, SelfIsUnique) {
- // Policy: 'self'
- CSPSourceList source_list(true, // allow_self
- false, // allow_star
- false, // allow_redirects
- std::vector<CSPSource>()); // source_list
- CSPContext context;
-
- context.SetSelf(url::Origin::Create(GURL("http://a.com")));
- EXPECT_TRUE(Allow(source_list, GURL("http://a.com"), &context));
- EXPECT_FALSE(Allow(source_list, GURL("data:text/html,hello"), &context));
-
- context.SetSelf(
- url::Origin::Create(GURL("data:text/html,<iframe src=[...]>")));
- EXPECT_FALSE(Allow(source_list, GURL("http://a.com"), &context));
- EXPECT_FALSE(Allow(source_list, GURL("data:text/html,hello"), &context));
-}
-
-} // namespace content
diff --git a/chromium/content/common/content_security_policy/csp_source_unittest.cc b/chromium/content/common/content_security_policy/csp_source_unittest.cc
deleted file mode 100644
index 941a07a89f0..00000000000
--- a/chromium/content/common/content_security_policy/csp_source_unittest.cc
+++ /dev/null
@@ -1,334 +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.
-
-#include "content/common/content_security_policy/csp_context.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace content {
-
-namespace {
-
-// Allow() is an abbreviation of CSPSource::Allow(). Useful for writting test
-// expectations on one line.
-bool Allow(const CSPSource& source,
- const GURL& url,
- CSPContext* context,
- bool is_redirect = false) {
- return CSPSource::Allow(source, url, context, is_redirect);
-}
-
-} // namespace
-
-TEST(CSPSourceTest, BasicMatching) {
- CSPContext context;
-
- CSPSource source("http", "example.com", false, 8000, false, "/foo/");
-
- EXPECT_TRUE(Allow(source, GURL("http://example.com:8000/foo/"), &context));
- EXPECT_TRUE(Allow(source, GURL("http://example.com:8000/foo/bar"), &context));
- EXPECT_TRUE(Allow(source, GURL("HTTP://EXAMPLE.com:8000/foo/BAR"), &context));
-
- EXPECT_FALSE(Allow(source, GURL("http://example.com:8000/bar/"), &context));
- EXPECT_FALSE(Allow(source, GURL("https://example.com:8000/bar/"), &context));
- EXPECT_FALSE(Allow(source, GURL("http://example.com:9000/bar/"), &context));
- EXPECT_FALSE(
- Allow(source, GURL("HTTP://example.com:8000/FOO/bar"), &context));
- EXPECT_FALSE(
- Allow(source, GURL("HTTP://example.com:8000/FOO/BAR"), &context));
-}
-
-TEST(CSPSourceTest, AllowScheme) {
- CSPContext context;
-
- // http -> {http, https}.
- {
- CSPSource source("http", "", false, url::PORT_UNSPECIFIED, false, "");
- EXPECT_TRUE(Allow(source, GURL("http://a.com"), &context));
- EXPECT_TRUE(Allow(source, GURL("https://a.com"), &context));
- // This passes because the source is "scheme only" so the upgrade is
- // allowed.
- EXPECT_TRUE(Allow(source, GURL("https://a.com:80"), &context));
- EXPECT_FALSE(Allow(source, GURL("ftp://a.com"), &context));
- EXPECT_FALSE(Allow(source, GURL("ws://a.com"), &context));
- EXPECT_FALSE(Allow(source, GURL("wss://a.com"), &context));
- }
-
- // ws -> {ws, wss}.
- {
- CSPSource source("ws", "", false, url::PORT_UNSPECIFIED, false, "");
- EXPECT_FALSE(Allow(source, GURL("http://a.com"), &context));
- EXPECT_FALSE(Allow(source, GURL("https://a.com"), &context));
- EXPECT_FALSE(Allow(source, GURL("ftp://a.com"), &context));
- EXPECT_TRUE(Allow(source, GURL("ws://a.com"), &context));
- EXPECT_TRUE(Allow(source, GURL("wss://a.com"), &context));
- }
-
- // Exact matches required (ftp)
- {
- CSPSource source("ftp", "", false, url::PORT_UNSPECIFIED, false, "");
- EXPECT_TRUE(Allow(source, GURL("ftp://a.com"), &context));
- EXPECT_FALSE(Allow(source, GURL("http://a.com"), &context));
- }
-
- // Exact matches required (https)
- {
- CSPSource source("https", "", false, url::PORT_UNSPECIFIED, false, "");
- EXPECT_TRUE(Allow(source, GURL("https://a.com"), &context));
- EXPECT_FALSE(Allow(source, GURL("http://a.com"), &context));
- }
-
- // Exact matches required (wss)
- {
- CSPSource source("wss", "", false, url::PORT_UNSPECIFIED, false, "");
- EXPECT_TRUE(Allow(source, GURL("wss://a.com"), &context));
- EXPECT_FALSE(Allow(source, GURL("ws://a.com"), &context));
- }
-
- // Scheme is empty (ProtocolMatchesSelf).
- {
- CSPSource source("", "a.com", false, url::PORT_UNSPECIFIED, false, "");
- EXPECT_FALSE(Allow(source, GURL("http://a.com"), &context));
-
- // Self's scheme is http.
- context.SetSelf(url::Origin::Create(GURL("http://a.com")));
- EXPECT_TRUE(Allow(source, GURL("http://a.com"), &context));
- EXPECT_TRUE(Allow(source, GURL("https://a.com"), &context));
- EXPECT_FALSE(Allow(source, GURL("ftp://a.com"), &context));
-
- // Self's is https.
- context.SetSelf(url::Origin::Create(GURL("https://a.com")));
- EXPECT_FALSE(Allow(source, GURL("http://a.com"), &context));
- EXPECT_TRUE(Allow(source, GURL("https://a.com"), &context));
- EXPECT_FALSE(Allow(source, GURL("ftp://a.com"), &context));
-
- // Self's scheme is not in the http familly.
- context.SetSelf(url::Origin::Create(GURL("ftp://a.com/")));
- EXPECT_FALSE(Allow(source, GURL("http://a.com"), &context));
- EXPECT_TRUE(Allow(source, GURL("ftp://a.com"), &context));
-
- // Self's scheme is unique (non standard scheme).
- context.SetSelf(url::Origin::Create(GURL("non-standard-scheme://a.com")));
- EXPECT_FALSE(Allow(source, GURL("http://a.com"), &context));
- EXPECT_FALSE(Allow(source, GURL("non-standard-scheme://a.com"), &context));
-
- // Self's scheme is unique (data-url).
- context.SetSelf(
- url::Origin::Create(GURL("data:text/html,<iframe src=[...]>")));
- EXPECT_FALSE(Allow(source, GURL("http://a.com"), &context));
- EXPECT_FALSE(Allow(source, GURL("data:text/html,hello"), &context));
- }
-}
-
-TEST(CSPSourceTest, AllowHost) {
- CSPContext context;
- context.SetSelf(url::Origin::Create(GURL("http://example.com")));
-
- // Host is * (source-expression = "http://*")
- {
- CSPSource source("http", "", true, url::PORT_UNSPECIFIED, false, "");
- EXPECT_TRUE(Allow(source, GURL("http://a.com"), &context));
- EXPECT_TRUE(Allow(source, GURL("http://."), &context));
- }
-
- // Host is *.foo.bar
- {
- CSPSource source("", "foo.bar", true, url::PORT_UNSPECIFIED, false, "");
- EXPECT_FALSE(Allow(source, GURL("http://a.com"), &context));
- EXPECT_FALSE(Allow(source, GURL("http://bar"), &context));
- EXPECT_FALSE(Allow(source, GURL("http://foo.bar"), &context));
- EXPECT_FALSE(Allow(source, GURL("http://o.bar"), &context));
- EXPECT_TRUE(Allow(source, GURL("http://*.foo.bar"), &context));
- EXPECT_TRUE(Allow(source, GURL("http://sub.foo.bar"), &context));
- EXPECT_TRUE(Allow(source, GURL("http://sub.sub.foo.bar"), &context));
- // Please see http://crbug.com/692505
- EXPECT_TRUE(Allow(source, GURL("http://.foo.bar"), &context));
- }
-
- // Host is exact.
- {
- CSPSource source("", "foo.bar", false, url::PORT_UNSPECIFIED, false, "");
- EXPECT_TRUE(Allow(source, GURL("http://foo.bar"), &context));
- EXPECT_FALSE(Allow(source, GURL("http://sub.foo.bar"), &context));
- EXPECT_FALSE(Allow(source, GURL("http://bar"), &context));
- // Please see http://crbug.com/692505
- EXPECT_FALSE(Allow(source, GURL("http://.foo.bar"), &context));
- }
-}
-
-TEST(CSPSourceTest, AllowPort) {
- CSPContext context;
- context.SetSelf(url::Origin::Create(GURL("http://example.com")));
-
- // Source's port unspecified.
- {
- CSPSource source("", "a.com", false, url::PORT_UNSPECIFIED, false, "");
- EXPECT_TRUE(Allow(source, GURL("http://a.com:80"), &context));
- EXPECT_FALSE(Allow(source, GURL("http://a.com:8080"), &context));
- EXPECT_FALSE(Allow(source, GURL("http://a.com:443"), &context));
- EXPECT_FALSE(Allow(source, GURL("https://a.com:80"), &context));
- EXPECT_FALSE(Allow(source, GURL("https://a.com:8080"), &context));
- EXPECT_TRUE(Allow(source, GURL("https://a.com:443"), &context));
- EXPECT_FALSE(Allow(source, GURL("unknown://a.com:80"), &context));
- EXPECT_TRUE(Allow(source, GURL("http://a.com"), &context));
- EXPECT_TRUE(Allow(source, GURL("http://a.com"), &context));
- EXPECT_TRUE(Allow(source, GURL("https://a.com"), &context));
- }
-
- // Source's port is "*".
- {
- CSPSource source("", "a.com", false, url::PORT_UNSPECIFIED, true, "");
- EXPECT_TRUE(Allow(source, GURL("http://a.com"), &context));
- EXPECT_TRUE(Allow(source, GURL("http://a.com:80"), &context));
- EXPECT_TRUE(Allow(source, GURL("http://a.com:8080"), &context));
- EXPECT_TRUE(Allow(source, GURL("https://a.com:8080"), &context));
- EXPECT_TRUE(Allow(source, GURL("https://a.com:0"), &context));
- EXPECT_TRUE(Allow(source, GURL("https://a.com"), &context));
- }
-
- // Source has a port.
- {
- CSPSource source("", "a.com", false, 80, false, "");
- EXPECT_TRUE(Allow(source, GURL("http://a.com:80"), &context));
- EXPECT_TRUE(Allow(source, GURL("http://a.com"), &context));
- EXPECT_FALSE(Allow(source, GURL("http://a.com:8080"), &context));
- EXPECT_TRUE(Allow(source, GURL("https://a.com"), &context));
- }
-
- // Allow upgrade from :80 to :443
- {
- CSPSource source("", "a.com", false, 80, false, "");
- EXPECT_TRUE(Allow(source, GURL("https://a.com:443"), &context));
- // Should not allow scheme upgrades unless both port and scheme are
- // upgraded.
- EXPECT_FALSE(Allow(source, GURL("http://a.com:443"), &context));
- }
-
- // Host is * but port is specified
- {
- CSPSource source("http", "", true, 111, false, "");
- EXPECT_TRUE(Allow(source, GURL("http://a.com:111"), &context));
- EXPECT_FALSE(Allow(source, GURL("http://a.com:222"), &context));
- }
-}
-
-TEST(CSPSourceTest, AllowPath) {
- CSPContext context;
- context.SetSelf(url::Origin::Create(GURL("http://example.com")));
-
- // Path to a file
- {
- CSPSource source("", "a.com", false, url::PORT_UNSPECIFIED, false,
- "/path/to/file");
- EXPECT_TRUE(Allow(source, GURL("http://a.com/path/to/file"), &context));
- EXPECT_FALSE(Allow(source, GURL("http://a.com/path/to/"), &context));
- EXPECT_FALSE(
- Allow(source, GURL("http://a.com/path/to/file/subpath"), &context));
- EXPECT_FALSE(
- Allow(source, GURL("http://a.com/path/to/something"), &context));
- }
-
- // Path to a directory
- {
- CSPSource source("", "a.com", false, url::PORT_UNSPECIFIED, false,
- "/path/to/");
- EXPECT_TRUE(Allow(source, GURL("http://a.com/path/to/file"), &context));
- EXPECT_TRUE(Allow(source, GURL("http://a.com/path/to/"), &context));
- EXPECT_FALSE(Allow(source, GURL("http://a.com/path/"), &context));
- EXPECT_FALSE(Allow(source, GURL("http://a.com/path/to"), &context));
- EXPECT_FALSE(Allow(source, GURL("http://a.com/path/to"), &context));
- }
-
- // Empty path
- {
- CSPSource source("", "a.com", false, url::PORT_UNSPECIFIED, false, "");
- EXPECT_TRUE(Allow(source, GURL("http://a.com/path/to/file"), &context));
- EXPECT_TRUE(Allow(source, GURL("http://a.com/path/to/"), &context));
- EXPECT_TRUE(Allow(source, GURL("http://a.com/"), &context));
- EXPECT_TRUE(Allow(source, GURL("http://a.com"), &context));
- }
-
- // Almost empty path
- {
- CSPSource source("", "a.com", false, url::PORT_UNSPECIFIED, false, "/");
- EXPECT_TRUE(Allow(source, GURL("http://a.com/path/to/file"), &context));
- EXPECT_TRUE(Allow(source, GURL("http://a.com/path/to/"), &context));
- EXPECT_TRUE(Allow(source, GURL("http://a.com/"), &context));
- EXPECT_TRUE(Allow(source, GURL("http://a.com"), &context));
- }
-
- // Path encoded.
- {
- CSPSource source("http", "a.com", false, url::PORT_UNSPECIFIED, false,
- "/Hello Günter");
- EXPECT_TRUE(
- Allow(source, GURL("http://a.com/Hello%20G%C3%BCnter"), &context));
- EXPECT_TRUE(Allow(source, GURL("http://a.com/Hello Günter"), &context));
- }
-
- // Host is * but path is specified.
- {
- CSPSource source("http", "", true, url::PORT_UNSPECIFIED, false,
- "/allowed-path");
- EXPECT_TRUE(Allow(source, GURL("http://a.com/allowed-path"), &context));
- EXPECT_FALSE(Allow(source, GURL("http://a.com/disallowed-path"), &context));
- }
-}
-
-TEST(CSPSourceTest, RedirectMatching) {
- CSPContext context;
- CSPSource source("http", "a.com", false, 8000, false, "/bar/");
- EXPECT_TRUE(Allow(source, GURL("http://a.com:8000/"), &context, true));
- EXPECT_TRUE(Allow(source, GURL("http://a.com:8000/foo"), &context, true));
- EXPECT_FALSE(Allow(source, GURL("https://a.com:8000/foo"), &context, true));
- EXPECT_FALSE(
- Allow(source, GURL("http://not-a.com:8000/foo"), &context, true));
- EXPECT_FALSE(Allow(source, GURL("http://a.com:9000/foo/"), &context, false));
-}
-
-TEST(CSPSourceTest, ToString) {
- {
- CSPSource source("http", "", false, url::PORT_UNSPECIFIED, false, "");
- EXPECT_EQ("http:", source.ToString());
- }
- {
- CSPSource source("http", "a.com", false, url::PORT_UNSPECIFIED, false, "");
- EXPECT_EQ("http://a.com", source.ToString());
- }
- {
- CSPSource source("", "a.com", false, url::PORT_UNSPECIFIED, false, "");
- EXPECT_EQ("a.com", source.ToString());
- }
- {
- CSPSource source("", "a.com", true, url::PORT_UNSPECIFIED, false, "");
- EXPECT_EQ("*.a.com", source.ToString());
- }
- {
- CSPSource source("", "", true, url::PORT_UNSPECIFIED, false, "");
- EXPECT_EQ("*", source.ToString());
- }
- {
- CSPSource source("", "a.com", false, 80, false, "");
- EXPECT_EQ("a.com:80", source.ToString());
- }
- {
- CSPSource source("", "a.com", false, url::PORT_UNSPECIFIED, true, "");
- EXPECT_EQ("a.com:*", source.ToString());
- }
- {
- CSPSource source("", "a.com", false, url::PORT_UNSPECIFIED, false, "/path");
- EXPECT_EQ("a.com/path", source.ToString());
- }
-}
-
-TEST(CSPSourceTest, UpgradeRequests) {
- CSPContext context;
- CSPSource source("http", "a.com", false, 80, false, "");
- EXPECT_TRUE(Allow(source, GURL("http://a.com:80"), &context, true));
- EXPECT_FALSE(Allow(source, GURL("https://a.com:80"), &context, true));
- EXPECT_FALSE(Allow(source, GURL("http://a.com:443"), &context, true));
- EXPECT_TRUE(Allow(source, GURL("https://a.com:443"), &context, true));
- EXPECT_TRUE(Allow(source, GURL("https://a.com"), &context, true));
-}
-
-} // namespace content
diff --git a/chromium/content/common/content_security_policy_header.cc b/chromium/content/common/content_security_policy_header.cc
deleted file mode 100644
index a56b5a0c031..00000000000
--- a/chromium/content/common/content_security_policy_header.cc
+++ /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.
-
-#include "content/common/content_security_policy_header.h"
-#include "services/network/public/mojom/content_security_policy.mojom.h"
-
-namespace content {
-
-ContentSecurityPolicyHeader::ContentSecurityPolicyHeader()
- : header_value(std::string()),
- type(network::mojom::ContentSecurityPolicyType::kEnforce),
- source(network::mojom::ContentSecurityPolicySource::kHTTP) {}
-
-ContentSecurityPolicyHeader::ContentSecurityPolicyHeader(
- const std::string& header_value,
- network::mojom::ContentSecurityPolicyType type,
- network::mojom::ContentSecurityPolicySource source)
- : header_value(header_value), type(type), source(source) {}
-
-} // namespace content
diff --git a/chromium/content/common/content_security_policy_header.h b/chromium/content/common/content_security_policy_header.h
deleted file mode 100644
index c127b65a27b..00000000000
--- a/chromium/content/common/content_security_policy_header.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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 CONTENT_COMMON_CONTENT_SECURITY_POLICY_HEADER_
-#define CONTENT_COMMON_CONTENT_SECURITY_POLICY_HEADER_
-
-#include <string>
-
-#include "content/common/content_export.h"
-#include "services/network/public/mojom/content_security_policy.mojom-forward.h"
-
-namespace content {
-
-// Represents a single Content Security Policy header (i.e. coming from
-// a single Content-Security-Policy header in an HTTP response, or from
-// a single <meta http-equiv="Content-Security-Policy"...> element).
-struct CONTENT_EXPORT ContentSecurityPolicyHeader {
- ContentSecurityPolicyHeader();
- ContentSecurityPolicyHeader(
- const std::string& header_value,
- network::mojom::ContentSecurityPolicyType type,
- network::mojom::ContentSecurityPolicySource source);
-
- std::string header_value;
- network::mojom::ContentSecurityPolicyType type;
- network::mojom::ContentSecurityPolicySource source;
-};
-
-} // namespace content
-
-#endif // CONTENT_COMMON_CONTENT_SECURITY_POLICY_HEADER_
diff --git a/chromium/content/common/tab_switch_time_recorder.cc b/chromium/content/common/content_to_visible_time_reporter.cc
index 9bac671a58d..ea1159af400 100644
--- a/chromium/content/common/tab_switch_time_recorder.cc
+++ b/chromium/content/common/content_to_visible_time_reporter.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/common/tab_switch_time_recorder.h"
+#include "content/common/content_to_visible_time_reporter.h"
#include <utility>
@@ -18,18 +18,23 @@ namespace content {
namespace {
+bool IsOptionalValueTrue(const base::Optional<bool>& data) {
+ return data.has_value() && data.value();
+}
+
// Used to generate unique "TabSwitching::Latency" event ids. Note: The address
-// of TabSwitchTimeRecorder can't be used as an id because a single
-// TabSwitchTimeRecorder can generate multiple overlapping events.
+// of ContentToVisibleTimeReporter can't be used as an id because a single
+// ContentToVisibleTimeReporter can generate multiple overlapping events.
int g_num_trace_events_in_process = 0;
-const char* GetHistogramSuffix(bool has_saved_frames,
- const RecordTabSwitchTimeRequest& start_state) {
+const char* GetHistogramSuffix(
+ bool has_saved_frames,
+ const RecordContentToVisibleTimeRequest& start_state) {
if (has_saved_frames)
return "WithSavedFrames";
- if (start_state.destination_is_loaded) {
- if (start_state.destination_is_frozen) {
+ if (IsOptionalValueTrue(start_state.destination_is_loaded)) {
+ if (IsOptionalValueTrue(start_state.destination_is_frozen)) {
return "NoSavedFrames_Loaded_Frozen";
} else {
return "NoSavedFrames_Loaded_NotFrozen";
@@ -39,41 +44,78 @@ const char* GetHistogramSuffix(bool has_saved_frames,
}
}
+void ReportUnOccludedMetric(const base::TimeTicks requested_time,
+ const gfx::PresentationFeedback& feedback) {
+ const base::TimeDelta delta = feedback.timestamp - requested_time;
+ UMA_HISTOGRAM_TIMES("Aura.WebContentsWindowUnOccludedTime", delta);
+}
+
+void RecordBackForwardCacheRestoreMetric(
+ const base::TimeTicks requested_time,
+ const gfx::PresentationFeedback& feedback) {
+ const base::TimeDelta delta = feedback.timestamp - requested_time;
+ // Histogram to record the content to visible duration after restoring a page
+ // from back-forward cache. Here min, max bucket size are same as the
+ // "PageLoad.PaintTiming.NavigationToFirstContentfulPaint" metric.
+ base::UmaHistogramCustomTimes(
+ "BackForwardCache.Restore.NavigationToFirstPaint", delta,
+ base::TimeDelta::FromMilliseconds(10), base::TimeDelta::FromMinutes(10),
+ 100);
+}
+
} // namespace
-RecordTabSwitchTimeRequest::RecordTabSwitchTimeRequest(
- base::TimeTicks tab_switch_start_time,
- bool destination_is_loaded,
- bool destination_is_frozen)
- : tab_switch_start_time(tab_switch_start_time),
+RecordContentToVisibleTimeRequest::RecordContentToVisibleTimeRequest() =
+ default;
+
+RecordContentToVisibleTimeRequest::~RecordContentToVisibleTimeRequest() =
+ default;
+
+RecordContentToVisibleTimeRequest::RecordContentToVisibleTimeRequest(
+ const RecordContentToVisibleTimeRequest& other) = default;
+
+RecordContentToVisibleTimeRequest::RecordContentToVisibleTimeRequest(
+ base::TimeTicks event_start_time,
+ base::Optional<bool> destination_is_loaded,
+ base::Optional<bool> destination_is_frozen,
+ bool show_reason_tab_switching,
+ bool show_reason_unoccluded,
+ bool show_reason_bfcache_restore)
+ : event_start_time(event_start_time),
destination_is_loaded(destination_is_loaded),
- destination_is_frozen(destination_is_frozen) {}
+ destination_is_frozen(destination_is_frozen),
+ show_reason_tab_switching(show_reason_tab_switching),
+ show_reason_unoccluded(show_reason_unoccluded),
+ show_reason_bfcache_restore(show_reason_bfcache_restore) {}
+
+void RecordContentToVisibleTimeRequest::UpdateRequest(
+ const RecordContentToVisibleTimeRequest& other) {
+ event_start_time = std::min(event_start_time, other.event_start_time);
+ if (IsOptionalValueTrue(other.destination_is_loaded))
+ destination_is_loaded = other.destination_is_loaded;
-TabSwitchTimeRecorder::TabSwitchTimeRecorder() {}
+ if (IsOptionalValueTrue(other.destination_is_frozen))
+ destination_is_frozen = other.destination_is_frozen;
-TabSwitchTimeRecorder::~TabSwitchTimeRecorder() {}
+ show_reason_tab_switching |= other.show_reason_tab_switching;
+ show_reason_unoccluded |= other.show_reason_unoccluded;
+ show_reason_bfcache_restore |= other.show_reason_bfcache_restore;
+}
+
+ContentToVisibleTimeReporter::ContentToVisibleTimeReporter() = default;
+
+ContentToVisibleTimeReporter::~ContentToVisibleTimeReporter() = default;
base::OnceCallback<void(const gfx::PresentationFeedback&)>
-TabSwitchTimeRecorder::TabWasShown(
+ContentToVisibleTimeReporter::TabWasShown(
bool has_saved_frames,
- const RecordTabSwitchTimeRequest& start_state,
+ const RecordContentToVisibleTimeRequest& start_state,
base::TimeTicks render_widget_visibility_request_timestamp) {
- DCHECK(!start_state.tab_switch_start_time.is_null());
+ DCHECK(!start_state.event_start_time.is_null());
DCHECK(!render_widget_visibility_request_timestamp.is_null());
DCHECK(!tab_switch_start_state_);
DCHECK(render_widget_visibility_request_timestamp_.is_null());
- if (tab_switch_start_state_) {
- // TabWasShown() is called multiple times without the tab being hidden in
- // between. This shouldn't happen per the DCHECK above. Dump without
- // crashing to gather more information for https://crbug.com/981757.
- //
- // TODO(fdoray): This code should be removed no later than August 30, 2019.
- // https://crbug.com/981757
- base::debug::DumpWithoutCrashing();
- weak_ptr_factory_.InvalidateWeakPtrs();
- }
-
has_saved_frames_ = has_saved_frames;
tab_switch_start_state_ = start_state;
render_widget_visibility_request_timestamp_ =
@@ -81,25 +123,50 @@ TabSwitchTimeRecorder::TabWasShown(
// |tab_switch_start_state_| is only reset by RecordHistogramsAndTraceEvents
// once the metrics have been emitted.
- return base::BindOnce(&TabSwitchTimeRecorder::RecordHistogramsAndTraceEvents,
- weak_ptr_factory_.GetWeakPtr(),
- false /* is_incomplete */);
+ return base::BindOnce(
+ &ContentToVisibleTimeReporter::RecordHistogramsAndTraceEvents,
+ weak_ptr_factory_.GetWeakPtr(), false /* is_incomplete */,
+ start_state.show_reason_tab_switching, start_state.show_reason_unoccluded,
+ start_state.show_reason_bfcache_restore);
}
-void TabSwitchTimeRecorder::TabWasHidden() {
+void ContentToVisibleTimeReporter::TabWasHidden() {
if (tab_switch_start_state_) {
RecordHistogramsAndTraceEvents(true /* is_incomplete */,
+ true /* show_reason_tab_switching */,
+ false /* show_reason_unoccluded */,
+ false /* show_reason_bfcache_restore */,
gfx::PresentationFeedback::Failure());
weak_ptr_factory_.InvalidateWeakPtrs();
}
}
-void TabSwitchTimeRecorder::RecordHistogramsAndTraceEvents(
+void ContentToVisibleTimeReporter::RecordHistogramsAndTraceEvents(
bool is_incomplete,
+ bool show_reason_tab_switching,
+ bool show_reason_unoccluded,
+ bool show_reason_bfcache_restore,
const gfx::PresentationFeedback& feedback) {
DCHECK(tab_switch_start_state_);
DCHECK(!render_widget_visibility_request_timestamp_.is_null());
+ // If the DCHECK fail, make sure RenderWidgetHostImpl::WasShown was triggered
+ // for recording the event.
+ DCHECK(show_reason_bfcache_restore || show_reason_unoccluded ||
+ show_reason_tab_switching);
+
+ if (show_reason_bfcache_restore) {
+ RecordBackForwardCacheRestoreMetric(
+ tab_switch_start_state_->event_start_time, feedback);
+ }
+
+ if (show_reason_unoccluded) {
+ ReportUnOccludedMetric(tab_switch_start_state_->event_start_time, feedback);
+ }
+
+ if (!show_reason_tab_switching)
+ return;
+ // Tab switching has occurred.
auto tab_switch_result = TabSwitchResult::kSuccess;
if (is_incomplete)
tab_switch_result = TabSwitchResult::kIncomplete;
@@ -107,13 +174,13 @@ void TabSwitchTimeRecorder::RecordHistogramsAndTraceEvents(
tab_switch_result = TabSwitchResult::kPresentationFailure;
const auto tab_switch_duration =
- feedback.timestamp - tab_switch_start_state_->tab_switch_start_time;
+ feedback.timestamp - tab_switch_start_state_->event_start_time;
// Record trace events.
TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP0(
"latency", "TabSwitching::Latency",
TRACE_ID_LOCAL(g_num_trace_events_in_process),
- tab_switch_start_state_->tab_switch_start_time);
+ tab_switch_start_state_->event_start_time);
TRACE_EVENT_ASYNC_END_WITH_TIMESTAMP2(
"latency", "TabSwitching::Latency",
TRACE_ID_LOCAL(g_num_trace_events_in_process), feedback.timestamp,
@@ -127,7 +194,8 @@ void TabSwitchTimeRecorder::RecordHistogramsAndTraceEvents(
// experiments that affect the number of frozen tab on tab switch time.
const bool is_no_saved_frames_loaded =
!has_saved_frames_ &&
- tab_switch_start_state_.value().destination_is_loaded;
+ IsOptionalValueTrue(
+ tab_switch_start_state_.value().destination_is_loaded);
// Record result histogram.
base::UmaHistogramEnumeration(
diff --git a/chromium/content/common/content_to_visible_time_reporter.h b/chromium/content/common/content_to_visible_time_reporter.h
new file mode 100644
index 00000000000..60811bfe584
--- /dev/null
+++ b/chromium/content/common/content_to_visible_time_reporter.h
@@ -0,0 +1,119 @@
+// 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 CONTENT_COMMON_CONTENT_TO_VISIBLE_TIME_REPORTER_H_
+#define CONTENT_COMMON_CONTENT_TO_VISIBLE_TIME_REPORTER_H_
+
+#include "base/callback.h"
+#include "base/memory/weak_ptr.h"
+#include "base/optional.h"
+#include "base/time/time.h"
+#include "content/common/content_export.h"
+
+namespace gfx {
+struct PresentationFeedback;
+}
+
+namespace content {
+
+// Keeps track of parameters for recording metrics for content to visible time
+// duration for different events. Here event indicates the reason for which the
+// web contents are visible. These values are set on
+// RenderWidgetHostView::SetRecordContentToVisibleTimeRequest. Note that
+// |show_reason_tab_switching| and |show_reason_unoccluded| can both be true at
+// the same time.
+struct CONTENT_EXPORT RecordContentToVisibleTimeRequest {
+ RecordContentToVisibleTimeRequest();
+ ~RecordContentToVisibleTimeRequest();
+ RecordContentToVisibleTimeRequest(
+ const RecordContentToVisibleTimeRequest& other);
+
+ RecordContentToVisibleTimeRequest(base::TimeTicks event_start_time,
+ base::Optional<bool> destination_is_loaded,
+ base::Optional<bool> destination_is_frozen,
+ bool show_reason_tab_switching,
+ bool show_reason_unoccluded,
+ bool show_reason_bfcache_restore);
+
+ // Merges two requests to include all the flags set and minimum start time.
+ void UpdateRequest(const RecordContentToVisibleTimeRequest& other);
+
+ // The time at which web contents become visible.
+ base::TimeTicks event_start_time = base::TimeTicks();
+ // Indicates if the destination tab is loaded when initiating the tab switch.
+ base::Optional<bool> destination_is_loaded;
+ // Indicates if the destination tab is frozen when initiating the tab switch.
+ base::Optional<bool> destination_is_frozen;
+ // If |show_reason_tab_switching| is true, web contents has become visible
+ // because of tab switching.
+ bool show_reason_tab_switching = false;
+ // If |show_reason_unoccluded| is true, then web contents has become visible
+ // because window un-occlusion has happened.
+ bool show_reason_unoccluded = false;
+ // If |show_reason_bfcache_restore| is true, web contents has become visible
+ // because of restoring a page from bfcache.
+ bool show_reason_bfcache_restore = false;
+
+ // Please update RecordContentToVisibleTimeRequestTest::ExpectEqual when
+ // changing this object!!!
+};
+
+// Generates UMA metric to track the duration of tab switching from when the
+// active tab is changed until the frame presentation time. The metric will be
+// separated into two whether the tab switch has saved frames or not.
+class CONTENT_EXPORT ContentToVisibleTimeReporter {
+ public:
+ // Matches the TabSwitchResult enum in enums.xml.
+ enum class TabSwitchResult {
+ // A frame was successfully presented after a tab switch.
+ kSuccess = 0,
+ // Tab was hidden before a frame was presented after a tab switch.
+ kIncomplete = 1,
+ // Compositor reported a failure after a tab switch.
+ kPresentationFailure = 2,
+ kMaxValue = kPresentationFailure,
+ };
+
+ ContentToVisibleTimeReporter();
+ ~ContentToVisibleTimeReporter();
+
+ // Invoked when the tab associated with this recorder is shown. Returns a
+ // callback to invoke the next time a frame is presented for this tab.
+ base::OnceCallback<void(const gfx::PresentationFeedback&)> TabWasShown(
+ bool has_saved_frames,
+ const RecordContentToVisibleTimeRequest& start_state,
+ base::TimeTicks render_widget_visibility_request_timestamp);
+
+ // Indicates that the tab associated with this recorder was hidden. If no
+ // frame was presented since the last tab switch, failure is reported to UMA.
+ void TabWasHidden();
+
+ private:
+ // Records histograms and trace events for the current tab switch.
+ void RecordHistogramsAndTraceEvents(
+ bool is_incomplete,
+ bool show_reason_tab_switching,
+ bool show_reason_unoccluded,
+ bool show_reason_bfcache_restore,
+ const gfx::PresentationFeedback& feedback);
+
+ // Whether there was a saved frame for the last tab switch.
+ bool has_saved_frames_;
+
+ // The information about the last tab switch request, or nullopt if there is
+ // no incomplete tab switch.
+ base::Optional<RecordContentToVisibleTimeRequest> tab_switch_start_state_;
+
+ // The render widget visibility request timestamp for the last tab switch, or
+ // null if there is no incomplete tab switch.
+ base::TimeTicks render_widget_visibility_request_timestamp_;
+
+ base::WeakPtrFactory<ContentToVisibleTimeReporter> weak_ptr_factory_{this};
+
+ DISALLOW_COPY_AND_ASSIGN(ContentToVisibleTimeReporter);
+};
+
+} // namespace content
+
+#endif // CONTENT_COMMON_CONTENT_TO_VISIBLE_TIME_REPORTER_H_
diff --git a/chromium/content/common/cursors/webcursor.cc b/chromium/content/common/cursors/webcursor.cc
index 2f5f76a96a8..ada5f75c205 100644
--- a/chromium/content/common/cursors/webcursor.cc
+++ b/chromium/content/common/cursors/webcursor.cc
@@ -8,15 +8,18 @@
#include "base/logging.h"
#include "build/build_config.h"
+#include "ui/base/mojom/cursor_type.mojom-shared.h"
namespace content {
+WebCursor::WebCursor() = default;
+
WebCursor::~WebCursor() {
CleanupPlatformData();
}
-WebCursor::WebCursor(const CursorInfo& info) {
- SetInfo(info);
+WebCursor::WebCursor(const ui::Cursor& cursor) {
+ SetCursor(cursor);
}
WebCursor::WebCursor(const WebCursor& other) {
@@ -29,32 +32,37 @@ WebCursor& WebCursor::operator=(const WebCursor& other) {
return *this;
}
-bool WebCursor::SetInfo(const CursorInfo& info) {
+bool WebCursor::SetCursor(const ui::Cursor& cursor) {
static constexpr int kMaxSize = 1024;
- if (info.image_scale_factor < 0.01f || info.image_scale_factor > 100.f ||
- info.custom_image.width() > kMaxSize ||
- info.custom_image.height() > kMaxSize ||
- info.custom_image.width() / info.image_scale_factor > kMaxSize ||
- info.custom_image.height() / info.image_scale_factor > kMaxSize) {
+ if (cursor.image_scale_factor() < 0.01f ||
+ cursor.image_scale_factor() > 100.f ||
+ (cursor.type() == ui::mojom::CursorType::kCustom &&
+ (cursor.custom_bitmap().width() > kMaxSize ||
+ cursor.custom_bitmap().height() > kMaxSize ||
+ cursor.custom_bitmap().width() / cursor.image_scale_factor() >
+ kMaxSize ||
+ cursor.custom_bitmap().height() / cursor.image_scale_factor() >
+ kMaxSize))) {
return false;
}
CleanupPlatformData();
- info_ = info;
+ cursor_ = cursor;
// Clamp the hotspot to the custom image's dimensions.
- if (info_.type == ui::CursorType::kCustom) {
- info_.hotspot.set_x(std::max(
- 0, std::min(info_.custom_image.width() - 1, info_.hotspot.x())));
- info_.hotspot.set_y(std::max(
- 0, std::min(info_.custom_image.height() - 1, info_.hotspot.y())));
+ if (cursor_.type() == ui::mojom::CursorType::kCustom) {
+ cursor_.set_custom_hotspot(
+ gfx::Point(std::max(0, std::min(cursor_.custom_bitmap().width() - 1,
+ cursor_.custom_hotspot().x())),
+ std::max(0, std::min(cursor_.custom_bitmap().height() - 1,
+ cursor_.custom_hotspot().y()))));
}
return true;
}
bool WebCursor::operator==(const WebCursor& other) const {
- return info_ == other.info_ &&
+ return cursor_ == other.cursor_ &&
#if defined(USE_AURA) || defined(USE_OZONE)
rotation_ == other.rotation_ &&
#endif
@@ -66,7 +74,7 @@ bool WebCursor::operator!=(const WebCursor& other) const {
}
void WebCursor::CopyAllData(const WebCursor& other) {
- SetInfo(other.info_);
+ SetCursor(other.cursor_);
CopyPlatformData(other);
}
diff --git a/chromium/content/common/cursors/webcursor.h b/chromium/content/common/cursors/webcursor.h
index 16707949847..6ae0aa5f459 100644
--- a/chromium/content/common/cursors/webcursor.h
+++ b/chromium/content/common/cursors/webcursor.h
@@ -9,13 +9,15 @@
#include "build/build_config.h"
#include "content/common/content_export.h"
-#include "content/public/common/cursor_info.h"
+#include "ui/base/cursor/cursor.h"
#include "ui/display/display.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/native_widget_types.h"
#if defined(USE_AURA)
+#include "base/optional.h"
+
#include "ui/base/cursor/cursor.h"
#endif
@@ -27,16 +29,16 @@ namespace content {
// WebCursor. This class is highly similar to ui::Cursor.
class CONTENT_EXPORT WebCursor {
public:
- WebCursor() = default;
- explicit WebCursor(const CursorInfo& info);
+ WebCursor();
+ explicit WebCursor(const ui::Cursor& info);
explicit WebCursor(const WebCursor& other);
WebCursor& operator=(const WebCursor& other);
~WebCursor();
- const CursorInfo& info() const { return info_; }
+ const ui::Cursor& cursor() const { return cursor_; }
- // Sets the cursor |info|; returns whether the struct has reasonable values.
- bool SetInfo(const CursorInfo& info);
+ // Sets the ui::Cursor |cursor|; returns whether it has reasonable values.
+ bool SetCursor(const ui::Cursor& cursor);
// Equality operator; performs bitmap content comparison as needed.
bool operator==(const WebCursor& other) const;
@@ -54,6 +56,8 @@ class CONTENT_EXPORT WebCursor {
void CreateScaledBitmapAndHotspotFromCustomData(SkBitmap* bitmap,
gfx::Point* hotspot,
float* scale);
+
+ bool has_custom_cursor_for_test() const { return !!custom_cursor_; }
#endif
private:
@@ -72,7 +76,7 @@ class CONTENT_EXPORT WebCursor {
float GetCursorScaleFactor(SkBitmap* bitmap);
// The basic cursor info.
- CursorInfo info_;
+ ui::Cursor cursor_;
#if defined(USE_AURA) || defined(USE_OZONE)
// Only used for custom cursors.
@@ -86,6 +90,10 @@ class CONTENT_EXPORT WebCursor {
static constexpr int kDefaultMaxSize = 64;
gfx::Size maximum_cursor_size_ = {kDefaultMaxSize, kDefaultMaxSize};
#endif
+
+#if defined(USE_AURA)
+ base::Optional<ui::Cursor> custom_cursor_;
+#endif
};
} // namespace content
diff --git a/chromium/content/common/cursors/webcursor_android.cc b/chromium/content/common/cursors/webcursor_android.cc
index cd1e8890a16..95c2faaef6d 100644
--- a/chromium/content/common/cursors/webcursor_android.cc
+++ b/chromium/content/common/cursors/webcursor_android.cc
@@ -5,7 +5,6 @@
#include "content/common/cursors/webcursor.h"
#include "base/logging.h"
-#include "third_party/blink/public/platform/web_cursor_info.h"
namespace content {
diff --git a/chromium/content/common/cursors/webcursor_aura.cc b/chromium/content/common/cursors/webcursor_aura.cc
index 1ca76925e37..f979945d775 100644
--- a/chromium/content/common/cursors/webcursor_aura.cc
+++ b/chromium/content/common/cursors/webcursor_aura.cc
@@ -5,33 +5,36 @@
#include "content/common/cursors/webcursor.h"
#include "base/logging.h"
-#include "third_party/blink/public/platform/web_cursor_info.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/cursor/cursor_util.h"
+#include "ui/base/mojom/cursor_type.mojom-shared.h"
namespace content {
gfx::NativeCursor WebCursor::GetNativeCursor() {
- if (info_.type == ui::CursorType::kCustom) {
- ui::Cursor cursor(ui::CursorType::kCustom);
- SkBitmap bitmap;
- gfx::Point hotspot;
- float scale;
- CreateScaledBitmapAndHotspotFromCustomData(&bitmap, &hotspot, &scale);
- cursor.set_custom_bitmap(bitmap);
- cursor.set_custom_hotspot(hotspot);
- cursor.set_device_scale_factor(scale);
- cursor.SetPlatformCursor(GetPlatformCursor(cursor));
- return cursor;
+ if (cursor_.type() == ui::mojom::CursorType::kCustom) {
+ if (!custom_cursor_) {
+ custom_cursor_.emplace(ui::mojom::CursorType::kCustom);
+ SkBitmap bitmap;
+ gfx::Point hotspot;
+ float scale;
+ CreateScaledBitmapAndHotspotFromCustomData(&bitmap, &hotspot, &scale);
+ custom_cursor_->set_custom_bitmap(bitmap);
+ custom_cursor_->set_custom_hotspot(hotspot);
+ custom_cursor_->set_image_scale_factor(scale);
+ custom_cursor_->SetPlatformCursor(GetPlatformCursor(*custom_cursor_));
+ }
+ return *custom_cursor_;
}
- return info_.type;
+ return cursor_.type();
}
void WebCursor::CreateScaledBitmapAndHotspotFromCustomData(SkBitmap* bitmap,
gfx::Point* hotspot,
float* scale) {
- *bitmap = info_.custom_image;
- *hotspot = info_.hotspot;
+ DCHECK_EQ(ui::mojom::CursorType::kCustom, cursor_.type());
+ *bitmap = cursor_.custom_bitmap();
+ *hotspot = cursor_.custom_hotspot();
*scale = GetCursorScaleFactor(bitmap);
ui::ScaleAndRotateCursorBitmapAndHotpoint(*scale, rotation_, bitmap, hotspot);
}
@@ -49,8 +52,8 @@ void WebCursor::SetDisplayInfo(const display::Display& display) {
// ozone also has extra calculations for scale factor (taking max cursor size
// into account).
float WebCursor::GetCursorScaleFactor(SkBitmap* bitmap) {
- DCHECK_NE(0, info_.image_scale_factor);
- return device_scale_factor_ / info_.image_scale_factor;
+ DCHECK_NE(0, cursor_.image_scale_factor());
+ return device_scale_factor_ / cursor_.image_scale_factor();
}
#endif
diff --git a/chromium/content/common/cursors/webcursor_aurawin.cc b/chromium/content/common/cursors/webcursor_aurawin.cc
index a41028e2f64..f70096edaa4 100644
--- a/chromium/content/common/cursors/webcursor_aurawin.cc
+++ b/chromium/content/common/cursors/webcursor_aurawin.cc
@@ -6,20 +6,21 @@
#include <windows.h>
-#include "third_party/blink/public/platform/web_cursor_info.h"
+#include "ui/base/cursor/cursor_lookup.h"
+#include "ui/base/mojom/cursor_type.mojom-shared.h"
#include "ui/gfx/icon_util.h"
namespace content {
ui::PlatformCursor WebCursor::GetPlatformCursor(const ui::Cursor& cursor) {
- if (info_.type != ui::CursorType::kCustom)
+ if (cursor_.type() != ui::mojom::CursorType::kCustom)
return LoadCursor(nullptr, IDC_ARROW);
if (platform_cursor_)
return platform_cursor_;
- platform_cursor_ = IconUtil::CreateCursorFromSkBitmap(cursor.GetBitmap(),
- cursor.GetHotspot())
+ platform_cursor_ = IconUtil::CreateCursorFromSkBitmap(
+ GetCursorBitmap(cursor), GetCursorHotspot(cursor))
.release();
return platform_cursor_;
}
@@ -33,6 +34,7 @@ void WebCursor::CleanupPlatformData() {
DestroyIcon(platform_cursor_);
platform_cursor_ = nullptr;
}
+ custom_cursor_.reset();
}
void WebCursor::CopyPlatformData(const WebCursor& other) {
diff --git a/chromium/content/common/cursors/webcursor_aurax11.cc b/chromium/content/common/cursors/webcursor_aurax11.cc
index 8f676e0b1d6..a52625ce1df 100644
--- a/chromium/content/common/cursors/webcursor_aurax11.cc
+++ b/chromium/content/common/cursors/webcursor_aurax11.cc
@@ -6,9 +6,9 @@
#include "base/logging.h"
-#include "third_party/blink/public/platform/web_cursor_info.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/cursor/cursor_loader_x11.h"
+#include "ui/base/cursor/cursor_lookup.h"
#include "ui/base/x/x11_util.h"
#include "ui/gfx/x/x11.h"
@@ -18,10 +18,10 @@ ui::PlatformCursor WebCursor::GetPlatformCursor(const ui::Cursor& cursor) {
if (platform_cursor_)
return platform_cursor_;
- SkBitmap bitmap = cursor.GetBitmap();
+ SkBitmap bitmap = GetCursorBitmap(cursor);
XcursorImage* image =
- ui::SkBitmapToXcursorImage(&bitmap, cursor.GetHotspot());
+ ui::SkBitmapToXcursorImage(&bitmap, GetCursorHotspot(cursor));
platform_cursor_ = ui::CreateReffedCustomXCursor(image);
return platform_cursor_;
}
@@ -35,6 +35,7 @@ void WebCursor::CleanupPlatformData() {
ui::UnrefCustomXCursor(platform_cursor_);
platform_cursor_ = 0;
}
+ custom_cursor_.reset();
}
void WebCursor::CopyPlatformData(const WebCursor& other) {
diff --git a/chromium/content/common/cursors/webcursor_mac.mm b/chromium/content/common/cursors/webcursor_mac.mm
index 52271389fca..792cde4224c 100644
--- a/chromium/content/common/cursors/webcursor_mac.mm
+++ b/chromium/content/common/cursors/webcursor_mac.mm
@@ -9,12 +9,12 @@
#include "base/logging.h"
#include "base/mac/scoped_cftyperef.h"
-#include "base/mac/sdk_forward_declarations.h"
#include "content/app/resources/grit/content_resources.h"
#include "content/public/common/content_client.h"
#include "skia/ext/skia_utils_mac.h"
-#include "third_party/blink/public/platform/web_cursor_info.h"
#include "third_party/blink/public/platform/web_size.h"
+#include "ui/base/cursor/cursor.h"
+#include "ui/base/mojom/cursor_type.mojom-shared.h"
#include "ui/gfx/geometry/point_conversions.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/image/image.h"
@@ -69,7 +69,7 @@ typedef long long CrCoreCursorType;
@interface CrCoreCursor : NSCursor {
@private
- CrCoreCursorType type_;
+ CrCoreCursorType _type;
}
+ (id)cursorWithType:(CrCoreCursorType)type;
@@ -91,13 +91,13 @@ typedef long long CrCoreCursorType;
- (id)initWithType:(CrCoreCursorType)type {
if ((self = [super init])) {
- type_ = type;
+ _type = type;
}
return self;
}
- (CrCoreCursorType)_coreCursorType {
- return type_;
+ return _type;
}
@end
@@ -126,9 +126,10 @@ NSCursor* GetCoreCursorWithFallback(CrCoreCursorType type,
return LoadCursor(resource_id, hotspot_x, hotspot_y);
}
-NSCursor* CreateCustomCursor(const content::CursorInfo& info) {
- float custom_scale = info.image_scale_factor;
- gfx::Size custom_size(info.custom_image.width(), info.custom_image.height());
+NSCursor* CreateCustomCursor(const ui::Cursor& cursor) {
+ float custom_scale = cursor.image_scale_factor();
+ gfx::Size custom_size(cursor.custom_bitmap().width(),
+ cursor.custom_bitmap().height());
// Convert from pixels to view units.
if (custom_scale == 0)
@@ -136,19 +137,20 @@ NSCursor* CreateCustomCursor(const content::CursorInfo& info) {
NSSize dip_size = NSSizeFromCGSize(
gfx::ScaleToFlooredSize(custom_size, 1 / custom_scale).ToCGSize());
NSPoint dip_hotspot = NSPointFromCGPoint(
- gfx::ScaleToFlooredPoint(info.hotspot, 1 / custom_scale).ToCGPoint());
+ gfx::ScaleToFlooredPoint(cursor.custom_hotspot(), 1 / custom_scale)
+ .ToCGPoint());
// Both the image and its representation need to have the same size for
// cursors to appear in high resolution on retina displays. Note that the
// size of a representation is not the same as pixelsWide or pixelsHigh.
- NSImage* cursor_image = skia::SkBitmapToNSImage(info.custom_image);
+ NSImage* cursor_image = skia::SkBitmapToNSImage(cursor.custom_bitmap());
[cursor_image setSize:dip_size];
[[[cursor_image representations] objectAtIndex:0] setSize:dip_size];
- NSCursor* cursor = [[NSCursor alloc] initWithImage:cursor_image
- hotSpot:dip_hotspot];
+ NSCursor* nscursor = [[NSCursor alloc] initWithImage:cursor_image
+ hotSpot:dip_hotspot];
- return [cursor autorelease];
+ return [nscursor autorelease];
}
} // namespace
@@ -157,118 +159,118 @@ namespace content {
// Match Safari's cursor choices; see platform/mac/CursorMac.mm .
gfx::NativeCursor WebCursor::GetNativeCursor() {
- switch (info_.type) {
- case ui::CursorType::kPointer:
+ switch (cursor_.type()) {
+ case ui::mojom::CursorType::kPointer:
return [NSCursor arrowCursor];
- case ui::CursorType::kCross:
+ case ui::mojom::CursorType::kCross:
return [NSCursor crosshairCursor];
- case ui::CursorType::kHand:
+ case ui::mojom::CursorType::kHand:
return [NSCursor pointingHandCursor];
- case ui::CursorType::kIBeam:
+ case ui::mojom::CursorType::kIBeam:
return [NSCursor IBeamCursor];
- case ui::CursorType::kWait:
+ case ui::mojom::CursorType::kWait:
return GetCoreCursorWithFallback(kBusyButClickableCursor,
IDR_WAIT_CURSOR, 7, 7);
- case ui::CursorType::kHelp:
+ case ui::mojom::CursorType::kHelp:
return GetCoreCursorWithFallback(kHelpCursor,
IDR_HELP_CURSOR, 8, 8);
- case ui::CursorType::kEastResize:
- case ui::CursorType::kEastPanning:
+ case ui::mojom::CursorType::kEastResize:
+ case ui::mojom::CursorType::kEastPanning:
return GetCoreCursorWithFallback(kResizeEastCursor,
IDR_EAST_RESIZE_CURSOR, 14, 7);
- case ui::CursorType::kNorthResize:
- case ui::CursorType::kNorthPanning:
+ case ui::mojom::CursorType::kNorthResize:
+ case ui::mojom::CursorType::kNorthPanning:
return GetCoreCursorWithFallback(kResizeNorthCursor,
IDR_NORTH_RESIZE_CURSOR, 7, 1);
- case ui::CursorType::kNorthEastResize:
- case ui::CursorType::kNorthEastPanning:
+ case ui::mojom::CursorType::kNorthEastResize:
+ case ui::mojom::CursorType::kNorthEastPanning:
return GetCoreCursorWithFallback(kResizeNortheastCursor,
IDR_NORTHEAST_RESIZE_CURSOR, 14, 1);
- case ui::CursorType::kNorthWestResize:
- case ui::CursorType::kNorthWestPanning:
+ case ui::mojom::CursorType::kNorthWestResize:
+ case ui::mojom::CursorType::kNorthWestPanning:
return GetCoreCursorWithFallback(kResizeNorthwestCursor,
IDR_NORTHWEST_RESIZE_CURSOR, 0, 0);
- case ui::CursorType::kSouthResize:
- case ui::CursorType::kSouthPanning:
+ case ui::mojom::CursorType::kSouthResize:
+ case ui::mojom::CursorType::kSouthPanning:
return GetCoreCursorWithFallback(kResizeSouthCursor,
IDR_SOUTH_RESIZE_CURSOR, 7, 14);
- case ui::CursorType::kSouthEastResize:
- case ui::CursorType::kSouthEastPanning:
+ case ui::mojom::CursorType::kSouthEastResize:
+ case ui::mojom::CursorType::kSouthEastPanning:
return GetCoreCursorWithFallback(kResizeSoutheastCursor,
IDR_SOUTHEAST_RESIZE_CURSOR, 14, 14);
- case ui::CursorType::kSouthWestResize:
- case ui::CursorType::kSouthWestPanning:
+ case ui::mojom::CursorType::kSouthWestResize:
+ case ui::mojom::CursorType::kSouthWestPanning:
return GetCoreCursorWithFallback(kResizeSouthwestCursor,
IDR_SOUTHWEST_RESIZE_CURSOR, 1, 14);
- case ui::CursorType::kWestResize:
- case ui::CursorType::kWestPanning:
+ case ui::mojom::CursorType::kWestResize:
+ case ui::mojom::CursorType::kWestPanning:
return GetCoreCursorWithFallback(kResizeWestCursor,
IDR_WEST_RESIZE_CURSOR, 1, 7);
- case ui::CursorType::kNorthSouthResize:
+ case ui::mojom::CursorType::kNorthSouthResize:
return GetCoreCursorWithFallback(kResizeNorthSouthCursor,
IDR_NORTHSOUTH_RESIZE_CURSOR, 7, 7);
- case ui::CursorType::kEastWestResize:
+ case ui::mojom::CursorType::kEastWestResize:
return GetCoreCursorWithFallback(kResizeEastWestCursor,
IDR_EASTWEST_RESIZE_CURSOR, 7, 7);
- case ui::CursorType::kNorthEastSouthWestResize:
+ case ui::mojom::CursorType::kNorthEastSouthWestResize:
return GetCoreCursorWithFallback(kResizeNortheastSouthwestCursor,
IDR_NORTHEASTSOUTHWEST_RESIZE_CURSOR,
7, 7);
- case ui::CursorType::kNorthWestSouthEastResize:
+ case ui::mojom::CursorType::kNorthWestSouthEastResize:
return GetCoreCursorWithFallback(kResizeNorthwestSoutheastCursor,
IDR_NORTHWESTSOUTHEAST_RESIZE_CURSOR,
7, 7);
- case ui::CursorType::kColumnResize:
+ case ui::mojom::CursorType::kColumnResize:
return [NSCursor resizeLeftRightCursor];
- case ui::CursorType::kRowResize:
+ case ui::mojom::CursorType::kRowResize:
return [NSCursor resizeUpDownCursor];
- case ui::CursorType::kMiddlePanning:
- case ui::CursorType::kMiddlePanningVertical:
- case ui::CursorType::kMiddlePanningHorizontal:
- case ui::CursorType::kMove:
+ case ui::mojom::CursorType::kMiddlePanning:
+ case ui::mojom::CursorType::kMiddlePanningVertical:
+ case ui::mojom::CursorType::kMiddlePanningHorizontal:
+ case ui::mojom::CursorType::kMove:
return GetCoreCursorWithFallback(kMoveCursor,
IDR_MOVE_CURSOR, 7, 7);
- case ui::CursorType::kVerticalText:
+ case ui::mojom::CursorType::kVerticalText:
// IBeamCursorForVerticalLayout is >= 10.7.
if ([NSCursor respondsToSelector:@selector(IBeamCursorForVerticalLayout)])
return [NSCursor IBeamCursorForVerticalLayout];
else
return LoadCursor(IDR_VERTICALTEXT_CURSOR, 7, 7);
- case ui::CursorType::kCell:
+ case ui::mojom::CursorType::kCell:
return GetCoreCursorWithFallback(kCellCursor,
IDR_CELL_CURSOR, 7, 7);
- case ui::CursorType::kContextMenu:
+ case ui::mojom::CursorType::kContextMenu:
return [NSCursor contextualMenuCursor];
- case ui::CursorType::kAlias:
+ case ui::mojom::CursorType::kAlias:
return GetCoreCursorWithFallback(kMakeAliasCursor,
IDR_ALIAS_CURSOR, 11, 3);
- case ui::CursorType::kProgress:
+ case ui::mojom::CursorType::kProgress:
return GetCoreCursorWithFallback(kBusyButClickableCursor,
IDR_PROGRESS_CURSOR, 3, 2);
- case ui::CursorType::kNoDrop:
- case ui::CursorType::kNotAllowed:
+ case ui::mojom::CursorType::kNoDrop:
+ case ui::mojom::CursorType::kNotAllowed:
return [NSCursor operationNotAllowedCursor];
- case ui::CursorType::kCopy:
+ case ui::mojom::CursorType::kCopy:
return [NSCursor dragCopyCursor];
- case ui::CursorType::kNone:
+ case ui::mojom::CursorType::kNone:
return LoadCursor(IDR_NONE_CURSOR, 7, 7);
- case ui::CursorType::kZoomIn:
+ case ui::mojom::CursorType::kZoomIn:
return GetCoreCursorWithFallback(kZoomInCursor,
IDR_ZOOMIN_CURSOR, 7, 7);
- case ui::CursorType::kZoomOut:
+ case ui::mojom::CursorType::kZoomOut:
return GetCoreCursorWithFallback(kZoomOutCursor,
IDR_ZOOMOUT_CURSOR, 7, 7);
- case ui::CursorType::kGrab:
+ case ui::mojom::CursorType::kGrab:
return [NSCursor openHandCursor];
- case ui::CursorType::kGrabbing:
+ case ui::mojom::CursorType::kGrabbing:
return [NSCursor closedHandCursor];
- case ui::CursorType::kCustom:
- return CreateCustomCursor(info_);
- case ui::CursorType::kNull:
- case ui::CursorType::kDndNone:
- case ui::CursorType::kDndMove:
- case ui::CursorType::kDndCopy:
- case ui::CursorType::kDndLink:
+ case ui::mojom::CursorType::kCustom:
+ return CreateCustomCursor(cursor_);
+ case ui::mojom::CursorType::kNull:
+ case ui::mojom::CursorType::kDndNone:
+ case ui::mojom::CursorType::kDndMove:
+ case ui::mojom::CursorType::kDndCopy:
+ case ui::mojom::CursorType::kDndLink:
// These cursors do not apply on Mac.
break;
}
diff --git a/chromium/content/common/cursors/webcursor_ozone.cc b/chromium/content/common/cursors/webcursor_ozone.cc
index f1bcf9a8c0d..1f3644bb1e0 100644
--- a/chromium/content/common/cursors/webcursor_ozone.cc
+++ b/chromium/content/common/cursors/webcursor_ozone.cc
@@ -6,8 +6,8 @@
#include <algorithm>
-#include "third_party/blink/public/platform/web_cursor_info.h"
#include "ui/base/cursor/cursor.h"
+#include "ui/base/cursor/cursor_lookup.h"
#include "ui/base/cursor/cursor_util.h"
#include "ui/ozone/public/cursor_factory_ozone.h"
@@ -16,27 +16,29 @@ namespace content {
ui::PlatformCursor WebCursor::GetPlatformCursor(const ui::Cursor& cursor) {
if (!platform_cursor_) {
platform_cursor_ = ui::CursorFactoryOzone::GetInstance()->CreateImageCursor(
- cursor.GetBitmap(), cursor.GetHotspot(), cursor.device_scale_factor());
+ GetCursorBitmap(cursor), GetCursorHotspot(cursor),
+ cursor.image_scale_factor());
}
return platform_cursor_;
}
void WebCursor::SetDisplayInfo(const display::Display& display) {
- if (rotation_ == display.rotation() &&
+ if (rotation_ == display.panel_rotation() &&
device_scale_factor_ == display.device_scale_factor() &&
maximum_cursor_size_ == display.maximum_cursor_size())
return;
device_scale_factor_ = display.device_scale_factor();
- rotation_ = display.rotation();
+ // The cursor should use the panel's physical rotation instead of
+ // rotation. They can be different on ChromeOS but the same on
+ // other platforms.
+ rotation_ = display.panel_rotation();
maximum_cursor_size_ = display.maximum_cursor_size();
// TODO(oshima): Identify if it's possible to remove this check here and move
// the kDefaultMaxSize constants to a single place. crbug.com/603512
if (maximum_cursor_size_.width() == 0 || maximum_cursor_size_.height() == 0)
maximum_cursor_size_ = gfx::Size(kDefaultMaxSize, kDefaultMaxSize);
- if (platform_cursor_)
- ui::CursorFactoryOzone::GetInstance()->UnrefImageCursor(platform_cursor_);
- platform_cursor_ = NULL;
+ CleanupPlatformData();
// It is not necessary to recreate platform_cursor_ yet, since it will be
// recreated on demand when GetPlatformCursor is called.
}
@@ -45,7 +47,7 @@ float WebCursor::GetCursorScaleFactor(SkBitmap* bitmap) {
DCHECK_LT(0, maximum_cursor_size_.width());
DCHECK_LT(0, maximum_cursor_size_.height());
return std::min(
- {device_scale_factor_ / info_.image_scale_factor,
+ {device_scale_factor_ / cursor_.image_scale_factor(),
static_cast<float>(maximum_cursor_size_.width()) / bitmap->width(),
static_cast<float>(maximum_cursor_size_.height()) / bitmap->height()});
}
@@ -59,6 +61,7 @@ void WebCursor::CleanupPlatformData() {
ui::CursorFactoryOzone::GetInstance()->UnrefImageCursor(platform_cursor_);
platform_cursor_ = NULL;
}
+ custom_cursor_.reset();
}
void WebCursor::CopyPlatformData(const WebCursor& other) {
diff --git a/chromium/content/common/cursors/webcursor_unittest.cc b/chromium/content/common/cursors/webcursor_unittest.cc
index ce38fc08fa3..2cbd51dcf0f 100644
--- a/chromium/content/common/cursors/webcursor_unittest.cc
+++ b/chromium/content/common/cursors/webcursor_unittest.cc
@@ -8,6 +8,9 @@
#include "content/common/cursors/webcursor.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/base/cursor/cursor.h"
+#include "ui/base/cursor/cursor_lookup.h"
+#include "ui/base/mojom/cursor_type.mojom-shared.h"
#if defined(OS_WIN)
#include <windows.h>
@@ -25,135 +28,159 @@ SkBitmap CreateTestBitmap(int width, int height) {
}
TEST(WebCursorTest, DefaultConstructor) {
- WebCursor cursor;
- EXPECT_EQ(ui::CursorType::kPointer, cursor.info().type);
- EXPECT_TRUE(cursor.info().custom_image.isNull());
- EXPECT_TRUE(cursor.info().hotspot.IsOrigin());
- EXPECT_EQ(1.f, cursor.info().image_scale_factor);
+ WebCursor webcursor;
+ EXPECT_EQ(ui::mojom::CursorType::kNull, webcursor.cursor().type());
+ EXPECT_TRUE(webcursor.cursor().custom_bitmap().isNull());
+ EXPECT_TRUE(webcursor.cursor().custom_hotspot().IsOrigin());
+ EXPECT_EQ(1.f, webcursor.cursor().image_scale_factor());
}
-TEST(WebCursorTest, CursorInfoConstructor) {
- CursorInfo info(ui::CursorType::kHand);
- WebCursor cursor(info);
- EXPECT_EQ(info, cursor.info());
+TEST(WebCursorTest, WebCursorCursorConstructor) {
+ ui::Cursor cursor(ui::mojom::CursorType::kHand);
+ WebCursor webcursor(cursor);
+ EXPECT_EQ(cursor, webcursor.cursor());
}
-TEST(WebCursorTest, CursorInfoConstructorCustom) {
- CursorInfo info(ui::CursorType::kCustom);
- info.custom_image = CreateTestBitmap(32, 32);
- info.hotspot = gfx::Point(10, 20);
- info.image_scale_factor = 1.5f;
- WebCursor cursor(info);
- EXPECT_EQ(info, cursor.info());
+TEST(WebCursorTest, WebCursorCursorConstructorCustom) {
+ ui::Cursor cursor(ui::mojom::CursorType::kCustom);
+ cursor.set_custom_bitmap(CreateTestBitmap(32, 32));
+ cursor.set_custom_hotspot(gfx::Point(10, 20));
+ cursor.set_image_scale_factor(2.f);
+ WebCursor webcursor(cursor);
+ EXPECT_EQ(cursor, webcursor.cursor());
+
+#if defined(USE_AURA)
+ // Test if the custom cursor is correctly cached and updated
+ // on aura platform.
+ gfx::NativeCursor native_cursor = webcursor.GetNativeCursor();
+ EXPECT_EQ(gfx::Point(5, 10), GetCursorHotspot(native_cursor));
+ EXPECT_TRUE(webcursor.has_custom_cursor_for_test());
+ webcursor.SetCursor(cursor);
+ EXPECT_FALSE(webcursor.has_custom_cursor_for_test());
+ webcursor.GetNativeCursor();
+ EXPECT_TRUE(webcursor.has_custom_cursor_for_test());
+
+#if defined(USE_OZONE)
+ // Test if the rotating custom cursor works correctly.
+ display::Display display;
+ display.set_panel_rotation(display::Display::ROTATE_90);
+ webcursor.SetDisplayInfo(display);
+ EXPECT_FALSE(webcursor.has_custom_cursor_for_test());
+ native_cursor = webcursor.GetNativeCursor();
+ EXPECT_TRUE(webcursor.has_custom_cursor_for_test());
+ // Hotspot should be scaled & rotated. We're using the icon created for 2.0,
+ // on the display with dsf=1.0, so the host spot should be
+ // ((32 - 20) / 2, 10 / 2) = (6, 5).
+ EXPECT_EQ(gfx::Point(6, 5), GetCursorHotspot(native_cursor));
+#endif
+#endif
}
TEST(WebCursorTest, CopyConstructorType) {
- CursorInfo info(ui::CursorType::kHand);
- WebCursor cursor(info);
- WebCursor copy(cursor);
- EXPECT_EQ(cursor, copy);
+ ui::Cursor cursor(ui::mojom::CursorType::kHand);
+ WebCursor webcursor(cursor);
+ WebCursor copy(webcursor);
+ EXPECT_EQ(webcursor, copy);
}
TEST(WebCursorTest, CopyConstructorCustom) {
- CursorInfo info(ui::CursorType::kCustom);
- info.custom_image = CreateTestBitmap(32, 32);
- info.hotspot = gfx::Point(10, 20);
- info.image_scale_factor = 1.5f;
- WebCursor cursor(info);
- WebCursor copy(cursor);
- EXPECT_EQ(cursor, copy);
+ ui::Cursor cursor(ui::mojom::CursorType::kCustom);
+ cursor.set_custom_bitmap(CreateTestBitmap(32, 32));
+ cursor.set_custom_hotspot(gfx::Point(10, 20));
+ cursor.set_image_scale_factor(1.5f);
+ WebCursor webcursor(cursor);
+ WebCursor copy(webcursor);
+ EXPECT_EQ(webcursor, copy);
}
TEST(WebCursorTest, ClampHotspot) {
// Initialize a cursor with an invalid hotspot; it should be clamped.
- CursorInfo info(ui::CursorType::kCustom);
- info.hotspot = gfx::Point(100, 100);
- info.custom_image = CreateTestBitmap(5, 7);
- WebCursor cursor(info);
- EXPECT_EQ(gfx::Point(4, 6), cursor.info().hotspot);
- // SetInfo should also clamp the hotspot.
- EXPECT_TRUE(cursor.SetInfo(info));
- EXPECT_EQ(gfx::Point(4, 6), cursor.info().hotspot);
+ ui::Cursor cursor(ui::mojom::CursorType::kCustom);
+ cursor.set_custom_hotspot(gfx::Point(100, 100));
+ cursor.set_custom_bitmap(CreateTestBitmap(5, 7));
+ WebCursor webcursor(cursor);
+ EXPECT_EQ(gfx::Point(4, 6), webcursor.cursor().custom_hotspot());
+ // SetCursor should also clamp the hotspot.
+ EXPECT_TRUE(webcursor.SetCursor(cursor));
+ EXPECT_EQ(gfx::Point(4, 6), webcursor.cursor().custom_hotspot());
}
-TEST(WebCursorTest, SetInfo) {
- WebCursor cursor;
- EXPECT_TRUE(cursor.SetInfo(CursorInfo()));
- EXPECT_TRUE(cursor.SetInfo(CursorInfo(ui::CursorType::kHand)));
- EXPECT_TRUE(cursor.SetInfo(CursorInfo(ui::CursorType::kCustom)));
-
- CursorInfo info(ui::CursorType::kCustom);
- info.custom_image = CreateTestBitmap(32, 32);
- info.hotspot = gfx::Point(10, 20);
- info.image_scale_factor = 1.5f;
- EXPECT_TRUE(cursor.SetInfo(info));
-
- // SetInfo should return false when the scale factor is too small.
- info.image_scale_factor = 0.001f;
- EXPECT_FALSE(cursor.SetInfo(info));
-
- // SetInfo should return false when the scale factor is too large.
- info.image_scale_factor = 1000.f;
- EXPECT_FALSE(cursor.SetInfo(info));
-
- // SetInfo should return false when the image width is too large.
- info.image_scale_factor = 1.f;
- info.custom_image = CreateTestBitmap(1025, 3);
- EXPECT_FALSE(cursor.SetInfo(info));
-
- // SetInfo should return false when the image height is too large.
- info.custom_image = CreateTestBitmap(3, 1025);
- EXPECT_FALSE(cursor.SetInfo(info));
-
- // SetInfo should return false when the scaled image width is too large.
- info.image_scale_factor = 0.02f;
- info.custom_image = CreateTestBitmap(50, 5);
- EXPECT_FALSE(cursor.SetInfo(info));
-
- // SetInfo should return false when the scaled image height is too large.
- info.image_scale_factor = 0.1f;
- info.custom_image = CreateTestBitmap(5, 200);
- EXPECT_FALSE(cursor.SetInfo(info));
+TEST(WebCursorTest, SetCursor) {
+ WebCursor webcursor;
+ EXPECT_TRUE(webcursor.SetCursor(ui::Cursor()));
+ EXPECT_TRUE(webcursor.SetCursor(ui::Cursor(ui::mojom::CursorType::kHand)));
+ EXPECT_TRUE(webcursor.SetCursor(ui::Cursor(ui::mojom::CursorType::kCustom)));
+
+ ui::Cursor cursor(ui::mojom::CursorType::kCustom);
+ cursor.set_custom_bitmap(CreateTestBitmap(32, 32));
+ cursor.set_custom_hotspot(gfx::Point(10, 20));
+ cursor.set_image_scale_factor(1.5f);
+ EXPECT_TRUE(webcursor.SetCursor(cursor));
+
+ // SetCursor should return false when the scale factor is too small.
+ cursor.set_image_scale_factor(0.001f);
+ EXPECT_FALSE(webcursor.SetCursor(cursor));
+
+ // SetCursor should return false when the scale factor is too large.
+ cursor.set_image_scale_factor(1000.f);
+ EXPECT_FALSE(webcursor.SetCursor(cursor));
+
+ // SetCursor should return false when the image width is too large.
+ cursor.set_image_scale_factor(1.f);
+ cursor.set_custom_bitmap(CreateTestBitmap(1025, 3));
+ EXPECT_FALSE(webcursor.SetCursor(cursor));
+
+ // SetCursor should return false when the image height is too large.
+ cursor.set_custom_bitmap(CreateTestBitmap(3, 1025));
+ EXPECT_FALSE(webcursor.SetCursor(cursor));
+
+ // SetCursor should return false when the scaled image width is too large.
+ cursor.set_image_scale_factor(0.02f);
+ cursor.set_custom_bitmap(CreateTestBitmap(50, 5));
+ EXPECT_FALSE(webcursor.SetCursor(cursor));
+
+ // SetCursor should return false when the scaled image height is too large.
+ cursor.set_image_scale_factor(0.1f);
+ cursor.set_custom_bitmap(CreateTestBitmap(5, 200));
+ EXPECT_FALSE(webcursor.SetCursor(cursor));
}
#if defined(USE_AURA)
TEST(WebCursorTest, CursorScaleFactor) {
- CursorInfo info;
- info.type = ui::CursorType::kCustom;
- info.hotspot = gfx::Point(0, 1);
- info.image_scale_factor = 2.0f;
- info.custom_image = CreateTestBitmap(128, 128);
- WebCursor cursor(info);
+ ui::Cursor cursor(ui::mojom::CursorType::kCustom);
+ cursor.set_custom_hotspot(gfx::Point(0, 1));
+ cursor.set_image_scale_factor(2.0f);
+ cursor.set_custom_bitmap(CreateTestBitmap(128, 128));
+ WebCursor webcursor(cursor);
display::Display display;
display.set_device_scale_factor(4.2f);
- cursor.SetDisplayInfo(display);
+ webcursor.SetDisplayInfo(display);
#if defined(USE_OZONE)
// For Ozone cursors, the size of the cursor is capped at 64px, and this is
// enforce through the calculated scale factor.
- EXPECT_EQ(0.5f, cursor.GetNativeCursor().device_scale_factor());
+ EXPECT_EQ(0.5f, webcursor.GetNativeCursor().image_scale_factor());
#else
- EXPECT_EQ(2.1f, cursor.GetNativeCursor().device_scale_factor());
+ EXPECT_EQ(2.1f, webcursor.GetNativeCursor().image_scale_factor());
#endif
// Test that the Display dsf is copied.
- WebCursor copy(cursor);
- EXPECT_EQ(cursor.GetNativeCursor().device_scale_factor(),
- copy.GetNativeCursor().device_scale_factor());
+ WebCursor copy(webcursor);
+ EXPECT_EQ(webcursor.GetNativeCursor().image_scale_factor(),
+ copy.GetNativeCursor().image_scale_factor());
}
TEST(WebCursorTest, UnscaledImageCopy) {
- CursorInfo info;
- info.type = ui::CursorType::kCustom;
- info.hotspot = gfx::Point(0, 1);
- info.custom_image = CreateTestBitmap(2, 2);
- WebCursor cursor(info);
+ ui::Cursor cursor(ui::mojom::CursorType::kCustom);
+ cursor.set_custom_hotspot(gfx::Point(0, 1));
+ cursor.set_custom_bitmap(CreateTestBitmap(2, 2));
+ WebCursor webcursor(cursor);
SkBitmap copy;
gfx::Point hotspot;
float dsf = 0.f;
- cursor.CreateScaledBitmapAndHotspotFromCustomData(&copy, &hotspot, &dsf);
+ webcursor.CreateScaledBitmapAndHotspotFromCustomData(&copy, &hotspot, &dsf);
EXPECT_EQ(1.f, dsf);
EXPECT_EQ(2, copy.width());
EXPECT_EQ(2, copy.height());
@@ -164,17 +191,16 @@ TEST(WebCursorTest, UnscaledImageCopy) {
#if defined(OS_WIN)
void ScaleCursor(float scale, int hotspot_x, int hotspot_y) {
- CursorInfo info;
- info.type = ui::CursorType::kCustom;
- info.hotspot = gfx::Point(hotspot_x, hotspot_y);
- info.custom_image = CreateTestBitmap(10, 10);
- WebCursor cursor(info);
+ ui::Cursor cursor(ui::mojom::CursorType::kCustom);
+ cursor.set_custom_hotspot(gfx::Point(hotspot_x, hotspot_y));
+ cursor.set_custom_bitmap(CreateTestBitmap(10, 10));
+ WebCursor webcursor(cursor);
display::Display display;
display.set_device_scale_factor(scale);
- cursor.SetDisplayInfo(display);
+ webcursor.SetDisplayInfo(display);
- HCURSOR windows_cursor_handle = cursor.GetNativeCursor().platform();
+ HCURSOR windows_cursor_handle = webcursor.GetNativeCursor().platform();
EXPECT_NE(nullptr, windows_cursor_handle);
ICONINFO windows_icon_info;
EXPECT_TRUE(GetIconInfo(windows_cursor_handle, &windows_icon_info));
diff --git a/chromium/content/common/drag_messages.h b/chromium/content/common/drag_messages.h
index 3f0bb169297..b07f4bdd012 100644
--- a/chromium/content/common/drag_messages.h
+++ b/chromium/content/common/drag_messages.h
@@ -14,7 +14,7 @@
#include "ipc/ipc_message_macros.h"
#include "third_party/blink/public/platform/web_drag_operation.h"
#include "third_party/skia/include/core/SkBitmap.h"
-#include "ui/gfx/geometry/point.h"
+#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/vector2d.h"
#define IPC_MESSAGE_START DragMsgStart
@@ -50,9 +50,6 @@ IPC_MESSAGE_ROUTED3(DragMsg_SourceEnded,
gfx::PointF /* screen_pt */,
blink::WebDragOperation /* drag_operation */)
-// Notifies the renderer that the system DoDragDrop call has ended.
-IPC_MESSAGE_ROUTED0(DragMsg_SourceSystemDragEnded)
-
// Messages sent from the renderer to the browser.
// Used to tell the parent the user started dragging in the content area. The
diff --git a/chromium/content/common/fetch/BUILD.gn b/chromium/content/common/fetch/BUILD.gn
index 377ae28ce2f..14781a754bc 100644
--- a/chromium/content/common/fetch/BUILD.gn
+++ b/chromium/content/common/fetch/BUILD.gn
@@ -5,7 +5,5 @@
import("//third_party/protobuf/proto_library.gni")
proto_library("fetch_api_request_proto") {
- sources = [
- "fetch_api_request.proto",
- ]
+ sources = [ "fetch_api_request.proto" ]
}
diff --git a/chromium/content/common/fetch/fetch_api_request_proto.cc b/chromium/content/common/fetch/fetch_api_request_proto.cc
index 52e33c17e3c..669d8dd02de 100644
--- a/chromium/content/common/fetch/fetch_api_request_proto.cc
+++ b/chromium/content/common/fetch/fetch_api_request_proto.cc
@@ -50,7 +50,7 @@ blink::mojom::FetchAPIRequestPtr DeserializeFetchRequestFromString(
request_ptr->request_context_type =
static_cast<blink::mojom::RequestContextType>(
request_proto.request_context_type());
- request_ptr->frame_type = network::mojom::RequestContextFrameType::kNone;
+ request_ptr->frame_type = blink::mojom::RequestContextFrameType::kNone;
request_ptr->url = GURL(request_proto.url());
request_ptr->method = request_proto.method();
request_ptr->headers = {request_proto.headers().begin(),
diff --git a/chromium/content/common/fetch/fetch_request_type_converters.cc b/chromium/content/common/fetch/fetch_request_type_converters.cc
index c02b5f004e2..e71b8afb7e3 100644
--- a/chromium/content/common/fetch/fetch_request_type_converters.cc
+++ b/chromium/content/common/fetch/fetch_request_type_converters.cc
@@ -33,13 +33,15 @@ blink::mojom::FetchAPIRequestPtr TypeConverter<
output->mode = input.mode;
output->is_main_resource_load =
content::ServiceWorkerUtils::IsMainResourceType(
- static_cast<content::ResourceType>(input.resource_type));
+ static_cast<blink::mojom::ResourceType>(input.resource_type));
output->credentials_mode = input.credentials_mode;
output->cache_mode =
content::ServiceWorkerUtils::GetCacheModeFromLoadFlags(input.load_flags);
output->redirect_mode = input.redirect_mode;
output->request_context_type = static_cast<blink::mojom::RequestContextType>(
input.fetch_request_context_type);
+ output->destination =
+ static_cast<network::mojom::RequestDestination>(input.destination);
output->is_reload = ui::PageTransitionCoreTypeIs(
static_cast<ui::PageTransition>(input.transition_type),
ui::PAGE_TRANSITION_RELOAD);
diff --git a/chromium/content/common/font_list.cc b/chromium/content/common/font_list.cc
index d5e78123ee0..63130ef940a 100644
--- a/chromium/content/common/font_list.cc
+++ b/chromium/content/common/font_list.cc
@@ -4,17 +4,15 @@
#include "content/common/font_list.h"
-#include "base/task/lazy_task_runner.h"
+#include "base/task/lazy_thread_pool_task_runner.h"
namespace content {
namespace {
-base::LazySequencedTaskRunner g_font_list_task_runner =
- LAZY_SEQUENCED_TASK_RUNNER_INITIALIZER(
- base::TaskTraits(base::ThreadPool(),
- base::MayBlock(),
- base::TaskPriority::USER_VISIBLE));
+base::LazyThreadPoolSequencedTaskRunner g_font_list_task_runner =
+ LAZY_THREAD_POOL_SEQUENCED_TASK_RUNNER_INITIALIZER(
+ base::TaskTraits(base::MayBlock(), base::TaskPriority::USER_VISIBLE));
} // namespace
diff --git a/chromium/content/common/font_list_unittest.cc b/chromium/content/common/font_list_unittest.cc
index 5d2ef4e5b62..710bf96a9ae 100644
--- a/chromium/content/common/font_list_unittest.cc
+++ b/chromium/content/common/font_list_unittest.cc
@@ -8,6 +8,7 @@
#include "base/i18n/rtl.h"
#include "base/sequenced_task_runner.h"
#include "base/strings/string_piece.h"
+#include "base/strings/string_util.h"
#include "base/task/post_task.h"
#include "base/task_runner_util.h"
#include "base/test/task_environment.h"
@@ -75,3 +76,23 @@ TEST(FontList, GetFontListLocalized) {
EXPECT_TRUE(HasFontWithName(*ko_fonts, "Malgun Gothic", "맑은 고딕"));
}
#endif // defined(OS_WIN)
+
+#if defined(OS_MACOSX)
+// On some macOS versions, CTFontManager returns LastResort and/or hidden fonts.
+// Ensure that someone (CTFontManager or our FontList code) filters these fonts
+// on all OS versions that we support.
+TEST(FontList, GetFontListDoesNotIncludeHiddenFonts) {
+ std::unique_ptr<base::ListValue> fonts = content::GetFontList_SlowBlocking();
+
+ for (const auto& font : fonts->GetList()) {
+ const auto& font_names = font.GetList();
+ const std::string& font_id = font_names[0].GetString();
+
+ // The checks are inspired by Gecko's gfxMacPlatformFontList::AddFamily.
+ EXPECT_FALSE(base::LowerCaseEqualsASCII(font_id, "lastresort"))
+ << font_id << " seems to be LastResort, which should be filtered";
+ EXPECT_FALSE(font_id[0] == '.')
+ << font_id << " seems like a hidden font, which should be filtered";
+ }
+}
+#endif // defined(OS_MACOSX)
diff --git a/chromium/content/common/frame.mojom b/chromium/content/common/frame.mojom
index 822413b2824..edf716bca26 100644
--- a/chromium/content/common/frame.mojom
+++ b/chromium/content/common/frame.mojom
@@ -4,44 +4,49 @@
module content.mojom;
+import "content/common/ax_content_tree_update.mojom";
import "content/common/document_scoped_interface_bundle.mojom";
import "content/common/frame_messages.mojom";
import "content/common/native_types.mojom";
import "content/common/navigation_client.mojom";
import "content/common/navigation_params.mojom";
+import "content/common/widget.mojom";
import "content/public/common/browser_controls_state.mojom";
-import "content/public/common/resource_type.mojom";
-import "content/public/common/resource_load_info.mojom";
import "content/public/common/transferrable_url_loader.mojom";
import "content/public/common/window_container_type.mojom";
import "mojo/public/mojom/base/string16.mojom";
import "mojo/public/mojom/base/unguessable_token.mojom";
import "mojo/public/mojom/base/values.mojom";
-import "services/network/public/mojom/url_response_head.mojom";
+import "services/network/public/mojom/content_security_policy.mojom";
import "services/network/public/mojom/url_loader.mojom";
import "services/network/public/mojom/url_loader_factory.mojom";
+import "services/network/public/mojom/url_response_head.mojom";
import "services/service_manager/public/mojom/interface_provider.mojom";
+import "services/viz/public/mojom/compositing/frame_sink_id.mojom";
import "services/viz/public/mojom/compositing/surface_id.mojom";
import "third_party/blink/public/mojom/blob/blob_url_store.mojom";
import "third_party/blink/public/mojom/commit_result/commit_result.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/feature_policy/document_policy_feature.mojom";
import "third_party/blink/public/mojom/feature_policy/feature_policy.mojom";
+import "third_party/blink/public/mojom/feature_policy/feature_policy_feature.mojom";
+import "third_party/blink/public/mojom/feature_policy/policy_value.mojom";
import "third_party/blink/public/mojom/frame/lifecycle.mojom";
import "third_party/blink/public/mojom/frame/navigation_initiator.mojom";
-import "third_party/blink/public/mojom/messaging/transferable_message.mojom";
+import "third_party/blink/public/mojom/loader/resource_load_info.mojom";
import "third_party/blink/public/mojom/loader/url_loader_factory_bundle.mojom";
import "third_party/blink/public/mojom/messaging/transferable_message.mojom";
+import "third_party/blink/public/mojom/page/widget.mojom";
import "third_party/blink/public/mojom/portal/portal.mojom";
import "third_party/blink/public/mojom/referrer.mojom";
import "third_party/blink/public/mojom/service_worker/controller_service_worker.mojom";
import "third_party/blink/public/mojom/service_worker/service_worker_provider.mojom";
-import "third_party/blink/public/mojom/devtools/devtools_agent.mojom";
-import "third_party/blink/public/mojom/portal/portal.mojom";
import "third_party/blink/public/mojom/window_features/window_features.mojom";
import "ui/base/mojom/window_open_disposition.mojom";
-import "url/mojom/url.mojom";
-import "url/mojom/origin.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
+import "url/mojom/origin.mojom";
+import "url/mojom/url.mojom";
// The name of the InterfaceProviderSpec in service manifests used by the
// frame tree to expose frame-specific interfaces between renderer and browser.
@@ -80,6 +85,12 @@ interface Frame {
UpdateBrowserControlsState(BrowserControlsState constraints,
BrowserControlsState current,
bool animate);
+
+ // Requests a one-time snapshot of the accessibility tree without enabling
+ // accessibility if it wasn't already enabled.
+ // See ui/accessibility/ax_mode.h for valid values of |ax_mode|.
+ SnapshotAccessibilityTree(uint32 ax_mode)
+ => (ax.mojom.AXContentTreeUpdate snapshot);
};
// Implemented by the frame provider and currently must be associated with the
@@ -232,12 +243,6 @@ interface FrameNavigationControl {
pending_associated_receiver<blink.mojom.PortalClient> portal_client,
blink.mojom.TransferableMessage data)
=> (blink.mojom.PortalActivateResult result);
-
- // Notifies the document navigation was blocked because a content security
- // policy was violated.
- // This message is targeting a specific document in the RenderFrame, so the
- // order with the CommitNavigation must be preserved.
- ReportContentSecurityPolicyViolation(CSPViolationParams violation_params);
};
// Implemented by the frame (e.g. renderer processes).
@@ -263,11 +268,9 @@ interface FrameFactory {
};
struct CreateNewWindowParams {
- // True if this open request came in the context of a user gesture.
- //
- // TODO(mustaq): We have cases where a user gesture is assumed to be
- // there even when it's not the case. See https://crbug.com/843233.
- bool mimic_user_gesture;
+ // True if ContentRendererClient allows popups. This is the case only for
+ // extensions.
+ bool allow_popup;
// Type of window requested.
WindowContainerType window_container_type;
@@ -328,6 +331,12 @@ struct CreateNewWindowReply {
// Initial properties for the main frame RenderWidget.
VisualProperties visual_properties;
+ // The communication interfaces for the WebFrameWidget in blink.
+ pending_associated_remote<blink.mojom.FrameWidgetHost> frame_widget_host;
+ pending_associated_receiver<blink.mojom.FrameWidget> frame_widget;
+ pending_associated_remote<blink.mojom.WidgetHost> widget_host;
+ pending_associated_receiver<blink.mojom.Widget> widget;
+
DocumentScopedInterfaceBundle main_frame_interface_bundle;
// Duplicated from CreateNewWindowParams because legacy code.
@@ -340,6 +349,11 @@ struct CreateNewWindowReply {
// |devtools_frame_token| is only defined by the browser and is never
// sent back from the renderer in the control calls.
mojo_base.mojom.UnguessableToken devtools_main_frame_token;
+
+ // Used by devtools instrumentation to tell devtools agent in the renderer
+ // that it should pause created window and wait for an explicit resume command
+ // from the client.
+ bool wait_for_debugger;
};
// An opaque handle that keeps alive the associated render process even after
@@ -357,12 +371,14 @@ interface FrameHost {
// Sent by the renderer process to request the creation of a new portal.
// |portal| is the pipe to be used for the Portal object, |client| is the pipe
// used to communicate back with the caller. Returns |proxy_routing_id|, which
- // is the routing id of the RenderFrameProxy and |portal_token|, which is the
- // unique identifier for the portal.
+ // is the routing id of the RenderFrameProxy, |initial_replicated_state|, the
+ // replicated state associated with that RenderFrameProxy, and |portal_token|,
+ // which is the unique identifier for the portal.
[Sync] CreatePortal(
pending_associated_receiver<blink.mojom.Portal> portal,
pending_associated_remote<blink.mojom.PortalClient> client)
=> (int32 proxy_routing_id,
+ FrameReplicationState initial_replicated_state,
mojo_base.mojom.UnguessableToken portal_token,
mojo_base.mojom.UnguessableToken devtools_frame_token);
@@ -372,9 +388,24 @@ interface FrameHost {
// that RFP, and the |devtools_frame_token|.
[Sync] AdoptPortal(mojo_base.mojom.UnguessableToken portal_token)
=> (int32 proxy_routing_id,
+ viz.mojom.FrameSinkId frame_sink_id,
FrameReplicationState replicated_state,
mojo_base.mojom.UnguessableToken devtools_frame_token);
+
+ // Similar to CreateNewWindow, except used for sub-widgets, like <select>
+ // dropdowns.
+ [Sync] CreateNewWidget(pending_remote<Widget> widget,
+ pending_associated_receiver<blink.mojom.WidgetHost> blink_widget_host,
+ pending_associated_remote<blink.mojom.Widget> blink_widget)
+ => (int32 routing_id);
+
+ // Similar to CreateNewWidget except the widget is a full screen window.
+ [Sync] CreateNewFullscreenWidget(pending_remote<Widget> widget,
+ pending_associated_receiver<blink.mojom.WidgetHost> blink_widget_host,
+ pending_associated_remote<blink.mojom.Widget> blink_widget)
+ => (int32 routing_id);
+
// Creates and returns a KeepAliveHandle.
IssueKeepAliveHandle(pending_receiver<KeepAliveHandle> keep_alive_handle);
@@ -429,21 +460,23 @@ interface FrameHost {
SubresourceResponseStarted(url.mojom.Url url, uint32 cert_status);
// Sent when a resource load finished, successfully or not.
- ResourceLoadComplete(ResourceLoadInfo url_load_info);
+ ResourceLoadComplete(blink.mojom.ResourceLoadInfo url_load_info);
// Sent when the frame changes its window.name.
DidChangeName(string name, string unique_name);
// Notifies the browser process that HTTP headers which affect the frame
// polices were delivered with the document being loaded into the frame. This
- // can be either or both of 'Feature-Policy' or 'Content-Security-Policy' (
- // which can set sandbox flags).
+ // can be any or all of 'Feature-Policy' or 'Content-Security-Policy' (
+ // which can set sandbox flags) or 'Document-Policy'.
//
- // |parsed_header| is a list of an origin whitelist for each feature in the
- // policy.
+ // |feature_policy_header| is a list of an origin whitelist for each feature
+ // in the policy.
DidSetFramePolicyHeaders(
blink.mojom.WebSandboxFlags sandbox_flags,
- array<blink.mojom.ParsedFeaturePolicyDeclaration> parsed_header);
+ array<blink.mojom.ParsedFeaturePolicyDeclaration> feature_policy_header,
+ map<blink.mojom.DocumentPolicyFeature, blink.mojom.PolicyValue>
+ document_policy_header);
// If a cross-process navigation was started for the initial history load in
// this subframe, this tries to cancel it to allow a client redirect to happen
@@ -466,10 +499,6 @@ interface FrameHost {
[EnableIf=is_android]
UpdateUserGestureCarryoverInfo();
- // Sent after the onload handler has been invoked for the document
- // in this frame. Sent for top-level frames.
- DocumentOnLoadCompleted();
-
// Blink and JavaScript error messages to log to the console or debugger UI.
DidAddMessageToConsole(
blink.mojom.ConsoleMessageLevel log_level,
@@ -477,12 +506,6 @@ interface FrameHost {
int32 line_number,
mojo_base.mojom.String16 source_id);
- // Sent when the renderer fails to load with an error.
- DidFailLoadWithError(
- url.mojom.Url url,
- int32 error_code,
- mojo_base.mojom.String16 error_description);
-
// Sent to the browser process to transfer the user activation state from the
// source frame to the frame sending this IPC. The browser will update the
// user activation state of the frames in the frame tree in the non-source and
@@ -497,11 +520,6 @@ interface FrameHost {
ui.mojom.WindowOpenDisposition disposition,
gfx.mojom.Rect rect, bool opened_by_user_gesture);
- // Notifies the browser process about a new Content Security Policy that needs
- // to be applies to the frame. This message is sent when a frame commits
- // navigation to a new location (reporting accumulated policies from HTTP
- // headers and/or policies that might have been inherited from the parent
- // frame) or when a new policy has been discovered afterwards (i.e. found in a
- // dynamically added or a static <meta> element).
- DidAddContentSecurityPolicies(array<ContentSecurityPolicy> policies);
+ // Requests an overlay routing token.
+ RequestOverlayRoutingToken() => (mojo_base.mojom.UnguessableToken token);
};
diff --git a/chromium/content/common/frame_message_structs.cc b/chromium/content/common/frame_message_structs.cc
deleted file mode 100644
index 440840a5fd0..00000000000
--- a/chromium/content/common/frame_message_structs.cc
+++ /dev/null
@@ -1,13 +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.
-
-#include "content/common/frame_message_structs.h"
-
-namespace content {
-
-FrameMsg_ViewChanged_Params::FrameMsg_ViewChanged_Params() = default;
-
-FrameMsg_ViewChanged_Params::~FrameMsg_ViewChanged_Params() = default;
-
-} // namespace content
diff --git a/chromium/content/common/frame_message_structs.h b/chromium/content/common/frame_message_structs.h
deleted file mode 100644
index 951dec23099..00000000000
--- a/chromium/content/common/frame_message_structs.h
+++ /dev/null
@@ -1,22 +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 CONTENT_COMMON_FRAME_MESSAGE_STRUCTS_H_
-#define CONTENT_COMMON_FRAME_MESSAGE_STRUCTS_H_
-
-#include "components/viz/common/surfaces/frame_sink_id.h"
-#include "content/common/content_export.h"
-
-namespace content {
-
-struct CONTENT_EXPORT FrameMsg_ViewChanged_Params {
- FrameMsg_ViewChanged_Params();
- ~FrameMsg_ViewChanged_Params();
-
- viz::FrameSinkId frame_sink_id;
-};
-
-} // namespace content
-
-#endif // CONTENT_COMMON_FRAME_MESSAGE_STRUCTS_H_
diff --git a/chromium/content/common/frame_messages.h b/chromium/content/common/frame_messages.h
index 5b558252087..118765f9323 100644
--- a/chromium/content/common/frame_messages.h
+++ b/chromium/content/common/frame_messages.h
@@ -18,63 +18,59 @@
#include "base/optional.h"
#include "build/build_config.h"
#include "cc/input/touch_action.h"
-#include "cc/trees/render_frame_metadata.h"
#include "components/viz/common/surfaces/surface_id.h"
#include "components/viz/common/surfaces/surface_info.h"
#include "content/common/buildflags.h"
#include "content/common/content_export.h"
#include "content/common/content_param_traits.h"
-#include "content/common/content_security_policy/csp_context.h"
-#include "content/common/content_security_policy_header.h"
#include "content/common/frame_delete_intention.h"
-#include "content/common/frame_message_structs.h"
-#include "content/common/frame_owner_properties.h"
#include "content/common/frame_replication_state.h"
#include "content/common/frame_visual_properties.h"
#include "content/common/navigation_gesture.h"
#include "content/common/navigation_params.h"
-#include "content/common/resource_timing_info.h"
#include "content/common/savable_subframe.h"
#include "content/public/common/common_param_traits.h"
-#include "content/public/common/context_menu_params.h"
-#include "content/public/common/favicon_url.h"
#include "content/public/common/frame_navigate_params.h"
-#include "content/public/common/javascript_dialog_type.h"
-#include "content/public/common/page_importance_signals.h"
+#include "content/public/common/navigation_policy.h"
#include "content/public/common/page_state.h"
#include "content/public/common/previews_state.h"
#include "content/public/common/referrer.h"
#include "content/public/common/screen_info.h"
#include "content/public/common/stop_find_action.h"
#include "content/public/common/three_d_api_types.h"
+#include "content/public/common/untrustworthy_context_menu_params.h"
+#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_platform_file.h"
#include "mojo/public/cpp/system/message_pipe.h"
#include "ppapi/buildflags/buildflags.h"
+#include "services/network/public/mojom/content_security_policy.mojom.h"
+#include "services/network/public/mojom/fetch_api.mojom-shared.h"
#include "third_party/blink/public/common/feature_policy/feature_policy.h"
-#include "third_party/blink/public/common/frame/blocked_navigation_types.h"
#include "third_party/blink/public/common/frame/frame_owner_element_type.h"
#include "third_party/blink/public/common/frame/frame_policy.h"
-#include "third_party/blink/public/common/frame/user_activation_update_type.h"
-#include "third_party/blink/public/common/media/media_player_action.h"
#include "third_party/blink/public/common/messaging/message_port_channel.h"
#include "third_party/blink/public/common/messaging/transferable_message.h"
#include "third_party/blink/public/common/navigation/triggering_event_info.h"
#include "third_party/blink/public/mojom/choosers/file_chooser.mojom.h"
#include "third_party/blink/public/mojom/devtools/console_message.mojom.h"
-#include "third_party/blink/public/mojom/feature_policy/feature_policy.mojom.h"
+#include "third_party/blink/public/mojom/favicon/favicon_url.mojom.h"
+#include "third_party/blink/public/mojom/feature_policy/document_policy_feature.mojom.h"
+#include "third_party/blink/public/mojom/feature_policy/policy_disposition.mojom.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom.h"
+#include "third_party/blink/public/mojom/frame/blocked_navigation_types.mojom.h"
+#include "third_party/blink/public/mojom/frame/frame_owner_properties.mojom.h"
#include "third_party/blink/public/mojom/frame/lifecycle.mojom.h"
+#include "third_party/blink/public/mojom/frame/user_activation_update_types.mojom.h"
+#include "third_party/blink/public/mojom/input/focus_type.mojom.h"
+#include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h"
+#include "third_party/blink/public/mojom/scroll/scrollbar_mode.mojom.h"
+#include "third_party/blink/public/mojom/security_context/insecure_request_policy.mojom.h"
#include "third_party/blink/public/mojom/web_feature/web_feature.mojom.h"
#include "third_party/blink/public/platform/viewport_intersection_state.h"
-#include "third_party/blink/public/platform/web_focus_type.h"
-#include "third_party/blink/public/platform/web_insecure_request_policy.h"
#include "third_party/blink/public/platform/web_intrinsic_sizing_info.h"
-#include "third_party/blink/public/platform/web_scroll_into_view_params.h"
-#include "third_party/blink/public/platform/web_scroll_types.h"
#include "third_party/blink/public/web/web_frame_owner_properties.h"
#include "third_party/blink/public/web/web_tree_scope_type.h"
-#include "ui/events/types/scroll_types.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/ipc/gfx_param_traits.h"
@@ -106,65 +102,50 @@ IPC_ENUM_TRAITS_MAX_VALUE(content::FrameDeleteIntention,
content::FrameDeleteIntention::kMaxValue)
IPC_ENUM_TRAITS_MAX_VALUE(blink::FrameOwnerElementType,
blink::FrameOwnerElementType::kMaxValue)
-IPC_ENUM_TRAITS_MAX_VALUE(
- blink::WebScrollIntoViewParams::AlignmentBehavior,
- blink::WebScrollIntoViewParams::kLastAlignmentBehavior)
-IPC_ENUM_TRAITS_MAX_VALUE(blink::WebScrollIntoViewParams::Type,
- blink::WebScrollIntoViewParams::kLastType)
-IPC_ENUM_TRAITS_MAX_VALUE(blink::WebScrollIntoViewParams::Behavior,
- blink::WebScrollIntoViewParams::kLastBehavior)
-IPC_ENUM_TRAITS_MIN_MAX_VALUE(content::JavaScriptDialogType,
- content::JAVASCRIPT_DIALOG_TYPE_ALERT,
- content::JAVASCRIPT_DIALOG_TYPE_PROMPT)
+IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::AdFrameType,
+ blink::mojom::AdFrameType::kMaxValue)
IPC_ENUM_TRAITS_MAX_VALUE(blink::ContextMenuDataMediaType,
blink::ContextMenuDataMediaType::kLast)
IPC_ENUM_TRAITS_MAX_VALUE(blink::ContextMenuDataInputFieldType,
- blink::ContextMenuDataInputFieldType::kLast)
-IPC_ENUM_TRAITS_MAX_VALUE(blink::WebFocusType, blink::kWebFocusTypeLast)
-IPC_ENUM_TRAITS_MAX_VALUE(blink::WebFrameOwnerProperties::ScrollingMode,
- blink::WebFrameOwnerProperties::ScrollingMode::kLast)
+ blink::ContextMenuDataInputFieldType::kMaxValue)
+IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::FocusType,
+ blink::mojom::FocusType::kMaxValue)
+IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::ScrollbarMode,
+ blink::mojom::ScrollbarMode::kMaxValue)
IPC_ENUM_TRAITS_MAX_VALUE(content::StopFindAction,
content::STOP_FIND_ACTION_LAST)
-IPC_ENUM_TRAITS_MAX_VALUE(content::FaviconURL::IconType,
- content::FaviconURL::IconType::kMax)
-IPC_ENUM_TRAITS(blink::WebSandboxFlags) // Bitmask.
+IPC_ENUM_TRAITS(blink::mojom::WebSandboxFlags) // Bitmask
IPC_ENUM_TRAITS_MAX_VALUE(blink::WebTreeScopeType,
- blink::WebTreeScopeType::kLast)
+ blink::WebTreeScopeType::kMaxValue)
IPC_ENUM_TRAITS_MAX_VALUE(ui::MenuSourceType, ui::MENU_SOURCE_TYPE_LAST)
-IPC_ENUM_TRAITS_MAX_VALUE(content::CSPDirective::Name,
- content::CSPDirective::NameLast)
+IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::CSPDirectiveName,
+ network::mojom::CSPDirectiveName::kMaxValue)
IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::FeaturePolicyFeature,
blink::mojom::FeaturePolicyFeature::kMaxValue)
-IPC_ENUM_TRAITS_MAX_VALUE(content::CSPDisposition,
- content::CSPDisposition::LAST)
+IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::DocumentPolicyFeature,
+ blink::mojom::DocumentPolicyFeature::kMaxValue)
IPC_ENUM_TRAITS_MAX_VALUE(blink::TriggeringEventInfo,
blink::TriggeringEventInfo::kMaxValue)
-IPC_ENUM_TRAITS_MAX_VALUE(blink::UserActivationUpdateType,
- blink::UserActivationUpdateType::kMaxValue)
-IPC_ENUM_TRAITS_MAX_VALUE(blink::MediaPlayerAction::Type,
- blink::MediaPlayerAction::Type::kMaxValue)
-IPC_ENUM_TRAITS_MIN_MAX_VALUE(blink::WebScrollDirection,
- blink::kFirstScrollDirection,
- blink::kLastScrollDirection)
-IPC_ENUM_TRAITS_MIN_MAX_VALUE(
- ui::input_types::ScrollGranularity,
- ui::input_types::ScrollGranularity::kFirstScrollGranularity,
- ui::input_types::ScrollGranularity::kMaxValue)
-IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::FeaturePolicyDisposition,
- blink::mojom::FeaturePolicyDisposition::kMaxValue)
+IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::UserActivationUpdateType,
+ blink::mojom::UserActivationUpdateType::kMaxValue)
+IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::PolicyDisposition,
+ blink::mojom::PolicyDisposition::kMaxValue)
IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::FrameVisibility,
blink::mojom::FrameVisibility::kMaxValue)
IPC_ENUM_TRAITS_MIN_MAX_VALUE(blink::FrameOcclusionState,
blink::FrameOcclusionState::kUnknown,
blink::FrameOcclusionState::kMaxValue)
-IPC_ENUM_TRAITS_MAX_VALUE(blink::NavigationBlockedReason,
- blink::NavigationBlockedReason::kMaxValue)
IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::WebFeature,
blink::mojom::WebFeature::kMaxValue)
+IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::RequestDestination,
+ network::mojom::RequestDestination::kMaxValue)
+IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::InsecureRequestPolicy,
+ blink::mojom::InsecureRequestPolicy::kMaxValue)
IPC_STRUCT_TRAITS_BEGIN(content::NavigationDownloadPolicy)
IPC_STRUCT_TRAITS_MEMBER(observed_types)
IPC_STRUCT_TRAITS_MEMBER(disallowed_types)
+ IPC_STRUCT_TRAITS_MEMBER(blocking_downloads_in_sandbox_enabled)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(blink::WebFloatSize)
@@ -179,25 +160,7 @@ IPC_STRUCT_TRAITS_BEGIN(blink::WebIntrinsicSizingInfo)
IPC_STRUCT_TRAITS_MEMBER(has_height)
IPC_STRUCT_TRAITS_END()
-IPC_STRUCT_TRAITS_BEGIN(blink::WebScrollIntoViewParams::Alignment)
- IPC_STRUCT_TRAITS_MEMBER(rect_visible)
- IPC_STRUCT_TRAITS_MEMBER(rect_hidden)
- IPC_STRUCT_TRAITS_MEMBER(rect_partial)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(blink::WebScrollIntoViewParams)
- IPC_STRUCT_TRAITS_MEMBER(align_x)
- IPC_STRUCT_TRAITS_MEMBER(align_y)
- IPC_STRUCT_TRAITS_MEMBER(type)
- IPC_STRUCT_TRAITS_MEMBER(make_visible_in_visual_viewport)
- IPC_STRUCT_TRAITS_MEMBER(behavior)
- IPC_STRUCT_TRAITS_MEMBER(is_for_scroll_sequence)
- IPC_STRUCT_TRAITS_MEMBER(zoom_into_rect)
- IPC_STRUCT_TRAITS_MEMBER(relative_element_bounds)
- IPC_STRUCT_TRAITS_MEMBER(relative_caret_bounds)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(content::ContextMenuParams)
+IPC_STRUCT_TRAITS_BEGIN(content::UntrustworthyContextMenuParams)
IPC_STRUCT_TRAITS_MEMBER(media_type)
IPC_STRUCT_TRAITS_MEMBER(x)
IPC_STRUCT_TRAITS_MEMBER(y)
@@ -207,8 +170,6 @@ IPC_STRUCT_TRAITS_BEGIN(content::ContextMenuParams)
IPC_STRUCT_TRAITS_MEMBER(src_url)
IPC_STRUCT_TRAITS_MEMBER(has_image_contents)
IPC_STRUCT_TRAITS_MEMBER(properties)
- IPC_STRUCT_TRAITS_MEMBER(page_url)
- IPC_STRUCT_TRAITS_MEMBER(frame_url)
IPC_STRUCT_TRAITS_MEMBER(media_flags)
IPC_STRUCT_TRAITS_MEMBER(selection_text)
IPC_STRUCT_TRAITS_MEMBER(title_text)
@@ -239,15 +200,9 @@ IPC_STRUCT_TRAITS_BEGIN(content::CustomContextMenuContext)
IPC_STRUCT_TRAITS_MEMBER(link_followed)
IPC_STRUCT_TRAITS_END()
-IPC_STRUCT_TRAITS_BEGIN(content::FaviconURL)
- IPC_STRUCT_TRAITS_MEMBER(icon_url)
- IPC_STRUCT_TRAITS_MEMBER(icon_type)
- IPC_STRUCT_TRAITS_MEMBER(icon_sizes)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(content::FrameOwnerProperties)
+IPC_STRUCT_TRAITS_BEGIN(blink::mojom::FrameOwnerProperties)
IPC_STRUCT_TRAITS_MEMBER(name)
- IPC_STRUCT_TRAITS_MEMBER(scrolling_mode)
+ IPC_STRUCT_TRAITS_MEMBER(scrollbar_mode)
IPC_STRUCT_TRAITS_MEMBER(margin_width)
IPC_STRUCT_TRAITS_MEMBER(margin_height)
IPC_STRUCT_TRAITS_MEMBER(allow_fullscreen)
@@ -259,89 +214,36 @@ IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(content::FrameVisualProperties)
IPC_STRUCT_TRAITS_MEMBER(screen_info)
IPC_STRUCT_TRAITS_MEMBER(auto_resize_enabled)
+ IPC_STRUCT_TRAITS_MEMBER(visible_viewport_size)
IPC_STRUCT_TRAITS_MEMBER(min_size_for_auto_resize)
IPC_STRUCT_TRAITS_MEMBER(max_size_for_auto_resize)
- IPC_STRUCT_TRAITS_MEMBER(screen_space_rect)
- IPC_STRUCT_TRAITS_MEMBER(local_frame_size)
- IPC_STRUCT_TRAITS_MEMBER(compositor_viewport)
IPC_STRUCT_TRAITS_MEMBER(capture_sequence_number)
IPC_STRUCT_TRAITS_MEMBER(zoom_level)
IPC_STRUCT_TRAITS_MEMBER(page_scale_factor)
IPC_STRUCT_TRAITS_MEMBER(is_pinch_gesture_active)
- IPC_STRUCT_TRAITS_MEMBER(local_surface_id_allocation)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(cc::RenderFrameMetadata)
- IPC_STRUCT_TRAITS_MEMBER(is_scroll_offset_at_top)
- IPC_STRUCT_TRAITS_MEMBER(root_background_color)
- IPC_STRUCT_TRAITS_MEMBER(root_scroll_offset)
- IPC_STRUCT_TRAITS_MEMBER(selection)
- IPC_STRUCT_TRAITS_MEMBER(is_mobile_optimized)
- IPC_STRUCT_TRAITS_MEMBER(device_scale_factor)
- IPC_STRUCT_TRAITS_MEMBER(viewport_size_in_pixels)
+ IPC_STRUCT_TRAITS_MEMBER(screen_space_rect)
+ IPC_STRUCT_TRAITS_MEMBER(local_frame_size)
+ IPC_STRUCT_TRAITS_MEMBER(compositor_viewport)
IPC_STRUCT_TRAITS_MEMBER(local_surface_id_allocation)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(blink::FramePolicy)
IPC_STRUCT_TRAITS_MEMBER(sandbox_flags)
IPC_STRUCT_TRAITS_MEMBER(container_policy)
+ IPC_STRUCT_TRAITS_MEMBER(required_document_policy)
IPC_STRUCT_TRAITS_MEMBER(allowed_to_download)
+ IPC_STRUCT_TRAITS_MEMBER(disallow_document_access)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(blink::ViewportIntersectionState)
IPC_STRUCT_TRAITS_MEMBER(viewport_offset)
IPC_STRUCT_TRAITS_MEMBER(viewport_intersection)
+ IPC_STRUCT_TRAITS_MEMBER(main_frame_document_intersection)
IPC_STRUCT_TRAITS_MEMBER(compositor_visible_rect)
IPC_STRUCT_TRAITS_MEMBER(occlusion_state)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(content::PageImportanceSignals)
- IPC_STRUCT_TRAITS_MEMBER(had_form_interaction)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(content::ResourceLoadTiming)
- IPC_STRUCT_TRAITS_MEMBER(request_time)
- IPC_STRUCT_TRAITS_MEMBER(proxy_start)
- IPC_STRUCT_TRAITS_MEMBER(proxy_end)
- IPC_STRUCT_TRAITS_MEMBER(dns_start)
- IPC_STRUCT_TRAITS_MEMBER(dns_end)
- IPC_STRUCT_TRAITS_MEMBER(connect_start)
- IPC_STRUCT_TRAITS_MEMBER(connect_end)
- IPC_STRUCT_TRAITS_MEMBER(worker_start)
- IPC_STRUCT_TRAITS_MEMBER(worker_ready)
- IPC_STRUCT_TRAITS_MEMBER(send_start)
- IPC_STRUCT_TRAITS_MEMBER(send_end)
- IPC_STRUCT_TRAITS_MEMBER(receive_headers_end)
- IPC_STRUCT_TRAITS_MEMBER(ssl_start)
- IPC_STRUCT_TRAITS_MEMBER(ssl_end)
- IPC_STRUCT_TRAITS_MEMBER(push_start)
- IPC_STRUCT_TRAITS_MEMBER(push_end)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(content::ResourceTimingInfo)
- IPC_STRUCT_TRAITS_MEMBER(name)
- IPC_STRUCT_TRAITS_MEMBER(start_time)
- IPC_STRUCT_TRAITS_MEMBER(initiator_type)
- IPC_STRUCT_TRAITS_MEMBER(alpn_negotiated_protocol)
- IPC_STRUCT_TRAITS_MEMBER(connection_info)
- IPC_STRUCT_TRAITS_MEMBER(timing)
- IPC_STRUCT_TRAITS_MEMBER(last_redirect_end_time)
- IPC_STRUCT_TRAITS_MEMBER(response_end)
- IPC_STRUCT_TRAITS_MEMBER(context_type)
- IPC_STRUCT_TRAITS_MEMBER(transfer_size)
- IPC_STRUCT_TRAITS_MEMBER(encoded_body_size)
- IPC_STRUCT_TRAITS_MEMBER(decoded_body_size)
- IPC_STRUCT_TRAITS_MEMBER(did_reuse_connection)
- IPC_STRUCT_TRAITS_MEMBER(allow_timing_details)
- IPC_STRUCT_TRAITS_MEMBER(allow_redirect_details)
- IPC_STRUCT_TRAITS_MEMBER(allow_negative_values)
- IPC_STRUCT_TRAITS_MEMBER(server_timing)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(content::ServerTimingInfo)
- IPC_STRUCT_TRAITS_MEMBER(name)
- IPC_STRUCT_TRAITS_MEMBER(duration)
- IPC_STRUCT_TRAITS_MEMBER(description)
+ IPC_STRUCT_TRAITS_MEMBER(main_frame_viewport_size)
+ IPC_STRUCT_TRAITS_MEMBER(main_frame_scroll_offset)
+ IPC_STRUCT_TRAITS_MEMBER(can_skip_sticky_frame_tracking)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(content::FrameNavigateParams)
@@ -422,7 +324,8 @@ IPC_STRUCT_BEGIN_WITH_PARENT(FrameHostMsg_DidCommitProvisionalLoad_Params,
IPC_STRUCT_MEMBER(url::Origin, origin)
// The insecure request policy the document for the load is enforcing.
- IPC_STRUCT_MEMBER(blink::WebInsecureRequestPolicy, insecure_request_policy)
+ IPC_STRUCT_MEMBER(blink::mojom::InsecureRequestPolicy,
+ insecure_request_policy)
// The upgrade insecure navigations set the document for the load is
// enforcing.
@@ -438,6 +341,10 @@ IPC_STRUCT_BEGIN_WITH_PARENT(FrameHostMsg_DidCommitProvisionalLoad_Params,
// A token that has been passed by the browser process when it asked the
// renderer process to commit the navigation.
IPC_STRUCT_MEMBER(base::UnguessableToken, navigation_token)
+
+ // An embedding token used to signify the relationship between the frame and
+ // its parent. This is populated for cross-document navigations in a subframe.
+ IPC_STRUCT_MEMBER(base::Optional<base::UnguessableToken>, embedding_token)
IPC_STRUCT_END()
IPC_STRUCT_BEGIN(FrameMsg_PostMessage_Params)
@@ -458,16 +365,10 @@ IPC_STRUCT_BEGIN(FrameMsg_PostMessage_Params)
scoped_refptr<base::RefCountedData<blink::TransferableMessage>>, message)
IPC_STRUCT_END()
-IPC_STRUCT_TRAITS_BEGIN(content::SourceLocation)
+IPC_STRUCT_TRAITS_BEGIN(network::mojom::SourceLocation)
IPC_STRUCT_TRAITS_MEMBER(url)
- IPC_STRUCT_TRAITS_MEMBER(line_number)
- IPC_STRUCT_TRAITS_MEMBER(column_number)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(content::InitiatorCSPInfo)
- IPC_STRUCT_TRAITS_MEMBER(should_check_main_world_csp)
- IPC_STRUCT_TRAITS_MEMBER(initiator_csp)
- IPC_STRUCT_TRAITS_MEMBER(initiator_self_source)
+ IPC_STRUCT_TRAITS_MEMBER(line)
+ IPC_STRUCT_TRAITS_MEMBER(column)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(blink::ParsedFeaturePolicyDeclaration)
@@ -493,6 +394,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::FrameReplicationState)
IPC_STRUCT_TRAITS_MEMBER(has_received_user_gesture)
IPC_STRUCT_TRAITS_MEMBER(has_received_user_gesture_before_nav)
IPC_STRUCT_TRAITS_MEMBER(frame_owner_element_type)
+ IPC_STRUCT_TRAITS_MEMBER(ad_frame_type)
IPC_STRUCT_TRAITS_END()
// Parameters included with an OpenURL request.
@@ -513,42 +415,6 @@ IPC_STRUCT_BEGIN(FrameHostMsg_OpenURL_Params)
IPC_STRUCT_MEMBER(content::NavigationDownloadPolicy, download_policy)
IPC_STRUCT_END()
-IPC_STRUCT_BEGIN(FrameHostMsg_DownloadUrl_Params)
- IPC_STRUCT_MEMBER(GURL, url)
- IPC_STRUCT_MEMBER(content::Referrer, referrer)
- IPC_STRUCT_MEMBER(url::Origin, initiator_origin)
- IPC_STRUCT_MEMBER(base::string16, suggested_name)
- IPC_STRUCT_MEMBER(network::mojom::RedirectMode, cross_origin_redirects)
- IPC_STRUCT_MEMBER(mojo::MessagePipeHandle, blob_url_token)
- IPC_STRUCT_MEMBER(mojo::MessagePipeHandle, data_url_blob)
-IPC_STRUCT_END()
-
-IPC_STRUCT_BEGIN(FrameMsg_TextTrackSettings_Params)
- // Text tracks on/off state
- IPC_STRUCT_MEMBER(bool, text_tracks_enabled)
-
- // Background color of the text track.
- IPC_STRUCT_MEMBER(std::string, text_track_background_color)
-
- // Font family of the text track text.
- IPC_STRUCT_MEMBER(std::string, text_track_font_family)
-
- // Font style of the text track text.
- IPC_STRUCT_MEMBER(std::string, text_track_font_style)
-
- // Font variant of the text track text.
- IPC_STRUCT_MEMBER(std::string, text_track_font_variant)
-
- // Color of the text track text.
- IPC_STRUCT_MEMBER(std::string, text_track_text_color)
-
- // Text shadow (edge style) of the text track text.
- IPC_STRUCT_MEMBER(std::string, text_track_text_shadow)
-
- // Size of the text track text.
- IPC_STRUCT_MEMBER(std::string, text_track_text_size)
-IPC_STRUCT_END()
-
IPC_STRUCT_TRAITS_BEGIN(content::SavableSubframe)
IPC_STRUCT_TRAITS_MEMBER(original_url)
IPC_STRUCT_TRAITS_MEMBER(routing_id)
@@ -561,7 +427,7 @@ IPC_STRUCT_BEGIN(FrameHostMsg_CreateChildFrame_Params)
IPC_STRUCT_MEMBER(std::string, frame_unique_name)
IPC_STRUCT_MEMBER(bool, is_created_by_script)
IPC_STRUCT_MEMBER(blink::FramePolicy, frame_policy)
- IPC_STRUCT_MEMBER(content::FrameOwnerProperties, frame_owner_properties)
+ IPC_STRUCT_MEMBER(blink::mojom::FrameOwnerProperties, frame_owner_properties)
IPC_STRUCT_MEMBER(blink::FrameOwnerElementType, frame_owner_element_type)
IPC_STRUCT_END()
@@ -572,60 +438,20 @@ IPC_STRUCT_BEGIN(FrameHostMsg_CreateChildFrame_Params_Reply)
IPC_STRUCT_MEMBER(base::UnguessableToken, devtools_frame_token)
IPC_STRUCT_END()
-IPC_STRUCT_TRAITS_BEGIN(content::CSPSource)
- IPC_STRUCT_TRAITS_MEMBER(scheme)
- IPC_STRUCT_TRAITS_MEMBER(host)
- IPC_STRUCT_TRAITS_MEMBER(is_host_wildcard)
- IPC_STRUCT_TRAITS_MEMBER(port)
- IPC_STRUCT_TRAITS_MEMBER(is_port_wildcard)
- IPC_STRUCT_TRAITS_MEMBER(path)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(content::CSPSourceList)
- IPC_STRUCT_TRAITS_MEMBER(allow_self)
- IPC_STRUCT_TRAITS_MEMBER(allow_star)
- IPC_STRUCT_TRAITS_MEMBER(allow_response_redirects)
- IPC_STRUCT_TRAITS_MEMBER(sources)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(content::CSPDirective)
- IPC_STRUCT_TRAITS_MEMBER(name)
- IPC_STRUCT_TRAITS_MEMBER(source_list)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(content::ContentSecurityPolicy)
- IPC_STRUCT_TRAITS_MEMBER(header)
- IPC_STRUCT_TRAITS_MEMBER(directives)
- IPC_STRUCT_TRAITS_MEMBER(report_endpoints)
- IPC_STRUCT_TRAITS_MEMBER(use_reporting_api)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(content::ContentSecurityPolicyHeader)
+IPC_STRUCT_TRAITS_BEGIN(network::mojom::ContentSecurityPolicyHeader)
IPC_STRUCT_TRAITS_MEMBER(header_value)
IPC_STRUCT_TRAITS_MEMBER(type)
IPC_STRUCT_TRAITS_MEMBER(source)
IPC_STRUCT_TRAITS_END()
-IPC_STRUCT_TRAITS_BEGIN(content::CSPViolationParams)
- IPC_STRUCT_TRAITS_MEMBER(directive)
- IPC_STRUCT_TRAITS_MEMBER(effective_directive)
- IPC_STRUCT_TRAITS_MEMBER(console_message)
- IPC_STRUCT_TRAITS_MEMBER(blocked_url)
- IPC_STRUCT_TRAITS_MEMBER(report_endpoints)
- IPC_STRUCT_TRAITS_MEMBER(use_reporting_api)
- IPC_STRUCT_TRAITS_MEMBER(header)
- IPC_STRUCT_TRAITS_MEMBER(disposition)
- IPC_STRUCT_TRAITS_MEMBER(after_redirect)
- IPC_STRUCT_TRAITS_MEMBER(source_location)
-IPC_STRUCT_TRAITS_END()
-
IPC_STRUCT_BEGIN(FrameMsg_MixedContentFound_Params)
IPC_STRUCT_MEMBER(GURL, main_resource_url)
IPC_STRUCT_MEMBER(GURL, mixed_content_url)
IPC_STRUCT_MEMBER(blink::mojom::RequestContextType, request_context_type)
+ IPC_STRUCT_MEMBER(network::mojom::RequestDestination, request_destination)
IPC_STRUCT_MEMBER(bool, was_allowed)
IPC_STRUCT_MEMBER(bool, had_redirect)
- IPC_STRUCT_MEMBER(content::SourceLocation, source_location)
+ IPC_STRUCT_MEMBER(network::mojom::SourceLocation, source_location)
IPC_STRUCT_END()
#if BUILDFLAG(USE_EXTERNAL_POPUP_MENU)
@@ -665,24 +491,9 @@ IPC_STRUCT_TRAITS_BEGIN(content::PepperRendererInstanceData)
IPC_STRUCT_TRAITS_END()
#endif
-IPC_STRUCT_TRAITS_BEGIN(blink::MediaPlayerAction)
- IPC_STRUCT_TRAITS_MEMBER(type)
- IPC_STRUCT_TRAITS_MEMBER(enable)
-IPC_STRUCT_TRAITS_END()
-
// -----------------------------------------------------------------------------
// Messages sent from the browser to the renderer.
-// Notifies the embedding frame that the intrinsic sizing info parameters
-// of a child frame have changed. Generated when the browser receives a
-// WidgetHostMsg_IntrinsicSizingInfoChanged.
-IPC_MESSAGE_ROUTED1(FrameMsg_IntrinsicSizingInfoOfChildChanged,
- blink::WebIntrinsicSizingInfo)
-
-// Notifies the embedding frame that the process rendering the child frame's
-// contents has terminated.
-IPC_MESSAGE_ROUTED0(FrameMsg_ChildFrameProcessGone)
-
// Sent in response to a FrameHostMsg_ContextMenu to let the renderer know that
// the menu has been closed.
IPC_MESSAGE_ROUTED1(FrameMsg_ContextMenuClosed,
@@ -702,10 +513,6 @@ IPC_MESSAGE_ROUTED1(FrameMsg_UpdateOpener, int /* opener_routing_id */)
// commit, activation and frame swap of the current DOM tree in blink.
IPC_MESSAGE_ROUTED1(FrameMsg_VisualStateRequest, uint64_t /* id */)
-// Instructs the renderer to invoke the frame's beforeunload event handler.
-// Expects the result to be returned via FrameHostMsg_BeforeUnload_ACK.
-IPC_MESSAGE_ROUTED1(FrameMsg_BeforeUnload, bool /* is_reload */)
-
// Requests that a provisional RenderFrame swap itself into the frame tree,
// replacing the RenderFrameProxy that it is associated with. This is used
// with remote-to-local frame navigations when the RenderFrameProxy corresponds
@@ -717,80 +524,16 @@ IPC_MESSAGE_ROUTED0(FrameMsg_SwapIn)
// Instructs the frame to stop the load in progress, if any.
IPC_MESSAGE_ROUTED0(FrameMsg_Stop)
-// A message sent to RenderFrameProxy to indicate that its corresponding
-// RenderFrame has started loading a document.
-IPC_MESSAGE_ROUTED0(FrameMsg_DidStartLoading)
-
-// A message sent to RenderFrameProxy to indicate that its corresponding
-// RenderFrame has completed loading.
-IPC_MESSAGE_ROUTED0(FrameMsg_DidStopLoading)
-
// TODO(https://crbug.com/995428): Deprecated.
// Tells the renderer to reload the frame.
IPC_MESSAGE_ROUTED0(FrameMsg_Reload)
-// Change the accessibility mode in the renderer process.
-IPC_MESSAGE_ROUTED1(FrameMsg_SetAccessibilityMode, ui::AXMode)
-
-// Sent to a proxy to record the resource timing info for this frame in the
-// parent frame.
-IPC_MESSAGE_ROUTED1(FrameMsg_ForwardResourceTimingToParent,
- content::ResourceTimingInfo)
-
-// Notifies the frame that its parent has changed the frame's sandbox flags or
-// container policy.
-IPC_MESSAGE_ROUTED1(FrameMsg_DidUpdateFramePolicy, blink::FramePolicy)
-
-// Sent to a frame proxy after navigation, when the active sandbox flags on its
-// real frame have been updated by a CSP header which sets sandbox flags, or
-// when the feature policy header has been set.
-IPC_MESSAGE_ROUTED2(FrameMsg_DidSetFramePolicyHeaders,
- blink::WebSandboxFlags,
- blink::ParsedFeaturePolicy)
-
// Update a proxy's window.name property. Used when the frame's name is
// changed in another process.
IPC_MESSAGE_ROUTED2(FrameMsg_DidUpdateName,
std::string /* name */,
std::string /* unique_name */)
-// Updates replicated ContentSecurityPolicy in a frame proxy.
-IPC_MESSAGE_ROUTED1(FrameMsg_AddContentSecurityPolicies,
- std::vector<content::ContentSecurityPolicyHeader>)
-
-// Update a proxy's replicated enforcement of insecure request policy.
-// Used when the frame's policy is changed in another process.
-IPC_MESSAGE_ROUTED1(FrameMsg_EnforceInsecureRequestPolicy,
- blink::WebInsecureRequestPolicy)
-
-// Notifies RenderFrameProxy that its associated RenderWidgetHostView has
-// changed.
-IPC_MESSAGE_ROUTED1(FrameMsg_ViewChanged,
- content::FrameMsg_ViewChanged_Params /* params */)
-
-// Send to the RenderFrame to set text tracks state and style settings.
-// Sent for top-level frames.
-IPC_MESSAGE_ROUTED1(FrameMsg_SetTextTrackSettings,
- FrameMsg_TextTrackSettings_Params /* params */)
-
-// Tells the RenderFrame to clear the focused element (if any).
-IPC_MESSAGE_ROUTED0(FrameMsg_ClearFocusedElement)
-
-// Informs the parent renderer that the child has completed an autoresize
-// transaction and should update with the provided viz::LocalSurfaceId.
-IPC_MESSAGE_ROUTED1(FrameMsg_DidUpdateVisualProperties,
- cc::RenderFrameMetadata /* metadata */)
-
-// Requests a viz::LocalSurfaceId to enable auto-resize mode from the parent
-// renderer.
-IPC_MESSAGE_ROUTED2(FrameMsg_EnableAutoResize,
- gfx::Size /* min_size */,
- gfx::Size /* max_size */)
-
-// Requests a viz::LocalSurfaceId to disable auto-resize-mode from the parent
-// renderer.
-IPC_MESSAGE_ROUTED0(FrameMsg_DisableAutoResize)
-
#if BUILDFLAG(USE_EXTERNAL_POPUP_MENU)
#if defined(OS_MACOSX)
IPC_MESSAGE_ROUTED1(FrameMsg_SelectPopupMenuItem,
@@ -813,39 +556,14 @@ IPC_MESSAGE_ROUTED3(FrameMsg_GetSerializedHtmlWithLocalLinks,
FrameMsg_GetSerializedHtmlWithLocalLinks_FrameRoutingIdMap,
bool /* save_with_empty_url */)
-IPC_MESSAGE_ROUTED1(FrameMsg_SetFrameOwnerProperties,
- content::FrameOwnerProperties /* frame_owner_properties */)
-
// Request to continue running the sequential focus navigation algorithm in
// this frame. |source_routing_id| identifies the frame that issued this
// request. This message is sent when pressing <tab> or <shift-tab> needs to
// find the next focusable element in a cross-process frame.
IPC_MESSAGE_ROUTED2(FrameMsg_AdvanceFocus,
- blink::WebFocusType /* type */,
+ blink::mojom::FocusType /* type */,
int32_t /* source_routing_id */)
-// Tells the RenderFrame to advance the focus to next input node in the form by
-// moving in specified direction if the currently focused node is a Text node
-// (textfield, text area or content editable nodes).
-IPC_MESSAGE_ROUTED1(FrameMsg_AdvanceFocusInForm,
- blink::WebFocusType /* direction for advancing focus */)
-
-// Copies the image at location x, y to the clipboard (if there indeed is an
-// image at that location).
-IPC_MESSAGE_ROUTED2(FrameMsg_CopyImageAt,
- int /* x */,
- int /* y */)
-
-// Saves the image at location x, y to the disk (if there indeed is an
-// image at that location).
-IPC_MESSAGE_ROUTED2(FrameMsg_SaveImageAt,
- int /* x */,
- int /* y */)
-
-// Notify the renderer of our overlay routing token.
-IPC_MESSAGE_ROUTED1(FrameMsg_SetOverlayRoutingToken,
- base::UnguessableToken /* routing_token */)
-
#if BUILDFLAG(ENABLE_PLUGINS)
// Notifies the renderer of updates to the Plugin Power Saver origin whitelist.
IPC_MESSAGE_ROUTED1(FrameMsg_UpdatePluginContentOriginWhitelist,
@@ -858,56 +576,12 @@ IPC_MESSAGE_ROUTED2(FrameMsg_SetPepperVolume,
double /* volume */)
#endif // BUILDFLAG(ENABLE_PLUGINS)
-// Notifies a parent frame that the child frame requires information about
-// whether it is occluded or has visual effects applied.
-IPC_MESSAGE_ROUTED1(FrameMsg_SetNeedsOcclusionTracking,
- bool /* needs_tracking */)
-
-// Tells the frame to update the user activation state in appropriate part of
-// the frame tree (ancestors for activation notification and all nodes for
-// consumption).
-IPC_MESSAGE_ROUTED1(FrameMsg_UpdateUserActivationState,
- blink::UserActivationUpdateType /* type of state update */)
-
-// Tells the frame to mark that the previous document on that frame had received
-// a user gesture on the same eTLD+1.
-IPC_MESSAGE_ROUTED1(FrameMsg_SetHasReceivedUserGestureBeforeNavigation,
- bool /* value */)
-
-// Updates the renderer with a list of unique WebFeature values representing
-// Blink features used, performed or encountered by the browser during the
-// current page load happening on the frame.
-IPC_MESSAGE_ROUTED1(FrameMsg_BlinkFeatureUsageReport,
- std::set<blink::mojom::WebFeature>) /* features */
-
// Informs the renderer that mixed content was found by the browser. The
// included data is used for instance to report to the CSP policy and to log to
// the frame console.
IPC_MESSAGE_ROUTED1(FrameMsg_MixedContentFound,
FrameMsg_MixedContentFound_Params)
-// Sent to the parent process of a cross-process frame to request scrolling.
-IPC_MESSAGE_ROUTED2(FrameMsg_ScrollRectToVisible,
- gfx::Rect /* rect_to_scroll */,
- blink::WebScrollIntoViewParams /* properties */)
-
-// Sent to the parent process of a cross-process frame to continue bubbling
-// a logical scroll.
-IPC_MESSAGE_ROUTED2(FrameMsg_BubbleLogicalScroll,
- blink::WebScrollDirection /* direction */,
- ui::input_types::ScrollGranularity /* granularity */)
-
-// Tells the renderer to perform the given action on the media player location
-// at the given point in the view coordinate space.
-IPC_MESSAGE_ROUTED2(FrameMsg_MediaPlayerActionAt,
- gfx::PointF /* location */,
- blink::MediaPlayerAction)
-
-// Sent to the proxy or frame in parent frame's process to ask for rendering
-// fallback contents. This only happens for frame owners which render their own
-// fallback contents (i.e., <object>).
-IPC_MESSAGE_ROUTED0(FrameMsg_RenderFallbackContent)
-
// Tell the renderer to add a property to the WebUI binding object. This
// only works if we allowed WebUI bindings.
IPC_MESSAGE_ROUTED2(FrameMsg_SetWebUIProperty,
@@ -933,35 +607,15 @@ IPC_SYNC_MESSAGE_CONTROL1_1(FrameHostMsg_CreateChildFrame,
// detached from the DOM.
IPC_MESSAGE_ROUTED0(FrameHostMsg_Detach)
-// Notifies the browser that a document has been loaded.
-IPC_MESSAGE_ROUTED0(FrameHostMsg_DidFinishDocumentLoad)
-
-
// Sent when the renderer is done loading a page.
IPC_MESSAGE_ROUTED0(FrameHostMsg_DidStopLoading)
// Notifies the browser that this frame has new session history information.
IPC_MESSAGE_ROUTED1(FrameHostMsg_UpdateState, content::PageState /* state */)
-// Sent when the renderer changed the progress of a load.
-IPC_MESSAGE_ROUTED1(FrameHostMsg_DidChangeLoadProgress,
- double /* load_progress */)
-
// Requests that the given URL be opened in the specified manner.
IPC_MESSAGE_ROUTED1(FrameHostMsg_OpenURL, FrameHostMsg_OpenURL_Params)
-// Notifies the browser that a frame finished loading.
-IPC_MESSAGE_ROUTED1(FrameHostMsg_DidFinishLoad,
- GURL /* validated_url */)
-
-// Initiates a download based on user actions like 'ALT+click'.
-IPC_MESSAGE_ROUTED1(FrameHostMsg_DownloadUrl, FrameHostMsg_DownloadUrl_Params)
-
-// Notifies that the initial empty document of a view has been accessed.
-// After this, it is no longer safe to show a pending navigation's URL without
-// making a URL spoof possible.
-IPC_MESSAGE_ROUTED0(FrameHostMsg_DidAccessInitialDocument)
-
// Sent when the RenderFrame or RenderFrameProxy either updates its opener to
// another frame identified by |opener_routing_id|, or, if |opener_routing_id|
// is MSG_ROUTING_NONE, the frame disowns its opener for the lifetime of the
@@ -977,15 +631,10 @@ IPC_MESSAGE_ROUTED2(
// Notifies the browser that frame owner properties have changed for a subframe
// of this frame.
-IPC_MESSAGE_ROUTED2(FrameHostMsg_DidChangeFrameOwnerProperties,
- int32_t /* subframe_routing_id */,
- content::FrameOwnerProperties /* frame_owner_properties */)
-
-// Changes the title for the page in the UI when the page is navigated or the
-// title changes. Sent for top-level frames.
-IPC_MESSAGE_ROUTED2(FrameHostMsg_UpdateTitle,
- base::string16 /* title */,
- blink::WebTextDirection /* title direction */)
+IPC_MESSAGE_ROUTED2(
+ FrameHostMsg_DidChangeFrameOwnerProperties,
+ int32_t /* subframe_routing_id */,
+ blink::mojom::FrameOwnerProperties /* frame_owner_properties */)
// Following message is used to communicate the values received by the
// callback binding the JS to Cpp.
@@ -995,23 +644,6 @@ IPC_MESSAGE_ROUTED2(FrameHostMsg_UpdateTitle,
IPC_MESSAGE_ROUTED1(FrameHostMsg_DomOperationResponse,
std::string /* json_string */)
-// Sent by the renderer process to check whether client 3D APIs
-// (Pepper 3D, WebGL) are explicitly blocked.
-IPC_SYNC_MESSAGE_CONTROL3_1(FrameHostMsg_Are3DAPIsBlocked,
- int /* render_frame_id */,
- GURL /* top_origin_url */,
- content::ThreeDAPIType /* requester */,
- bool /* blocked */)
-
-// Message sent from renderer to the browser when focus changes inside the
-// frame. The first parameter says whether the newly focused element needs
-// keyboard input (true for textfields, text areas and content editable divs).
-// The second parameter is the node bounds relative to local root's
-// RenderWidgetHostView.
-IPC_MESSAGE_ROUTED2(FrameHostMsg_FocusedNodeChanged,
- bool /* is_editable_node */,
- gfx::Rect /* node_bounds */)
-
#if BUILDFLAG(ENABLE_PLUGINS)
// Notification sent from a renderer to the browser that a Pepper plugin
// instance is created in the DOM.
@@ -1080,8 +712,16 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_PluginContentOriginAllowed,
// used to identify the proper process when the renderer notifies it that the
// plugin is hung.
//
+// |embedder_origin| provides the origin of the frame that embeds the plugin
+// (i.e. the origin of the document that contains the <embed> html tag).
+// |embedder_origin| needs to be included in the message payload, because the
+// message is received and handled on the IO thread in the browser process
+// (where it is not possible to consult
+// RenderFrameHostImpl::GetLastCommittedOrigin).
+//
// On error an empty string and null handles are returned.
-IPC_SYNC_MESSAGE_CONTROL2_3(FrameHostMsg_OpenChannelToPepperPlugin,
+IPC_SYNC_MESSAGE_CONTROL3_3(FrameHostMsg_OpenChannelToPepperPlugin,
+ url::Origin /* embedder_origin */,
base::FilePath /* path */,
base::Optional<url::Origin>, /* origin_lock */
IPC::ChannelHandle /* handle to channel */,
@@ -1144,16 +784,10 @@ IPC_MESSAGE_CONTROL3(FrameHostMsg_PluginInstanceThrottleStateChange,
bool /* is_throttled */)
#endif // BUILDFLAG(ENABLE_PLUGINS)
-// Provides the result from handling BeforeUnload. |proceed| matches the return
-// value of the frame's beforeunload handler: true if the user decided to
-// proceed with leaving the page.
-IPC_MESSAGE_ROUTED3(FrameHostMsg_BeforeUnload_ACK,
- bool /* proceed */,
- base::TimeTicks /* before_unload_start_time */,
- base::TimeTicks /* before_unload_end_time */)
-
-// Indicates that the current frame has swapped out, after a SwapOut message.
-IPC_MESSAGE_ROUTED0(FrameHostMsg_SwapOut_ACK)
+// Indicates that the current frame has finished running its unload handler (if
+// one was registered) and has been detached, as a response to
+// UnfreezableFrameMsg_Unload message from the browser process.
+IPC_MESSAGE_ROUTED0(FrameHostMsg_Unload_ACK)
// Tells the browser that a child's visual properties have changed.
IPC_MESSAGE_ROUTED2(FrameHostMsg_SynchronizeVisualProperties,
@@ -1166,41 +800,16 @@ IPC_MESSAGE_ROUTED2(FrameHostMsg_SynchronizeVisualProperties,
IPC_MESSAGE_ROUTED1(FrameHostMsg_UpdateViewportIntersection,
blink::ViewportIntersectionState /* intersection_state */)
-// Sent by a RenderFrameProxy to the browser signaling that the renderer
-// has determined the DOM subtree it represents is inert and should no
-// longer process input events. Also see WidgetMsg_SetIsInert.
-//
-// https://html.spec.whatwg.org/multipage/interaction.html#inert
-IPC_MESSAGE_ROUTED1(FrameHostMsg_SetIsInert, bool /* inert */)
-
-// Toggles render throttling on a remote frame. |is_throttled| indicates
-// whether the current frame should be throttled based on its viewport
-// visibility, and |subtree_throttled| indicates that an ancestor frame has
-// been throttled, so all descendant frames also should be throttled.
-IPC_MESSAGE_ROUTED2(FrameHostMsg_UpdateRenderThrottlingStatus,
- bool /* is_throttled */,
- bool /* subtree_throttled */)
-
-// Indicates that the user activation state in the current frame has been
-// updated, so the replicated states need to be synced (in the browser process
-// as well as in all other renderer processes).
-IPC_MESSAGE_ROUTED1(FrameHostMsg_UpdateUserActivationState,
- blink::UserActivationUpdateType /* type of state update */)
-
// Transfers user activation state from the source frame to the current frame.
IPC_MESSAGE_ROUTED1(FrameMsg_TransferUserActivationFrom,
int /* source_routing_id */)
-// Indicates that this frame received a user gesture on a previous navigation on
-// the same eTLD+1. This ensures the state is propagated to any remote frames.
-IPC_MESSAGE_ROUTED1(FrameHostMsg_SetHasReceivedUserGestureBeforeNavigation,
- bool /* value */)
-
// Used to tell the parent that the user right clicked on an area of the
// content area, and a context menu should be shown for it. The params
// object contains information about the node(s) that were selected when the
// user right clicked.
-IPC_MESSAGE_ROUTED1(FrameHostMsg_ContextMenu, content::ContextMenuParams)
+IPC_MESSAGE_ROUTED1(FrameHostMsg_ContextMenu,
+ content::UntrustworthyContextMenuParams)
// Notification that the text selection has changed.
// Note: The second parameter is the character based offset of the
@@ -1210,14 +819,6 @@ IPC_MESSAGE_ROUTED3(FrameHostMsg_SelectionChanged,
uint32_t /* the offset of the text in the document */,
gfx::Range /* selection range in the document */)
-// A request to run a JavaScript dialog.
-IPC_SYNC_MESSAGE_ROUTED3_2(FrameHostMsg_RunJavaScriptDialog,
- base::string16 /* in - alert message */,
- base::string16 /* in - default prompt */,
- content::JavaScriptDialogType /* in - type */,
- bool /* out - success */,
- base::string16 /* out - user_input field */)
-
// Displays a dialog to confirm that the user wants to navigate away from the
// page. Replies true if yes, and false otherwise. The reply string is ignored,
// but is included so that we can use
@@ -1235,32 +836,12 @@ IPC_MESSAGE_ROUTED4(FrameHostMsg_DidLoadResourceFromMemoryCache,
GURL /* url */,
std::string /* http method */,
std::string /* mime type */,
- content::ResourceType /* resource type */)
-
-// This frame attempted to navigate the main frame from the |initiator_url| to
-// the |blocked_url|, but the navigation was blocked because of |reason|.
-IPC_MESSAGE_ROUTED3(FrameHostMsg_DidBlockNavigation,
- GURL /* blocked_url */,
- GURL /* initiator_url */,
- blink::NavigationBlockedReason /* reason */)
+ network::mojom::RequestDestination)
// Sent as a response to FrameMsg_VisualStateRequest.
// The message is delivered using RenderWidget::QueueMessage.
IPC_MESSAGE_ROUTED1(FrameHostMsg_VisualStateResponse, uint64_t /* id */)
-// Requests that the resource timing info be added to the performance entries of
-// a remote parent frame.
-IPC_MESSAGE_ROUTED1(FrameHostMsg_ForwardResourceTimingToParent,
- content::ResourceTimingInfo)
-
-// Dispatch a load event for this frame in the iframe element of an
-// out-of-process parent frame.
-IPC_MESSAGE_ROUTED0(FrameHostMsg_DispatchLoad)
-
-// Sent by a frame proxy to the browser when a child frame finishes loading, so
-// that the corresponding RenderFrame can check whether its load has completed.
-IPC_MESSAGE_ROUTED0(FrameHostMsg_CheckCompleted)
-
// Sent to the browser from a frame proxy to post a message to the frame's
// active renderer.
IPC_MESSAGE_ROUTED1(FrameHostMsg_RouteMessageEvent,
@@ -1295,44 +876,21 @@ IPC_MESSAGE_ROUTED2(FrameHostMsg_SerializedHtmlWithLocalLinksResponse,
std::string /* data buffer */,
bool /* end of data? */)
-// Sent when the renderer updates hint for importance of a tab.
-IPC_MESSAGE_ROUTED1(FrameHostMsg_UpdatePageImportanceSignals,
- content::PageImportanceSignals)
-
// This message is sent from a RenderFrameProxy when sequential focus
// navigation needs to advance into its actual frame. |source_routing_id|
// identifies the frame that issued this request. This is used when pressing
// <tab> or <shift-tab> hits an out-of-process iframe when searching for the
// next focusable element.
IPC_MESSAGE_ROUTED2(FrameHostMsg_AdvanceFocus,
- blink::WebFocusType /* type */,
+ blink::mojom::FocusType /* type */,
int32_t /* source_routing_id */)
-// Request that the host send its overlay routing token for this render frame
-// via SetOverlayRoutingToken.
-IPC_MESSAGE_ROUTED0(FrameHostMsg_RequestOverlayRoutingToken)
-
-// Notification that the urls for the favicon of a site has been determined.
-IPC_MESSAGE_ROUTED1(FrameHostMsg_UpdateFaviconURL,
- std::vector<content::FaviconURL> /* candidates */)
-
// A message from HTML-based UI. When (trusted) Javascript calls
// send(message, args), this message is sent to the browser.
IPC_MESSAGE_ROUTED2(FrameHostMsg_WebUISend,
std::string /* message */,
base::ListValue /* args */)
-// Sent by a local root to request scrolling in its parent process.
-IPC_MESSAGE_ROUTED2(FrameHostMsg_ScrollRectToVisibleInParentFrame,
- gfx::Rect /* rect_to_scroll */,
- blink::WebScrollIntoViewParams /* properties */)
-
-// Sent by a local root to continue bubbling a logical scroll in its parent
-// process.
-IPC_MESSAGE_ROUTED2(FrameHostMsg_BubbleLogicalScrollInParentFrame,
- blink::WebScrollDirection /* direction */,
- ui::input_types::ScrollGranularity /* granularity */)
-
// Sent to notify that a frame called |window.focus()|.
IPC_MESSAGE_ROUTED0(FrameHostMsg_FrameDidCallFocus)
@@ -1346,17 +904,6 @@ IPC_MESSAGE_ROUTED2(FrameHostMsg_PrintCrossProcessSubframe,
gfx::Rect /* rect area of the frame content */,
int /* rendered document cookie */)
-// Asks the frame host to notify the owner element in parent process that it
-// should render fallback content.
-IPC_MESSAGE_ROUTED0(FrameHostMsg_RenderFallbackContentInParentProcess)
-
-// Used to go to the session history entry at the given offset (ie, -1 will
-// return the "back" item). This message affects a view and not just a frame,
-// but is sent on the frame channel for attribution purposes.
-IPC_MESSAGE_ROUTED2(FrameHostMsg_GoToEntryAtOffset,
- int /* offset (from current) of history item to get */,
- bool /* has_user_gesture */)
-
#if BUILDFLAG(USE_EXTERNAL_POPUP_MENU)
// Message to show/hide a popup menu using native controls.
diff --git a/chromium/content/common/frame_messages.typemap b/chromium/content/common/frame_messages.typemap
deleted file mode 100644
index 37f2c8fb397..00000000000
--- a/chromium/content/common/frame_messages.typemap
+++ /dev/null
@@ -1,8 +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.
-
-mojom = "//content/common/frame_messages.mojom"
-public_headers = [ "//content/common/frame_messages_forward.h" ]
-traits_headers = [ "//content/common/frame_messages.h" ]
-type_mappings = [ "content.mojom.DidCommitProvisionalLoadParams=::std::unique_ptr<::FrameHostMsg_DidCommitProvisionalLoad_Params>[move_only,nullable_is_same_type]" ]
diff --git a/chromium/content/common/frame_owner_properties.cc b/chromium/content/common/frame_owner_properties.cc
deleted file mode 100644
index 0a135b4d02f..00000000000
--- a/chromium/content/common/frame_owner_properties.cc
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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.
-
-#include "content/common/frame_owner_properties.h"
-
-namespace content {
-
-FrameOwnerProperties::FrameOwnerProperties()
- : scrolling_mode(blink::WebFrameOwnerProperties::ScrollingMode::kAuto),
- margin_width(-1),
- margin_height(-1),
- allow_fullscreen(false),
- allow_payment_request(false),
- is_display_none(false) {}
-
-FrameOwnerProperties::FrameOwnerProperties(const FrameOwnerProperties& other) =
- default;
-
-FrameOwnerProperties::~FrameOwnerProperties() {}
-
-bool FrameOwnerProperties::operator==(const FrameOwnerProperties& other) const {
- return name == other.name && scrolling_mode == other.scrolling_mode &&
- margin_width == other.margin_width &&
- margin_height == other.margin_height &&
- allow_fullscreen == other.allow_fullscreen &&
- allow_payment_request == other.allow_payment_request &&
- is_display_none == other.is_display_none &&
- required_csp == other.required_csp;
-}
-
-} // namespace content
diff --git a/chromium/content/common/frame_owner_properties.h b/chromium/content/common/frame_owner_properties.h
deleted file mode 100644
index 74ed5d59428..00000000000
--- a/chromium/content/common/frame_owner_properties.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// 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 CONTENT_COMMON_FRAME_OWNER_PROPERTIES_H_
-#define CONTENT_COMMON_FRAME_OWNER_PROPERTIES_H_
-
-#include <vector>
-
-#include "content/common/content_export.h"
-#include "third_party/blink/public/common/feature_policy/feature_policy.h"
-#include "third_party/blink/public/web/web_frame_owner_properties.h"
-
-namespace content {
-
-// Used for IPC transport of WebFrameOwnerProperties. WebFrameOwnerProperties
-// can't be used directly as it contains a WebVector which doesn't have
-// ParamTraits defined.
-struct CONTENT_EXPORT FrameOwnerProperties {
- FrameOwnerProperties();
- FrameOwnerProperties(const FrameOwnerProperties& other);
- ~FrameOwnerProperties();
-
- bool operator==(const FrameOwnerProperties& other) const;
- bool operator!=(const FrameOwnerProperties& other) const {
- return !(*this == other);
- }
-
- std::string name; // browsing context container's name
- blink::WebFrameOwnerProperties::ScrollingMode scrolling_mode;
- int margin_width;
- int margin_height;
- bool allow_fullscreen;
- bool allow_payment_request;
- bool is_display_none;
-
- // An experimental attribute to be used by a parent frame to enforce CSP on a
- // subframe. This is different from replicated CSP headers kept in
- // FrameReplicationState that keep track of CSP headers currently in effect
- // for a frame. See https://crbug.com/647588 and
- // https://www.w3.org/TR/csp-embedded-enforcement/#required-csp
- std::string required_csp;
-};
-
-} // namespace content
-
-#endif // CONTENT_COMMON_FRAME_OWNER_PROPERTIES_H_
diff --git a/chromium/content/common/frame_proxy.mojom b/chromium/content/common/frame_proxy.mojom
index 957302ccb9a..5b48f28804a 100644
--- a/chromium/content/common/frame_proxy.mojom
+++ b/chromium/content/common/frame_proxy.mojom
@@ -4,10 +4,38 @@
module content.mojom;
+import "ui/gfx/geometry/mojom/geometry.mojom";
+import "content/common/render_frame_metadata.mojom";
+import "services/viz/public/mojom/compositing/frame_sink_id.mojom";
+
// Mojo interface for communicating from RenderFrameProxy to
-// RenderFrameProxyHost.
+// RenderFrameProxyHost. Implemented by the browser process, called by renderer
+// processes.
interface RenderFrameProxyHost {
// TODO(dtapuska): Keep this interface for now. All methods have moved to
// blink::RemoteFrameHost but we might still need this.
};
+// Mojo interface for communicating from RenderFrameProxyHost to
+// RenderFrameProxy. Implemented by renderer processes, called by the browser
+// process.
+interface RenderFrameProxy {
+ // Notifies the remote frame that the process rendering the child frame's
+ // contents has terminated.
+ ChildProcessGone();
+
+ // This function enables auto-resize mode from the parent renderer.
+ EnableAutoResize(gfx.mojom.Size min_size, gfx.mojom.Size max_size);
+
+ // This function disables auto-resize-mode from the parent renderer.
+ DisableAutoResize();
+
+ // Informs the completion of an autoresize transaction from the parent
+ // renderer and updates with the provided viz::LocalSurfaceId.
+ DidUpdateVisualProperties(RenderFrameMetadata metadata);
+
+ // This function notifies the remote frame that its associated
+ // compositing destination (RenderWidgetHostView) has changed.
+ SetFrameSinkId(viz.mojom.FrameSinkId frame_sink_id);
+
+};
diff --git a/chromium/content/common/frame_replication_state.cc b/chromium/content/common/frame_replication_state.cc
index 01375d3d0a8..abae9b0b53d 100644
--- a/chromium/content/common/frame_replication_state.cc
+++ b/chromium/content/common/frame_replication_state.cc
@@ -5,14 +5,16 @@
#include "content/common/frame_replication_state.h"
#include "third_party/blink/public/common/frame/sandbox_flags.h"
+#include "third_party/blink/public/mojom/security_context/insecure_request_policy.mojom.h"
#include "third_party/blink/public/web/web_tree_scope_type.h"
namespace content {
FrameReplicationState::FrameReplicationState()
- : active_sandbox_flags(blink::WebSandboxFlags::kNone),
+ : active_sandbox_flags(blink::mojom::WebSandboxFlags::kNone),
scope(blink::WebTreeScopeType::kDocument),
- insecure_request_policy(blink::kLeaveInsecureRequestsAlone),
+ insecure_request_policy(
+ blink::mojom::InsecureRequestPolicy::kLeaveInsecureRequestsAlone),
has_potentially_trustworthy_unique_origin(false),
has_received_user_gesture(false),
has_received_user_gesture_before_nav(false) {}
@@ -21,7 +23,7 @@ FrameReplicationState::FrameReplicationState(
blink::WebTreeScopeType scope,
const std::string& name,
const std::string& unique_name,
- blink::WebInsecureRequestPolicy insecure_request_policy,
+ blink::mojom::InsecureRequestPolicy insecure_request_policy,
const std::vector<uint32_t>& insecure_navigations_set,
bool has_potentially_trustworthy_unique_origin,
bool has_received_user_gesture,
@@ -30,7 +32,7 @@ FrameReplicationState::FrameReplicationState(
: origin(),
name(name),
unique_name(unique_name),
- active_sandbox_flags(blink::WebSandboxFlags::kNone),
+ active_sandbox_flags(blink::mojom::WebSandboxFlags::kNone),
scope(scope),
insecure_request_policy(insecure_request_policy),
insecure_navigations_set(insecure_navigations_set),
diff --git a/chromium/content/common/frame_replication_state.h b/chromium/content/common/frame_replication_state.h
index e06f123c55a..98226da4dc2 100644
--- a/chromium/content/common/frame_replication_state.h
+++ b/chromium/content/common/frame_replication_state.h
@@ -9,11 +9,12 @@
#include <vector>
#include "content/common/content_export.h"
-#include "content/common/content_security_policy_header.h"
+#include "services/network/public/mojom/content_security_policy.mojom.h"
#include "third_party/blink/public/common/feature_policy/feature_policy.h"
#include "third_party/blink/public/common/frame/frame_owner_element_type.h"
#include "third_party/blink/public/common/frame/frame_policy.h"
-#include "third_party/blink/public/platform/web_insecure_request_policy.h"
+#include "third_party/blink/public/mojom/ad_tagging/ad_frame.mojom-shared.h"
+#include "third_party/blink/public/mojom/security_context/insecure_request_policy.mojom-forward.h"
#include "url/origin.h"
namespace blink {
@@ -27,15 +28,16 @@ namespace content {
// RenderFrame and any of its associated RenderFrameProxies.
struct CONTENT_EXPORT FrameReplicationState {
FrameReplicationState();
- FrameReplicationState(blink::WebTreeScopeType scope,
- const std::string& name,
- const std::string& unique_name,
- blink::WebInsecureRequestPolicy insecure_request_policy,
- const std::vector<uint32_t>& insecure_navigations_set,
- bool has_potentially_trustworthy_unique_origin,
- bool has_received_user_gesture,
- bool has_received_user_gesture_before_nav,
- blink::FrameOwnerElementType owner_type);
+ FrameReplicationState(
+ blink::WebTreeScopeType scope,
+ const std::string& name,
+ const std::string& unique_name,
+ blink::mojom::InsecureRequestPolicy insecure_request_policy,
+ const std::vector<uint32_t>& insecure_navigations_set,
+ bool has_potentially_trustworthy_unique_origin,
+ bool has_received_user_gesture,
+ bool has_received_user_gesture_before_nav,
+ blink::FrameOwnerElementType owner_type);
FrameReplicationState(const FrameReplicationState& other);
~FrameReplicationState();
@@ -84,7 +86,7 @@ struct CONTENT_EXPORT FrameReplicationState {
// inherited from parent frames, the currently active flags from the <iframe>
// element hosting this frame, as well as any flags set from a
// Content-Security-Policy HTTP header.
- blink::WebSandboxFlags active_sandbox_flags;
+ blink::mojom::WebSandboxFlags active_sandbox_flags;
// Iframe sandbox flags and container policy currently in effect for the
// frame. Container policy may be empty if this is the top-level frame.
@@ -108,7 +110,8 @@ struct CONTENT_EXPORT FrameReplicationState {
// Accumulated CSP headers - gathered from http headers, <meta> elements,
// parent frames (in case of about:blank frames).
- std::vector<ContentSecurityPolicyHeader> accumulated_csp_headers;
+ std::vector<network::mojom::ContentSecurityPolicyHeader>
+ accumulated_csp_headers;
// Whether the frame is in a document tree or a shadow tree, per the Shadow
// DOM spec: https://w3c.github.io/webcomponents/spec/shadow/
@@ -121,7 +124,7 @@ struct CONTENT_EXPORT FrameReplicationState {
// The insecure request policy that a frame's current document is enforcing.
// Updates are immediately sent to all frame proxies when frames live in
// different processes.
- blink::WebInsecureRequestPolicy insecure_request_policy;
+ blink::mojom::InsecureRequestPolicy insecure_request_policy;
// The upgrade insecure navigations set that a frame's current document is
// enforcing. Updates are immediately sent to all frame proxies when frames
@@ -148,6 +151,11 @@ struct CONTENT_EXPORT FrameReplicationState {
blink::FrameOwnerElementType frame_owner_element_type =
blink::FrameOwnerElementType::kNone;
+ // Whether this frame is an ad frame. Once a frame becomes an ad, it stays as
+ // an ad throughout its lifetime, even if it later navigates to a non-ad
+ // document.
+ blink::mojom::AdFrameType ad_frame_type = blink::mojom::AdFrameType::kNonAd;
+
// IMPORTANT NOTE: When adding a new member to this struct, don't forget to
// also add a corresponding entry to the struct traits in frame_messages.h!
};
diff --git a/chromium/content/common/frame_visual_properties.h b/chromium/content/common/frame_visual_properties.h
index 9659e8129ab..24964d7e766 100644
--- a/chromium/content/common/frame_visual_properties.h
+++ b/chromium/content/common/frame_visual_properties.h
@@ -22,35 +22,27 @@ struct CONTENT_EXPORT FrameVisualProperties {
FrameVisualProperties& operator=(const FrameVisualProperties& other);
- // Information about the screen (dpi, depth, etc..).
+ // These fields are values from VisualProperties, see comments there for
+ // descriptions. They exist here to propagate from each RenderWidget to its
+ // child RenderWidgets. Here they are flowing from RenderWidget in a parent
+ // renderer process up to the RenderWidgetHost for a child RenderWidget in
+ // another renderer process. That RenderWidgetHost would then be responsible
+ // for passing it along to the child RenderWidget.
ScreenInfo screen_info;
-
- // Whether or not blink should be in auto-resize mode.
bool auto_resize_enabled = false;
-
- // The minimum size for Blink if auto-resize is enabled.
+ bool is_pinch_gesture_active = false;
+ uint32_t capture_sequence_number = 0u;
+ double zoom_level = 0;
+ float page_scale_factor = 1.f;
+ gfx::Size visible_viewport_size;
gfx::Size min_size_for_auto_resize;
-
- // The maximum size for Blink if auto-resize is enabled.
gfx::Size max_size_for_auto_resize;
- gfx::Rect screen_space_rect;
-
- gfx::Size local_frame_size;
-
// The size of the compositor viewport, to match the sub-frame's surface.
gfx::Rect compositor_viewport;
- uint32_t capture_sequence_number = 0u;
-
- // This represents the page zoom level for a WebContents.
- // (0 is the default value which results in 1.0 zoom factor.)
- double zoom_level = 0;
-
- // Tracks the page-scale factor and whether the frame is currently in an
- // active pinch-zoom gesture.
- float page_scale_factor = 1.f;
- bool is_pinch_gesture_active = false;
+ gfx::Rect screen_space_rect;
+ gfx::Size local_frame_size;
// The time at which the viz::LocalSurfaceId used to submit this was
// allocated.
diff --git a/chromium/content/common/input/OWNERS b/chromium/content/common/input/OWNERS
index 1821a6c4ca1..1bd8cec3ba1 100644
--- a/chromium/content/common/input/OWNERS
+++ b/chromium/content/common/input/OWNERS
@@ -12,8 +12,6 @@ per-file *_messages.cc=set noparent
per-file *_messages.cc=file://ipc/SECURITY_OWNERS
per-file *_messages*.h=set noparent
per-file *_messages*.h=file://ipc/SECURITY_OWNERS
-per-file *.typemap=set noparent
-per-file *.typemap=file://ipc/SECURITY_OWNERS
# TEAM: input-dev@chromium.org
# COMPONENT: Blink>Input
diff --git a/chromium/content/common/input/actions_parser.cc b/chromium/content/common/input/actions_parser.cc
index 3d931e19baf..b4d6b56120d 100644
--- a/chromium/content/common/input/actions_parser.cc
+++ b/chromium/content/common/input/actions_parser.cc
@@ -115,7 +115,7 @@ bool ActionsParser::ParsePointerActionSequence() {
++action_index) {
SyntheticPointerActionListParams::ParamList param_list;
size_t longest_pause_frame = 0;
- for (const auto pointer_action_list : pointer_actions_list_) {
+ for (const auto& pointer_action_list : pointer_actions_list_) {
if (action_index < pointer_action_list.size()) {
param_list.push_back(pointer_action_list[action_index]);
if (pointer_action_list[action_index].pointer_action_type() ==
diff --git a/chromium/content/common/input/event_with_latency_info.h b/chromium/content/common/input/event_with_latency_info.h
index 0b97bdd35ad..58e8b8ca2de 100644
--- a/chromium/content/common/input/event_with_latency_info.h
+++ b/chromium/content/common/input/event_with_latency_info.h
@@ -8,9 +8,9 @@
#include "base/compiler_specific.h"
#include "base/logging.h"
#include "content/common/content_export.h"
-#include "third_party/blink/public/platform/web_gesture_event.h"
-#include "third_party/blink/public/platform/web_mouse_wheel_event.h"
-#include "third_party/blink/public/platform/web_touch_event.h"
+#include "third_party/blink/public/common/input/web_gesture_event.h"
+#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
+#include "third_party/blink/public/common/input/web_touch_event.h"
#include "ui/events/blink/blink_event_util.h"
#include "ui/events/blink/web_input_event_traits.h"
#include "ui/latency/latency_info.h"
@@ -41,9 +41,6 @@ class EventWithLatencyInfo {
if (other.event.GetType() != event.GetType())
return false;
- DCHECK_EQ(sizeof(T), event.size());
- DCHECK_EQ(sizeof(T), other.event.size());
-
return ui::CanCoalesce(other.event, event);
}
diff --git a/chromium/content/common/input/event_with_latency_info_unittest.cc b/chromium/content/common/input/event_with_latency_info_unittest.cc
index 53c46856a46..006e05e1e88 100644
--- a/chromium/content/common/input/event_with_latency_info_unittest.cc
+++ b/chromium/content/common/input/event_with_latency_info_unittest.cc
@@ -7,7 +7,7 @@
#include <limits>
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/blink/public/platform/web_input_event.h"
+#include "third_party/blink/public/common/input/web_input_event.h"
using blink::WebGestureEvent;
using blink::WebInputEvent;
@@ -332,8 +332,8 @@ TEST_F(EventWithLatencyInfoTest, WebMouseWheelEventCoalescing) {
Coalesce(mouse_wheel_0, &mouse_wheel_1);
// Coalesced event has the position of the most recent event.
- EXPECT_EQ(1, mouse_wheel_1.event.PositionInWidget().x);
- EXPECT_EQ(1, mouse_wheel_1.event.PositionInWidget().y);
+ EXPECT_EQ(1, mouse_wheel_1.event.PositionInWidget().x());
+ EXPECT_EQ(1, mouse_wheel_1.event.PositionInWidget().y());
// deltaX/Y, wheelTicksX/Y, and movementX/Y of the coalesced event are
// calculated properly.
diff --git a/chromium/content/common/input/gesture_event_stream_validator.cc b/chromium/content/common/input/gesture_event_stream_validator.cc
index 00748c21d5c..005970ca542 100644
--- a/chromium/content/common/input/gesture_event_stream_validator.cc
+++ b/chromium/content/common/input/gesture_event_stream_validator.cc
@@ -6,8 +6,8 @@
#include "base/logging.h"
#include "base/strings/stringprintf.h"
-#include "third_party/blink/public/platform/web_gesture_event.h"
-#include "third_party/blink/public/platform/web_input_event.h"
+#include "third_party/blink/public/common/input/web_gesture_event.h"
+#include "third_party/blink/public/common/input/web_input_event.h"
#include "ui/events/blink/web_input_event_traits.h"
using blink::WebInputEvent;
diff --git a/chromium/content/common/input/ime_text_span_conversions.cc b/chromium/content/common/input/ime_text_span_conversions.cc
index be91d7608f2..4f70fb2ed0b 100644
--- a/chromium/content/common/input/ime_text_span_conversions.cc
+++ b/chromium/content/common/input/ime_text_span_conversions.cc
@@ -68,15 +68,58 @@ ui::ImeTextSpan::Thickness ConvertUiImeTextSpanThicknessToUiThickness(
return ui::ImeTextSpan::Thickness::kThin;
}
+ui::mojom::ImeTextSpanUnderlineStyle
+ConvertUiUnderlineStyleToUiImeTextSpanUnderlineStyle(
+ ui::ImeTextSpan::UnderlineStyle underline_style) {
+ switch (underline_style) {
+ case ui::ImeTextSpan::UnderlineStyle::kNone:
+ return ui::mojom::ImeTextSpanUnderlineStyle::kNone;
+ case ui::ImeTextSpan::UnderlineStyle::kSolid:
+ return ui::mojom::ImeTextSpanUnderlineStyle::kSolid;
+ case ui::ImeTextSpan::UnderlineStyle::kDot:
+ return ui::mojom::ImeTextSpanUnderlineStyle::kDot;
+ case ui::ImeTextSpan::UnderlineStyle::kDash:
+ return ui::mojom::ImeTextSpanUnderlineStyle::kDash;
+ case ui::ImeTextSpan::UnderlineStyle::kSquiggle:
+ return ui::mojom::ImeTextSpanUnderlineStyle::kSquiggle;
+ }
+
+ NOTREACHED();
+ return ui::mojom::ImeTextSpanUnderlineStyle::kSolid;
+}
+
+ui::ImeTextSpan::UnderlineStyle
+ConvertUiImeTextSpanUnderlineStyleToUiUnderlineStyle(
+ ui::mojom::ImeTextSpanUnderlineStyle underline_style) {
+ switch (underline_style) {
+ case ui::mojom::ImeTextSpanUnderlineStyle::kNone:
+ return ui::ImeTextSpan::UnderlineStyle::kNone;
+ case ui::mojom::ImeTextSpanUnderlineStyle::kSolid:
+ return ui::ImeTextSpan::UnderlineStyle::kSolid;
+ case ui::mojom::ImeTextSpanUnderlineStyle::kDot:
+ return ui::ImeTextSpan::UnderlineStyle::kDot;
+ case ui::mojom::ImeTextSpanUnderlineStyle::kDash:
+ return ui::ImeTextSpan::UnderlineStyle::kDash;
+ case ui::mojom::ImeTextSpanUnderlineStyle::kSquiggle:
+ return ui::ImeTextSpan::UnderlineStyle::kSquiggle;
+ }
+
+ NOTREACHED();
+ return ui::ImeTextSpan::UnderlineStyle::kSolid;
+}
+
blink::WebImeTextSpan ConvertUiImeTextSpanToBlinkImeTextSpan(
const ui::ImeTextSpan& ui_ime_text_span) {
blink::WebImeTextSpan blink_ime_text_span = blink::WebImeTextSpan(
ConvertUiImeTextSpanTypeToWebType(ui_ime_text_span.type),
ui_ime_text_span.start_offset, ui_ime_text_span.end_offset,
ConvertUiThicknessToUiImeTextSpanThickness(ui_ime_text_span.thickness),
+ ConvertUiUnderlineStyleToUiImeTextSpanUnderlineStyle(
+ ui_ime_text_span.underline_style),
ui_ime_text_span.background_color,
ui_ime_text_span.suggestion_highlight_color,
ui_ime_text_span.suggestions);
+ blink_ime_text_span.text_color = ui_ime_text_span.text_color;
blink_ime_text_span.underline_color = ui_ime_text_span.underline_color;
blink_ime_text_span.remove_on_finish_composing =
ui_ime_text_span.remove_on_finish_composing;
@@ -99,9 +142,12 @@ ui::ImeTextSpan ConvertBlinkImeTextSpanToUiImeTextSpan(
ConvertWebImeTextSpanTypeToUiType(blink_ime_text_span.type),
blink_ime_text_span.start_offset, blink_ime_text_span.end_offset,
ConvertUiImeTextSpanThicknessToUiThickness(blink_ime_text_span.thickness),
+ ConvertUiImeTextSpanUnderlineStyleToUiUnderlineStyle(
+ blink_ime_text_span.underline_style),
blink_ime_text_span.background_color,
blink_ime_text_span.suggestion_highlight_color,
blink_ime_text_span.suggestions);
+ ui_ime_text_span.text_color = blink_ime_text_span.text_color;
ui_ime_text_span.underline_color = blink_ime_text_span.underline_color;
ui_ime_text_span.remove_on_finish_composing =
blink_ime_text_span.remove_on_finish_composing;
diff --git a/chromium/content/common/input/ime_text_span_conversions.h b/chromium/content/common/input/ime_text_span_conversions.h
index 18353d300d7..e7dd4fbfc16 100644
--- a/chromium/content/common/input/ime_text_span_conversions.h
+++ b/chromium/content/common/input/ime_text_span_conversions.h
@@ -18,6 +18,12 @@ ui::mojom::ImeTextSpanThickness ConvertUiThicknessToUiImeTextSpanThickness(
ui::ImeTextSpan::Thickness thickness);
ui::ImeTextSpan::Thickness ConvertUiImeTextSpanThicknessToUiThickness(
ui::mojom::ImeTextSpanThickness thickness);
+ui::mojom::ImeTextSpanUnderlineStyle
+ConvertUiUnderlineStyleToUiImeTextSpanUnderlineStyle(
+ ui::ImeTextSpan::UnderlineStyle underline_style);
+ui::ImeTextSpan::UnderlineStyle
+ConvertUiImeTextSpanUnderlineStyleToUiUnderlineStyle(
+ ui::mojom::ImeTextSpanUnderlineStyle underline_style);
blink::WebImeTextSpan ConvertUiImeTextSpanToBlinkImeTextSpan(
const ui::ImeTextSpan&);
ui::ImeTextSpan ConvertBlinkImeTextSpanToUiImeTextSpan(
diff --git a/chromium/content/common/input/input_event.cc b/chromium/content/common/input/input_event.cc
index 5204dde65a5..4e11e69a36a 100644
--- a/chromium/content/common/input/input_event.cc
+++ b/chromium/content/common/input/input_event.cc
@@ -16,8 +16,7 @@ InputEvent::InputEvent(ui::WebScopedInputEvent event,
InputEvent::InputEvent(const blink::WebInputEvent& web_event,
const ui::LatencyInfo& latency_info)
- : web_event(ui::WebInputEventTraits::Clone(web_event)),
- latency_info(latency_info) {}
+ : web_event(web_event.Clone()), latency_info(latency_info) {}
InputEvent::~InputEvent() {}
diff --git a/chromium/content/common/input/input_event_ack.h b/chromium/content/common/input/input_event_ack.h
index 321c0201a5d..b9e4b7ca531 100644
--- a/chromium/content/common/input/input_event_ack.h
+++ b/chromium/content/common/input/input_event_ack.h
@@ -14,7 +14,7 @@
#include "content/common/content_export.h"
#include "content/public/common/input_event_ack_source.h"
#include "content/public/common/input_event_ack_state.h"
-#include "third_party/blink/public/platform/web_input_event.h"
+#include "third_party/blink/public/common/input/web_input_event.h"
#include "ui/events/blink/did_overscroll_params.h"
#include "ui/latency/latency_info.h"
diff --git a/chromium/content/common/input/input_event_mojom_traits.cc b/chromium/content/common/input/input_event_mojom_traits.cc
index efb63fae65a..9f19111f925 100644
--- a/chromium/content/common/input/input_event_mojom_traits.cc
+++ b/chromium/content/common/input/input_event_mojom_traits.cc
@@ -7,14 +7,14 @@
#include "base/i18n/char_iterator.h"
#include "content/common/input_messages.h"
#include "mojo/public/cpp/base/time_mojom_traits.h"
-#include "third_party/blink/public/platform/web_keyboard_event.h"
-#include "third_party/blink/public/platform/web_mouse_wheel_event.h"
+#include "third_party/blink/public/common/input/web_keyboard_event.h"
+#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
#include "ui/latency/mojom/latency_info_mojom_traits.h"
namespace mojo {
namespace {
-void CopyString(blink::WebUChar* dst, const base::string16& text) {
+void CopyString(base::char16* dst, const base::string16& text) {
base::i18n::UTF16CharIterator iter(&text);
size_t pos = 0;
while (!iter.end() && pos < blink::WebKeyboardEvent::kTextLengthCap - 1) {
@@ -343,8 +343,7 @@ bool StructTraits<content::mojom::EventDataView, InputEventUniquePtr>::Read(
static_cast<blink::WebMouseWheelEvent::EventAction>(
wheel_data->event_action);
wheel_event->delta_units =
- static_cast<ui::input_types::ScrollGranularity>(
- wheel_data->delta_units);
+ static_cast<ui::ScrollGranularity>(wheel_data->delta_units);
}
}
diff --git a/chromium/content/common/input/input_event_stream_validator.cc b/chromium/content/common/input/input_event_stream_validator.cc
index 731aa1f41a3..bb1fd0bcea9 100644
--- a/chromium/content/common/input/input_event_stream_validator.cc
+++ b/chromium/content/common/input/input_event_stream_validator.cc
@@ -7,8 +7,8 @@
#include "base/command_line.h"
#include "base/logging.h"
#include "content/public/common/content_switches.h"
-#include "third_party/blink/public/platform/web_gesture_event.h"
-#include "third_party/blink/public/platform/web_input_event.h"
+#include "third_party/blink/public/common/input/web_gesture_event.h"
+#include "third_party/blink/public/common/input/web_input_event.h"
#include "ui/events/blink/web_input_event_traits.h"
using blink::WebInputEvent;
diff --git a/chromium/content/common/input/input_handler.mojom b/chromium/content/common/input/input_handler.mojom
index 2f161f8dd09..a7853e55a0b 100644
--- a/chromium/content/common/input/input_handler.mojom
+++ b/chromium/content/common/input/input_handler.mojom
@@ -9,10 +9,12 @@ import "content/common/input/synchronous_compositor.mojom";
import "content/common/native_types.mojom";
import "mojo/public/mojom/base/string16.mojom";
import "mojo/public/mojom/base/time.mojom";
+import "third_party/blink/public/mojom/input/pointer_lock_result.mojom";
import "third_party/blink/public/mojom/selection_menu/selection_menu_behavior.mojom";
import "ui/base/ime/mojom/ime_types.mojom";
import "ui/events/mojom/event.mojom";
import "ui/events/mojom/event_constants.mojom";
+import "ui/events/mojom/scroll_granularity.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "ui/gfx/range/mojom/range.mojom";
import "ui/latency/mojom/latency_info.mojom";
@@ -81,7 +83,7 @@ struct ScrollUpdate {
struct ScrollData {
float delta_x;
float delta_y;
- ScrollGranularity delta_units;
+ ui.mojom.ScrollGranularity delta_units;
bool target_viewport;
InertialPhaseState inertial_phase;
bool synthetic;
@@ -163,9 +165,7 @@ struct TouchActionOptional {
cc.mojom.TouchAction touch_action;
};
-// Interface exposed by the browser to the renderer. The messages
-// contained in here are state changes that the renderer has taken
-// that the browser must be aware of.
+// Interface exposed by the browser to the renderer.
interface WidgetInputHandlerHost {
// Call platform Fallback Cursor Mode APIs.
[EnableIf=is_android]
@@ -208,6 +208,38 @@ interface WidgetInputHandlerHost {
// a scrollbar is being dragged, or text is being drag-highlighted, even
// when the mouse passes across different RenderWidget areas.
SetMouseCapture(bool capture);
+
+ // Requests locking the target of mouse events to a single element and
+ // removing the cursor from view. Mostly used by the Pointer Lock API.
+ // See https://www.w3.org/TR/pointerlock/ for more info. This call is
+ // also used by Pepper Flash.
+ // |from_user_gesture| indicates whether this request came from a user
+ // gesture or not.
+ // |privileged| is used by Pepper Flash. Privileged mouse lock is only
+ // allowed for fullscreen render widget, which is used to implement Pepper
+ // Flash fullscreen. If privileged is allowed and set to true, we
+ // won't pop up a bubble to ask for user permission or take mouse lock
+ // content into account. The mouse lock will be directly approved.
+ // |unadjusted_movement| indicates whether the request asked for raw mouse
+ // movement data or just what the operating system returns (often accelerated
+ // mouse movement).
+ // TODO(jameshollyer-https://crbug.com/1056036): Add a context to this call
+ // so that both sides have a shared state telling them if the mouse is
+ // locked.
+ RequestMouseLock(bool from_user_gesture,
+ bool privileged,
+ bool unadjusted_movement)
+ => (blink.mojom.PointerLockResult result);
+
+ // A request to change the current mouse lock to have the given unadjusted
+ // movement.
+ RequestMouseLockChange(bool unadjusted_movement)
+ => (blink.mojom.PointerLockResult result);
+
+ // Unlocks the mouse back to its default behavior. This will also returns
+ // mouse movement back to the platform's adjusted movement if unadjusted
+ // movement was true while locking.
+ UnlockMouse();
};
// Interface exposed by the renderer to the browser. This class represents
@@ -220,6 +252,9 @@ interface WidgetInputHandler {
// Tells widget mouse capture has been lost.
MouseCaptureLost();
+ // Tells the render side that the mouse has been unlocked.
+ MouseLockLost();
+
// This message notifies the renderer that the next key event is bound to one
// or more pre-defined edit commands. If the next key event is not handled
// by webkit, the specified edit commands shall be executed against current
diff --git a/chromium/content/common/input/sync_compositor_messages.h b/chromium/content/common/input/sync_compositor_messages.h
index 435ca671ad0..ff83875b284 100644
--- a/chromium/content/common/input/sync_compositor_messages.h
+++ b/chromium/content/common/input/sync_compositor_messages.h
@@ -31,7 +31,6 @@ struct SyncCompositorDemandDrawHwParams {
~SyncCompositorDemandDrawHwParams();
gfx::Size viewport_size;
- gfx::Rect clip;
gfx::Rect viewport_rect_for_tile_priority;
gfx::Transform transform_for_tile_priority;
};
diff --git a/chromium/content/common/input/synchronous_compositor.mojom b/chromium/content/common/input/synchronous_compositor.mojom
index b6a0dd38e80..858cab6543c 100644
--- a/chromium/content/common/input/synchronous_compositor.mojom
+++ b/chromium/content/common/input/synchronous_compositor.mojom
@@ -11,6 +11,7 @@ import "services/viz/public/mojom/compositing/compositor_frame.mojom";
import "services/viz/public/mojom/compositing/compositor_frame_metadata.mojom";
import "services/viz/public/mojom/compositing/frame_timing_details.mojom";
import "services/viz/public/mojom/compositing/returned_resource.mojom";
+import "services/viz/public/mojom/hit_test/hit_test_region_list.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
[Native]
@@ -38,7 +39,8 @@ interface SynchronousCompositor {
(SyncCompositorCommonRendererParams result,
uint32 layer_tree_frame_sink_id,
uint32 metadata_version,
- viz.mojom.CompositorFrame? frame);
+ viz.mojom.CompositorFrame? frame,
+ viz.mojom.HitTestRegionList? hit_test_region_list);
// Synchronously sets the shared memory used for resourceless software
// drawing. This mode just has the renderer send over a single bitmap of the
@@ -124,7 +126,8 @@ interface SynchronousCompositorControlHost {
// Response from DrawHwAsync.
ReturnFrame(uint32 layer_tree_frame_sink_id,
uint32 metadata_version,
- viz.mojom.CompositorFrame? frame);
+ viz.mojom.CompositorFrame? frame,
+ viz.mojom.HitTestRegionList? hit_test_region_list);
// Response from BeginFrame.
BeginFrameResponse(SyncCompositorCommonRendererParams params);
diff --git a/chromium/content/common/input/synchronous_compositor.typemap b/chromium/content/common/input/synchronous_compositor.typemap
deleted file mode 100644
index 3883b72922e..00000000000
--- a/chromium/content/common/input/synchronous_compositor.typemap
+++ /dev/null
@@ -1,16 +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.
-
-mojom = "//content/common/input/synchronous_compositor.mojom"
-public_headers = [ "//content/common/input/sync_compositor_messages.h" ]
-traits_headers = [ "//content/common/input/sync_compositor_messages.h" ]
-deps = [
- "//ui/gfx/ipc",
-]
-type_mappings = [
- "content.mojom.SyncCompositorDemandDrawHwParams=::content::SyncCompositorDemandDrawHwParams",
- "content.mojom.SyncCompositorSetSharedMemoryParams=::content::SyncCompositorSetSharedMemoryParams",
- "content.mojom.SyncCompositorDemandDrawSwParams=::content::SyncCompositorDemandDrawSwParams",
- "content.mojom.SyncCompositorCommonRendererParams=::content::SyncCompositorCommonRendererParams",
-]
diff --git a/chromium/content/common/input/synthetic_pointer_action_params.h b/chromium/content/common/input/synthetic_pointer_action_params.h
index d2b29885655..87586800850 100644
--- a/chromium/content/common/input/synthetic_pointer_action_params.h
+++ b/chromium/content/common/input/synthetic_pointer_action_params.h
@@ -10,7 +10,7 @@
#include "content/common/content_param_traits_macros.h"
#include "content/common/input/synthetic_gesture_params.h"
#include "content/common/input/synthetic_web_input_event_builders.h"
-#include "third_party/blink/public/platform/web_touch_event.h"
+#include "third_party/blink/public/common/input/web_touch_event.h"
#include "ui/gfx/geometry/point_f.h"
namespace ipc_fuzzer {
diff --git a/chromium/content/common/input/synthetic_smooth_scroll_gesture_params.cc b/chromium/content/common/input/synthetic_smooth_scroll_gesture_params.cc
index 018d4955460..d543982aae2 100644
--- a/chromium/content/common/input/synthetic_smooth_scroll_gesture_params.cc
+++ b/chromium/content/common/input/synthetic_smooth_scroll_gesture_params.cc
@@ -18,7 +18,7 @@ SyntheticSmoothScrollGestureParams::SyntheticSmoothScrollGestureParams()
speed_in_pixels_s(kDefaultSpeedInPixelsS),
fling_velocity_x(0),
fling_velocity_y(0),
- granularity(ui::input_types::ScrollGranularity::kScrollByPixel) {}
+ granularity(ui::ScrollGranularity::kScrollByPixel) {}
SyntheticSmoothScrollGestureParams::SyntheticSmoothScrollGestureParams(
const SyntheticSmoothScrollGestureParams& other) = default;
diff --git a/chromium/content/common/input/synthetic_smooth_scroll_gesture_params.h b/chromium/content/common/input/synthetic_smooth_scroll_gesture_params.h
index ccc6dce65a9..131960aa8ca 100644
--- a/chromium/content/common/input/synthetic_smooth_scroll_gesture_params.h
+++ b/chromium/content/common/input/synthetic_smooth_scroll_gesture_params.h
@@ -31,7 +31,7 @@ struct CONTENT_EXPORT SyntheticSmoothScrollGestureParams
float speed_in_pixels_s;
float fling_velocity_x;
float fling_velocity_y;
- ui::input_types::ScrollGranularity granularity;
+ ui::ScrollGranularity granularity;
static const SyntheticSmoothScrollGestureParams* Cast(
const SyntheticGestureParams* gesture_params);
diff --git a/chromium/content/common/input/synthetic_web_input_event_builders.cc b/chromium/content/common/input/synthetic_web_input_event_builders.cc
index 54f11ee619a..8ddb6105a71 100644
--- a/chromium/content/common/input/synthetic_web_input_event_builders.cc
+++ b/chromium/content/common/input/synthetic_web_input_event_builders.cc
@@ -58,7 +58,7 @@ WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build(
float dx,
float dy,
int modifiers,
- ui::input_types::ScrollGranularity delta_units) {
+ ui::ScrollGranularity delta_units) {
return Build(x, y, 0, 0, dx, dy, modifiers, delta_units);
}
@@ -70,7 +70,7 @@ WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build(
float dx,
float dy,
int modifiers,
- ui::input_types::ScrollGranularity delta_units) {
+ ui::ScrollGranularity delta_units) {
WebMouseWheelEvent result(WebInputEvent::kMouseWheel, modifiers,
ui::EventTimeForNow());
result.SetPositionInScreen(global_x, global_y);
@@ -149,8 +149,8 @@ WebGestureEvent SyntheticWebGestureEventBuilder::BuildPinchUpdate(
WebGestureEvent result =
Build(WebInputEvent::kGesturePinchUpdate, source_device, modifiers);
result.data.pinch_update.scale = scale;
- result.SetPositionInWidget(blink::WebFloatPoint(anchor_x, anchor_y));
- result.SetPositionInScreen(blink::WebFloatPoint(anchor_x, anchor_y));
+ result.SetPositionInWidget(gfx::PointF(anchor_x, anchor_y));
+ result.SetPositionInScreen(gfx::PointF(anchor_x, anchor_y));
return result;
}
diff --git a/chromium/content/common/input/synthetic_web_input_event_builders.h b/chromium/content/common/input/synthetic_web_input_event_builders.h
index 608123f4266..42e46d3f4b2 100644
--- a/chromium/content/common/input/synthetic_web_input_event_builders.h
+++ b/chromium/content/common/input/synthetic_web_input_event_builders.h
@@ -7,11 +7,11 @@
#include "base/time/time.h"
#include "content/common/content_export.h"
-#include "third_party/blink/public/platform/web_gesture_event.h"
-#include "third_party/blink/public/platform/web_input_event.h"
-#include "third_party/blink/public/platform/web_keyboard_event.h"
-#include "third_party/blink/public/platform/web_mouse_wheel_event.h"
-#include "third_party/blink/public/platform/web_touch_event.h"
+#include "third_party/blink/public/common/input/web_gesture_event.h"
+#include "third_party/blink/public/common/input/web_input_event.h"
+#include "third_party/blink/public/common/input/web_keyboard_event.h"
+#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
+#include "third_party/blink/public/common/input/web_touch_event.h"
#include "ui/events/types/scroll_types.h"
// Provides sensible creation of default WebInputEvents for testing purposes.
@@ -34,22 +34,20 @@ class CONTENT_EXPORT SyntheticWebMouseWheelEventBuilder {
public:
static blink::WebMouseWheelEvent Build(
blink::WebMouseWheelEvent::Phase phase);
- static blink::WebMouseWheelEvent Build(
- float x,
- float y,
- float dx,
- float dy,
- int modifiers,
- ui::input_types::ScrollGranularity delta_units);
- static blink::WebMouseWheelEvent Build(
- float x,
- float y,
- float global_x,
- float global_y,
- float dx,
- float dy,
- int modifiers,
- ui::input_types::ScrollGranularity delta_units);
+ static blink::WebMouseWheelEvent Build(float x,
+ float y,
+ float dx,
+ float dy,
+ int modifiers,
+ ui::ScrollGranularity delta_units);
+ static blink::WebMouseWheelEvent Build(float x,
+ float y,
+ float global_x,
+ float global_y,
+ float dx,
+ float dy,
+ int modifiers,
+ ui::ScrollGranularity delta_units);
};
class CONTENT_EXPORT SyntheticWebKeyboardEventBuilder {
diff --git a/chromium/content/common/input/synthetic_web_input_event_builders_unittest.cc b/chromium/content/common/input/synthetic_web_input_event_builders_unittest.cc
index 1c225e7aa9b..e5f6ca9822f 100644
--- a/chromium/content/common/input/synthetic_web_input_event_builders_unittest.cc
+++ b/chromium/content/common/input/synthetic_web_input_event_builders_unittest.cc
@@ -6,7 +6,6 @@
#include "content/common/input/web_touch_event_traits.h"
#include "testing/gtest/include/gtest/gtest.h"
-using blink::WebFloatPoint;
using blink::WebInputEvent;
using blink::WebTouchEvent;
using blink::WebTouchPoint;
@@ -20,21 +19,21 @@ TEST(SyntheticWebInputEventBuilders, BuildWebTouchEvent) {
EXPECT_EQ(1U, event.touches_length);
EXPECT_EQ(0, event.touches[0].id);
EXPECT_EQ(WebTouchPoint::kStatePressed, event.touches[0].state);
- EXPECT_EQ(WebFloatPoint(1, 2), event.touches[0].PositionInWidget());
+ EXPECT_EQ(gfx::PointF(1, 2), event.touches[0].PositionInWidget());
event.ResetPoints();
event.PressPoint(3, 4);
EXPECT_EQ(2U, event.touches_length);
EXPECT_EQ(1, event.touches[1].id);
EXPECT_EQ(WebTouchPoint::kStatePressed, event.touches[1].state);
- EXPECT_EQ(WebFloatPoint(3, 4), event.touches[1].PositionInWidget());
+ EXPECT_EQ(gfx::PointF(3, 4), event.touches[1].PositionInWidget());
event.ResetPoints();
event.MovePoint(1, 5, 6);
EXPECT_EQ(2U, event.touches_length);
EXPECT_EQ(1, event.touches[1].id);
EXPECT_EQ(WebTouchPoint::kStateMoved, event.touches[1].state);
- EXPECT_EQ(WebFloatPoint(5, 6), event.touches[1].PositionInWidget());
+ EXPECT_EQ(gfx::PointF(5, 6), event.touches[1].PositionInWidget());
event.ResetPoints();
event.ReleasePoint(0);
@@ -47,7 +46,7 @@ TEST(SyntheticWebInputEventBuilders, BuildWebTouchEvent) {
EXPECT_EQ(1U, event.touches_length);
EXPECT_EQ(1, event.touches[1].id);
EXPECT_EQ(WebTouchPoint::kStateMoved, event.touches[1].state);
- EXPECT_EQ(WebFloatPoint(7, 8), event.touches[1].PositionInWidget());
+ EXPECT_EQ(gfx::PointF(7, 8), event.touches[1].PositionInWidget());
EXPECT_EQ(WebTouchPoint::kStateUndefined, event.touches[0].state);
event.ResetPoints();
@@ -55,7 +54,7 @@ TEST(SyntheticWebInputEventBuilders, BuildWebTouchEvent) {
EXPECT_EQ(2U, event.touches_length);
EXPECT_EQ(2, event.touches[0].id);
EXPECT_EQ(WebTouchPoint::kStatePressed, event.touches[0].state);
- EXPECT_EQ(WebFloatPoint(9, 10), event.touches[0].PositionInWidget());
+ EXPECT_EQ(gfx::PointF(9, 10), event.touches[0].PositionInWidget());
}
} // namespace content
diff --git a/chromium/content/common/input/touch_event_stream_validator.cc b/chromium/content/common/input/touch_event_stream_validator.cc
index f6e0abd14a0..506c62ff04f 100644
--- a/chromium/content/common/input/touch_event_stream_validator.cc
+++ b/chromium/content/common/input/touch_event_stream_validator.cc
@@ -7,7 +7,7 @@
#include "base/logging.h"
#include "base/strings/stringprintf.h"
#include "content/common/input/web_touch_event_traits.h"
-#include "third_party/blink/public/platform/web_touch_event.h"
+#include "third_party/blink/public/common/input/web_touch_event.h"
#include "ui/events/blink/web_input_event_traits.h"
using base::StringPrintf;
diff --git a/chromium/content/common/input/touch_event_stream_validator.h b/chromium/content/common/input/touch_event_stream_validator.h
index 0372d8b60b4..278f288435f 100644
--- a/chromium/content/common/input/touch_event_stream_validator.h
+++ b/chromium/content/common/input/touch_event_stream_validator.h
@@ -9,7 +9,7 @@
#include "base/macros.h"
#include "content/common/content_export.h"
-#include "third_party/blink/public/platform/web_touch_event.h"
+#include "third_party/blink/public/common/input/web_touch_event.h"
namespace content {
diff --git a/chromium/content/common/input/web_mouse_wheel_event_traits.cc b/chromium/content/common/input/web_mouse_wheel_event_traits.cc
index 0ff0bde4f9a..73d1c4eb87a 100644
--- a/chromium/content/common/input/web_mouse_wheel_event_traits.cc
+++ b/chromium/content/common/input/web_mouse_wheel_event_traits.cc
@@ -4,7 +4,7 @@
#include "content/common/input/web_mouse_wheel_event_traits.h"
-#include "third_party/blink/public/platform/web_input_event.h"
+#include "third_party/blink/public/common/input/web_input_event.h"
namespace content {
@@ -16,8 +16,7 @@ blink::WebMouseWheelEvent::EventAction WebMouseWheelEventTraits::GetEventAction(
#if defined(USE_AURA)
// Scroll events generated from the mouse wheel when the control key is held
// don't trigger scrolling. Instead, they may cause zooming.
- if (event.delta_units !=
- ui::input_types::ScrollGranularity::kScrollByPrecisePixel &&
+ if (event.delta_units != ui::ScrollGranularity::kScrollByPrecisePixel &&
(event.GetModifiers() & WebInputEvent::kControlKey)) {
return blink::WebMouseWheelEvent::EventAction::kPageZoom;
}
diff --git a/chromium/content/common/input/web_mouse_wheel_event_traits.h b/chromium/content/common/input/web_mouse_wheel_event_traits.h
index 171ea244fcf..45fe2a8e6ad 100644
--- a/chromium/content/common/input/web_mouse_wheel_event_traits.h
+++ b/chromium/content/common/input/web_mouse_wheel_event_traits.h
@@ -7,7 +7,7 @@
#include "base/macros.h"
#include "content/common/content_export.h"
-#include "third_party/blink/public/platform/web_mouse_wheel_event.h"
+#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
namespace content {
diff --git a/chromium/content/common/input/web_touch_event_traits.cc b/chromium/content/common/input/web_touch_event_traits.cc
index 06972d03654..664c7a39883 100644
--- a/chromium/content/common/input/web_touch_event_traits.cc
+++ b/chromium/content/common/input/web_touch_event_traits.cc
@@ -7,7 +7,7 @@
#include <stddef.h>
#include "base/logging.h"
-#include "third_party/blink/public/platform/web_touch_event.h"
+#include "third_party/blink/public/common/input/web_touch_event.h"
using blink::WebInputEvent;
using blink::WebTouchEvent;
diff --git a/chromium/content/common/input/web_touch_event_traits.h b/chromium/content/common/input/web_touch_event_traits.h
index ff27930e937..5928d60b18a 100644
--- a/chromium/content/common/input/web_touch_event_traits.h
+++ b/chromium/content/common/input/web_touch_event_traits.h
@@ -7,7 +7,7 @@
#include "base/time/time.h"
#include "content/common/content_export.h"
-#include "third_party/blink/public/platform/web_input_event.h"
+#include "third_party/blink/public/common/input/web_touch_event.h"
namespace blink {
class WebTouchEvent;
diff --git a/chromium/content/common/input_messages.h b/chromium/content/common/input_messages.h
index b41a2d27296..cb3488b36c6 100644
--- a/chromium/content/common/input_messages.h
+++ b/chromium/content/common/input_messages.h
@@ -27,9 +27,10 @@
#include "content/public/common/input_event_ack_source.h"
#include "content/public/common/input_event_ack_state.h"
#include "ipc/ipc_message_macros.h"
-#include "third_party/blink/public/platform/web_input_event.h"
-#include "third_party/blink/public/platform/web_pointer_properties.h"
+#include "third_party/blink/public/common/input/web_input_event.h"
+#include "third_party/blink/public/common/input/web_pointer_properties.h"
#include "ui/events/blink/did_overscroll_params.h"
+#include "ui/events/ipc/ui_events_param_traits_macros.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/vector2d_f.h"
@@ -41,12 +42,6 @@
#undef IPC_MESSAGE_EXPORT
#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
-#ifdef IPC_MESSAGE_START
-#error IPC_MESSAGE_START
-#endif
-
-#define IPC_MESSAGE_START InputMsgStart
-
IPC_ENUM_TRAITS_MAX_VALUE(content::InputEventAckSource,
content::InputEventAckSource::MAX_FROM_RENDERER)
IPC_ENUM_TRAITS_MAX_VALUE(
@@ -66,9 +61,9 @@ IPC_ENUM_TRAITS_MAX_VALUE(content::InputEventDispatchType,
content::InputEventDispatchType::DISPATCH_TYPE_MAX)
IPC_ENUM_TRAITS_MIN_MAX_VALUE(blink::WebPointerProperties::Button,
blink::WebPointerProperties::Button::kNoButton,
- blink::WebPointerProperties::Button::kLastEntry)
+ blink::WebPointerProperties::Button::kMaxValue)
IPC_ENUM_TRAITS_MAX_VALUE(blink::WebPointerProperties::PointerType,
- blink::WebPointerProperties::PointerType::kLastEntry)
+ blink::WebPointerProperties::PointerType::kMaxValue)
IPC_ENUM_TRAITS_MAX_VALUE(blink::WebGestureDevice,
blink::WebGestureDevice::kMaxValue)
IPC_ENUM_TRAITS_MAX_VALUE(blink::WebInputEvent::DispatchType,
@@ -153,8 +148,4 @@ IPC_STRUCT_TRAITS_BEGIN(content::SyntheticPointerActionListParams)
IPC_STRUCT_TRAITS_MEMBER(params)
IPC_STRUCT_TRAITS_END()
-// TODO(dtapuska): Remove this as only OOPIF uses this
-IPC_MESSAGE_ROUTED1(InputMsg_SetFocus,
- bool /* enable */)
-
#endif // CONTENT_COMMON_INPUT_MESSAGES_H_
diff --git a/chromium/content/common/mac/font_loader.h b/chromium/content/common/mac/font_loader.h
index 02f8196dc1e..c3f9d96c895 100644
--- a/chromium/content/common/mac/font_loader.h
+++ b/chromium/content/common/mac/font_loader.h
@@ -5,12 +5,13 @@
#ifndef CONTENT_COMMON_MAC_FONT_LOADER_H_
#define CONTENT_COMMON_MAC_FONT_LOADER_H_
-#include <CoreGraphics/CoreGraphics.h>
+#include <CoreText/CoreText.h>
#include <stdint.h>
#include <memory>
#include "base/callback_forward.h"
+#include "base/mac/scoped_cftyperef.h"
#include "content/common/content_export.h"
#include "mojo/public/cpp/system/buffer.h"
@@ -49,20 +50,20 @@ class FontLoader {
LoadedCallback callback);
// Given a shared memory buffer containing the raw data for a font file, load
- // the font and return a CGFontRef.
+ // the font and turn them into a CTFontDescriptor.
//
// |data| - A shared memory handle pointing to the raw data from a font file.
// |data_size| - Size of |data|.
//
// On return:
// returns true on success, false on failure.
- // |out| - A CGFontRef corresponding to the designated font.
- // The caller is responsible for releasing this value via CGFontRelease()
- // when done.
+ // |out| - A CTFontDescriptorRef corresponding to the designated font buffer.
+ // The caller is responsible for releasing this value via CFRelease().
CONTENT_EXPORT
- static bool CGFontRefFromBuffer(mojo::ScopedSharedBufferHandle font_data,
- uint32_t font_data_size,
- CGFontRef* out);
+ static bool CTFontDescriptorFromBuffer(
+ mojo::ScopedSharedBufferHandle font_data,
+ uint32_t font_data_size,
+ base::ScopedCFTypeRef<CTFontDescriptorRef>* out_descriptor);
CONTENT_EXPORT
static std::unique_ptr<ResultInternal> LoadFontForTesting(
diff --git a/chromium/content/common/mac/font_loader.mm b/chromium/content/common/mac/font_loader.mm
index 642602c90da..ce391bb8b57 100644
--- a/chromium/content/common/mac/font_loader.mm
+++ b/chromium/content/common/mac/font_loader.mm
@@ -18,7 +18,8 @@
#include "base/mac/scoped_cftyperef.h"
#import "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h"
-#include "base/task/post_task.h"
+#include "base/task/task_traits.h"
+#include "base/task/thread_pool.h"
#include "base/threading/scoped_blocking_call.h"
namespace content {
@@ -132,34 +133,32 @@ void FontLoader::LoadFont(const base::string16& font_name,
// a user installing a third-party font manager. See crbug.com/72727. Web page
// rendering can't continue until a font is returned.
constexpr base::TaskTraits kTraits = {
- base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE,
+ base::MayBlock(), base::TaskPriority::USER_VISIBLE,
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN};
- base::PostTaskAndReplyWithResult(
+ base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE, kTraits,
base::BindOnce(&LoadFontOnFileThread, font_name, font_point_size),
base::BindOnce(&ReplyOnUIThread, std::move(callback)));
}
// static
-bool FontLoader::CGFontRefFromBuffer(mojo::ScopedSharedBufferHandle font_data,
- uint32_t font_data_size,
- CGFontRef* out) {
- *out = NULL;
+bool FontLoader::CTFontDescriptorFromBuffer(
+ mojo::ScopedSharedBufferHandle font_data,
+ uint32_t font_data_size,
+ base::ScopedCFTypeRef<CTFontDescriptorRef>* out_descriptor) {
+ out_descriptor->reset();
mojo::ScopedSharedBufferMapping mapping = font_data->Map(font_data_size);
if (!mapping)
return false;
NSData* data = [NSData dataWithBytes:mapping.get() length:font_data_size];
- base::ScopedCFTypeRef<CGDataProviderRef> provider(
- CGDataProviderCreateWithCFData(base::mac::NSToCFCast(data)));
- if (!provider)
- return false;
-
- *out = CGFontCreateWithDataProvider(provider.get());
+ base::ScopedCFTypeRef<CTFontDescriptorRef> data_descriptor(
+ CTFontManagerCreateFontDescriptorFromData(base::mac::NSToCFCast(data)));
- if (*out == NULL)
+ if (!data_descriptor)
return false;
+ *out_descriptor = std::move(data_descriptor);
return true;
}
diff --git a/chromium/content/common/media/media_log_records.mojom b/chromium/content/common/media/media_log_records.mojom
new file mode 100644
index 00000000000..4c74cee3f63
--- /dev/null
+++ b/chromium/content/common/media/media_log_records.mojom
@@ -0,0 +1,14 @@
+// Copyright 2020 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 content.mojom;
+
+import "media/mojo/mojom/media_types.mojom";
+
+// This interface notifies the browser of an event occurring in the
+// media pipeline. It sends media event logs from renderer to browser.
+interface MediaInternalLogRecords {
+ // Sends batched media logs to MediaInternalLogRecordsImpl::Log
+ Log(array<media.mojom.MediaLogRecord> events);
+}; \ No newline at end of file
diff --git a/chromium/content/common/media/media_player_delegate_messages.h b/chromium/content/common/media/media_player_delegate_messages.h
index 1f9f5cc0d83..80fcfb4b270 100644
--- a/chromium/content/common/media/media_player_delegate_messages.h
+++ b/chromium/content/common/media/media_player_delegate_messages.h
@@ -33,7 +33,7 @@ IPC_STRUCT_TRAITS_END()
IPC_ENUM_TRAITS_MAX_VALUE(media::MediaContentType, media::MediaContentType::Max)
IPC_ENUM_TRAITS_MAX_VALUE(blink::WebFullscreenVideoStatus,
- blink::WebFullscreenVideoStatus::kMax)
+ blink::WebFullscreenVideoStatus::kMaxValue)
// ----------------------------------------------------------------------------
// Messages from the browser to the renderer requesting playback state changes.
@@ -68,6 +68,16 @@ IPC_MESSAGE_ROUTED2(MediaPlayerDelegateMsg_BecamePersistentVideo,
int /* delegate_id, distinguishes instances */,
double /* is_persistent */)
+IPC_MESSAGE_ROUTED1(MediaPlayerDelegateMsg_EnterPictureInPicture,
+ int /* delegate_id, distinguishes instances */)
+
+IPC_MESSAGE_ROUTED1(MediaPlayerDelegateMsg_ExitPictureInPicture,
+ int /* delegate_id, distinguishes instances */)
+
+IPC_MESSAGE_ROUTED2(MediaPlayerDelegateMsg_NotifyPowerExperimentState,
+ int /* delegate_id, distinguishes instances */,
+ bool /* is experiment starting (true) or stopping? */)
+
// ----------------------------------------------------------------------------
// Messages from the renderer notifying the browser of playback state changes.
// ----------------------------------------------------------------------------
@@ -103,4 +113,9 @@ IPC_MESSAGE_ROUTED2(MediaPlayerDelegateHostMsg_OnMediaSizeChanged,
int /* delegate_id, distinguishes instances */,
gfx::Size /* new size of video */)
+IPC_MESSAGE_ROUTED2(
+ MediaPlayerDelegateHostMsg_OnPictureInPictureAvailabilityChanged,
+ int /* delegate_id, distinguishes instances */,
+ bool /* picture-in-picture availability */)
+
#endif // CONTENT_COMMON_MEDIA_MEDIA_PLAYER_DELEGATE_MESSAGES_H_
diff --git a/chromium/content/common/native_types.mojom b/chromium/content/common/native_types.mojom
index 0796a31e5a7..e8015a14e54 100644
--- a/chromium/content/common/native_types.mojom
+++ b/chromium/content/common/native_types.mojom
@@ -32,9 +32,6 @@ enum ScrollerStyle;
[Native]
enum V8CacheOptions;
-[Native]
-struct WebPreferences;
-
// TODO(rockot): This should most likely be defined by network service mojom,
// but the network service doesn't exist yet.
[Native]
@@ -68,9 +65,6 @@ enum Cancelability;
enum GestureDevice;
[Native]
-enum ScrollGranularity;
-
-[Native]
enum InertialPhaseState;
[Native]
@@ -95,22 +89,4 @@ struct SyntheticTap;
struct SyntheticPointerAction;
[Native]
-enum PreferredColorScheme;
-
-[Native]
enum SystemThemeColor;
-
-[Native]
-struct ContentSecurityPolicy;
-
-[Native]
-struct CSPDirective;
-
-[Native]
-struct CSPSourceList;
-
-[Native]
-struct CSPSource;
-
-[Native]
-struct CSPViolationParams;
diff --git a/chromium/content/common/native_types.typemap b/chromium/content/common/native_types.typemap
deleted file mode 100644
index 529ddab8c19..00000000000
--- a/chromium/content/common/native_types.typemap
+++ /dev/null
@@ -1,106 +0,0 @@
-# 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.
-
-mojom = "//content/common/native_types.mojom"
-public_headers = [
- "//cc/input/touch_action.h",
- "//content/common/content_security_policy/content_security_policy.h",
- "//content/common/content_security_policy/csp_context.h",
- "//content/common/content_security_policy/csp_directive.h",
- "//content/common/content_security_policy/csp_source.h",
- "//content/common/content_security_policy/csp_source_list.h",
- "//content/common/cursors/webcursor.h",
- "//content/common/edit_command.h",
- "//content/common/frame_owner_properties.h",
- "//content/common/frame_replication_state.h",
- "//content/common/input/input_event.h",
- "//content/common/input/synthetic_pinch_gesture_params.h",
- "//content/common/input/synthetic_pointer_action_list_params.h",
- "//content/common/input/synthetic_smooth_drag_gesture_params.h",
- "//content/common/input/synthetic_smooth_scroll_gesture_params.h",
- "//content/common/input/synthetic_tap_gesture_params.h",
- "//content/common/visual_properties.h",
- "//content/public/common/input_event_ack_source.h",
- "//content/public/common/input_event_ack_state.h",
- "//content/public/common/web_preferences.h",
- "//net/base/network_change_notifier.h",
- "//third_party/blink/public/platform/web_gesture_device.h",
- "//third_party/blink/public/platform/web_gesture_event.h",
- "//third_party/blink/public/platform/web_input_event.h",
- "//third_party/blink/public/platform/web_mouse_wheel_event.h",
- "//third_party/blink/public/platform/web_pointer_properties.h",
- "//third_party/blink/public/platform/web_touch_point.h",
- "//ui/events/blink/did_overscroll_params.h",
- "//ui/events/blink/web_input_event_traits.h",
- "//ui/latency/ipc/latency_info_param_traits.h",
- "//ui/native_theme/native_theme.h",
-]
-traits_headers = [
- "//content/common/frame_messages.h",
- "//content/common/input/input_event_mojom_traits.h",
- "//content/common/input/touch_action_optional_mojom_traits.h",
- "//content/common/input_messages.h",
- "//content/common/view_messages.h",
- "//content/common/widget_messages.h",
- "//content/public/common/common_param_traits.h",
- "//services/network/public/cpp/p2p_param_traits.h",
-]
-public_deps = [
- # NOTE: These dependencies are here to satisfy gn check because
- # common_param_traits_macros.h and/or view_messages.h include their headers.
- # Although the mojo bindings target is configured to allow direct circular
- # includes from //content/common and //content/public/common, this isn't a
- # transitive allowance, so those targets' own public_deps aren't included in
- # the set of implied dependencies.
- "//content/common:buildflags",
- "//media",
- "//media/base/ipc",
- "//net",
- "//ppapi/buildflags",
- "//services/network/public/cpp",
- "//third_party/blink/public/common",
- "//ui/accessibility",
- "//ui/base/ime:text_input_types",
- "//ui/events/blink",
- "//ui/gfx/ipc",
- "//ui/gfx/ipc/color",
- "//ui/gfx/ipc/skia",
- "//ui/surface",
- "//url/ipc:url_ipc",
-]
-type_mappings = [
- "content.mojom.Button=::blink::WebPointerProperties::Button",
- "content.mojom.CSPDirective=::content::CSPDirective",
- "content.mojom.CSPSource=::content::CSPSource",
- "content.mojom.CSPSourceList=::content::CSPSourceList",
- "content.mojom.CSPViolationParams=::content::CSPViolationParams",
- "content.mojom.Cancelability=::blink::WebInputEvent::DispatchType",
- "content.mojom.ContentSecurityPolicy=::content::ContentSecurityPolicy",
- "content.mojom.DidOverscrollParams=::ui::DidOverscrollParams",
- "content.mojom.EditCommand=::content::EditCommand",
- "content.mojom.Event=::std::unique_ptr<::content::InputEvent>[move_only]",
- "content.mojom.EventType=::blink::WebInputEvent::Type",
- "content.mojom.FrameOwnerProperties=::content::FrameOwnerProperties",
- "content.mojom.FrameReplicationState=::content::FrameReplicationState",
- "content.mojom.GestureDevice=::blink::WebGestureDevice",
- "content.mojom.InertialPhaseState=::blink::WebGestureEvent::InertialPhaseState",
- "content.mojom.InputEventAckSource=::content::InputEventAckSource",
- "content.mojom.InputEventAckState=::content::InputEventAckState",
- "content.mojom.NetworkConnectionType=::net::NetworkChangeNotifier::ConnectionType",
- "content.mojom.PointerType=::blink::WebPointerProperties::PointerType",
- "content.mojom.PreferredColorScheme=::ui::NativeTheme::PreferredColorScheme",
- "content.mojom.ScrollGranularity=::ui::input_types::ScrollGranularity",
- "content.mojom.SyntheticPinch=::content::SyntheticPinchGestureParams",
- "content.mojom.SyntheticPointerAction=::content::SyntheticPointerActionListParams",
- "content.mojom.SyntheticSmoothDrag=::content::SyntheticSmoothDragGestureParams",
- "content.mojom.SyntheticSmoothScroll=::content::SyntheticSmoothScrollGestureParams",
- "content.mojom.SyntheticTap=::content::SyntheticTapGestureParams",
- "content.mojom.SystemThemeColor=::ui::NativeTheme::SystemThemeColor",
- "content.mojom.TouchActionOptional=::cc::TouchAction",
- "content.mojom.TouchState=::blink::WebTouchPoint::State",
- "content.mojom.VisualProperties=::content::VisualProperties",
- "content.mojom.WebCursor=::content::WebCursor",
- "content.mojom.WebPopupType=::blink::WebPopupType",
- "content.mojom.WebPreferences=::content::WebPreferences",
-]
diff --git a/chromium/content/common/native_types_mac.typemap b/chromium/content/common/native_types_mac.typemap
deleted file mode 100644
index 01262e1f16a..00000000000
--- a/chromium/content/common/native_types_mac.typemap
+++ /dev/null
@@ -1,36 +0,0 @@
-# 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.
-
-mojom = "//content/common/native_types.mojom"
-os_whitelist = [ "mac" ]
-public_headers = [
- "//content/common/mac/attributed_string_coder.h",
- "//third_party/blink/public/platform/web_scrollbar_buttons_placement.h",
- "//third_party/blink/public/platform/mac/web_scrollbar_theme.h",
-]
-traits_headers = [ "//content/common/view_messages.h" ]
-deps = [
- # NOTE: These dependencies are here to satisfy gn check because
- # common_param_traits_macros.h and/or view_messages.h include their headers.
- # Although the mojo bindings target is configured to allow direct circular
- # includes from //content/common and //content/public/common, this isn't a
- # transitive allowance, so those targets' own public_deps aren't included in
- # the set of implied dependencies.
- "//media",
- "//media/base/ipc",
- "//net",
- "//third_party/blink/public:blink_headers",
- "//ui/accessibility",
- "//ui/base/ime:text_input_types",
- "//ui/gfx/ipc",
- "//ui/gfx/ipc/color",
- "//ui/gfx/ipc/skia",
- "//ui/surface",
- "//url/ipc:url_ipc",
-]
-type_mappings = [
- "content.mojom.EncodedAttributedString=::mac::AttributedStringCoder::EncodedString",
- "content.mojom.ScrollerStyle=::blink::ScrollerStyle",
- "content.mojom.ScrollbarButtonsPlacement=::blink::WebScrollbarButtonsPlacement",
-]
diff --git a/chromium/content/common/navigation_client.mojom b/chromium/content/common/navigation_client.mojom
index d96c190f6b5..bd561f899ae 100644
--- a/chromium/content/common/navigation_client.mojom
+++ b/chromium/content/common/navigation_client.mojom
@@ -4,6 +4,7 @@
module content.mojom;
+import "services/network/public/mojom/host_resolver.mojom";
import "services/network/public/mojom/url_response_head.mojom";
import "services/network/public/mojom/url_loader.mojom";
import "services/network/public/mojom/url_loader_factory.mojom";
@@ -82,6 +83,7 @@ interface NavigationClient {
CommitNavigationParams request_params,
bool has_stale_copy_in_cache,
int32 error_code,
+ network.mojom.ResolveErrorInfo resolve_error_info,
string? error_page_content,
blink.mojom.URLLoaderFactoryBundle? subresource_loader_factories)
=> (DidCommitProvisionalLoadParams params,
diff --git a/chromium/content/common/navigation_params.cc b/chromium/content/common/navigation_params.cc
index aa493dc0617..4d0b164f335 100644
--- a/chromium/content/common/navigation_params.cc
+++ b/chromium/content/common/navigation_params.cc
@@ -3,42 +3,24 @@
// found in the LICENSE file.
#include "content/common/navigation_params.h"
-
-#include "base/logging.h"
-#include "build/build_config.h"
#include "content/common/navigation_params.mojom.h"
-#include "content/public/common/url_constants.h"
-#include "url/gurl.h"
-#include "url/url_constants.h"
-#include "url/url_util.h"
namespace content {
-SourceLocation::SourceLocation() = default;
-
-SourceLocation::SourceLocation(const std::string& url,
- unsigned int line_number,
- unsigned int column_number)
- : url(url), line_number(line_number), column_number(column_number) {}
-
-SourceLocation::~SourceLocation() = default;
-
-InitiatorCSPInfo::InitiatorCSPInfo() = default;
-InitiatorCSPInfo::InitiatorCSPInfo(
- CSPDisposition should_check_main_world_csp,
- const std::vector<ContentSecurityPolicy>& initiator_csp,
- const base::Optional<CSPSource>& initiator_self_source)
- : should_check_main_world_csp(should_check_main_world_csp),
- initiator_csp(initiator_csp),
- initiator_self_source(initiator_self_source) {}
-InitiatorCSPInfo::InitiatorCSPInfo(const InitiatorCSPInfo& other) = default;
-
-InitiatorCSPInfo::~InitiatorCSPInfo() = default;
+mojom::InitiatorCSPInfoPtr CreateInitiatorCSPInfo() {
+ return mojom::InitiatorCSPInfo::New(
+ network::mojom::CSPDisposition::CHECK,
+ std::vector<network::mojom::ContentSecurityPolicyPtr>() /* empty */,
+ nullptr /* initiator_self_source */
+ );
+}
mojom::CommonNavigationParamsPtr CreateCommonNavigationParams() {
auto common_params = mojom::CommonNavigationParams::New();
common_params->referrer = blink::mojom::Referrer::New();
common_params->navigation_start = base::TimeTicks::Now();
+ common_params->initiator_csp_info = CreateInitiatorCSPInfo();
+ common_params->source_location = network::mojom::SourceLocation::New();
return common_params;
}
diff --git a/chromium/content/common/navigation_params.h b/chromium/content/common/navigation_params.h
index 9775680ef76..2719488b526 100644
--- a/chromium/content/common/navigation_params.h
+++ b/chromium/content/common/navigation_params.h
@@ -5,84 +5,14 @@
#ifndef CONTENT_COMMON_NAVIGATION_PARAMS_H_
#define CONTENT_COMMON_NAVIGATION_PARAMS_H_
-#include <stdint.h>
-
-#include <map>
#include <string>
-#include <vector>
-
-#include "base/memory/ref_counted.h"
-#include "base/optional.h"
-#include "base/time/time.h"
-#include "base/unguessable_token.h"
-#include "build/build_config.h"
-#include "content/common/content_export.h"
-#include "content/common/content_security_policy/content_security_policy.h"
-#include "content/common/content_security_policy/csp_disposition_enum.h"
#include "content/common/navigation_params.mojom-forward.h"
-#include "content/common/prefetched_signed_exchange_info.mojom.h"
-#include "content/public/common/navigation_policy.h"
-#include "content/public/common/page_state.h"
-#include "content/public/common/previews_state.h"
-#include "content/public/common/referrer.h"
-#include "content/public/common/was_activated_option.mojom.h"
-#include "net/url_request/redirect_info.h"
-#include "services/network/public/cpp/resource_request_body.h"
-#include "services/network/public/cpp/resource_response.h"
-#include "services/network/public/cpp/resource_response_info.h"
-#include "third_party/blink/public/mojom/appcache/appcache.mojom.h"
-#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom.h"
-#include "third_party/blink/public/platform/web_mixed_content_context_type.h"
-#include "ui/base/page_transition_types.h"
-#include "url/gurl.h"
-#include "url/origin.h"
namespace content {
-// Struct keeping track of the Javascript SourceLocation that triggered the
-// navigation. This is initialized based on information from Blink at the start
-// of navigation, and passed back to Blink when the navigation commits.
-struct CONTENT_EXPORT SourceLocation {
- SourceLocation();
- SourceLocation(const std::string& url,
- unsigned int line_number,
- unsigned int column_number);
- ~SourceLocation();
- std::string url;
- unsigned int line_number = 0;
- unsigned int column_number = 0;
-};
-
-// The following structures hold parameters used during a navigation. In
-// particular they are used by FrameMsg_Navigate, FrameHostMsg_BeginNavigation,
-// and mojom::FrameNavigationControl.
-
-// Provided by the browser or the renderer -------------------------------------
-
-// Represents the Content Security Policy of the initator of the navigation.
-struct CONTENT_EXPORT InitiatorCSPInfo {
- InitiatorCSPInfo();
- InitiatorCSPInfo(CSPDisposition should_check_main_world_csp,
- const std::vector<ContentSecurityPolicy>& initiator_csp,
- const base::Optional<CSPSource>& initiator_self_source);
- InitiatorCSPInfo(const InitiatorCSPInfo& other);
- ~InitiatorCSPInfo();
-
- // Whether or not the CSP of the main world should apply. When the navigation
- // is initiated from a content script in an isolated world, the CSP defined
- // in the main world should not apply.
- // TODO(arthursonzogni): Instead of this boolean, the origin of the isolated
- // world which has initiated the navigation should be passed.
- // See https://crbug.com/702540
- CSPDisposition should_check_main_world_csp = CSPDisposition::CHECK;
-
- // The relevant CSP policies and the initiator 'self' source to be used.
- std::vector<ContentSecurityPolicy> initiator_csp;
- base::Optional<CSPSource> initiator_self_source;
-};
-
CONTENT_EXPORT mojom::CommonNavigationParamsPtr CreateCommonNavigationParams();
CONTENT_EXPORT mojom::CommitNavigationParamsPtr CreateCommitNavigationParams();
+CONTENT_EXPORT mojom::InitiatorCSPInfoPtr CreateInitiatorCSPInfo();
} // namespace content
diff --git a/chromium/content/common/navigation_params.mojom b/chromium/content/common/navigation_params.mojom
index 69f1cef9b3e..385987aa891 100644
--- a/chromium/content/common/navigation_params.mojom
+++ b/chromium/content/common/navigation_params.mojom
@@ -9,20 +9,21 @@ import "content/public/common/was_activated_option.mojom";
import "mojo/public/mojom/base/time.mojom";
import "mojo/public/mojom/base/unguessable_token.mojom";
import "mojo/public/mojom/base/values.mojom";
+import "services/network/public/mojom/content_security_policy.mojom";
+import "services/network/public/mojom/fetch_api.mojom";
import "services/network/public/mojom/ip_address_space.mojom";
+import "services/network/public/mojom/source_location.mojom";
+import "services/network/public/mojom/trust_tokens.mojom";
import "services/network/public/mojom/url_loader.mojom";
import "services/network/public/mojom/url_response_head.mojom";
-import "third_party/blink/public/mojom/fetch/fetch_api_request.mojom";
-import "third_party/blink/public/mojom/referrer.mojom";
import "third_party/blink/public/mojom/feature_policy/feature_policy.mojom";
+import "third_party/blink/public/mojom/fetch/fetch_api_request.mojom";
import "third_party/blink/public/mojom/frame/frame_policy.mojom";
+import "third_party/blink/public/mojom/referrer.mojom";
import "url/mojom/origin.mojom";
import "url/mojom/url.mojom";
[Native]
-struct InitiatorCSPInfo;
-
-[Native]
enum MixedContentContextType;
[Native]
@@ -34,8 +35,21 @@ struct PageState;
[Native]
enum PageTransition;
-[Native]
-struct SourceLocation;
+// Represents the Content Security Policy of the initator of the navigation.
+struct InitiatorCSPInfo {
+ // Whether or not the CSP of the main world should apply. When the navigation
+ // is initiated from a content script in an isolated world, the CSP defined
+ // in the main world should not apply.
+ // TODO(arthursonzogni): Instead of this boolean, the origin of the isolated
+ // world which has initiated the navigation should be passed.
+ // See https://crbug.com/702540
+ network.mojom.CSPDisposition should_check_main_world_csp =
+ network.mojom.CSPDisposition.CHECK;
+
+ // The relevant CSP policies and the initiator 'self' source to be used.
+ array<network.mojom.ContentSecurityPolicy> initiator_csp;
+ network.mojom.CSPSource? initiator_self_source;
+};
enum NavigationType {
// Reload the page, validating only cache entry for the main resource.
@@ -89,6 +103,9 @@ struct BeginNavigationParams {
// Indicates the request context type.
blink.mojom.RequestContextType request_context_type;
+ // Indicates the request destination.
+ network.mojom.RequestDestination request_destination;
+
// The mixed content context type for potential mixed content checks.
MixedContentContextType mixed_content_context_type;
@@ -122,6 +139,11 @@ struct BeginNavigationParams {
// they were cross-site due to the site_for_cookies and request URL differing.
// See the field of the same name in network::ResourceRequest.
bool attach_same_site_cookies = false;
+
+ // Specifies whether, and how, the navigation should execute a Trust Tokens
+ // operation (https://github.com/wicg/trust-token-api) and attach headers
+ // conveying the result of the operation. Set on some child frame navigations.
+ network.mojom.TrustTokenParams? trust_token_params;
};
// Provided by the browser or the renderer -------------------------------------
@@ -184,9 +206,9 @@ struct CommonNavigationParams {
// Information about the Javascript source for this navigation. Used for
// providing information in console error messages triggered by the
- // navigation. If the navigation was not caused by Javascript, this should
- // not be set.
- SourceLocation? source_location;
+ // navigation. If the navigation is not caused by Javascript, the
+ // SourceLocation's URL is empty.
+ network.mojom.SourceLocation source_location;
// Whether or not this navigation was started from a context menu.
bool started_from_context_menu = false;
@@ -219,20 +241,6 @@ struct CommonNavigationParams {
// not always be set; it depends on the creator of the CommonNavigationParams
// setting it.
mojo_base.mojom.TimeTicks input_start;
-
- // A snapshot value of frame policy(both sandbox flags and container policy)
- // of the frame that is being navigated. The snapshot value is captured at the
- // start of navigation.
- // The value is set to null for top-level browser-initiated navigation.
- // The value is also set to null when Ctrl-click was used to create a new tab
- // and navigate, i.e. the document in new tab will inherit no frame_policy.
- // For navigation created from NavigationControllerImpl::
- // CreateNavigationRequestFromEntry which corresponds to history navigation,
- // the value is set to current FrameTreeNode::pending_frame_policy in
- // frame_tree_node. This behavior is currently undocumented and probably need
- // further discussion. Another potential approach is to record frame policy
- // value in NavigationEntry and reuse the historical value.
- blink.mojom.FramePolicy? frame_policy;
};
// Provided by the browser -----------------------------------------------------
@@ -375,7 +383,28 @@ struct CommitNavigationParams {
// Used as an additional identifier for MemoryCache.
url.mojom.Url web_bundle_physical_url;
- // The base URL which will be set for the document to support relative path
- // subresource loading in unsigned Web Bundle file.
- url.mojom.Url base_url_override_for_web_bundle;
+ // The claimed URL inside Web Bundle from which the document is loaded.
+ url.mojom.Url web_bundle_claimed_url;
+
+ // A snapshot value of frame policy(both sandbox flags and container policy)
+ // of the frame that is being navigated. The snapshot value is captured at the
+ // start of navigation.
+ // - The value is set to null for top-level browser-initiated navigation.
+ // - The value is also set to null when Ctrl-click was used to create a new
+ // tab and navigate, i.e. the document in new tab will inherit no
+ // frame_policy.
+ // - For navigation created from NavigationControllerImpl::
+ // CreateNavigationRequestFromEntry which corresponds to history navigation,
+ // the value is set to current FrameTreeNode::pending_frame_policy in
+ // frame_tree_node. This behavior is currently undocumented and probably need
+ // further discussion. Another potential approach is to record frame policy
+ // value in NavigationEntry and reuse the historical value.
+ // - For local frame navigation, the value is set at NavigationRequest::
+ // CreateRendererInitiated.
+ // - For remote frame navigation, the value is set at
+ // NavigationControllerImpl::CreateNavigationRequestFromLoadParams.
+ blink.mojom.FramePolicy? frame_policy;
+
+ // The names of origin trials to be force enabled for this navigation.
+ array<string> force_enabled_origin_trials;
};
diff --git a/chromium/content/common/navigation_params.typemap b/chromium/content/common/navigation_params.typemap
deleted file mode 100644
index 3067bad7a4e..00000000000
--- a/chromium/content/common/navigation_params.typemap
+++ /dev/null
@@ -1,29 +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.
-
-mojom = "//content/common/navigation_params.mojom"
-public_headers = [
- "//content/common/content_param_traits.h",
- "//content/common/navigation_params.h",
- "//content/public/common/page_state.h",
- "//content/public/common/navigation_policy.h",
- "//third_party/blink/public/platform/web_mixed_content_context_type.h",
- "//ui/base/page_transition_types.h",
-]
-traits_headers = [
- "//content/common/frame_messages.h",
- "//content/common/resource_messages.h",
-]
-deps = [
- "//content:export",
-]
-type_mappings = [
- "content.mojom.InitiatorCSPInfo=::content::InitiatorCSPInfo",
- "content.mojom.MixedContentContextType=::blink::WebMixedContentContextType",
- "content.mojom.NavigationDownloadPolicy=::content::NavigationDownloadPolicy",
- "content.mojom.PageState=::content::PageState",
- "content.mojom.PageTransition=::ui::PageTransition",
- "content.mojom.SHA256HashValue=::net::SHA256HashValue",
- "content.mojom.SourceLocation=::content::SourceLocation",
-]
diff --git a/chromium/content/common/net/record_load_histograms.cc b/chromium/content/common/net/record_load_histograms.cc
index d7405bb2a9d..a02b49cf3e2 100644
--- a/chromium/content/common/net/record_load_histograms.cc
+++ b/chromium/content/common/net/record_load_histograms.cc
@@ -13,27 +13,27 @@
namespace content {
-void RecordLoadHistograms(const GURL& url,
- ResourceType resource_type,
+void RecordLoadHistograms(const url::Origin& origin,
+ network::mojom::RequestDestination destination,
int net_error) {
// Requests shouldn't complete with net::ERR_IO_PENDING.
DCHECK_NE(net::ERR_IO_PENDING, net_error);
- if (resource_type == ResourceType::kMainFrame) {
+ if (destination == network::mojom::RequestDestination::kDocument) {
base::UmaHistogramSparse("Net.ErrorCodesForMainFrame4", -net_error);
- if (url.SchemeIsCryptographic()) {
- if (url.host_piece() == "www.google.com") {
+ if (GURL::SchemeIsCryptographic(origin.scheme())) {
+ if (origin.host() == "www.google.com") {
base::UmaHistogramSparse("Net.ErrorCodesForHTTPSGoogleMainFrame3",
-net_error);
}
- if (net::IsTLS13ExperimentHost(url.host_piece())) {
+ if (net::IsTLS13ExperimentHost(origin.host())) {
base::UmaHistogramSparse("Net.ErrorCodesForTLS13ExperimentMainFrame2",
-net_error);
}
}
} else {
- if (resource_type == ResourceType::kImage) {
+ if (destination == network::mojom::RequestDestination::kImage) {
base::UmaHistogramSparse("Net.ErrorCodesForImages2", -net_error);
}
base::UmaHistogramSparse("Net.ErrorCodesForSubresources3", -net_error);
diff --git a/chromium/content/common/net/record_load_histograms.h b/chromium/content/common/net/record_load_histograms.h
index dc690a4a9ce..e3eafa54a68 100644
--- a/chromium/content/common/net/record_load_histograms.h
+++ b/chromium/content/common/net/record_load_histograms.h
@@ -5,17 +5,17 @@
#ifndef CONTENT_COMMON_NET_RECORD_LOAD_HISTOGRAMS_H_
#define CONTENT_COMMON_NET_RECORD_LOAD_HISTOGRAMS_H_
-#include "content/public/common/resource_type.h"
-
-class GURL;
+#include "services/network/public/mojom/fetch_api.mojom-shared.h"
+#include "url/origin.h"
namespace content {
// Logs histograms when a resource destined for a renderer (One with a
-// content::ResourceType) finishes loading, or when a load is aborted. Not used
-// for internal network requests initiated by the browser itself.
-void RecordLoadHistograms(const GURL& url,
- ResourceType resource_type,
+// network::mojom::RequestDestination) finishes loading, or when a load is
+// aborted. Not used for internal network requests initiated by the browser
+// itself.
+void RecordLoadHistograms(const url::Origin& origin,
+ network::mojom::RequestDestination destination,
int net_error);
} // namespace content
diff --git a/chromium/content/common/page_messages.h b/chromium/content/common/page_messages.h
index 232f6fd5d07..285c1517ab5 100644
--- a/chromium/content/common/page_messages.h
+++ b/chromium/content/common/page_messages.h
@@ -22,6 +22,7 @@
// Messages sent from the browser to the renderer.
+// TODO(yuzus): Migrate this as a part of blink::mojom::SetPageLifecycleState.
IPC_MESSAGE_ROUTED1(PageMsg_VisibilityChanged, content::PageVisibilityState)
// Sent when the history for this page is altered from another process. The
@@ -33,11 +34,6 @@ IPC_MESSAGE_ROUTED2(PageMsg_SetHistoryOffsetAndLength,
IPC_MESSAGE_ROUTED1(PageMsg_AudioStateChanged, bool /* is_audio_playing */)
-// Sent to renderers with remote main frames when page-related visual properties
-// change.
-IPC_MESSAGE_ROUTED1(PageMsg_UpdatePageVisualProperties,
- gfx::Size /* VisualViewport size */)
-
// Sent to all renderers, instructing them to freeze or unfreeze all frames that
// belongs to this page.
IPC_MESSAGE_ROUTED1(PageMsg_SetPageFrozen, bool /* frozen */)
@@ -59,6 +55,10 @@ IPC_MESSAGE_ROUTED1(PageMsg_UpdateTextAutosizerPageInfoForRemoteMainFrames,
// Sends updated preferences to the renderer.
IPC_MESSAGE_ROUTED1(PageMsg_SetRendererPrefs, blink::mojom::RendererPreferences)
+// Sent to all renderers when a portal web contents is activated or if a
+// web contents is adopted as a portal.
+IPC_MESSAGE_ROUTED1(PageMsg_SetInsidePortal, bool /* inside_portal */)
+
// -----------------------------------------------------------------------------
// Messages sent from the renderer to the browser.
diff --git a/chromium/content/common/coverage_utils.cc b/chromium/content/common/profiling_utils.cc
index 609f5039309..48772eb0cdc 100644
--- a/chromium/content/common/coverage_utils.cc
+++ b/chromium/content/common/profiling_utils.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/common/coverage_utils.h"
+#include "content/common/profiling_utils.h"
#include <memory>
@@ -23,7 +23,7 @@
namespace content {
-base::File OpenCoverageFile() {
+base::File OpenProfilingFile() {
base::ScopedAllowBlockingForTesting allows_blocking;
std::unique_ptr<base::Environment> env(base::Environment::Create());
std::string prof_template;
@@ -41,6 +41,8 @@ base::File OpenCoverageFile() {
// sajjadm@ and liaoyuke@ experimentally determined that a size 4 pool works
// well for the coverage builder.
+ // TODO(https://crbug.com/1059335): Check if this is an appropriate value for
+ // the PGO builds.
int pool_index = base::RandInt(0, 3);
std::string filename = base::StrCat(
{"child_pool-", base::NumberToString(pool_index), ".profraw"});
diff --git a/chromium/content/common/coverage_utils.h b/chromium/content/common/profiling_utils.h
index 24d8270bd3f..f9e6e17b376 100644
--- a/chromium/content/common/coverage_utils.h
+++ b/chromium/content/common/profiling_utils.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_COMMON_COVERAGE_UTILS_H_
-#define CONTENT_COMMON_COVERAGE_UTILS_H_
+#ifndef CONTENT_COMMON_PROFILING_UTILS_H_
+#define CONTENT_COMMON_PROFILING_UTILS_H_
#include <string>
@@ -11,8 +11,8 @@
namespace content {
-base::File OpenCoverageFile();
+base::File OpenProfilingFile();
} // namespace content
-#endif // CONTENT_COMMON_COVERAGE_UTILS_H_
+#endif // CONTENT_COMMON_PROFILING_UTILS_H_
diff --git a/chromium/content/common/render_accessibility.mojom b/chromium/content/common/render_accessibility.mojom
new file mode 100644
index 00000000000..4bfa3eee09c
--- /dev/null
+++ b/chromium/content/common/render_accessibility.mojom
@@ -0,0 +1,96 @@
+// Copyright 2020 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 content.mojom;
+
+import "content/common/ax_content_tree_update.mojom";
+import "ui/accessibility/ax_enums.mojom";
+import "ui/accessibility/mojom/ax_action_data.mojom";
+import "ui/accessibility/mojom/ax_event.mojom";
+import "ui/accessibility/mojom/ax_relative_bounds.mojom";
+import "ui/gfx/geometry/mojom/geometry.mojom";
+
+struct LocationChanges {
+ // ID of the object whose location is changing.
+ int32 id;
+
+ // The object's new location info.
+ ax.mojom.AXRelativeBounds new_location;
+};
+
+struct ChildFrameHitTestInfo {
+ // The routing ID of the child frame to request a hit test for.
+ int32 child_frame_routing_id;
+
+ // The coordinates that should be used for the hit test on the child frame
+ // indicated by |child_frame_routing_id|, accounting for the viewport.
+ gfx.mojom.Point transformed_point;
+
+ // The accessibility event that should be fired.
+ ax.mojom.Event event_to_fire;
+};
+
+// Interface for accessibility messages sent from the renderer to the browser,
+// implemented by RenderFrameHostImpl in the browser process.
+interface RenderAccessibilityHost {
+ // Sent to notify the browser about renderer accessibility events.
+ //
+ // The browser will respond by invoking the callback specified by the renderer
+ // as part of once the original call has been processed, in order to notify
+ // the renderer that it can send additional updates.
+ //
+ // |reset_token| parameter is set if this method was sent in response to a
+ // reset request from the browser. When the browser requests a reset, it
+ // ignores incoming remote calls until it sees one with the correct reset
+ // token. Any other time, it ignores further calls with a reset token.
+ HandleAXEvents(array<ax.mojom.AXContentTreeUpdate> updates,
+ array<ax.mojom.AXEvent> events, int32 reset_token) => ();
+
+ // Sent to update the browser of the location of accessibility objects.
+ HandleAXLocationChanges(array<LocationChanges> changes);
+};
+
+// Interface for accessibility messages sent from RenderFrameHostImpl in the
+// browser process, implemented by the RenderAccessibilityManager object in the
+// renderer process. This RenderAccessibilityManager object will be owned by the
+// RenderFrameImpl object, which will keep it alive during its entire lifetime.
+//
+// This interface is used via an associated channel from RenderFrameHostImpl in
+// the browser process, shared with other interfaces that accessibility-related
+// messages need to maintain the order with like NavigationClient or LocalFrame.
+interface RenderAccessibility {
+ // Change the accessibility mode in the renderer process for a given frame to
+ // match the one set for such frame from the browser process. |ax_mode| should
+ // contain at least the ui::AXMode::kWebContents value to enable accessibility
+ // support for web contents. See ui/accessibility/ax_mode.h for valid values.
+ SetMode(uint32 ax_mode);
+
+ // Kills the renderer. Sent when there is a fatal error in the accessibility
+ // tree and the maximum number of resets has been hit.
+ FatalError();
+
+ // Relays a request from assistive technology to perform a hit test over the
+ // accessibility object at the point passed via |action_data.target_point|.
+ //
+ // If the object hit doesn't have a child frame, the accessibility event
+ // indicated via |action_data.hit_test_event_to_fire| will be emitted by the
+ // renderer and no |child_frame_hit_test_info| should be returned. Otherwise,
+ // |child_frame_hit_test_info| will provide the necessary information for the
+ // browser process to request another hit test over the child frame found.
+ HitTest(ax.mojom.AXActionData action_data)
+ => (ChildFrameHitTestInfo? child_frame_hit_test_info);
+
+ // Relay a request from assistive technology to perform an action, such as
+ // focusing or clicking on a node.
+ PerformAction(ax.mojom.AXActionData action_data);
+
+ // Tell the renderer to reset and send a new accessibility tree from scratch
+ // because the browser is out of sync. It passes a sequential reset token.
+ // This should be rare, and if we need to reset the same renderer too many
+ // times we just kill it. After sending a reset, the browser ignores incoming
+ // accessibility IPCs until it receives one with the matching reset token.
+ // Conversely, it ignores IPCs with a reset token if it was not expecting a
+ // reset.
+ Reset(int32 reset_token);
+};
diff --git a/chromium/content/common/render_frame_metadata.mojom b/chromium/content/common/render_frame_metadata.mojom
index b1d5710f221..fccbceb8034 100644
--- a/chromium/content/common/render_frame_metadata.mojom
+++ b/chromium/content/common/render_frame_metadata.mojom
@@ -70,6 +70,12 @@ struct RenderFrameMetadata {
float bottom_controls_shown_ratio;
[EnableIf=is_android]
+ float top_controls_min_height_offset;
+
+ [EnableIf=is_android]
+ float bottom_controls_min_height_offset;
+
+ [EnableIf=is_android]
float min_page_scale_factor;
[EnableIf=is_android]
diff --git a/chromium/content/common/render_frame_metadata.typemap b/chromium/content/common/render_frame_metadata.typemap
deleted file mode 100644
index 6cb68f815e5..00000000000
--- a/chromium/content/common/render_frame_metadata.typemap
+++ /dev/null
@@ -1,16 +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.
-
-mojom = "//content/common/render_frame_metadata.mojom"
-public_headers = [ "//cc/trees/render_frame_metadata.h" ]
-traits_headers = [ "//content/common/render_frame_metadata_mojom_traits.h" ]
-deps = [
- "//cc",
- "//ui/gfx/geometry/mojom:mojom_traits",
-]
-sources = [
- "//content/common/render_frame_metadata_mojom_traits.cc",
-]
-type_mappings =
- [ "content.mojom.RenderFrameMetadata=::cc::RenderFrameMetadata" ]
diff --git a/chromium/content/common/render_frame_metadata_mojom_traits.cc b/chromium/content/common/render_frame_metadata_mojom_traits.cc
index cd87c25aa68..065f06fc64f 100644
--- a/chromium/content/common/render_frame_metadata_mojom_traits.cc
+++ b/chromium/content/common/render_frame_metadata_mojom_traits.cc
@@ -29,6 +29,9 @@ bool StructTraits<content::mojom::RenderFrameMetadataDataView,
#if defined(OS_ANDROID)
out->bottom_controls_height = data.bottom_controls_height();
out->bottom_controls_shown_ratio = data.bottom_controls_shown_ratio();
+ out->top_controls_min_height_offset = data.top_controls_min_height_offset();
+ out->bottom_controls_min_height_offset =
+ data.bottom_controls_min_height_offset();
out->min_page_scale_factor = data.min_page_scale_factor();
out->max_page_scale_factor = data.max_page_scale_factor();
out->root_overflow_y_hidden = data.root_overflow_y_hidden();
diff --git a/chromium/content/common/render_frame_metadata_mojom_traits.h b/chromium/content/common/render_frame_metadata_mojom_traits.h
index 8cd8b6a8dd2..b998ec4e963 100644
--- a/chromium/content/common/render_frame_metadata_mojom_traits.h
+++ b/chromium/content/common/render_frame_metadata_mojom_traits.h
@@ -87,6 +87,16 @@ struct StructTraits<content::mojom::RenderFrameMetadataDataView,
return metadata.bottom_controls_shown_ratio;
}
+ static float top_controls_min_height_offset(
+ const cc::RenderFrameMetadata& metadata) {
+ return metadata.top_controls_min_height_offset;
+ }
+
+ static float bottom_controls_min_height_offset(
+ const cc::RenderFrameMetadata& metadata) {
+ return metadata.bottom_controls_min_height_offset;
+ }
+
static float min_page_scale_factor(const cc::RenderFrameMetadata& metadata) {
return metadata.min_page_scale_factor;
}
diff --git a/chromium/content/common/render_message_filter.mojom b/chromium/content/common/render_message_filter.mojom
index 18aa8088697..78a8f754c0e 100644
--- a/chromium/content/common/render_message_filter.mojom
+++ b/chromium/content/common/render_message_filter.mojom
@@ -4,25 +4,12 @@
module content.mojom;
-import "content/common/input/input_handler.mojom";
-import "content/common/widget.mojom";
import "mojo/public/mojom/base/thread_priority.mojom";
-import "mojo/public/mojom/base/time.mojom";
-import "url/mojom/url.mojom";
interface RenderMessageFilter {
// Synchronously generates a new routing ID for the caller.
[Sync] GenerateRoutingID() => (int32 routing_id);
- // Similar to CreateWindow, except used for sub-widgets, like <select>
- // dropdowns.
- [Sync] CreateNewWidget(int32 opener_id, pending_remote<Widget> widget)
- => (int32 route_id);
-
- // Similar to CreateWidget except the widget is a full screen window.
- [Sync] CreateFullscreenWidget(int32 opener_id, pending_remote<Widget> widget)
- => (int32 route_id);
-
// A renderer sends this when it wants to know whether a gpu process exists.
[Sync] HasGpuProcess() => (bool has_gpu_process);
diff --git a/chromium/content/common/render_widget_host_ns_view.mojom b/chromium/content/common/render_widget_host_ns_view.mojom
index 98f8e0c9186..861cbd7b8f8 100644
--- a/chromium/content/common/render_widget_host_ns_view.mojom
+++ b/chromium/content/common/render_widget_host_ns_view.mojom
@@ -21,7 +21,7 @@ import "ui/gfx/range/mojom/range.mojom";
interface RenderWidgetHostNSView {
// Specify that the NSView will a popup (e.g, date/time picker) that will
// create its own NSWindow.
- InitAsPopup(gfx.mojom.Rect content_rect);
+ InitAsPopup(gfx.mojom.Rect content_rect, bool has_shadow);
// Set this to be a child NSView of the NSView mapped to by
// |parent_ns_view_id|.
diff --git a/chromium/content/common/renderer.mojom b/chromium/content/common/renderer.mojom
index 8179ef9fea3..1c5b3e1ae82 100644
--- a/chromium/content/common/renderer.mojom
+++ b/chromium/content/common/renderer.mojom
@@ -6,12 +6,16 @@ module content.mojom;
import "content/common/document_scoped_interface_bundle.mojom";
import "content/common/native_types.mojom";
+import "content/public/common/web_preferences.mojom";
import "ipc/constants.mojom";
import "mojo/public/mojom/base/generic_pending_receiver.mojom";
import "mojo/public/mojom/base/time.mojom";
import "mojo/public/mojom/base/unguessable_token.mojom";
import "services/network/public/mojom/network_types.mojom";
+import "third_party/blink/public/mojom/frame/frame_owner_properties.mojom";
import "third_party/blink/public/mojom/manifest/manifest.mojom";
+import "third_party/blink/public/mojom/page/page.mojom";
+import "third_party/blink/public/mojom/page/widget.mojom";
import "third_party/blink/public/mojom/renderer_preferences.mojom";
import "third_party/blink/public/mojom/user_agent/user_agent_metadata.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
@@ -28,15 +32,24 @@ struct CreateViewParams {
// The ID of the main frame hosted in the view, or None if creating a view to
// host a main frame proxy. If this is None, then |proxy_routing_id| should be
- // set to something other than None.
+ // set to something other than None. The |main_frame_widget_routing_id| is
+ // None if this is None.
int32 main_frame_routing_id = IPC.mojom.kRoutingIdNone;
+ // The ID of the widget for the main frame. The |main_frame_routing_id| is
+ // None if this is None.
+ int32 main_frame_widget_routing_id = IPC.mojom.kRoutingIdNone;
+
// This is null precisely when |main_frame_routing_id| is MSG_ROUTING_NONE,
// that is, when creating a RenderView for a remote main frame.
DocumentScopedInterfaceBundle? main_frame_interface_bundle;
- // The ID of the widget for the main frame.
- int32 main_frame_widget_routing_id = IPC.mojom.kRoutingIdNone;
+ // The communication interfaces for the WebFrameWidget in blink. All should
+ // be set if there is a |main_frame_routing_id|.
+ pending_associated_remote<blink.mojom.FrameWidgetHost>? frame_widget_host;
+ pending_associated_receiver<blink.mojom.FrameWidget>? frame_widget;
+ pending_associated_remote<blink.mojom.WidgetHost>? widget_host;
+ pending_associated_receiver<blink.mojom.Widget>? widget;
// The session storage namespace ID this view should use.
string session_storage_namespace_id;
@@ -66,8 +79,11 @@ struct CreateViewParams {
// Whether the RenderView should initially be hidden.
bool hidden;
- // Whether the RenderView will never be visible.
- bool never_visible;
+ // When true, all RenderWidgets under this RenderView will never be shown to
+ // the user, and thus never composited, and will not need to produce pixels
+ // for display. This allows the renderer to optimize and avoid resources used
+ // for displaying graphical output.
+ bool never_composited;
// Whether the window associated with this view was created with an opener.
bool window_was_created_with_opener;
@@ -87,6 +103,9 @@ struct CreateViewParams {
// Set this to true when creating a RenderView inside a portal.
bool inside_portal;
+
+ // Endpoint for any messages that are broadcast to all views in a WebContents.
+ pending_associated_receiver<blink.mojom.PageBroadcast> blink_page_broadcast;
};
struct CreateFrameWidgetParams {
@@ -94,6 +113,12 @@ struct CreateFrameWidgetParams {
// new RenderFrame.
int32 routing_id;
+ // The communication interfaces for the WebFrameWidget in blink.
+ pending_associated_remote<blink.mojom.FrameWidgetHost> frame_widget_host;
+ pending_associated_receiver<blink.mojom.FrameWidget> frame_widget;
+ pending_associated_remote<blink.mojom.WidgetHost> widget_host;
+ pending_associated_receiver<blink.mojom.Widget> widget;
+
// The initial visual properties of the widget.
VisualProperties visual_properties;
};
@@ -141,7 +166,7 @@ struct CreateFrameParams {
// properties of the HTMLFrameOwnerElement from the parent process.
// Note that unlike FrameReplicationState, this is not replicated for remote
// frames.
- FrameOwnerProperties frame_owner_properties;
+ blink.mojom.FrameOwnerProperties frame_owner_properties;
// Specifies properties for a new RenderWidget that will be attached to the
// new RenderFrame (if one is needed).
@@ -169,7 +194,6 @@ struct UpdateScrollbarThemeParams {
struct UpdateSystemColorInfoParams {
bool is_dark_mode;
bool is_high_contrast;
- PreferredColorScheme preferred_color_scheme;
// uint32 represents a SkColor in the map.
map<SystemThemeColor, uint32> colors;
};
diff --git a/chromium/content/common/renderer_host.mojom b/chromium/content/common/renderer_host.mojom
index 9e63799ce86..67bf20a5fc8 100644
--- a/chromium/content/common/renderer_host.mojom
+++ b/chromium/content/common/renderer_host.mojom
@@ -18,4 +18,7 @@ interface RendererHost {
// Notify the browser that this render process can or can't be suddenly
// terminated.
SuddenTerminationChanged(bool enabled);
+
+ // Sends a string to be recorded by UserMetrics.
+ RecordUserMetricsAction(string action);
};
diff --git a/chromium/content/common/renderer_variations_configuration.mojom b/chromium/content/common/renderer_variations_configuration.mojom
new file mode 100644
index 00000000000..7a5d1d66bb6
--- /dev/null
+++ b/chromium/content/common/renderer_variations_configuration.mojom
@@ -0,0 +1,18 @@
+// Copyright 2020 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 content.mojom;
+
+// Configures the renderer.
+interface RendererVariationsConfiguration {
+ // Instructs the renderer to append a variations header for google requests.
+ // Only sent for non-incognito sessions.
+ SetVariationsHeader(string variation_ids_header);
+
+ // Tells the renderer to create a FieldTrial, and by using a 100% probability
+ // for the FieldTrial, forces the FieldTrial to have assigned group name.
+ //
+ // See base/metrics/field_trial.h for more information.
+ SetFieldTrialGroup(string trial_name, string group_name);
+};
diff --git a/chromium/content/common/resource_messages.h b/chromium/content/common/resource_messages.h
index 287c59d3e05..c48fef70e41 100644
--- a/chromium/content/common/resource_messages.h
+++ b/chromium/content/common/resource_messages.h
@@ -29,6 +29,6 @@
#endif // INTERNAL_CONTENT_COMMON_RESOURCE_MESSAGES_H_
IPC_ENUM_TRAITS_MAX_VALUE(blink::WebMixedContentContextType,
- blink::WebMixedContentContextType::kLast)
+ blink::WebMixedContentContextType::kMaxValue)
#endif // CONTENT_COMMON_RESOURCE_MESSAGES_H_
diff --git a/chromium/content/common/resource_timing_info.cc b/chromium/content/common/resource_timing_info.cc
deleted file mode 100644
index 00ece379ab7..00000000000
--- a/chromium/content/common/resource_timing_info.cc
+++ /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.
-
-#include "content/common/resource_timing_info.h"
-
-namespace content {
-
-ServerTimingInfo::ServerTimingInfo() = default;
-ServerTimingInfo::ServerTimingInfo(const ServerTimingInfo&) = default;
-ServerTimingInfo::~ServerTimingInfo() = default;
-
-ResourceLoadTiming::ResourceLoadTiming() = default;
-ResourceLoadTiming::ResourceLoadTiming(const ResourceLoadTiming&) = default;
-ResourceLoadTiming::~ResourceLoadTiming() = default;
-
-ResourceTimingInfo::ResourceTimingInfo() = default;
-ResourceTimingInfo::ResourceTimingInfo(const ResourceTimingInfo&) = default;
-ResourceTimingInfo::~ResourceTimingInfo() = default;
-
-} // namespace content
diff --git a/chromium/content/common/resource_timing_info.h b/chromium/content/common/resource_timing_info.h
deleted file mode 100644
index e508eb1c075..00000000000
--- a/chromium/content/common/resource_timing_info.h
+++ /dev/null
@@ -1,91 +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 CONTENT_COMMON_RESOURCE_TIMING_INFO_H_
-#define CONTENT_COMMON_RESOURCE_TIMING_INFO_H_
-
-#include <stdint.h>
-
-#include <string>
-#include <vector>
-
-#include "base/optional.h"
-#include "base/time/time.h"
-#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom.h"
-
-namespace content {
-
-// TODO(dcheng): Migrate this struct over to Mojo so it doesn't need to be
-// duplicated in //content and //third_party/WebKit.
-// See blink::WebServerTimingInfo for more information about this struct's
-// fields.
-struct ServerTimingInfo {
- ServerTimingInfo();
- ServerTimingInfo(const ServerTimingInfo&);
- ~ServerTimingInfo();
-
- std::string name;
- double duration = 0.0;
- std::string description;
-};
-
-// TODO(dcheng): Migrate this struct over to Mojo so it doesn't need to be
-// duplicated in //content and //third_party/WebKit.
-// See blink::WebURLLoadTiming for more information about this struct's fields.
-struct ResourceLoadTiming {
- ResourceLoadTiming();
- ResourceLoadTiming(const ResourceLoadTiming&);
- ~ResourceLoadTiming();
-
- base::TimeTicks request_time;
- base::TimeTicks proxy_start;
- base::TimeTicks proxy_end;
- base::TimeTicks dns_start;
- base::TimeTicks dns_end;
- base::TimeTicks connect_start;
- base::TimeTicks connect_end;
- base::TimeTicks worker_start;
- base::TimeTicks worker_ready;
- base::TimeTicks send_start;
- base::TimeTicks send_end;
- base::TimeTicks receive_headers_start;
- base::TimeTicks receive_headers_end;
- base::TimeTicks ssl_start;
- base::TimeTicks ssl_end;
- base::TimeTicks push_start;
- base::TimeTicks push_end;
-};
-
-// TODO(dcheng): Migrate this struct over to Mojo so it doesn't need to be
-// duplicated in //content and //third_party/WebKit.
-// See blink::WebResourceTimingInfo for more information about this struct's
-// fields.
-struct ResourceTimingInfo {
- ResourceTimingInfo();
- ResourceTimingInfo(const ResourceTimingInfo&);
- ~ResourceTimingInfo();
-
- std::string name;
- base::TimeTicks start_time;
- std::string initiator_type;
- std::string alpn_negotiated_protocol;
- std::string connection_info;
- base::Optional<ResourceLoadTiming> timing;
- base::TimeTicks last_redirect_end_time;
- base::TimeTicks response_end;
- blink::mojom::RequestContextType context_type =
- blink::mojom::RequestContextType::UNSPECIFIED;
- uint64_t transfer_size = 0;
- uint64_t encoded_body_size = 0;
- uint64_t decoded_body_size = 0;
- bool did_reuse_connection = false;
- bool allow_timing_details = false;
- bool allow_redirect_details = false;
- bool allow_negative_values = false;
- std::vector<ServerTimingInfo> server_timing;
-};
-
-} // namespace content
-
-#endif // CONTENT_COMMON_RESOURCE_TIMING_INFO_H_
diff --git a/chromium/content/common/sandbox_init_mac.cc b/chromium/content/common/sandbox_init_mac.cc
index 64e125805be..525247ac10e 100644
--- a/chromium/content/common/sandbox_init_mac.cc
+++ b/chromium/content/common/sandbox_init_mac.cc
@@ -31,7 +31,7 @@ namespace {
base::OnceClosure MaybeWrapWithGPUSandboxHook(
service_manager::SandboxType sandbox_type,
base::OnceClosure original) {
- if (sandbox_type != service_manager::SANDBOX_TYPE_GPU)
+ if (sandbox_type != service_manager::SandboxType::kGpu)
return original;
return base::BindOnce(
@@ -92,7 +92,7 @@ bool GetSandboxTypeFromCommandLine(service_manager::SandboxType* sandbox_type) {
return false;
}
- return *sandbox_type != service_manager::SANDBOX_TYPE_INVALID;
+ return *sandbox_type != service_manager::SandboxType::kInvalid;
}
} // namespace
@@ -105,7 +105,7 @@ bool InitializeSandbox(service_manager::SandboxType sandbox_type) {
bool InitializeSandbox(base::OnceClosure post_warmup_hook) {
service_manager::SandboxType sandbox_type =
- service_manager::SANDBOX_TYPE_INVALID;
+ service_manager::SandboxType::kInvalid;
return !GetSandboxTypeFromCommandLine(&sandbox_type) ||
service_manager::Sandbox::Initialize(
sandbox_type, MaybeWrapWithGPUSandboxHook(
diff --git a/chromium/content/common/service_manager/service_manager_connection_impl_unittest.cc b/chromium/content/common/service_manager/service_manager_connection_impl_unittest.cc
index 44a23dd1163..47d7312fc3c 100644
--- a/chromium/content/common/service_manager/service_manager_connection_impl_unittest.cc
+++ b/chromium/content/common/service_manager/service_manager_connection_impl_unittest.cc
@@ -10,6 +10,7 @@
#include "base/test/task_environment.h"
#include "base/threading/thread.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/remote.h"
#include "services/service_manager/public/cpp/constants.h"
#include "services/service_manager/public/cpp/identity.h"
#include "services/service_manager/public/cpp/service.h"
@@ -26,9 +27,9 @@ TEST(ServiceManagerConnectionImplTest, ServiceLaunchThreading) {
base::test::SingleThreadTaskEnvironment task_environment;
base::Thread io_thread("ServiceManagerConnectionImplTest IO Thread");
io_thread.Start();
- service_manager::mojom::ServicePtr service;
- ServiceManagerConnectionImpl connection_impl(mojo::MakeRequest(&service),
- io_thread.task_runner());
+ mojo::Remote<service_manager::mojom::Service> service;
+ ServiceManagerConnectionImpl connection_impl(
+ service.BindNewPipeAndPassReceiver(), io_thread.task_runner());
ServiceManagerConnection& connection = connection_impl;
base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL,
base::WaitableEvent::InitialState::NOT_SIGNALED);
diff --git a/chromium/content/common/service_worker/service_worker_loader_helpers.cc b/chromium/content/common/service_worker/service_worker_loader_helpers.cc
index 1f573ee5b22..35b3053acd5 100644
--- a/chromium/content/common/service_worker/service_worker_loader_helpers.cc
+++ b/chromium/content/common/service_worker/service_worker_loader_helpers.cc
@@ -12,16 +12,19 @@
#include "base/strings/stringprintf.h"
#include "content/public/common/content_features.h"
-#include "content/public/common/resource_type.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "net/http/http_util.h"
+#include "net/http/structured_headers.h"
#include "net/url_request/redirect_util.h"
-#include "services/network/loader_util.h"
-#include "services/network/public/cpp/content_security_policy.h"
+#include "services/network/public/cpp/content_security_policy/content_security_policy.h"
+#include "services/network/public/cpp/cross_origin_embedder_policy.h"
+#include "services/network/public/cpp/cross_origin_opener_policy_parser.h"
+#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/resource_request_body.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "third_party/blink/public/common/blob/blob_utils.h"
+#include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h"
#include "ui/base/page_transition_types.h"
namespace content {
@@ -46,6 +49,37 @@ class BlobCompleteCaller : public blink::mojom::BlobReaderClient {
BlobCompleteCallback callback_;
};
+std::pair<network::mojom::CrossOriginEmbedderPolicyValue,
+ base::Optional<std::string>>
+ParseCrossOriginEmbedderPolicyValueInternal(
+ const net::HttpResponseHeaders* headers,
+ base::StringPiece header_name) {
+ static constexpr char kRequireCorp[] = "require-corp";
+ constexpr auto kNone = network::mojom::CrossOriginEmbedderPolicyValue::kNone;
+ using Item = net::structured_headers::Item;
+ std::string header_value;
+ if (!headers ||
+ !headers->GetNormalizedHeader(header_name.as_string(), &header_value)) {
+ return std::make_pair(kNone, base::nullopt);
+ }
+ const auto item = net::structured_headers::ParseItem(header_value);
+ if (!item || item->item.Type() != Item::kTokenType ||
+ item->item.GetString() != kRequireCorp) {
+ return std::make_pair(kNone, base::nullopt);
+ }
+ base::Optional<std::string> endpoint;
+ auto it = std::find_if(item->params.cbegin(), item->params.cend(),
+ [](const std::pair<std::string, Item>& param) {
+ return param.first == "report-to";
+ });
+ if (it != item->params.end() && it->second.Type() == Item::kStringType) {
+ endpoint = it->second.GetString();
+ }
+ return std::make_pair(
+ network::mojom::CrossOriginEmbedderPolicyValue::kRequireCorp,
+ std::move(endpoint));
+}
+
} // namespace
// static
@@ -89,6 +123,44 @@ void ServiceWorkerLoaderHelpers::SaveResponseHeaders(
// headers.
if (out_head->content_length == -1)
out_head->content_length = out_head->headers->GetContentLength();
+
+ // TODO(yhirano): Remove the code duplication with
+ // //services/network/url_loader.cc.
+ if (base::FeatureList::IsEnabled(
+ network::features::kCrossOriginEmbedderPolicy)) {
+ // Parse the Cross-Origin-Embedder-Policy and
+ // Cross-Origin-Embedder-Policy-Report-Only headers.
+
+ static constexpr char kCrossOriginEmbedderPolicyValueHeader[] =
+ "Cross-Origin-Embedder-Policy";
+ static constexpr char kCrossOriginEmbedderPolicyValueReportOnlyHeader[] =
+ "Cross-Origin-Embedder-Policy-Report-Only";
+ network::CrossOriginEmbedderPolicy coep;
+ std::tie(coep.value, coep.reporting_endpoint) =
+ ParseCrossOriginEmbedderPolicyValueInternal(
+ out_head->headers.get(), kCrossOriginEmbedderPolicyValueHeader);
+ std::tie(coep.report_only_value, coep.report_only_reporting_endpoint) =
+ ParseCrossOriginEmbedderPolicyValueInternal(
+ out_head->headers.get(),
+ kCrossOriginEmbedderPolicyValueReportOnlyHeader);
+ out_head->cross_origin_embedder_policy = coep;
+ }
+
+ // TODO(pmeuleman): Remove the code duplication with
+ // //services/network/url_loader.cc.
+ if (base::FeatureList::IsEnabled(
+ network::features::kCrossOriginOpenerPolicy)) {
+ // Parse the Cross-Origin-Opener-Policy header.
+ constexpr char kCrossOriginOpenerPolicyHeader[] =
+ "Cross-Origin-Opener-Policy";
+ std::string raw_coop_string;
+ if (out_head->headers &&
+ out_head->headers->GetNormalizedHeader(kCrossOriginOpenerPolicyHeader,
+ &raw_coop_string)) {
+ out_head->cross_origin_opener_policy =
+ network::ParseCrossOriginOpenerPolicyHeader(raw_coop_string);
+ }
+ }
}
// static
@@ -110,7 +182,7 @@ void ServiceWorkerLoaderHelpers::SaveResponseInfo(
out_head->cors_exposed_header_names = response.cors_exposed_header_names;
out_head->did_service_worker_navigation_preload = false;
out_head->content_security_policy =
- network::ContentSecurityPolicy(response.content_security_policy.Clone());
+ mojo::Clone(response.content_security_policy);
}
// static
@@ -126,7 +198,7 @@ ServiceWorkerLoaderHelpers::ComputeRedirectInfo(
// updated on redirects.
const net::URLRequest::FirstPartyURLPolicy first_party_url_policy =
original_request.resource_type ==
- static_cast<int>(ResourceType::kMainFrame)
+ static_cast<int>(blink::mojom::ResourceType::kMainFrame)
? net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT
: net::URLRequest::NEVER_CHANGE_FIRST_PARTY_URL;
return net::RedirectInfo::ComputeRedirectInfo(
diff --git a/chromium/content/common/service_worker/service_worker_utils.cc b/chromium/content/common/service_worker/service_worker_utils.cc
index a338dc0fb90..8ae4eb596dc 100644
--- a/chromium/content/common/service_worker/service_worker_utils.cc
+++ b/chromium/content/common/service_worker/service_worker_utils.cc
@@ -18,6 +18,7 @@
#include "services/network/public/cpp/features.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "third_party/blink/public/common/features.h"
+#include "third_party/blink/public/common/loader/resource_type_util.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom.h"
namespace content {
@@ -44,12 +45,13 @@ bool PathContainsDisallowedCharacter(const GURL& url) {
} // namespace
// static
-bool ServiceWorkerUtils::IsMainResourceType(ResourceType type) {
+bool ServiceWorkerUtils::IsMainResourceType(blink::mojom::ResourceType type) {
// When PlzDedicatedWorker is enabled, a dedicated worker script is considered
// to be a main resource.
- if (type == ResourceType::kWorker)
+ if (type == blink::mojom::ResourceType::kWorker)
return base::FeatureList::IsEnabled(blink::features::kPlzDedicatedWorker);
- return IsResourceTypeFrame(type) || type == ResourceType::kSharedWorker;
+ return blink::IsResourceTypeFrame(type) ||
+ type == blink::mojom::ResourceType::kSharedWorker;
}
// static
@@ -105,6 +107,13 @@ bool ServiceWorkerUtils::IsPathRestrictionSatisfiedInternal(
error_message->append("') was received when fetching the script.");
return false;
}
+
+ if (max_scope.GetOrigin() != script_url.GetOrigin()) {
+ *error_message = "A cross-origin Service-Worker-Allowed header value ('";
+ error_message->append(*service_worker_allowed_header_value);
+ error_message->append("') was received when fetching the script.");
+ return false;
+ }
max_scope_string = max_scope.path();
} else {
max_scope_string = script_url.GetWithoutFilename().path();
diff --git a/chromium/content/common/service_worker/service_worker_utils.h b/chromium/content/common/service_worker/service_worker_utils.h
index 3aff477444a..8f09616e767 100644
--- a/chromium/content/common/service_worker/service_worker_utils.h
+++ b/chromium/content/common/service_worker/service_worker_utils.h
@@ -14,19 +14,19 @@
#include "base/macros.h"
#include "content/common/content_export.h"
#include "content/public/common/content_switches.h"
-#include "content/public/common/resource_type.h"
#include "net/http/http_request_headers.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "third_party/blink/public/common/fetch/fetch_api_request_headers_map.h"
#include "third_party/blink/public/common/service_worker/service_worker_status_code.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom.h"
+#include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h"
#include "url/gurl.h"
namespace content {
class ServiceWorkerUtils {
public:
- static bool IsMainResourceType(ResourceType type);
+ static bool IsMainResourceType(blink::mojom::ResourceType type);
// Returns true if |scope| matches |url|.
CONTENT_EXPORT static bool ScopeMatches(const GURL& scope, const GURL& url);
diff --git a/chromium/content/common/service_worker/service_worker_utils_unittest.cc b/chromium/content/common/service_worker/service_worker_utils_unittest.cc
index f19e682641e..1b0cc91cd5f 100644
--- a/chromium/content/common/service_worker/service_worker_utils_unittest.cc
+++ b/chromium/content/common/service_worker/service_worker_utils_unittest.cc
@@ -402,6 +402,14 @@ TEST(ServiceWorkerUtilsTest, PathRestriction_ServiceWorkerAllowed) {
EXPECT_TRUE(IsPathRestrictionSatisfiedWithServiceWorkerAllowedHeader(
GURL("http://example.com/sw.js/hi"), GURL("http://example.com/sw.js"),
""));
+
+ // Cross origin header value is not accepted.
+ EXPECT_FALSE(IsPathRestrictionSatisfiedWithServiceWorkerAllowedHeader(
+ GURL("http://example.com/"), GURL("http://example.com/sw.js"),
+ "http://other.com/"));
+ EXPECT_FALSE(IsPathRestrictionSatisfiedWithServiceWorkerAllowedHeader(
+ GURL("http://example.com/foo/"), GURL("http://example.com/bar/sw.js"),
+ "http://other.com/foo/"));
}
TEST(ServiceWorkerUtilsTest, AllOriginsMatchAndCanAccessServiceWorkers) {
diff --git a/chromium/content/common/swapped_out_messages.cc b/chromium/content/common/swapped_out_messages.cc
deleted file mode 100644
index 46d4da872a9..00000000000
--- a/chromium/content/common/swapped_out_messages.cc
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) 2012 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.
-
-#include "content/common/swapped_out_messages.h"
-
-#include "content/common/accessibility_messages.h"
-#include "content/common/view_messages.h"
-#include "content/public/common/content_client.h"
-
-namespace content {
-
-bool SwappedOutMessages::CanSendWhileSwappedOut(const IPC::Message* msg) {
- // We filter out most IPC messages when swapped out. However, some are
- // important (e.g., ACKs) for keeping the browser and renderer state
- // consistent in case we later return to the same renderer.
- switch (msg->type()) {
- // Handled by RenderViewHost.
- case ViewHostMsg_ClosePage_ACK::ID:
- case ViewHostMsg_Focus::ID:
- case ViewHostMsg_ShowFullscreenWidget::ID:
- case ViewHostMsg_ShowWidget::ID:
- case ViewHostMsg_UpdateTargetURL::ID:
- case ViewHostMsg_RouteCloseEvent::ID:
- // Send page scale factor reset notification upon cross-process navigations.
- case ViewHostMsg_PageScaleFactorChanged::ID:
- return true;
- default:
- break;
- }
-
- // Check with the embedder as well.
- ContentClient* client = GetContentClient();
- return client->CanSendWhileSwappedOut(msg);
-}
-
-bool SwappedOutMessages::CanHandleWhileSwappedOut(
- const IPC::Message& msg) {
- // Any message the renderer is allowed to send while swapped out should
- // be handled by the browser.
- if (CanSendWhileSwappedOut(&msg))
- return true;
-
- // We drop most other messages that arrive from a swapped out renderer.
- // However, some are important (e.g., ACKs) for keeping the browser and
- // renderer state consistent in case we later return to the renderer.
- // Note that synchronous messages that are not handled will receive an
- // error reply instead, to avoid leaving the renderer in a stuck state.
- switch (msg.type()) {
- // Sends an ACK.
- case AccessibilityHostMsg_EventBundle::ID:
- return true;
- default:
- break;
- }
-
- return false;
-}
-
-} // namespace content
diff --git a/chromium/content/common/swapped_out_messages.h b/chromium/content/common/swapped_out_messages.h
deleted file mode 100644
index c4b0649a7c6..00000000000
--- a/chromium/content/common/swapped_out_messages.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) 2012 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 CONTENT_COMMON_SWAPPED_OUT_MESSAGES_H_
-#define CONTENT_COMMON_SWAPPED_OUT_MESSAGES_H_
-
-#include "ipc/ipc_message.h"
-
-namespace content {
-
-// Functions for filtering IPC messages sent from and received from a swapped
-// out renderer.
-class SwappedOutMessages {
- public:
- static bool CanSendWhileSwappedOut(const IPC::Message* msg);
- static bool CanHandleWhileSwappedOut(const IPC::Message& msg);
-};
-
-} // namespace content
-
-#endif // CONTENT_COMMON_SWAPPED_OUT_MESSAGES_H_
diff --git a/chromium/content/common/tab_switch_time_recorder.h b/chromium/content/common/tab_switch_time_recorder.h
deleted file mode 100644
index 9a933476131..00000000000
--- a/chromium/content/common/tab_switch_time_recorder.h
+++ /dev/null
@@ -1,90 +0,0 @@
-// 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 CONTENT_COMMON_TAB_SWITCH_TIME_RECORDER_H_
-#define CONTENT_COMMON_TAB_SWITCH_TIME_RECORDER_H_
-
-#include "base/callback.h"
-#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
-#include "base/time/time.h"
-#include "content/common/content_export.h"
-
-namespace gfx {
-struct PresentationFeedback;
-}
-
-namespace content {
-
-struct CONTENT_EXPORT RecordTabSwitchTimeRequest {
- RecordTabSwitchTimeRequest() = default;
- ~RecordTabSwitchTimeRequest() = default;
-
- RecordTabSwitchTimeRequest(base::TimeTicks tab_switch_start_time,
- bool destination_is_loaded,
- bool destination_is_frozen);
-
- // The time at which the tab switch has been initiated.
- base::TimeTicks tab_switch_start_time = base::TimeTicks();
- // Indicates if the destination tab is loaded when initiating the tab switch.
- bool destination_is_loaded = false;
- // Indicates if the destination tab is frozen when initiating the tab switch.
- bool destination_is_frozen = false;
-};
-
-// Generates UMA metric to track the duration of tab switching from when the
-// active tab is changed until the frame presentation time. The metric will be
-// separated into two whether the tab switch has saved frames or not.
-class CONTENT_EXPORT TabSwitchTimeRecorder {
- public:
- // Matches the TabSwitchResult enum in enums.xml.
- enum class TabSwitchResult {
- // A frame was successfully presented after a tab switch.
- kSuccess = 0,
- // Tab was hidden before a frame was presented after a tab switch.
- kIncomplete = 1,
- // Compositor reported a failure after a tab switch.
- kPresentationFailure = 2,
- kMaxValue = kPresentationFailure,
- };
-
- TabSwitchTimeRecorder();
- ~TabSwitchTimeRecorder();
-
- // Invoked when the tab associated with this recorder is shown. Returns a
- // callback to invoke the next time a frame is presented for this tab.
- base::OnceCallback<void(const gfx::PresentationFeedback&)> TabWasShown(
- bool has_saved_frames,
- const RecordTabSwitchTimeRequest& start_state,
- base::TimeTicks render_widget_visibility_request_timestamp);
-
- // Indicates that the tab associated with this recorder was hidden. If no
- // frame was presented since the last tab switch, failure is reported to UMA.
- void TabWasHidden();
-
- private:
- // Records histograms and trace events for the current tab switch.
- void RecordHistogramsAndTraceEvents(
- bool is_incomplete,
- const gfx::PresentationFeedback& feedback);
-
- // Whether there was a saved frame for the last tab switch.
- bool has_saved_frames_;
-
- // The information about the last tab switch request, or nullopt if there is
- // no incomplete tab switch.
- base::Optional<RecordTabSwitchTimeRequest> tab_switch_start_state_;
-
- // The render widget visibility request timestamp for the last tab switch, or
- // null if there is no incomplete tab switch.
- base::TimeTicks render_widget_visibility_request_timestamp_;
-
- base::WeakPtrFactory<TabSwitchTimeRecorder> weak_ptr_factory_{this};
-
- DISALLOW_COPY_AND_ASSIGN(TabSwitchTimeRecorder);
-};
-
-} // namespace content
-
-#endif // CONTENT_COMMON_TAB_SWITCH_TIME_RECORDER_H_
diff --git a/chromium/content/common/tab_switch_time_recorder_unittest.cc b/chromium/content/common/tab_switch_time_recorder_unittest.cc
index aaff264ae05..e8dfadb2cfa 100644
--- a/chromium/content/common/tab_switch_time_recorder_unittest.cc
+++ b/chromium/content/common/tab_switch_time_recorder_unittest.cc
@@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <strstream>
#include <utility>
+#include "base/rand_util.h"
#include "base/strings/stringprintf.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
-#include "content/common/tab_switch_time_recorder.h"
+#include "content/common/content_to_visible_time_reporter.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/presentation_feedback.h"
@@ -45,12 +47,16 @@ constexpr char kResultNoSavedFramesFrozenHistogram[] =
"Browser.Tabs.TabSwitchResult.NoSavedFrames_Loaded_Frozen";
constexpr char kResultNoSavedFramesUnloadedHistogram[] =
"Browser.Tabs.TabSwitchResult.NoSavedFrames_NotLoaded";
+constexpr char kWebContentsUnOccludedHistogram[] =
+ "Aura.WebContentsWindowUnOccludedTime";
+constexpr char kBfcacheRestoreHistogram[] =
+ "BackForwardCache.Restore.NavigationToFirstPaint";
constexpr base::TimeDelta kDuration = base::TimeDelta::FromMilliseconds(42);
constexpr base::TimeDelta kOtherDuration =
base::TimeDelta::FromMilliseconds(4242);
-class TabSwitchTimeRecorderTest : public testing::Test {
+class ContentToVisibleTimeReporterTest : public testing::Test {
protected:
void SetUp() override {
// Expect all histograms to be empty.
@@ -74,7 +80,8 @@ class TabSwitchTimeRecorderTest : public testing::Test {
kResultNoSavedFramesHistogram,
kResultNoSavedFramesNotFrozenHistogram,
kResultNoSavedFramesFrozenHistogram,
- kResultNoSavedFramesUnloadedHistogram};
+ kResultNoSavedFramesUnloadedHistogram,
+ kWebContentsUnOccludedHistogram};
for (const char* histogram : kAllHistograms) {
if (!base::Contains(histograms_with_values, histogram))
ExpectTotalSamples(histogram, 0);
@@ -95,26 +102,29 @@ class TabSwitchTimeRecorderTest : public testing::Test {
histogram_tester_.ExpectTimeBucketCount(histogram_name, value, count);
}
- void ExpectResultBucketCount(const char* histogram_name,
- TabSwitchTimeRecorder::TabSwitchResult value,
- int count) {
+ void ExpectResultBucketCount(
+ const char* histogram_name,
+ ContentToVisibleTimeReporter::TabSwitchResult value,
+ int count) {
histogram_tester_.ExpectBucketCount(histogram_name, value, count);
}
base::test::TaskEnvironment task_environment_{
base::test::TaskEnvironment::TimeSource::MOCK_TIME};
- TabSwitchTimeRecorder tab_switch_time_recorder_;
+ ContentToVisibleTimeReporter tab_switch_time_recorder_;
base::HistogramTester histogram_tester_;
};
// Time is properly recorded to histogram when we have saved frames and if we
// have a proper matching TabWasShown and callback execution.
-TEST_F(TabSwitchTimeRecorderTest, TimeIsRecordedWithSavedFrames) {
+TEST_F(ContentToVisibleTimeReporterTest, TimeIsRecordedWithSavedFrames) {
const auto start = base::TimeTicks::Now();
auto callback = tab_switch_time_recorder_.TabWasShown(
true /* has_saved_frames */,
{start, /* destination_is_loaded */ true,
- /* destination_is_frozen */ false},
+ /* destination_is_frozen */ false, /* show_reason_tab_switching */ true,
+ /* show_reason_unoccluded */ false,
+ /* show_reason_bfcache_restore */ false},
start);
const auto end = start + kDuration;
auto presentation_feedback = gfx::PresentationFeedback(
@@ -130,18 +140,21 @@ TEST_F(TabSwitchTimeRecorderTest, TimeIsRecordedWithSavedFrames) {
// Result.
ExpectTotalSamples(kResultWithSavedFramesHistogram, 1);
- ExpectResultBucketCount(kResultWithSavedFramesHistogram,
- TabSwitchTimeRecorder::TabSwitchResult::kSuccess, 1);
+ ExpectResultBucketCount(
+ kResultWithSavedFramesHistogram,
+ ContentToVisibleTimeReporter::TabSwitchResult::kSuccess, 1);
}
// Time is properly recorded to histogram when we have no saved frame and if we
// have a proper matching TabWasShown and callback execution.
-TEST_F(TabSwitchTimeRecorderTest, TimeIsRecordedNoSavedFrameNotFrozen) {
+TEST_F(ContentToVisibleTimeReporterTest, TimeIsRecordedNoSavedFrameNotFrozen) {
const auto start = base::TimeTicks::Now();
auto callback = tab_switch_time_recorder_.TabWasShown(
false /* has_saved_frames */,
{start, /* destination_is_loaded */ true,
- /* destination_is_frozen */ false},
+ /* destination_is_frozen */ false, /* show_reason_tab_switching */ true,
+ /* show_reason_unoccluded */ false,
+ /* show_reason_bfcache_restore */ false},
start);
const auto end = start + kDuration;
auto presentation_feedback = gfx::PresentationFeedback(
@@ -161,20 +174,24 @@ TEST_F(TabSwitchTimeRecorderTest, TimeIsRecordedNoSavedFrameNotFrozen) {
// Result.
ExpectTotalSamples(kResultNoSavedFramesHistogram, 1);
- ExpectResultBucketCount(kResultNoSavedFramesHistogram,
- TabSwitchTimeRecorder::TabSwitchResult::kSuccess, 1);
+ ExpectResultBucketCount(
+ kResultNoSavedFramesHistogram,
+ ContentToVisibleTimeReporter::TabSwitchResult::kSuccess, 1);
ExpectTotalSamples(kResultNoSavedFramesNotFrozenHistogram, 1);
- ExpectResultBucketCount(kResultNoSavedFramesNotFrozenHistogram,
- TabSwitchTimeRecorder::TabSwitchResult::kSuccess, 1);
+ ExpectResultBucketCount(
+ kResultNoSavedFramesNotFrozenHistogram,
+ ContentToVisibleTimeReporter::TabSwitchResult::kSuccess, 1);
}
// Same as TimeIsRecordedNoSavedFrame but with the destination frame frozen.
-TEST_F(TabSwitchTimeRecorderTest, TimeIsRecordedNoSavedFrameFrozen) {
+TEST_F(ContentToVisibleTimeReporterTest, TimeIsRecordedNoSavedFrameFrozen) {
const auto start = base::TimeTicks::Now();
auto callback = tab_switch_time_recorder_.TabWasShown(
false /* has_saved_frames */,
{start, /* destination_is_loaded */ true,
- /* destination_is_frozen */ true},
+ /* destination_is_frozen */ true, /* show_reason_tab_switching */ true,
+ /* show_reason_unoccluded */ false,
+ /* show_reason_bfcache_restore */ false},
start);
const auto end = start + kDuration;
auto presentation_feedback = gfx::PresentationFeedback(
@@ -193,20 +210,24 @@ TEST_F(TabSwitchTimeRecorderTest, TimeIsRecordedNoSavedFrameFrozen) {
// Result.
ExpectTotalSamples(kResultNoSavedFramesHistogram, 1);
- ExpectResultBucketCount(kResultNoSavedFramesHistogram,
- TabSwitchTimeRecorder::TabSwitchResult::kSuccess, 1);
+ ExpectResultBucketCount(
+ kResultNoSavedFramesHistogram,
+ ContentToVisibleTimeReporter::TabSwitchResult::kSuccess, 1);
ExpectTotalSamples(kResultNoSavedFramesFrozenHistogram, 1);
- ExpectResultBucketCount(kResultNoSavedFramesFrozenHistogram,
- TabSwitchTimeRecorder::TabSwitchResult::kSuccess, 1);
+ ExpectResultBucketCount(
+ kResultNoSavedFramesFrozenHistogram,
+ ContentToVisibleTimeReporter::TabSwitchResult::kSuccess, 1);
}
// Same as TimeIsRecordedNoSavedFrame but with the destination frame unloaded.
-TEST_F(TabSwitchTimeRecorderTest, TimeIsRecordedNoSavedFrameUnloaded) {
+TEST_F(ContentToVisibleTimeReporterTest, TimeIsRecordedNoSavedFrameUnloaded) {
const auto start = base::TimeTicks::Now();
auto callback = tab_switch_time_recorder_.TabWasShown(
false /* has_saved_frames */,
{start, /* destination_is_loaded */ false,
- /* destination_is_frozen */ false},
+ /* destination_is_frozen */ false, /* show_reason_tab_switching */ true,
+ /* show_reason_unoccluded */ false,
+ /* show_reason_bfcache_restore */ false},
start);
const auto end = start + kDuration;
auto presentation_feedback = gfx::PresentationFeedback(
@@ -222,18 +243,21 @@ TEST_F(TabSwitchTimeRecorderTest, TimeIsRecordedNoSavedFrameUnloaded) {
// Result.
ExpectTotalSamples(kResultNoSavedFramesUnloadedHistogram, 1);
- ExpectResultBucketCount(kResultNoSavedFramesUnloadedHistogram,
- TabSwitchTimeRecorder::TabSwitchResult::kSuccess, 1);
+ ExpectResultBucketCount(
+ kResultNoSavedFramesUnloadedHistogram,
+ ContentToVisibleTimeReporter::TabSwitchResult::kSuccess, 1);
}
// A failure should be reported if gfx::PresentationFeedback contains the
// kFailure flag.
-TEST_F(TabSwitchTimeRecorderTest, PresentationFailureWithSavedFrames) {
+TEST_F(ContentToVisibleTimeReporterTest, PresentationFailureWithSavedFrames) {
const auto start = base::TimeTicks::Now();
auto callback = tab_switch_time_recorder_.TabWasShown(
true /* has_saved_frames */,
{start, /* destination_is_loaded */ true,
- /* destination_is_frozen */ false},
+ /* destination_is_frozen */ false, /* show_reason_tab_switching */ true,
+ /* show_reason_unoccluded */ false,
+ /* show_reason_bfcache_restore */ false},
start);
std::move(callback).Run(gfx::PresentationFeedback::Failure());
@@ -243,17 +267,19 @@ TEST_F(TabSwitchTimeRecorderTest, PresentationFailureWithSavedFrames) {
ExpectTotalSamples(kResultWithSavedFramesHistogram, 1);
ExpectResultBucketCount(
kResultWithSavedFramesHistogram,
- TabSwitchTimeRecorder::TabSwitchResult::kPresentationFailure, 1);
+ ContentToVisibleTimeReporter::TabSwitchResult::kPresentationFailure, 1);
}
// A failure should be reported if gfx::PresentationFeedback contains the
// kFailure flag.
-TEST_F(TabSwitchTimeRecorderTest, PresentationFailureNoSavedFrames) {
+TEST_F(ContentToVisibleTimeReporterTest, PresentationFailureNoSavedFrames) {
const auto start = base::TimeTicks::Now();
auto callback = tab_switch_time_recorder_.TabWasShown(
false /* has_saved_frames */,
{start, /* destination_is_loaded */ true,
- /* destination_is_frozen */ false},
+ /* destination_is_frozen */ false, /* show_reason_tab_switching */ true,
+ /* show_reason_unoccluded */ false,
+ /* show_reason_bfcache_restore */ false},
start);
std::move(callback).Run(gfx::PresentationFeedback::Failure());
@@ -264,21 +290,24 @@ TEST_F(TabSwitchTimeRecorderTest, PresentationFailureNoSavedFrames) {
ExpectTotalSamples(kResultNoSavedFramesHistogram, 1);
ExpectResultBucketCount(
kResultNoSavedFramesHistogram,
- TabSwitchTimeRecorder::TabSwitchResult::kPresentationFailure, 1);
+ ContentToVisibleTimeReporter::TabSwitchResult::kPresentationFailure, 1);
ExpectTotalSamples(kResultNoSavedFramesNotFrozenHistogram, 1);
ExpectResultBucketCount(
kResultNoSavedFramesNotFrozenHistogram,
- TabSwitchTimeRecorder::TabSwitchResult::kPresentationFailure, 1);
+ ContentToVisibleTimeReporter::TabSwitchResult::kPresentationFailure, 1);
}
// An incomplete tab switch is reported when no frame is shown before a tab is
// hidden.
-TEST_F(TabSwitchTimeRecorderTest, HideBeforePresentFrameWithSavedFrames) {
+TEST_F(ContentToVisibleTimeReporterTest,
+ HideBeforePresentFrameWithSavedFrames) {
const auto start1 = base::TimeTicks::Now();
auto callback1 = tab_switch_time_recorder_.TabWasShown(
true /* has_saved_frames */,
{start1, /* destination_is_loaded */ true,
- /* destination_is_frozen */ false},
+ /* destination_is_frozen */ false, /* show_reason_tab_switching */ true,
+ /* show_reason_unoccluded */ false,
+ /* show_reason_bfcache_restore */ false},
start1);
task_environment_.FastForwardBy(kDuration);
@@ -294,15 +323,17 @@ TEST_F(TabSwitchTimeRecorderTest, HideBeforePresentFrameWithSavedFrames) {
// Result.
ExpectTotalSamples(kResultWithSavedFramesHistogram, 1);
- ExpectResultBucketCount(kResultWithSavedFramesHistogram,
- TabSwitchTimeRecorder::TabSwitchResult::kIncomplete,
- 1);
+ ExpectResultBucketCount(
+ kResultWithSavedFramesHistogram,
+ ContentToVisibleTimeReporter::TabSwitchResult::kIncomplete, 1);
const auto start2 = base::TimeTicks::Now();
auto callback2 = tab_switch_time_recorder_.TabWasShown(
true /* has_saved_frames */,
{start2, /* destination_is_loaded */ true,
- /* destination_is_frozen */ false},
+ /* destination_is_frozen */ false, /* show_reason_tab_switching */ true,
+ /* show_reason_unoccluded */ false,
+ /* show_reason_bfcache_restore */ false},
start2);
const auto end2 = start2 + kOtherDuration;
auto presentation_feedback = gfx::PresentationFeedback(
@@ -320,21 +351,24 @@ TEST_F(TabSwitchTimeRecorderTest, HideBeforePresentFrameWithSavedFrames) {
// Result.
ExpectTotalSamples(kResultWithSavedFramesHistogram, 2);
- ExpectResultBucketCount(kResultWithSavedFramesHistogram,
- TabSwitchTimeRecorder::TabSwitchResult::kIncomplete,
- 1);
- ExpectResultBucketCount(kResultWithSavedFramesHistogram,
- TabSwitchTimeRecorder::TabSwitchResult::kSuccess, 1);
+ ExpectResultBucketCount(
+ kResultWithSavedFramesHistogram,
+ ContentToVisibleTimeReporter::TabSwitchResult::kIncomplete, 1);
+ ExpectResultBucketCount(
+ kResultWithSavedFramesHistogram,
+ ContentToVisibleTimeReporter::TabSwitchResult::kSuccess, 1);
}
// An incomplete tab switch is reported when no frame is shown before a tab is
// hidden.
-TEST_F(TabSwitchTimeRecorderTest, HideBeforePresentFrameNoSavedFrames) {
+TEST_F(ContentToVisibleTimeReporterTest, HideBeforePresentFrameNoSavedFrames) {
const auto start1 = base::TimeTicks::Now();
auto callback1 = tab_switch_time_recorder_.TabWasShown(
false /* has_saved_frames */,
{start1, /* destination_is_loaded */ true,
- /* destination_is_frozen */ false},
+ /* destination_is_frozen */ false, /* show_reason_tab_switching */ true,
+ /* show_reason_unoccluded */ false,
+ /* show_reason_bfcache_restore */ false},
start1);
task_environment_.FastForwardBy(kDuration);
@@ -355,19 +389,21 @@ TEST_F(TabSwitchTimeRecorderTest, HideBeforePresentFrameNoSavedFrames) {
// Result.
ExpectTotalSamples(kResultNoSavedFramesHistogram, 1);
- ExpectResultBucketCount(kResultNoSavedFramesHistogram,
- TabSwitchTimeRecorder::TabSwitchResult::kIncomplete,
- 1);
+ ExpectResultBucketCount(
+ kResultNoSavedFramesHistogram,
+ ContentToVisibleTimeReporter::TabSwitchResult::kIncomplete, 1);
ExpectTotalSamples(kResultNoSavedFramesNotFrozenHistogram, 1);
- ExpectResultBucketCount(kResultNoSavedFramesNotFrozenHistogram,
- TabSwitchTimeRecorder::TabSwitchResult::kIncomplete,
- 1);
+ ExpectResultBucketCount(
+ kResultNoSavedFramesNotFrozenHistogram,
+ ContentToVisibleTimeReporter::TabSwitchResult::kIncomplete, 1);
const auto start2 = base::TimeTicks::Now();
auto callback2 = tab_switch_time_recorder_.TabWasShown(
false /* has_saved_frames */,
{start2, /* destination_is_loaded */ true,
- /* destination_is_frozen */ false},
+ /* destination_is_frozen */ false, /* show_reason_tab_switching */ true,
+ /* show_reason_unoccluded */ false,
+ /* show_reason_bfcache_restore */ false},
start2);
const auto end2 = start2 + kOtherDuration;
@@ -398,17 +434,228 @@ TEST_F(TabSwitchTimeRecorderTest, HideBeforePresentFrameNoSavedFrames) {
// Result.
ExpectTotalSamples(kResultNoSavedFramesHistogram, 2);
- ExpectResultBucketCount(kResultNoSavedFramesHistogram,
- TabSwitchTimeRecorder::TabSwitchResult::kIncomplete,
- 1);
- ExpectResultBucketCount(kResultNoSavedFramesHistogram,
- TabSwitchTimeRecorder::TabSwitchResult::kSuccess, 1);
+ ExpectResultBucketCount(
+ kResultNoSavedFramesHistogram,
+ ContentToVisibleTimeReporter::TabSwitchResult::kIncomplete, 1);
+ ExpectResultBucketCount(
+ kResultNoSavedFramesHistogram,
+ ContentToVisibleTimeReporter::TabSwitchResult::kSuccess, 1);
ExpectTotalSamples(kResultNoSavedFramesNotFrozenHistogram, 2);
- ExpectResultBucketCount(kResultNoSavedFramesNotFrozenHistogram,
- TabSwitchTimeRecorder::TabSwitchResult::kIncomplete,
- 1);
- ExpectResultBucketCount(kResultNoSavedFramesNotFrozenHistogram,
- TabSwitchTimeRecorder::TabSwitchResult::kSuccess, 1);
+ ExpectResultBucketCount(
+ kResultNoSavedFramesNotFrozenHistogram,
+ ContentToVisibleTimeReporter::TabSwitchResult::kIncomplete, 1);
+ ExpectResultBucketCount(
+ kResultNoSavedFramesNotFrozenHistogram,
+ ContentToVisibleTimeReporter::TabSwitchResult::kSuccess, 1);
+}
+
+// Time is properly recorded to histogram when we have unoccluded event.
+TEST_F(ContentToVisibleTimeReporterTest, UnoccludedTimeIsRecorded) {
+ const auto start = base::TimeTicks::Now();
+ auto callback = tab_switch_time_recorder_.TabWasShown(
+ true /* has_saved_frames */,
+ {start, base::Optional<bool>() /* destination_is_loaded */,
+ base::Optional<bool>() /* destination_is_frozen */,
+ /* show_reason_tab_switching */ false,
+ /* show_reason_unoccluded */ true,
+ /* show_reason_bfcache_restore */ false},
+ start);
+ const auto end = start + kDuration;
+ auto presentation_feedback = gfx::PresentationFeedback(
+ end, end - start, gfx::PresentationFeedback::Flags::kHWCompletion);
+ std::move(callback).Run(presentation_feedback);
+
+ ExpectHistogramsEmptyExcept({kWebContentsUnOccludedHistogram});
+
+ // UnOccluded.
+ ExpectTotalSamples(kWebContentsUnOccludedHistogram, 1);
+ ExpectTimeBucketCount(kWebContentsUnOccludedHistogram, kDuration, 1);
+}
+
+// Time is properly recorded to histogram when we have unoccluded event
+// and some other events too.
+TEST_F(ContentToVisibleTimeReporterTest,
+ TimeIsRecordedWithSavedFramesPlusUnoccludedTimeIsRecorded) {
+ const auto start = base::TimeTicks::Now();
+ auto callback = tab_switch_time_recorder_.TabWasShown(
+ true /* has_saved_frames */,
+ {start, /* destination_is_loaded */ true,
+ /* destination_is_frozen */ false, /* show_reason_tab_switching */ true,
+ /* show_reason_unoccluded */ true,
+ /* show_reason_bfcache_restore */ false},
+ start);
+ const auto end = start + kDuration;
+ auto presentation_feedback = gfx::PresentationFeedback(
+ end, end - start, gfx::PresentationFeedback::Flags::kHWCompletion);
+ std::move(callback).Run(presentation_feedback);
+
+ ExpectHistogramsEmptyExcept({kDurationWithSavedFramesHistogram,
+ kResultWithSavedFramesHistogram,
+ kWebContentsUnOccludedHistogram});
+
+ // Duration.
+ ExpectTotalSamples(kDurationWithSavedFramesHistogram, 1);
+ ExpectTimeBucketCount(kDurationWithSavedFramesHistogram, kDuration, 1);
+
+ // Result.
+ ExpectTotalSamples(kResultWithSavedFramesHistogram, 1);
+ ExpectResultBucketCount(
+ kResultWithSavedFramesHistogram,
+ ContentToVisibleTimeReporter::TabSwitchResult::kSuccess, 1);
+
+ // UnOccluded.
+ ExpectTotalSamples(kWebContentsUnOccludedHistogram, 1);
+ ExpectTimeBucketCount(kWebContentsUnOccludedHistogram, kDuration, 1);
+}
+
+// Time is properly recorded to histogram when we have bfcache restore event.
+TEST_F(ContentToVisibleTimeReporterTest, BfcacheRestoreTimeIsRecorded) {
+ const auto start = base::TimeTicks::Now();
+ auto callback = tab_switch_time_recorder_.TabWasShown(
+ false /* has_saved_frames */,
+ {start, base::Optional<bool>() /* destination_is_loaded */,
+ base::Optional<bool>() /* destination_is_frozen */,
+ /* show_reason_tab_switching */ false,
+ /* show_reason_unoccluded */ false,
+ /* show_reason_bfcache_restore */ true},
+ start);
+ const auto end = start + kDuration;
+ auto presentation_feedback = gfx::PresentationFeedback(
+ end, end - start, gfx::PresentationFeedback::Flags::kHWCompletion);
+ std::move(callback).Run(presentation_feedback);
+
+ ExpectHistogramsEmptyExcept({kBfcacheRestoreHistogram});
+
+ // Bfcache restore.
+ ExpectTotalSamples(kBfcacheRestoreHistogram, 1);
+ ExpectTimeBucketCount(kBfcacheRestoreHistogram, kDuration, 1);
+}
+
+class RecordContentToVisibleTimeRequestTest : public testing::Test {
+ protected:
+ // event_start_times are random, so caller is expected to provide failure
+ // message useful for debugging timestamps inequality.
+ void ExpectEqual(const RecordContentToVisibleTimeRequest& left,
+ const RecordContentToVisibleTimeRequest& right,
+ const std::string& msg) const {
+ EXPECT_EQ(left.event_start_time, right.event_start_time) << msg;
+ EXPECT_EQ(left.destination_is_loaded, right.destination_is_loaded);
+ EXPECT_EQ(left.destination_is_frozen, right.destination_is_frozen);
+ EXPECT_EQ(left.show_reason_tab_switching, right.show_reason_tab_switching);
+ EXPECT_EQ(left.show_reason_unoccluded, right.show_reason_unoccluded);
+ EXPECT_EQ(left.show_reason_bfcache_restore,
+ right.show_reason_bfcache_restore);
+ }
+};
+
+TEST_F(RecordContentToVisibleTimeRequestTest, MergeEmpty) {
+ // Merge two empty requests
+ RecordContentToVisibleTimeRequest request;
+ request.UpdateRequest(RecordContentToVisibleTimeRequest());
+ ExpectEqual(request, RecordContentToVisibleTimeRequest(), std::string());
+}
+
+// Merge two requests. Tuple represents the parameters of the two requests.
+class RecordContentToVisibleTimeRequest_MergeRequestTest
+ : public RecordContentToVisibleTimeRequestTest,
+ public testing::WithParamInterface<std::tuple<bool,
+ bool,
+ bool,
+ bool,
+ bool,
+ bool,
+ bool,
+ bool,
+ bool,
+ bool>> {
+ protected:
+ RecordContentToVisibleTimeRequest GetRequest1() const {
+ const base::TimeTicks timestamp = RandomRequestTimeTicks();
+ return RecordContentToVisibleTimeRequest(
+ timestamp,
+ std::get<0>(GetParam())
+ ? base::Optional<bool>(true)
+ : base::Optional<bool>() /* destination_is_loaded */,
+ std::get<1>(GetParam())
+ ? base::Optional<bool>(true)
+ : base::Optional<bool>() /* destination_is_frozen */,
+ std::get<2>(GetParam()) /* show_reason_tab_switching */,
+ std::get<3>(GetParam()) /* show_reason_unoccluded */,
+ std::get<4>(GetParam()) /* show_reason_bfcache_restore */);
+ }
+
+ RecordContentToVisibleTimeRequest GetRequest2() const {
+ const base::TimeTicks timestamp = RandomRequestTimeTicks();
+ return RecordContentToVisibleTimeRequest(
+ timestamp,
+ std::get<5>(GetParam())
+ ? base::Optional<bool>(true)
+ : base::Optional<bool>() /* destination_is_loaded */,
+ std::get<6>(GetParam())
+ ? base::Optional<bool>(true)
+ : base::Optional<bool>() /* destination_is_frozen */,
+ std::get<7>(GetParam()) /* show_reason_tab_switching */,
+ std::get<8>(GetParam()) /* show_reason_unoccluded */,
+ std::get<9>(GetParam()) /* show_reason_bfcache_restore */);
+ }
+
+ bool isOptionalBoolTrue(const base::Optional<bool>& data) {
+ return data.has_value() && data.value();
+ }
+
+ private:
+ // Returns random moment between (Now) and (Now - random time in the past)
+ base::TimeTicks RandomRequestTimeTicks() const {
+ uint16_t number;
+ base::RandBytes(&number, sizeof(number));
+ return base::TimeTicks::Now() - base::TimeDelta::FromMilliseconds(number);
+ }
+};
+
+TEST_P(RecordContentToVisibleTimeRequest_MergeRequestTest, DoMerge) {
+ RecordContentToVisibleTimeRequest request1 = GetRequest1();
+ const RecordContentToVisibleTimeRequest request2 = GetRequest2();
+
+ // Timestamps are random, log them in case of failure.
+ std::ostringstream buf;
+ buf << "Original request1.event_start_time = " << request1.event_start_time
+ << ", merged request2.event_start_time = " << request2.event_start_time
+ << ".";
+
+ request1.UpdateRequest(request2);
+
+ // We expect to get minimal timestamp and all the boolean flags set in any
+ // request.
+ const RecordContentToVisibleTimeRequest expected(
+ std::min(request1.event_start_time, request2.event_start_time),
+ (request1.destination_is_loaded.has_value() ||
+ request2.destination_is_loaded.has_value())
+ ? isOptionalBoolTrue(request1.destination_is_loaded) ||
+ isOptionalBoolTrue(request2.destination_is_loaded)
+ : base::Optional<bool>(),
+ (request1.destination_is_frozen.has_value() ||
+ request2.destination_is_frozen.has_value())
+ ? isOptionalBoolTrue(request1.destination_is_frozen) ||
+ isOptionalBoolTrue(request2.destination_is_frozen)
+ : base::Optional<bool>(),
+ request1.show_reason_tab_switching || request2.show_reason_tab_switching,
+ request1.show_reason_unoccluded || request2.show_reason_unoccluded,
+ request1.show_reason_bfcache_restore ||
+ request2.show_reason_bfcache_restore);
+
+ ExpectEqual(request1, expected, buf.str());
}
+INSTANTIATE_TEST_SUITE_P(All,
+ RecordContentToVisibleTimeRequest_MergeRequestTest,
+ testing::Combine(testing::Bool(),
+ testing::Bool(),
+ testing::Bool(),
+ testing::Bool(),
+ testing::Bool(),
+ testing::Bool(),
+ testing::Bool(),
+ testing::Bool(),
+ testing::Bool(),
+ testing::Bool()));
} // namespace content
diff --git a/chromium/content/common/text_input_state.cc b/chromium/content/common/text_input_state.cc
index c08a3309c1d..d7bd82f0de7 100644
--- a/chromium/content/common/text_input_state.cc
+++ b/chromium/content/common/text_input_state.cc
@@ -10,4 +10,6 @@ TextInputState::TextInputState() = default;
TextInputState::TextInputState(const TextInputState& other) = default;
+TextInputState::~TextInputState() = default;
+
} // namespace content
diff --git a/chromium/content/common/text_input_state.h b/chromium/content/common/text_input_state.h
index 2ce7f20c3c0..11c2c3f1639 100644
--- a/chromium/content/common/text_input_state.h
+++ b/chromium/content/common/text_input_state.h
@@ -5,11 +5,13 @@
#ifndef CONTENT_COMMON_TEXT_INPUT_STATE_H_
#define CONTENT_COMMON_TEXT_INPUT_STATE_H_
+#include "base/optional.h"
#include "base/strings/string16.h"
#include "content/common/content_export.h"
#include "ui/base/ime/text_input_action.h"
#include "ui/base/ime/text_input_mode.h"
#include "ui/base/ime/text_input_type.h"
+#include "ui/gfx/geometry/rect.h"
namespace content {
@@ -19,6 +21,7 @@ namespace content {
struct CONTENT_EXPORT TextInputState {
TextInputState();
TextInputState(const TextInputState& other);
+ ~TextInputState();
// Type of the input field.
ui::TextInputType type = ui::TEXT_INPUT_TYPE_NONE;
@@ -62,6 +65,13 @@ struct CONTENT_EXPORT TextInputState {
// Whether or not this is a reply to a request from IME.
bool reply_to_request = false;
+
+ // Store control and selection bounds of EditContext.
+ // These optionals will be nullopts if there isn't any active EditContext.
+ // For non EditContext scenarios, the bounds are returned via
+ // |GetCompositionCharacterBounds|
+ base::Optional<gfx::Rect> edit_context_control_bounds;
+ base::Optional<gfx::Rect> edit_context_selection_bounds;
};
} // namespace content
diff --git a/chromium/content/common/typemaps.gni b/chromium/content/common/typemaps.gni
deleted file mode 100644
index e01e0658a85..00000000000
--- a/chromium/content/common/typemaps.gni
+++ /dev/null
@@ -1,13 +0,0 @@
-# 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.
-
-typemaps = [
- "//content/common/frame_messages.typemap",
- "//content/common/input/synchronous_compositor.typemap",
- "//content/common/native_types.typemap",
- "//content/common/native_types_mac.typemap",
- "//content/common/navigation_params.typemap",
- "//content/common/render_frame_metadata.typemap",
- "//content/common/web_preferences.typemap",
-]
diff --git a/chromium/content/common/unfreezable_frame_messages.h b/chromium/content/common/unfreezable_frame_messages.h
index 3e2e181df99..35356561620 100644
--- a/chromium/content/common/unfreezable_frame_messages.h
+++ b/chromium/content/common/unfreezable_frame_messages.h
@@ -20,9 +20,9 @@
#define IPC_MESSAGE_START UnfreezableFrameMsgStart
-// Swap this RenderFrame out so the frame can navigate to a document rendered by
-// a different process.
-IPC_MESSAGE_ROUTED3(UnfreezableFrameMsg_SwapOut,
+// Unload this RenderFrame and potentially replace it by a RenderFrameProxy, so
+// the frame can navigate to a document rendered by a different process.
+IPC_MESSAGE_ROUTED3(UnfreezableFrameMsg_Unload,
int /* proxy_routing_id */,
bool /* is_loading */,
content::FrameReplicationState /* replication_state */)
diff --git a/chromium/content/common/url_schemes.cc b/chromium/content/common/url_schemes.cc
index 6c6bf27a685..d0a31f2406e 100644
--- a/chromium/content/common/url_schemes.cc
+++ b/chromium/content/common/url_schemes.cc
@@ -19,6 +19,8 @@
namespace content {
namespace {
+bool g_registered_url_schemes = false;
+
const char* const kDefaultSavableSchemes[] = {
url::kHttpScheme,
url::kHttpsScheme,
@@ -47,12 +49,17 @@ std::vector<std::string>& GetMutableServiceWorkerSchemes() {
} // namespace
-void RegisterContentSchemes(bool lock_schemes) {
+void RegisterContentSchemes() {
+ // On Android and in tests, schemes may have been registered already.
+ if (g_registered_url_schemes)
+ return;
+ g_registered_url_schemes = true;
ContentClient::Schemes schemes;
GetContentClient()->AddAdditionalSchemes(&schemes);
url::AddStandardScheme(kChromeDevToolsScheme, url::SCHEME_WITH_HOST);
url::AddStandardScheme(kChromeUIScheme, url::SCHEME_WITH_HOST);
+ url::AddStandardScheme(kChromeUIUntrustedScheme, url::SCHEME_WITH_HOST);
url::AddStandardScheme(kGuestScheme, url::SCHEME_WITH_HOST);
url::AddStandardScheme(kChromeErrorScheme, url::SCHEME_WITH_HOST);
@@ -63,6 +70,7 @@ void RegisterContentSchemes(bool lock_schemes) {
url::AddReferrerScheme(scheme.c_str(), url::SCHEME_WITH_HOST);
schemes.secure_schemes.push_back(kChromeUIScheme);
+ schemes.secure_schemes.push_back(kChromeUIUntrustedScheme);
schemes.secure_schemes.push_back(kChromeErrorScheme);
for (auto& scheme : schemes.secure_schemes)
url::AddSecureScheme(scheme.c_str());
@@ -96,8 +104,7 @@ void RegisterContentSchemes(bool lock_schemes) {
// threadsafe so must be called when GURL isn't used on any other thread. This
// is really easy to mess up, so we say that all calls to Add*Scheme in Chrome
// must be inside this function.
- if (lock_schemes)
- url::LockSchemeRegistries();
+ url::LockSchemeRegistries();
// Combine the default savable schemes with the additional ones given.
GetMutableSavableSchemes().assign(std::begin(kDefaultSavableSchemes),
@@ -109,6 +116,12 @@ void RegisterContentSchemes(bool lock_schemes) {
GetMutableServiceWorkerSchemes() = std::move(schemes.service_worker_schemes);
}
+void ReRegisterContentSchemesForTests() {
+ url::ClearSchemesForTests();
+ g_registered_url_schemes = false;
+ RegisterContentSchemes();
+}
+
const std::vector<std::string>& GetSavableSchemes() {
return GetMutableSavableSchemes();
}
diff --git a/chromium/content/common/url_schemes.h b/chromium/content/common/url_schemes.h
index 407d6f55e91..3038f9d2579 100644
--- a/chromium/content/common/url_schemes.h
+++ b/chromium/content/common/url_schemes.h
@@ -12,17 +12,14 @@
namespace content {
-// Note: ContentMainRunner calls this method internally as part of main
-// initialization, so this function generally should not be called by
-// embedders. It's exported to facilitate test harnesses that do not
-// utilize ContentMainRunner and that do not wish to lock the set
-// of standard schemes at init time.
-//
// Called near the beginning of startup to register URL schemes that should be
-// parsed as "standard" or "referrer" with the src/url/ library. Optionally, the
-// sets of schemes are locked down. The embedder can add additional schemes by
+// parsed as "standard" or "referrer" with the src/url/ library, then locks the
+// sets of schemes down. The embedder can add additional schemes by
// overriding the ContentClient::AddAdditionalSchemes method.
-CONTENT_EXPORT void RegisterContentSchemes(bool lock_schemes);
+CONTENT_EXPORT void RegisterContentSchemes();
+
+// Re-initializes schemes for tests.
+CONTENT_EXPORT void ReRegisterContentSchemesForTests();
// See comment in ContentClient::AddAdditionalSchemes for explanations. These
// getters can be invoked on any thread.
diff --git a/chromium/content/common/user_agent.cc b/chromium/content/common/user_agent.cc
index 37e72394997..954209bd8cc 100644
--- a/chromium/content/common/user_agent.cc
+++ b/chromium/content/common/user_agent.cc
@@ -60,65 +60,97 @@ std::string GetWebKitRevision() {
return WEBKIT_SVN_REVISION;
}
-std::string BuildOSCpuInfo(bool include_android_build_number) {
- std::string os_cpu;
-
-#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS) ||\
- defined(OS_ANDROID)
- int32_t os_major_version = 0;
- int32_t os_minor_version = 0;
- int32_t os_bugfix_version = 0;
- base::SysInfo::OperatingSystemVersionNumbers(&os_major_version,
- &os_minor_version,
- &os_bugfix_version);
-#endif
+std::string BuildCpuInfo() {
+ std::string cpuinfo = "";
-#if defined(OS_WIN)
- std::string architecture_token;
+#if defined(OS_MACOSX)
+ cpuinfo = "Intel";
+#elif defined(OS_WIN)
base::win::OSInfo* os_info = base::win::OSInfo::GetInstance();
if (os_info->wow64_status() == base::win::OSInfo::WOW64_ENABLED) {
- architecture_token = "; WOW64";
+ cpuinfo = "WOW64";
} else {
base::win::OSInfo::WindowsArchitecture windows_architecture =
os_info->GetArchitecture();
if (windows_architecture == base::win::OSInfo::X64_ARCHITECTURE)
- architecture_token = "; Win64; x64";
+ cpuinfo = "Win64; x64";
else if (windows_architecture == base::win::OSInfo::IA64_ARCHITECTURE)
- architecture_token = "; Win64; IA64";
+ cpuinfo = "Win64; IA64";
}
-#elif defined(OS_ANDROID)
- std::string android_version_str = base::SysInfo::OperatingSystemVersion();
- std::string android_info_str = GetAndroidOSInfo(include_android_build_number);
#elif defined(OS_POSIX) && !defined(OS_MACOSX)
// Should work on any Posix system.
struct utsname unixinfo;
uname(&unixinfo);
- std::string cputype;
// special case for biarch systems
if (strcmp(unixinfo.machine, "x86_64") == 0 &&
sizeof(void*) == sizeof(int32_t)) {
- cputype.assign("i686 (x86_64)");
+ cpuinfo.assign("i686 (x86_64)");
} else {
- cputype.assign(unixinfo.machine);
+ cpuinfo.assign(unixinfo.machine);
}
#endif
+ return cpuinfo;
+}
+
+std::string GetOSVersion(bool include_android_build_number) {
+ std::string os_version;
+#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS)
+ int32_t os_major_version = 0;
+ int32_t os_minor_version = 0;
+ int32_t os_bugfix_version = 0;
+ base::SysInfo::OperatingSystemVersionNumbers(
+ &os_major_version, &os_minor_version, &os_bugfix_version);
+#endif
+
+#if defined(OS_ANDROID)
+ std::string android_version_str = base::SysInfo::OperatingSystemVersion();
+ std::string android_info_str = GetAndroidOSInfo(include_android_build_number);
+#endif
+
+ base::StringAppendF(&os_version,
+#if defined(OS_WIN)
+ "%d.%d; ", os_major_version, os_minor_version
+#elif defined(OS_MACOSX)
+ "%d_%d_%d", os_major_version, os_minor_version,
+ os_bugfix_version
+#elif defined(OS_CHROMEOS)
+ "%d.%d.%d",
+ os_major_version, os_minor_version, os_bugfix_version
+#elif defined(OS_ANDROID)
+ "%s%s", android_version_str.c_str(),
+ android_info_str.c_str()
+#else
+ ""
+#endif
+ );
+ return os_version;
+}
+
+std::string BuildOSCpuInfo(bool include_android_build_number) {
+ std::string cputype = BuildCpuInfo();
+ std::string os_version = GetOSVersion(include_android_build_number);
+ std::string os_cpu;
+
+#if !defined(OS_ANDROID) && defined(OS_POSIX) && !defined(OS_MACOSX)
+ // Should work on any Posix system.
+ struct utsname unixinfo;
+ uname(&unixinfo);
+#endif
+
base::StringAppendF(&os_cpu,
#if defined(OS_WIN)
- "Windows NT %d.%d%s", os_major_version, os_minor_version,
- architecture_token.c_str()
+ "Windows NT %s%s", os_version.c_str(), cputype.c_str()
#elif defined(OS_MACOSX)
- "Intel Mac OS X %d_%d_%d", os_major_version,
- os_minor_version, os_bugfix_version
+ "%s Mac OS X %s", cputype.c_str(), os_version.c_str()
#elif defined(OS_CHROMEOS)
"CrOS "
- "%s %d.%d.%d",
+ "%s %s",
cputype.c_str(), // e.g. i686
- os_major_version, os_minor_version, os_bugfix_version
+ os_version.c_str()
#elif defined(OS_ANDROID)
- "Android %s%s", android_version_str.c_str(),
- android_info_str.c_str()
+ "Android %s", os_version.c_str()
#elif defined(OS_FUCHSIA)
"Fuchsia"
#elif defined(OS_POSIX)
@@ -131,12 +163,16 @@ std::string BuildOSCpuInfo(bool include_android_build_number) {
return os_cpu;
}
-base::StringPiece GetFrozenUserAgent(bool mobile) {
+std::string GetFrozenUserAgent(bool mobile, std::string major_version) {
+ std::string user_agent;
#if defined(OS_ANDROID)
- return mobile ? frozen_user_agent_strings::kAndroidMobile
- : frozen_user_agent_strings::kAndroid;
+ user_agent = mobile ? frozen_user_agent_strings::kAndroidMobile
+ : frozen_user_agent_strings::kAndroid;
+#else
+ user_agent = frozen_user_agent_strings::kDesktop;
#endif
- return frozen_user_agent_strings::kDesktop;
+
+ return base::StringPrintf(user_agent.c_str(), major_version.c_str());
}
std::string BuildUserAgentFromProduct(const std::string& product) {
@@ -146,6 +182,17 @@ std::string BuildUserAgentFromProduct(const std::string& product) {
return BuildUserAgentFromOSAndProduct(os_info, product);
}
+std::string BuildModelInfo() {
+ std::string model = "";
+#if defined(OS_ANDROID)
+ // Only send the model information if on the release build of Android,
+ // matching user agent behaviour.
+ if (base::SysInfo::GetAndroidBuildCodename() == "REL")
+ model = base::SysInfo::HardwareModelName();
+#endif
+ return model;
+}
+
#if defined(OS_ANDROID)
std::string BuildUserAgentFromProductAndExtraOSInfo(
const std::string& product,
@@ -163,9 +210,8 @@ std::string GetAndroidOSInfo(bool include_android_build_number) {
// Send information about the device.
bool semicolon_inserted = false;
- std::string android_build_codename = base::SysInfo::GetAndroidBuildCodename();
- std::string android_device_name = base::SysInfo::HardwareModelName();
- if (!android_device_name.empty() && "REL" == android_build_codename) {
+ std::string android_device_name = BuildModelInfo();
+ if (!android_device_name.empty()) {
android_info_str += "; " + android_device_name;
semicolon_inserted = true;
}
diff --git a/chromium/content/common/view_messages.h b/chromium/content/common/view_messages.h
index a609cc1fa15..b75aee16237 100644
--- a/chromium/content/common/view_messages.h
+++ b/chromium/content/common/view_messages.h
@@ -40,11 +40,9 @@
#include "media/base/ipc/media_param_traits.h"
#include "net/base/network_change_notifier.h"
#include "ppapi/buildflags/buildflags.h"
-#include "third_party/blink/public/common/plugin/plugin_action.h"
#include "third_party/blink/public/mojom/manifest/display_mode.mojom.h"
#include "third_party/blink/public/mojom/renderer_preferences.mojom.h"
#include "third_party/blink/public/platform/web_text_autosizer_page_info.h"
-#include "third_party/blink/public/web/web_text_direction.h"
#include "ui/base/ime/text_input_type.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/point.h"
@@ -59,7 +57,6 @@
#if defined(OS_MACOSX)
#include "third_party/blink/public/platform/mac/web_scrollbar_theme.h"
-#include "third_party/blink/public/platform/web_scrollbar_buttons_placement.h"
#endif
#undef IPC_MESSAGE_EXPORT
@@ -67,8 +64,6 @@
#define IPC_MESSAGE_START ViewMsgStart
-IPC_ENUM_TRAITS_MAX_VALUE(blink::PluginAction::Type,
- blink::PluginAction::Type::kTypeLast)
IPC_ENUM_TRAITS_MAX_VALUE(content::MenuItem::Type, content::MenuItem::TYPE_LAST)
IPC_ENUM_TRAITS_MAX_VALUE(content::NavigationGesture,
content::NavigationGestureLast)
@@ -80,23 +75,12 @@ IPC_ENUM_TRAITS_MAX_VALUE(content::ThreeDAPIType,
IPC_ENUM_TRAITS_MAX_VALUE(ui::TextInputType, ui::TEXT_INPUT_TYPE_MAX)
#if defined(OS_MACOSX)
-IPC_ENUM_TRAITS_MAX_VALUE(
- blink::WebScrollbarButtonsPlacement,
- blink::WebScrollbarButtonsPlacement::kWebScrollbarButtonsPlacementLast)
-
IPC_ENUM_TRAITS_MAX_VALUE(blink::ScrollerStyle, blink::kScrollerStyleOverlay)
#endif
-IPC_ENUM_TRAITS_MAX_VALUE(ui::NativeTheme::PreferredColorScheme,
- ui::NativeTheme::PreferredColorScheme::kMaxValue)
IPC_ENUM_TRAITS_MAX_VALUE(ui::NativeTheme::SystemThemeColor,
ui::NativeTheme::SystemThemeColor::kMaxValue)
-IPC_STRUCT_TRAITS_BEGIN(blink::PluginAction)
- IPC_STRUCT_TRAITS_MEMBER(type)
- IPC_STRUCT_TRAITS_MEMBER(enable)
-IPC_STRUCT_TRAITS_END()
-
IPC_STRUCT_TRAITS_BEGIN(content::MenuItem)
IPC_STRUCT_TRAITS_MEMBER(label)
IPC_STRUCT_TRAITS_MEMBER(tool_tip)
@@ -111,44 +95,18 @@ IPC_STRUCT_TRAITS_END()
// Messages sent from the browser to the renderer.
-// Make the RenderWidget background transparent or opaque.
-IPC_MESSAGE_ROUTED1(ViewMsg_SetBackgroundOpaque, bool /* opaque */)
-
// This passes a set of webkit preferences down to the renderer.
IPC_MESSAGE_ROUTED1(ViewMsg_UpdateWebPreferences,
content::WebPreferences)
-// Tells the renderer to focus the first (last if reverse is true) focusable
-// node.
-IPC_MESSAGE_ROUTED1(ViewMsg_SetInitialFocus,
- bool /* reverse */)
-
-// Tells the renderer to perform the given action on the plugin located at
-// the given point.
-IPC_MESSAGE_ROUTED2(ViewMsg_PluginActionAt,
- gfx::Point, /* location */
- blink::PluginAction)
-
-// Sets the page scale for the current main frame to the given page scale.
-IPC_MESSAGE_ROUTED1(ViewMsg_SetPageScale, float /* page_scale_factor */)
-
// Used to notify the render-view that we have received a target URL. Used
// to prevent target URLs spamming the browser.
IPC_MESSAGE_ROUTED0(ViewMsg_UpdateTargetURL_ACK)
-// Instructs the renderer to close the current page, including running the
-// onunload event handler.
-//
-// Expects a ClosePage_ACK message when finished.
-IPC_MESSAGE_ROUTED0(ViewMsg_ClosePage)
-
// Notification that a move or resize renderer's containing window has
// started.
IPC_MESSAGE_ROUTED0(ViewMsg_MoveOrResizeStarted)
-// Used to instruct the RenderView to send back updates to the preferred size.
-IPC_MESSAGE_ROUTED0(ViewMsg_EnablePreferredSizeChangedMode)
-
#if BUILDFLAG(ENABLE_PLUGINS)
// Reply to ViewHostMsg_OpenChannelToPpapiBroker
// Tells the renderer that the channel to the broker has been created.
@@ -163,16 +121,6 @@ IPC_MESSAGE_ROUTED1(ViewMsg_PpapiBrokerPermissionResult,
bool /* result */)
#endif
-// Sent to the main-frame's view to request performing a page scale animation
-// based on the point/rect provided.
-IPC_MESSAGE_ROUTED2(ViewMsg_AnimateDoubleTapZoom,
- gfx::Point /* tap point */,
- gfx::Rect /* rect_to_zoom */)
-
-// Sent to the main-frame's view to request performing a zoom-to-find-in-page
-// based on the rect provided.
-IPC_MESSAGE_ROUTED1(ViewMsg_ZoomToFindInPageRect, gfx::Rect /*rect_to_zoom */)
-
// -----------------------------------------------------------------------------
// Messages sent from the renderer to the browser.
@@ -190,26 +138,13 @@ IPC_MESSAGE_ROUTED1(ViewHostMsg_ShowFullscreenWidget,
// Sent from an inactive renderer for the browser to route to the active
// renderer, instructing it to close.
-//
-// TODO(http://crbug.com/419087): Move this thing to Frame as it's a signal
-// from a swapped out frame to the mainframe of the frame tree.
IPC_MESSAGE_ROUTED0(ViewHostMsg_RouteCloseEvent)
-// Indicates that the current page has been closed, after a ClosePage
-// message.
-IPC_MESSAGE_ROUTED0(ViewHostMsg_ClosePage_ACK)
-
// Notifies the browser that we want to show a destination url for a potential
// action (e.g. when the user is hovering over a link).
IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateTargetURL,
GURL)
-// Sent when the document element is available for the top-level frame. This
-// happens after the page starts loading, but before all resources are
-// finished.
-IPC_MESSAGE_ROUTED1(ViewHostMsg_DocumentAvailableInMainFrame,
- bool /* uses_temporary_zoom_level */)
-
IPC_MESSAGE_ROUTED0(ViewHostMsg_Focus)
// Get the list of proxies to use for |url|, as a semicolon delimited list
@@ -219,10 +154,6 @@ IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_ResolveProxy,
bool /* result */,
std::string /* proxy list */)
-// Notifies that the preferred size of the content changed.
-IPC_MESSAGE_ROUTED1(ViewHostMsg_DidContentsPreferredSizeChange,
- gfx::Size /* pref_size */)
-
#if BUILDFLAG(ENABLE_PLUGINS)
// A renderer sends this to the browser process when it wants to access a PPAPI
// broker. In contrast to FrameHostMsg_OpenChannelToPpapiBroker, this is called
@@ -240,22 +171,10 @@ IPC_MESSAGE_ROUTED3(ViewHostMsg_RequestPpapiBrokerPermission,
IPC_MESSAGE_ROUTED1(ViewHostMsg_TakeFocus,
bool /* reverse */)
-// Sent when the renderer changes its page scale factor.
-IPC_MESSAGE_ROUTED1(ViewHostMsg_PageScaleFactorChanged,
- float /* page_scale_factor */)
-
IPC_MESSAGE_ROUTED1(
ViewHostMsg_NotifyTextAutosizerPageInfoChangedInLocalMainFrame,
blink::WebTextAutosizerPageInfo /* page_info */)
-// Send back a string to be recorded by UserMetrics.
-IPC_MESSAGE_CONTROL1(ViewHostMsg_UserMetricsRecordAction,
- std::string /* action */)
-
-// Notifies the browser of an event occurring in the media pipeline.
-IPC_MESSAGE_CONTROL1(ViewHostMsg_MediaLogEvents,
- std::vector<media::MediaLogEvent> /* events */)
-
// Adding a new message? Stick to the sort order above: first platform
// independent ViewMsg, then ifdefs for platform specific ViewMsg, then platform
// independent ViewHostMsg, then ifdefs for platform specific ViewHostMsg.
diff --git a/chromium/content/common/visual_properties.h b/chromium/content/common/visual_properties.h
index 599c6b0fbe9..82ffc7e2a3d 100644
--- a/chromium/content/common/visual_properties.h
+++ b/chromium/content/common/visual_properties.h
@@ -72,9 +72,23 @@ struct CONTENT_EXPORT VisualProperties {
// The size for the widget in DIPs.
gfx::Size new_size;
- // The rect of compositor's viewport in pixels. Note that this may differ in
- // size from a ScaleToCeiledSize of |new_size| due to Android's keyboard or
- // due to rounding particulars.
+ // The size of the area of the widget that is visible to the user, in DIPs.
+ // The visible area may be empty if the visible area does not intersect with
+ // the widget, for example in the case of a child frame that is entirely
+ // scrolled out of the main frame's viewport. It may also be smaller than the
+ // widget's size in |new_size| due to the UI hiding part of the widget, such
+ // as with an on-screen keyboard.
+ gfx::Size visible_viewport_size;
+
+ // The rect of compositor's viewport in pixels. Note that for top level
+ // widgets this is roughly the DSF scaled new_size put into a rect. For child
+ // frame widgets it is a pixel-perfect bounds of the visible region of the
+ // widget. The size would be similar to visible_viewport_size, but in physical
+ // pixels and computed via very different means.
+ // TODO(danakj): It would be super nice to remove one of |new_size|,
+ // |visible_viewport_size| and |compositor_viewport_pixel_rect|. Their values
+ // overlap in purpose, creating a very confusing situation about which to use
+ // for what, and how they should relate or not.
gfx::Rect compositor_viewport_pixel_rect;
// Browser controls params such as top and bottom controls heights, whether
@@ -88,11 +102,6 @@ struct CONTENT_EXPORT VisualProperties {
// The local surface ID to use (if valid) and its allocation time.
base::Optional<viz::LocalSurfaceIdAllocation> local_surface_id_allocation;
- // The size of the visible viewport, which may be smaller than the view if the
- // view is partially occluded (e.g. by a virtual keyboard). The size is in
- // DPI-adjusted pixels.
- gfx::Size visible_viewport_size;
-
// Indicates whether tab-initiated fullscreen was granted.
bool is_fullscreen_granted = false;
diff --git a/chromium/content/common/web_preferences.typemap b/chromium/content/common/web_preferences.typemap
deleted file mode 100644
index 4f79eb2dc27..00000000000
--- a/chromium/content/common/web_preferences.typemap
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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.
-
-mojom = "//content/common/native_types.mojom"
-public_headers = [ "//content/public/common/web_preferences.h" ]
-traits_headers = [ "//content/public/common/common_param_traits_macros.h" ]
-type_mappings = [
- "content.mojom.V8CacheOptions=::content::V8CacheOptions",
- "content.mojom.WebPreferences=::content::WebPreferences",
-]
diff --git a/chromium/content/common/widget_messages.h b/chromium/content/common/widget_messages.h
index dbd1115f1eb..dfc28946d2e 100644
--- a/chromium/content/common/widget_messages.h
+++ b/chromium/content/common/widget_messages.h
@@ -12,18 +12,16 @@
#include "cc/input/touch_action.h"
#include "content/common/common_param_traits_macros.h"
#include "content/common/content_param_traits.h"
+#include "content/common/content_to_visible_time_reporter.h"
#include "content/common/cursors/webcursor.h"
-#include "content/common/tab_switch_time_recorder.h"
#include "content/common/text_input_state.h"
#include "content/common/visual_properties.h"
#include "content/public/common/common_param_traits.h"
#include "ipc/ipc_message_macros.h"
#include "third_party/blink/public/common/screen_orientation/web_screen_orientation_type.h"
#include "third_party/blink/public/platform/viewport_intersection_state.h"
-#include "third_party/blink/public/platform/web_float_point.h"
#include "third_party/blink/public/platform/web_float_rect.h"
#include "third_party/blink/public/platform/web_intrinsic_sizing_info.h"
-#include "third_party/blink/public/web/web_text_direction.h"
#include "ui/base/ime/text_input_action.h"
#include "ui/base/ime/text_input_mode.h"
#include "ui/base/ui_base_types.h"
@@ -36,11 +34,6 @@
#define IPC_MESSAGE_START WidgetMsgStart
// Traits for WebDeviceEmulationParams.
-IPC_STRUCT_TRAITS_BEGIN(blink::WebFloatPoint)
- IPC_STRUCT_TRAITS_MEMBER(x)
- IPC_STRUCT_TRAITS_MEMBER(y)
-IPC_STRUCT_TRAITS_END()
-
IPC_STRUCT_TRAITS_BEGIN(blink::WebFloatRect)
IPC_STRUCT_TRAITS_MEMBER(x)
IPC_STRUCT_TRAITS_MEMBER(y)
@@ -66,14 +59,14 @@ IPC_STRUCT_TRAITS_BEGIN(blink::WebDeviceEmulationParams)
IPC_STRUCT_TRAITS_MEMBER(screen_orientation_type)
IPC_STRUCT_TRAITS_END()
-IPC_ENUM_TRAITS_MAX_VALUE(blink::WebTextDirection,
- blink::WebTextDirection::kWebTextDirectionLast)
+IPC_ENUM_TRAITS_MAX_VALUE(base::i18n::TextDirection,
+ base::i18n::TEXT_DIRECTION_MAX)
IPC_STRUCT_BEGIN(WidgetHostMsg_SelectionBounds_Params)
IPC_STRUCT_MEMBER(gfx::Rect, anchor_rect)
- IPC_STRUCT_MEMBER(blink::WebTextDirection, anchor_dir)
+ IPC_STRUCT_MEMBER(base::i18n::TextDirection, anchor_dir)
IPC_STRUCT_MEMBER(gfx::Rect, focus_rect)
- IPC_STRUCT_MEMBER(blink::WebTextDirection, focus_dir)
+ IPC_STRUCT_MEMBER(base::i18n::TextDirection, focus_dir)
IPC_STRUCT_MEMBER(bool, is_anchor_first)
IPC_STRUCT_END()
@@ -95,6 +88,8 @@ IPC_STRUCT_TRAITS_BEGIN(content::TextInputState)
IPC_STRUCT_TRAITS_MEMBER(show_ime_if_needed)
IPC_STRUCT_TRAITS_MEMBER(always_hide_ime)
IPC_STRUCT_TRAITS_MEMBER(reply_to_request)
+ IPC_STRUCT_TRAITS_MEMBER(edit_context_control_bounds)
+ IPC_STRUCT_TRAITS_MEMBER(edit_context_selection_bounds)
IPC_STRUCT_TRAITS_END()
//
@@ -123,13 +118,11 @@ IPC_MESSAGE_ROUTED0(WidgetMsg_DisableDeviceEmulation)
IPC_MESSAGE_ROUTED0(WidgetMsg_WasHidden)
// Tells the render view that it is no longer hidden (see WasHidden).
-IPC_MESSAGE_ROUTED3(
- WidgetMsg_WasShown,
- base::TimeTicks /* show_request_timestamp */,
- bool /* was_evicted */,
- base::Optional<
- content::
- RecordTabSwitchTimeRequest> /* record_tab_switch_time_request */)
+IPC_MESSAGE_ROUTED3(WidgetMsg_WasShown,
+ base::TimeTicks /* show_request_timestamp */,
+ bool /* was_evicted */,
+ base::Optional<content::RecordContentToVisibleTimeRequest>
+ /* record_tab_switch_time_request */)
// Activate/deactivate the RenderWidget (i.e., set its controls' tint
// accordingly, etc.).
@@ -137,7 +130,7 @@ IPC_MESSAGE_ROUTED1(WidgetMsg_SetActive, bool /* active */)
// Changes the text direction of the currently selected input field (if any).
IPC_MESSAGE_ROUTED1(WidgetMsg_SetTextDirection,
- blink::WebTextDirection /* direction */)
+ base::i18n::TextDirection /* direction */)
// Reply to WidgetHostMsg_RequestSetBounds, WidgetHostMsg_ShowWidget, and
// FrameHostMsg_ShowCreatedWindow, to inform the renderer that the browser has
@@ -190,13 +183,6 @@ IPC_MESSAGE_ROUTED2(WidgetMsg_UpdateRenderThrottlingStatus,
IPC_MESSAGE_ROUTED1(WidgetMsg_WaitForNextFrameForTests,
int /* main_frame_thread_observer_routing_id */)
-// Tells the render side that a WidgetHostMsg_LockMouse message has been
-// processed. |succeeded| indicates whether the mouse has been successfully
-// locked or not.
-IPC_MESSAGE_ROUTED1(WidgetMsg_LockMouse_ACK, bool /* succeeded */)
-// Tells the render side that the mouse has been unlocked.
-IPC_MESSAGE_ROUTED0(WidgetMsg_MouseLockLost)
-
//
// Renderer -> Browser Messages.
//
@@ -220,14 +206,14 @@ IPC_MESSAGE_ROUTED0(WidgetHostMsg_UpdateScreenRects_ACK)
// browser can then notify a containing frame that the frame may need to
// trigger a new layout.
//
-// Also see FrameMsg_IntrinsicSizingInfoOfChildChanged.
+// Also see blink::mojom::RemoteFrame::IntrinsicSizingInfoOfChildChanged.
IPC_MESSAGE_ROUTED1(WidgetHostMsg_IntrinsicSizingInfoChanged,
blink::WebIntrinsicSizingInfo)
// Send the tooltip text for the current mouse position to the browser.
IPC_MESSAGE_ROUTED2(WidgetHostMsg_SetTooltipText,
base::string16 /* tooltip text string */,
- blink::WebTextDirection /* text direction hint */)
+ base::i18n::TextDirection /* text direction hint */)
// Updates the current cursor to be used by the browser for indicating the
// location of a pointing device.
@@ -253,21 +239,6 @@ IPC_MESSAGE_ROUTED1(WidgetHostMsg_TextInputStateChanged,
// APIs, and the browser may ignore this message.
IPC_MESSAGE_ROUTED1(WidgetHostMsg_RequestSetBounds, gfx::Rect /* bounds */)
-// Requests to lock the mouse. Will result in a WidgetMsg_LockMouse_ACK message
-// being sent back.
-// |privileged| is used by Pepper Flash. If this flag is set to true, we won't
-// pop up a bubble to ask for user permission or take mouse lock content into
-// account.
-IPC_MESSAGE_ROUTED3(WidgetHostMsg_LockMouse,
- bool /* user_gesture */,
- bool /* privileged */,
- bool /* request_raw_movement */)
-
-// Requests to unlock the mouse. A WidgetMsg_MouseLockLost message will be sent
-// whenever the mouse is unlocked (which may or may not be caused by
-// WidgetHostMsg_UnlockMouse).
-IPC_MESSAGE_ROUTED0(WidgetHostMsg_UnlockMouse)
-
// Sent by the renderer process in response to an earlier WidgetMsg_ForceRedraw
// message. The reply includes the snapshot-id from the request.
IPC_MESSAGE_ROUTED1(WidgetHostMsg_ForceRedrawComplete, int /* snapshot_id */)